tall-thailand-5343
12/10/2021, 11:06 AMcy.window()
.its("navigator.clipboard")
.invoke("readText") // !! this sometimes fails, so a FLAKY TEST ???
.as("authBearer") // this is not available in this.authBearer in next it() test
.should("contain", "Bearer ");
// this passes sometimes actually
Another way to write it is:
cy.window().then((win) => {
win.navigator.clipboard.readText().then((auth) => {
auth.should("contain", "Bearer "); // HOW TO DO THIS? + use as "authBearer" so it can be used in the next it() test
});
});
When running headless there's additional error: "Error: Browser context management is not supported.".
Totally lost on this now.
any help appreciated!freezing-needle-5178
12/13/2021, 6:52 PMcy.session()
, but then when the next spec test runs, it doesn't have access to any of that state. Am I supposed to send an email for every spec test? Or do I need to use both cy.session()
and somehow also persist a cookie between specs? Has anyone dealt with this before?gray-kilobyte-89541
12/13/2021, 9:09 PMfreezing-needle-5178
12/13/2021, 9:11 PMcy.session()
, however. I don't understand why some kind of solution isn't built into cypress itself.gray-kilobyte-89541
12/13/2021, 9:12 PMfreezing-needle-5178
12/13/2021, 9:14 PMcy.session()
to help store session state and automatically reset all other browser state between tests, so it seems perfect for keeping auth state, except it only works in a single spec file.gray-kilobyte-89541
12/13/2021, 9:16 PMgray-kilobyte-89541
12/13/2021, 9:17 PMfreezing-needle-5178
12/13/2021, 9:20 PMgray-kilobyte-89541
12/14/2021, 12:51 AMbefore:run
plugin event and store the data and share it with each specnarrow-optician-44716
12/14/2021, 4:59 PMgray-kilobyte-89541
12/14/2021, 6:10 PMdazzling-salesclerk-15570
12/14/2021, 6:40 PMfreezing-needle-5178
12/14/2021, 7:30 PMnarrow-optician-44716
12/14/2021, 8:16 PMfreezing-needle-5178
12/14/2021, 8:39 PMgray-kilobyte-89541
12/14/2021, 8:50 PMfast-cpu-20763
12/15/2021, 5:16 AMimportant-river-75795
12/15/2021, 9:21 AMfuture-gold-77198
12/15/2021, 8:11 PMfuture-gold-77198
12/15/2021, 8:13 PMfuture-gold-77198
12/15/2021, 11:06 PMbrief-quill-91989
12/20/2021, 4:47 AMclean-london-79739
12/20/2021, 8:32 AMbored-church-78777
12/20/2021, 10:34 PMdescribe('and the api will respond with data', () => {
before(() => {
cy.intercept('POST', 'test', {
fixture: 'response',
}).as('response');
});
describe('first call', () => {
it('should show data', () => {
cy.wait('@response');
cy.get('[data-edit]').contains('word');
});
});
describe('second call', () => {
it('should show data', () => {
cy.wait('@response');
cy.get('[data-edit]').contains('word');
});
});
});
gray-kilobyte-89541
12/20/2021, 11:21 PMbefore
that runs only before the first test, and does not exist before the second testbored-church-78777
12/20/2021, 11:25 PMbeforeEach
would not work for me.
describe('and the api will respond with data', () => {
before(() => {
cy.intercept('POST', 'test', {
fixture: 'response',
}).as('response');
});
describe('first call', () => {
it('should show data', () => {
cy.wait('@response');
cy.get('[data-edit]').contains('word');
});
});
describe('second call', () => {
before(() => {
cy.intercept('POST', 'test', {
fixture: 'response',
}).as('response');
});
describe('second call', () => {
it('should show data', () => {
cy.wait('@response');
cy.get('[data-edit]').contains('word');
});
});
});
});
gray-kilobyte-89541
12/21/2021, 12:11 AMbroad-potato-69393
12/21/2021, 4:27 AMgray-kilobyte-89541
12/21/2021, 4:09 PMtestFiles: ["**/*.feature", "**/*.features", "**/*.js"]
is your friend