melodic-hydrogen-41542
06/16/2022, 3:53 PMswift-kitchen-62493
06/16/2022, 3:56 PMgreat-engine-82623
06/16/2022, 5:27 PMCypress.env()
function. i have a cypress.env.json
inside the /cypress
folder of my Next.js TypeScript project. In there I have a JSON that looks like this:
json
{
"CORRECT_PASSWORD": "The password 123"
}
Inside a test.cy.ts
file I'm trying to use the env variable like this:
typescript
const correctPassword = Cypress.env('CORRECT_PASSWORD')
But when I run the tests (in the Dashboard as well as headless) it just throws me the error as shown on the screenshot. Did anyone have the same problem?great-engine-82623
06/16/2022, 5:43 PM/cypress
foldernutritious-honey-65632
06/16/2022, 6:11 PMSo Cypress skips the remaining tests in that block, because they would also fail due to the beforeEach hook failure.
nutritious-honey-65632
06/16/2022, 6:12 PMbeforeEach
it will skip all contexts, if you have an error in single context in beforeEach
it should run other contexts but skip rest of the tests in context with error.proud-breakfast-29892
06/16/2022, 6:13 PMit
block itself, not in beforeEach
proud-breakfast-29892
06/16/2022, 6:13 PMnutritious-honey-65632
06/16/2022, 6:15 PMcy.contains(false)
in any before
or inside it
proud-breakfast-29892
06/16/2022, 6:17 PMafterEach
bulky-twilight-81110
06/16/2022, 6:26 PMbulky-twilight-81110
06/16/2022, 6:27 PMnutritious-honey-65632
06/16/2022, 6:30 PMbulky-twilight-81110
06/16/2022, 6:31 PMbulky-twilight-81110
06/16/2022, 6:55 PMbulky-twilight-81110
06/16/2022, 6:55 PMnutritious-honey-65632
06/16/2022, 7:23 PMbulky-twilight-81110
06/16/2022, 9:07 PMimportant-fish-21193
06/16/2022, 9:39 PMimportant-fish-21193
06/16/2022, 9:42 PMchilly-market-86437
06/17/2022, 6:26 AMacoustic-magazine-89269
06/17/2022, 8:34 AMcy.route
to cy.intercept
since refactoring it does not seem to be working as intended!fresh-doctor-14925
06/17/2022, 11:00 AMmammoth-napkin-19312
06/17/2022, 11:12 AMacoustic-magazine-89269
06/17/2022, 11:13 AMjs
const standardUser = organisationFactory("id123", {
name:"bob"
userType:"user"
premium: false,
});
const premiumUser = organisationFactory("id123", {
name:"Jim"
userType:"user"
premium: true,
});
export const user: someType = {
standard: apiResponseFactory([
standardUser,
premiumUser,
])
}
fresh-doctor-14925
06/17/2022, 11:16 AMfixture
syntax within cy.intercept()
. I've been able to use that with success
https://docs.cypress.io/api/commands/intercept#Stubbing-a-responsekind-pizza-45261
06/17/2022, 11:30 AMkind-pizza-45261
06/17/2022, 11:40 AMmammoth-napkin-19312
06/17/2022, 11:41 AMkind-pizza-45261
06/17/2022, 11:42 AM