wide-hospital-71307
07/27/2022, 10:37 AMwide-hospital-71307
07/27/2022, 10:40 AMfresh-doctor-14925
07/27/2022, 10:48 AMit()
blocks
> don't want to tell the app where to go on every step, it goes to the page it is supposed to go to
It sounds a lot like one it()
block will rely on the actions performed in the previous one? This isn't a good pattern to followwide-hospital-71307
07/27/2022, 10:49 AMwide-hospital-71307
07/27/2022, 10:50 AMwide-hospital-71307
07/27/2022, 10:52 AMwide-hospital-71307
07/27/2022, 10:58 AMgreen-book-63455
07/27/2022, 12:35 PM/
, {
onBeforeLoad(win) {
win.authorised =true
win.emailName = "johnny@email.com"
win.fred = "Johnny"
win.authToken = body.token
win.userId = body.userId
},
})
})
cy.get('h1').should('contain', 'Svelte To-Do List')
})
Now running this works and in the svelte app, I have some console logging and that shows what I expected / hoped.
Do I need the cy.window? Or can I just use the visit with onBeforeLoad?
Many thanks for this - though being able to authenticate with request is not an essential (the time saving is minimal), this has been frustrating me for a while.gray-kilobyte-89541
07/27/2022, 12:44 PMbrash-magazine-98754
07/27/2022, 3:28 PMgray-kilobyte-89541
07/27/2022, 3:54 PMabundant-eve-90571
07/28/2022, 1:05 AMabundant-eve-90571
07/28/2022, 1:06 AMWhen('I choose 1 non image file', () => {
cy.get("input[type=file").attachFile( {
filePath: "example.json"
mimeType: image/jpg || image/png
})
})
here i want to write a test to check if a non image file is being uploaded, can i do this?mysterious-motherboard-13344
07/28/2022, 6:05 AMabundant-eve-90571
07/28/2022, 6:17 AMabundant-eve-90571
07/28/2022, 6:17 AMabundant-eve-90571
07/28/2022, 6:33 AMacceptable-hamburger-48790
07/28/2022, 10:29 AMacceptable-hamburger-48790
07/28/2022, 10:30 AMacceptable-hamburger-48790
07/28/2022, 10:30 AMmysterious-motherboard-13344
07/28/2022, 10:57 AMwooden-teacher-96595
07/28/2022, 3:23 PMquaint-butcher-3955
07/28/2022, 3:41 PMit('Should Click the edit button on the table', () => {
cy.url().should('contain', '/profile');
cy.get('[data-cy="profile-table"] > :nth-child(2) > :nth-child(8) > :nth-child(8)').invoke('text').as('data');
cy.get('@data').then((data) => {
cy.get(`[data-cy="edit_${data}"]`).click();
});
});
The cy on the button element
cy={`edit_${row.original.profileId}`}
curved-father-48262
07/28/2022, 5:09 PMgray-kilobyte-89541
07/28/2022, 5:52 PMloud-city-40050
07/28/2022, 9:45 PMalert-parrot-29600
07/29/2022, 11:19 AMpowerful-vr-28259
08/01/2022, 1:19 AMgray-kilobyte-89541
08/01/2022, 12:03 PMplain-garden-5374
08/01/2022, 11:18 PM/graphql
endpoint
- each request has the same method (POST) and endpoint url; they differ only in their request bodies, in particular the operationName
. so the naive cy.intercept('POST', '/endpoint')
matches all of them, and i have to implement the aliasing methods from https://docs.cypress.io/guides/end-to-end-testing/working-with-graphql to have a hope of disambiguating them
- i would like to stub all of these requests inside the same test, replacing their responses with mock data stored as fixtures
is this even possible? gleb's blog post https://glebbahmutov.com/blog/cypress-intercept-problems/#multiple-matchers seems to suggest there's no way for me to cy.wait()
on more than one `cy.intercept()`s with the same method and endpoint in the same test context, and that my only solution is to not have tests that require more than one of the intercepts.