stale-optician-85950
10/11/2022, 8:25 AMmysterious-belgium-25713
10/11/2022, 8:30 AMbest-window-49967
10/11/2022, 8:37 AMstale-optician-85950
10/11/2022, 8:38 AMbest-window-49967
10/11/2022, 8:39 AMmysterious-belgium-25713
10/11/2022, 8:43 AMrich-jewelry-26348
10/11/2022, 8:43 AM<base href="/__cypress/src/" />
but it doesn't fix the problem any idea how I can make Cypress load my assets ?stale-optician-85950
10/11/2022, 8:44 AMbest-window-49967
10/11/2022, 8:47 AMmysterious-belgium-25713
10/11/2022, 9:05 AMcareful-tent-30457
10/11/2022, 11:00 AM@cypress#8954/code-coverage
but ran in to an interesting issue.
on my local machine I get higher coverage numbers than I get in our CI (Azure DevOps Pipelines).
Anyone have any suggestions where I even begin to look to make sense of this?creamy-train-56346
10/11/2022, 11:49 AMdescribe
block with multiple it
blocks in it. I want to use intercept
alias
combination to intercept request, wait for it to be done (200 status code) before I start doing something else with the page. Something like: cy.intercept(url).as('awaitStuff');
Pretty basic stuff I presume. Only last test requires this wait
, this is important. My debugging:
1. I placed intercept
in before
hook. Then for the last (crucial) test Cypress tells me that there are no aliases whatsoever and test fails.
2. I placed intercept
in beforeEach
hook. It works fine, but it's run for all tests so not the ideal solution and doesn't solve the core issue to me.
3. I placed intercept
in before
hook and switch tests order. Now this crucial test is first in line. It works fine, but again it's just a workaround and "fishy" one.
To me it's obvious that before
hook contents are relevant for the first test only which is not fine. Or I am doing something wrong which also valid option 😄stale-optician-85950
10/11/2022, 11:57 AMcreamy-train-56346
10/11/2022, 12:04 PMstale-optician-85950
10/11/2022, 12:08 PMcreamy-train-56346
10/11/2022, 12:15 PMstale-optician-85950
10/11/2022, 12:22 PMcy.pause()
in your before() hook and watching your Dev Tools > network request at the same time.
Somewhere in there is your problem I bet.
You could also test this by ensuring it() blocks use just 1 URL for spec.stale-optician-85950
10/11/2022, 12:30 PMdescribe('Cypress Alias', () => {
before(() => {
cy.visit('https://discord.com/');
cy.request('https://catfact.ninja/fact').then(resp => {
cy.wrap(resp.allRequestResponses[0]['Response Status']).as('responseStatus');
});
});
it('Validates stuff 1', () => {
cy.get('@responseStatus').then(r => {
cy.log('in Test 1', r);
});
});
it('Validates stuff 2', () => {
cy.get('@responseStatus').then(r => {
cy.log('in Test 2', r);
});
});
});
The alias is lost after 1 test even on same URL.stale-optician-85950
10/11/2022, 12:33 PMfresh-doctor-14925
10/11/2022, 12:37 PMbefore()
hook should behave. Any aliases should be set in the beforeEach()
> "Note: all aliases are reset before each test. A common user mistake is to create aliases using the before hook. Such aliases work in the first test only!"
(https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Requests)stale-optician-85950
10/11/2022, 12:39 PMstale-optician-85950
10/11/2022, 12:40 PMcreamy-train-56346
10/11/2022, 12:40 PMlimited-barista-33480
10/11/2022, 1:31 PMgray-kilobyte-89541
10/11/2022, 2:50 PMcareful-tent-30457
10/11/2022, 4:37 PMcypress8954code coverage
thousands-gpu-36872
10/11/2022, 7:46 PMmysterious-belgium-25713
10/11/2022, 7:54 PMjs
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on("task", {
async YourTask() {
}
})
},
},
});
thousands-gpu-36872
10/11/2022, 7:59 PMhappy-megabyte-98400
10/11/2022, 8:43 PM