happy-dinner-13480
11/17/2022, 2:57 PMtypescript
cy.el('inputEmailAddress').type(Cypress.env('CUSTOM_EMAIL'));
cy.el('inputPassword').type(Cypress.env('CUSTOM_PASSWORD'));
cy.el('buttonLogin').click();
locally this is fine, but on my CI sometimes the second field isn't filled in.
Adding some waits seems to fix it:
typescript
cy.el('inputEmailAddress').type(Cypress.env('CUSTOM_EMAIL'));
cy.wait(500);
cy.el('inputPassword').type(Cypress.env('CUSTOM_PASSWORD'));
cy.wait(500);
cy.el('buttonLogin').click();
has anyone else experience this issue with typing multiple inputs in a row?acceptable-fall-11897
11/17/2022, 3:14 PMfresh-doctor-14925
11/17/2022, 3:16 PMacceptable-fall-11897
11/17/2022, 3:20 PMgray-kilobyte-89541
11/17/2022, 4:42 PMlate-quill-17187
11/17/2022, 4:44 PMplain-elephant-20908
11/17/2022, 6:32 PMcustomeE2E.js
under` /support` folder? for cypress runbroad-lock-59143
11/17/2022, 6:53 PMenough-truck-68085
11/17/2022, 6:56 PM"cypress run --e2e --config supportFile=cypress/support/customE2E.js"
you can always change the support file location for e2e if needed
https://docs.cypress.io/guides/references/configuration#e2eworried-pager-99039
11/17/2022, 7:55 PMcypress open
and having an actual browser where the test runs the following code is working:
ts
beforeEach(() => {
Cypress.on("window:before:load", (window) => {
window.localStorage.setItem("some_key", "some_value")
window.localStorage.setItem("another_key", "another_value");
})
})
But running this with cypress run --headless --browser electron
does not work and it seems like that the items are not set inside localStorage
. I tried to check it with
ts
expect(localStorage.getItem("some_key")).to.not.be.null;
expect(localStorage.getItem("another_key")).to.not.be.null;
Is there a way to set some localStorage
items in the headless mode to get rid of my cookie banner?fresh-doctor-14925
11/17/2022, 8:21 PMwindow:before:load
. Have you tried doing a cy.setCookie()
in your beforeEach()
before your visit()
command?worried-pager-99039
11/17/2022, 8:33 PMworried-pager-99039
11/17/2022, 8:36 PMmysterious-belgium-25713
11/17/2022, 8:50 PMjs
cy.window().then((win) => {
win.localStorage.setItem("some_key", "some_value")
win.localStorage.setItem("another_key", "another_value");
})
mysterious-belgium-25713
11/17/2022, 8:52 PMmysterious-belgium-25713
11/17/2022, 8:52 PMsquare-honey-48197
11/17/2022, 8:56 PMmysterious-belgium-25713
11/17/2022, 9:29 PMmysterious-belgium-25713
11/17/2022, 9:30 PMsquare-honey-48197
11/17/2022, 9:30 PMcdk-overlay-container
Headed it works fine, but headlessly it fails to click as the dropdown elements are detached from DOMsquare-honey-48197
11/17/2022, 9:31 PMspan
elements is the desired element to click.
Javascript
cy.get('span').contains('WF+ AVOD').click()
worried-pager-99039
11/17/2022, 9:32 PMsquare-honey-48197
11/17/2022, 9:40 PMmysterious-belgium-25713
11/17/2022, 9:45 PMjs
cy.contains(".mat-option-text","WF+ AVOD").click()
square-honey-48197
11/17/2022, 9:45 PMdetached from DOM
only headlessly, works fine headed (Electron 106) for bothsquare-honey-48197
11/17/2022, 9:46 PMmysterious-belgium-25713
11/17/2022, 9:46 PMsquare-honey-48197
11/17/2022, 9:47 PMnpx cypress run --browser chrome
? or do I need to specify the path to the chrome binary?mysterious-belgium-25713
11/17/2022, 9:47 PM