|
|
|
|
|
import { adminUser } from '../support/e2e';
|
|
|
|
|
|
|
|
|
|
|
|
describe('Registration and Login', () => {
|
|
|
|
after(() => {
|
|
|
|
cy.wait(2000);
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.visit('/');
|
|
});
|
|
|
|
it('should register a new user as pending', () => {
|
|
const userName = `Test User - ${Date.now()}`;
|
|
const userEmail = `cypress-${Date.now()}@example.com`;
|
|
|
|
cy.contains('Sign up').click();
|
|
|
|
cy.get('input[autocomplete="name"]').type(userName);
|
|
cy.get('input[autocomplete="email"]').type(userEmail);
|
|
cy.get('input[type="password"]').type('password');
|
|
|
|
cy.get('button[type="submit"]').click();
|
|
|
|
cy.contains(userName);
|
|
|
|
cy.contains('Check Again');
|
|
});
|
|
|
|
it('can login with the admin user', () => {
|
|
|
|
cy.get('input[autocomplete="email"]').type(adminUser.email);
|
|
cy.get('input[type="password"]').type(adminUser.password);
|
|
|
|
cy.get('button[type="submit"]').click();
|
|
|
|
cy.contains(adminUser.name);
|
|
|
|
cy.getAllLocalStorage().then((ls) => {
|
|
if (!ls['version']) {
|
|
cy.get('button').contains("Okay, Let's Go!").click();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|