2022-11-24 09:32:00 -08:00
|
|
|
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
|
|
|
|
import { randFirstName, randLastName } from '@ngneat/falso';
|
2022-11-08 04:21:10 -08:00
|
|
|
|
2022-11-24 09:32:00 -08:00
|
|
|
const email = DEFAULT_USER_EMAIL;
|
2022-11-08 04:21:10 -08:00
|
|
|
const password = DEFAULT_USER_PASSWORD;
|
|
|
|
const firstName = randFirstName();
|
|
|
|
const lastName = randLastName();
|
|
|
|
|
2022-11-22 01:37:26 -08:00
|
|
|
describe('Authentication', () => {
|
2022-11-24 09:32:00 -08:00
|
|
|
beforeEach(() => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.resetAll();
|
2022-11-24 09:32:00 -08:00
|
|
|
});
|
|
|
|
|
2022-11-24 03:52:09 -08:00
|
|
|
it('should setup owner', () => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.setup({ email, firstName, lastName, password });
|
2022-11-08 04:21:10 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should sign user in', () => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.setupOwner({ email, password, firstName, lastName });
|
2022-11-08 04:21:10 -08:00
|
|
|
cy.on('uncaught:exception', (err, runnable) => {
|
|
|
|
expect(err.message).to.include('Not logged in');
|
|
|
|
|
|
|
|
return false;
|
2022-11-24 09:32:00 -08:00
|
|
|
});
|
2022-11-08 04:21:10 -08:00
|
|
|
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.signin({ email, password });
|
2022-11-08 04:21:10 -08:00
|
|
|
});
|
|
|
|
});
|