echoing-laptop-99181
08/05/2022, 8:26 AMechoing-laptop-99181
08/05/2022, 8:27 AMstale-optician-85950
08/05/2022, 8:54 AMcy.setCookie('OptanonAlertBoxClosed', '2099-01-01T01:01:01.926Z');
cy.visit('/');
stale-optician-85950
08/05/2022, 8:55 AMbrief-midnight-25297
08/05/2022, 9:14 AMCypress.Commands.add("getAccessToken", () => {
cy.request({
method: 'POST',
url: `${Cypress.env('apiUrl')}${url.path.common.login}`,
body: {
'email': userSecrets.email,
'password': userSecrets.password
}
}).then(response => {
const token = response.body.access_token;
Cypress.env('token', token);
return response;
});
});
then in the spec file:
beforeEach(() => {
cy.getAccessToken();
let token = Cypress.env('token');
testData.create(token);
});
If I move the token and the method to create the date inside the it() block works.
it("should create test data", () => {
let token = Cypress.env('token');
testData.create(token);
});
brief-midnight-25297
08/05/2022, 9:15 AMstale-optician-85950
08/05/2022, 9:25 AMlet token ...
helpful-truck-53930
08/05/2022, 9:33 AMstale-optician-85950
08/05/2022, 9:36 AMset-cookie()
acceptable-hamburger-48790
08/05/2022, 9:38 AMbrief-midnight-25297
08/05/2022, 9:38 AMgorgeous-jordan-86065
08/05/2022, 11:08 AMbrief-midnight-25297
08/05/2022, 11:17 AMflaky-airplane-33826
08/05/2022, 12:12 PMflaky-airplane-33826
08/05/2022, 12:13 PMflaky-airplane-33826
08/05/2022, 12:47 PMfast-ocean-24805
08/05/2022, 2:42 PMfancy-policeman-40827
08/05/2022, 2:59 PMfierce-lion-2381
08/05/2022, 3:42 PMmelodic-egg-83620
08/05/2022, 4:05 PMmelodic-egg-83620
08/05/2022, 4:06 PMfancy-policeman-40827
08/05/2022, 4:43 PMacceptable-hamburger-48790
08/05/2022, 4:44 PMacceptable-hamburger-48790
08/05/2022, 4:45 PMmelodic-egg-83620
08/05/2022, 4:46 PMfast-ocean-24805
08/05/2022, 5:58 PMgray-toothbrush-44079
08/05/2022, 7:02 PMfull-wall-14294
08/05/2022, 9:27 PMfierce-lion-2381
08/06/2022, 9:01 AMlimited-room-30929
08/07/2022, 9:31 AM