gray-dawn-16972
01/16/2023, 9:39 AMbroad-analyst-94821
01/16/2023, 10:23 AMbroad-analyst-94821
01/16/2023, 10:27 AMsome-cartoon-73108
01/16/2023, 12:21 PMdry-portugal-25841
01/16/2023, 1:56 PMgray-dawn-16972
01/16/2023, 1:58 PMgray-dawn-16972
01/16/2023, 2:06 PMdry-portugal-25841
01/16/2023, 2:07 PMcareful-tent-30457
01/16/2023, 3:10 PMcypress open
and cypress run
on my local machine, webGL error in headless.
But more frustrating is that I have additional flakyness with different tests failing in CI (Azure pipelines) using cypress run
.
the error in CI environment started occurring after upgrading from 11.3 to 12.3.
the offending code is:
afterEach(() => {
cy.dataCy("clear-button").each((btn) => {
cy.wrap(btn).click();
});
});
which is the latest attempt going around the error. it works for one IT but not for the next one. I've used { testIsolation: false },
in my describe as running with indivudual visit and setup for each test is soo slow in CI environment that we opted for test depending on eachother.. not ideal but saving several minutes per PR is worth it.
Looking for any suggestions on how to make tests be less random depending on environment.gray-kilobyte-89541
01/16/2023, 3:51 PMcareful-tent-30457
01/16/2023, 3:52 PMcareful-tent-30457
01/16/2023, 3:53 PMcareful-tent-30457
01/16/2023, 3:53 PMgray-kilobyte-89541
01/16/2023, 3:56 PMcareful-tent-30457
01/16/2023, 3:59 PMgray-kilobyte-89541
01/16/2023, 4:00 PMcareful-tent-30457
01/16/2023, 4:01 PMgray-kilobyte-89541
01/16/2023, 4:02 PMcareful-tent-30457
01/16/2023, 4:04 PMgray-kilobyte-89541
01/16/2023, 4:05 PMcareful-tent-30457
01/16/2023, 4:09 PMfuture-glass-89764
01/16/2023, 4:13 PMfuture-glass-89764
01/16/2023, 4:14 PMfuture-glass-89764
01/16/2023, 4:14 PMfuture-glass-89764
01/16/2023, 4:15 PMwooden-shampoo-53816
01/16/2023, 4:16 PMcypress.config.js
which writes given data into a file.
The I tried multiple different ways but two are worth mentioning.
### 1st approach
I wrote the following code into support/e2e.js
beforeEach
function
cy.intercept('/api/*', (req) => {
return req.continue((response) => {
let responseData = {
status: response.status,
headers: response.headers,
body: response.body
};
console.log('1')
return new Promise((resolve, rej) => {
resolve(responseData)
})
});
})
.then(res => {
console.log('2')
})
"2" is printed only once and it is printed earlier than any "1". Each "1" is printed as many times as many requests are made. So I can't get result after cy.intercept
### 2nd approach
javascript
cy.intercept('/api/*', (req) => {
return req.continue((response) => {
let responseData = {
status: response.status,
headers: response.headers,
body: response.body
};
cy.task('appendFileSync', JSON.stringify(responseData))
});
})
I get the following error
Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
Do you have any idea, how I can collect my request/response data and log inside a file?gray-kilobyte-89541
01/16/2023, 4:17 PMgray-kilobyte-89541
01/16/2023, 4:18 PMfuture-glass-89764
01/16/2023, 4:20 PMwooden-shampoo-53816
01/16/2023, 4:22 PM