mysterious-psychiatrist-29678
02/18/2023, 11:33 PMdazzling-thailand-9844
02/19/2023, 12:03 AMdazzling-thailand-9844
02/19/2023, 12:04 AMCypress.Commands.add('getAccessToken', () => {
cy.request({
method: 'POST',
url: '/api/auth/login',
body: {
username: 'testuser',
password: 'password123'
}
}).then((response) => {
const accessToken = response.body.accessToken;
Cypress.env('ACCESS_TOKEN', accessToken);
});
});dazzling-thailand-9844
02/19/2023, 12:06 AMmysterious-psychiatrist-29678
02/19/2023, 12:06 AMcy.setLocalStorage("accessToken", body.access_token);
just would like to know if env var or localStorage is better options in some perspectivedazzling-thailand-9844
02/19/2023, 12:07 AMBearer ${Cypress.env('ACCESS_TOKEN')}
}
}).then((response) => {
// test user profile response
});
});`mysterious-psychiatrist-29678
02/19/2023, 12:15 AMcy.getLocalStorage('access_token').then((token) => {
cy.deployAssembly(url, token, id);
})
like env var was used
cy.deployAssembly(url, Cyrpress.env('access_token'), id);dazzling-thailand-9844
02/19/2023, 12:20 AMmysterious-psychiatrist-29678
02/19/2023, 12:22 AMdazzling-thailand-9844
02/19/2023, 12:24 AMdazzling-thailand-9844
02/19/2023, 12:26 AM