flaky-airport-12178
09/05/2022, 7:01 AMmysterious-motherboard-13344
09/05/2022, 7:27 AMflaky-airport-12178
09/05/2022, 7:28 AMcolossal-farmer-50435
09/05/2022, 7:48 AMfierce-engineer-40904
09/05/2022, 2:29 PMjs
it('Should open widget and do a preflight', () => {
cy.get('[data-cy="twilio-widget"]').click({ force: true })
cy.intercept(
'GET',
`https://INSERTURLHERE/token`,
(req) => {
const parsedToken = twilioVoiceEntity(req.body.token)
const preflightTest = Device.runPreflight(parsedToken)
preflightTest.on('completed', (report) => {
console.log('report', report)
})
},
)
})
I want to see the console log of the report in cypress and then assert if the test failed or passes.bitter-fountain-36713
09/05/2022, 2:32 PMfierce-engineer-40904
09/05/2022, 2:33 PMfierce-engineer-40904
09/05/2022, 2:34 PMdelightful-microphone-80931
09/05/2022, 2:43 PMfierce-engineer-40904
09/05/2022, 3:00 PMbitter-fountain-36713
09/05/2022, 3:05 PMnutritious-army-46708
09/05/2022, 3:26 PMnutritious-army-46708
09/05/2022, 3:36 PMgray-kilobyte-89541
09/05/2022, 6:39 PMflaky-airport-12178
09/06/2022, 2:31 AMbitter-fountain-36713
09/06/2022, 3:26 AMgray-kilobyte-89541
09/06/2022, 11:07 AMmelodic-ocean-83158
09/06/2022, 1:19 PMchilly-quill-34099
09/06/2022, 1:31 PMcommands.ts
file but the problem is:
1. My storage cy.restoreLocalStorage
logic does not work (I have an microsoft authentification, which needs to be saved in the local storage)
2. The tests inside the function are being recognized as independent tests. There is only one single file.
I can't find a way to reuse the cypress tests using different visit
paths as parameter. Is there a best practice, which someone can point me to?melodic-ocean-83158
09/06/2022, 1:40 PMmelodic-ocean-83158
09/06/2022, 1:40 PMmelodic-ocean-83158
09/06/2022, 1:42 PMchilly-quill-34099
09/06/2022, 2:06 PMbeforeEach
as well, with the restoreLocaleStorage
to have a valid authentication. So point 1 is working 🙂 Thank!!! @melodic-ocean-83158chilly-quill-34099
09/06/2022, 2:18 PMts
export function checkHeader(url: string): any {
const currentUrl = url;
describe('App Header', () => {
beforeEach(() => {
cy.restoreLocalStorage('logged in');
});
it('... appears', () => {
cy.visit(currentUrl).get('[data-testid="app-header"]');
});
// ... more tests
});
}
chilly-quill-34099
09/06/2022, 2:33 PMcheckHeader
function inside a it()
-function, inside the test suite. The logic itself seems to work looking on the green check marks and also the interactive Preview of the Cypress UI. But not being able to get responses is a major disadvantage.chilly-quill-34099
09/06/2022, 2:34 PMgray-kilobyte-89541
09/06/2022, 2:38 PMmelodic-ocean-83158
09/06/2022, 2:40 PMmelodic-ocean-83158
09/06/2022, 2:41 PMmelodic-ocean-83158
09/06/2022, 2:43 PM