mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
test(e2e): session validation (#52197)
This commit is contained in:
committed by
GitHub
parent
f82428b703
commit
b29e16c12c
@@ -1,9 +1,21 @@
|
||||
const login = (user?: string) => {
|
||||
cy.session(user ?? 'new-user', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
cy.visit(`${Cypress.env('API_LOCATION')}/signin`);
|
||||
cy.contains('Welcome back');
|
||||
});
|
||||
cy.session(
|
||||
user ?? 'new-user',
|
||||
() => {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
cy.visit(`${Cypress.env('API_LOCATION')}/signin`);
|
||||
cy.url().should('include', '/learn');
|
||||
cy.contains('Welcome back');
|
||||
},
|
||||
{
|
||||
validate() {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
cy.request(`${Cypress.env('API_LOCATION')}/user/get-session-user`)
|
||||
.its('status')
|
||||
.should('eq', 200);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const setPrivacyTogglesToPublic = () => {
|
||||
|
||||
Reference in New Issue
Block a user