mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
af3ac2db28
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
43 lines
1,009 B
TypeScript
43 lines
1,009 B
TypeScript
import { N8N_AUTH_COOKIE } from '../constants';
|
|
import { BasePage } from './base';
|
|
import { WorkflowsPage } from './workflows';
|
|
|
|
export class SigninPage extends BasePage {
|
|
url = '/signin';
|
|
|
|
getters = {
|
|
form: () => cy.getByTestId('auth-form'),
|
|
email: () => cy.getByTestId('email'),
|
|
password: () => cy.getByTestId('password'),
|
|
submit: () => cy.get('button'),
|
|
};
|
|
|
|
actions = {
|
|
loginWithEmailAndPassword: (email: string, password: string) => {
|
|
const signinPage = new SigninPage();
|
|
const workflowsPage = new WorkflowsPage();
|
|
|
|
cy.session(
|
|
[email, password],
|
|
() => {
|
|
cy.visit(signinPage.url);
|
|
|
|
this.getters.form().within(() => {
|
|
this.getters.email().type(email);
|
|
this.getters.password().type(password);
|
|
this.getters.submit().click();
|
|
});
|
|
|
|
// we should be redirected to /workflows
|
|
cy.url().should('include', workflowsPage.url);
|
|
},
|
|
{
|
|
validate() {
|
|
cy.getCookie(N8N_AUTH_COOKIE).should('exist');
|
|
},
|
|
},
|
|
);
|
|
},
|
|
};
|
|
}
|