user
07/20/2021, 2:45 PMbulky-sundown-74498
07/20/2021, 5:27 PMbulky-sundown-74498
07/20/2021, 5:28 PMuser
07/22/2021, 10:23 AMuser
07/22/2021, 10:33 AMcy.state('runnable').ctx.test
ancient-wire-34126
07/22/2021, 2:18 PMancient-wire-34126
07/22/2021, 2:24 PMancient-wire-34126
07/22/2021, 2:30 PMancient-wire-34126
07/22/2021, 2:32 PMancient-wire-34126
07/22/2021, 2:58 PMbefore
hook in the support file only runs for the first test for some reasonlate-sundown-90898
07/22/2021, 3:20 PMbeforeEach
maybe? 🤷♂️ancient-wire-34126
07/22/2021, 3:26 PMancient-wire-34126
07/22/2021, 3:27 PMreadFile
, which I need to mock a graphSchemaancient-wire-34126
07/22/2021, 3:45 PMancient-wire-34126
07/22/2021, 3:48 PMancient-wire-34126
07/22/2021, 3:53 PMancient-wire-34126
07/22/2021, 3:55 PMancient-wire-34126
07/22/2021, 4:07 PMancient-wire-34126
07/22/2021, 4:08 PMuser
07/22/2021, 6:15 PMcy.intercept('POST', '/endpoint', request => {
if (request.body.foo === true) {
request.continue(response => {
cy.writeFile('cypress/foobar.json', response.body)
})
}
})
user
07/22/2021, 6:16 PMwait
conditionallyfaint-bear-92677
07/22/2021, 11:16 PMbumpy-yacht-37274
07/23/2021, 9:52 AMcy.visit
. Do you have a clue?user
07/23/2021, 1:11 PMancient-wire-34126
07/23/2021, 2:26 PMts
before(() => {
// Get all the created users.
cy.getUsers() // Exposes @users
})
beforeEach(() => {
// Get all the created users.
cy.getUsers() // Exposes @users
})
This should mean that the alias @users
is available everywhere at any point in time.
However, this fails to resolve in a test that uses the before
hook **twice**:
ts
describe('Profile', () => {
describe('New User', () => {
// Login through the Cognito mock and visit the profile page.
before(() => {
cy.get('@users').then(users => {})
})
})
describe('Owner', () => {
// Login through the Cognito mock and visit the profile page.
before(() => {
cy.get('@users').then(users => {}) // this fails
})
})
})
I see no reason why this would fail, as the alias should be exposed during every step.
I've spent a week now on trying to get Cypress to work with seeded data in JS and I'm close to giving up, as it seems to just not want you to do that for some reason.
Esp. when using graphql and there's no DB involved this is almost impossible to work with, as your data needs to be "local" but Cypress has the tendency to completely wipe out everything between tests.
I thought aliases would save me here and they do when it comes to beforeEach
, but I'm not going to continuously fetch data/login between it
statements that are grouped in a describe. I should be able to perform a specific action before each it
.user
07/26/2021, 7:26 PMuser
07/26/2021, 7:27 PMuser
07/27/2021, 2:52 AMbulky-sundown-74498
07/27/2021, 2:35 PMbulky-sundown-74498
07/27/2021, 2:36 PM