gray-crayon-29691
03/07/2023, 12:26 AMcy.writeFile does not work in cypress run mode when writing data from the async function but works in cypress IDE cypress open mode
Any idea why this is not working in cypress run mode?
async function getSheet() {
return 'something'
}
cy.writeFile('file.js', JSON.stringify(getSheet))gray-kilobyte-89541
03/07/2023, 2:56 AMgray-crayon-29691
03/07/2023, 3:58 AMlet exercises = []
async function getSheet() {
// call sheet api
const response = await fetch(exportUrl);
// etc
return exercises
}
for (const array of exercises){
it ('run ' + array, ()=>{
// other cypress stuff here
})
})
So I create a separate spec file to upload API data and then save it to the file
async function getSheet() {
// call sheet api
const response = await fetch(exportUrl);
// etc
cy.writeFile(file_path + 'Array.js', response )
}
And if you run it from cypress IDE it works fine but when I run it from cypress run nothing happensgray-kilobyte-89541
03/07/2023, 12:58 PMgray-crayon-29691
03/07/2023, 5:25 PM