-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into N8N-5191-pinia-migration-part2
* master: fix(editor): Fix for incorrect execution saving indicator in executions view (#4547) feat(API): Report unhandled app crashes to Sentry (#4548) fix(SendInBlue Trigger Node): fix typo in credential name (#4357) refactor(core): Update rule typescript-eslint/no-unused-vars to not error when variable starts with _ (#4523) refactor: make IPollFunctions emit consistent with trigger emit (#4201) feat: Add cypress e2e tests for signup and signin (#3490) fix(core): Fix manual execution of pinned trigger on main mode (#4535) fix(HTTP Request Node): Show error cause in the output (#4538) refactor(core): Skip interim updates check (no-changelog) (#4536) ci: Revert support for node.js 18 (#4518) (#4537) ci: Start supporting node.js 18 (#4518)
- Loading branch information
Showing
310 changed files
with
2,572 additions
and
806 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:5678', | ||
video: false, | ||
screenshotOnRunFailure: false, | ||
experimentalSessionAndOrigin: true, | ||
experimentalInteractiveRunEvents: true, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const N8N_AUTH_COOKIE = 'n8n-auth'; | ||
|
||
export const DEFAULT_USER_EMAIL = 'nathan@n8n.io'; | ||
export const DEFAULT_USER_PASSWORD = 'CypressTest123'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD} from "../constants"; | ||
import {randFirstName, randLastName} from "@ngneat/falso"; | ||
|
||
const username = DEFAULT_USER_EMAIL; | ||
const password = DEFAULT_USER_PASSWORD; | ||
const firstName = randFirstName(); | ||
const lastName = randLastName(); | ||
|
||
describe('Authentication flow', () => { | ||
it('should sign user up', () => { | ||
cy.signup(username, firstName, lastName, password); | ||
}); | ||
|
||
it('should sign user in', () => { | ||
cy.on('uncaught:exception', (err, runnable) => { | ||
expect(err.message).to.include('Not logged in'); | ||
|
||
return false; | ||
}) | ||
|
||
cy.signin(username, password); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { IE2ETestPage, IE2ETestPageElement } from "../types"; | ||
|
||
|
||
export class BasePage implements IE2ETestPage { | ||
elements: Record<string, IE2ETestPageElement> = {}; | ||
get(id: keyof BasePage['elements'], ...args: unknown[]): ReturnType<IE2ETestPageElement> { | ||
const getter = this.elements[id]; | ||
|
||
if (!getter) { | ||
throw new Error(`No element with id "${id}" found. Check your page object definition.`); | ||
} | ||
|
||
return getter(...args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './base'; | ||
export * from './signin'; | ||
export * from './signup'; | ||
export * from './workflows'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { BasePage } from "./base"; | ||
|
||
export class SigninPage extends BasePage { | ||
url = '/signin'; | ||
elements = { | ||
form: () => cy.getByTestId('auth-form'), | ||
email: () => cy.getByTestId('email'), | ||
password: () => cy.getByTestId('password'), | ||
submit: () => cy.get('button'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BasePage } from "./base"; | ||
|
||
export class SignupPage extends BasePage { | ||
url = '/setup'; | ||
elements = { | ||
form: () => cy.getByTestId('auth-form'), | ||
email: () => cy.getByTestId('email'), | ||
firstName: () => cy.getByTestId('firstName'), | ||
lastName: () => cy.getByTestId('lastName'), | ||
password: () => cy.getByTestId('password'), | ||
submit: () => cy.get('button'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { BasePage } from "./base"; | ||
|
||
export class WorkflowsPage extends BasePage { | ||
url = '/workflows'; | ||
elements = {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
|
||
import { WorkflowsPage, SigninPage, SignupPage } from "../pages"; | ||
import { N8N_AUTH_COOKIE } from "../constants"; | ||
|
||
|
||
Cypress.Commands.add('getByTestId', (selector, ...args) => { | ||
return cy.get(`[data-test-id="${selector}"]`, ...args) | ||
}) | ||
|
||
Cypress.Commands.add( | ||
'signin', | ||
(email, password) => { | ||
const signinPage = new SigninPage(); | ||
const workflowsPage = new WorkflowsPage(); | ||
|
||
cy.session([email, password], () => { | ||
cy.visit(signinPage.url); | ||
|
||
signinPage.get('form').within(() => { | ||
signinPage.get('email').type(email); | ||
signinPage.get('password').type(password); | ||
signinPage.get('submit').click(); | ||
}); | ||
|
||
// we should be redirected to /workflows | ||
cy.url().should('include', workflowsPage.url); | ||
}, | ||
{ | ||
validate() { | ||
cy.getCookie(N8N_AUTH_COOKIE).should('exist'); | ||
}, | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('signup', (email, firstName, lastName, password) => { | ||
const signupPage = new SignupPage(); | ||
|
||
cy.visit(signupPage.url); | ||
|
||
signupPage.get('form').within(() => { | ||
cy.url().then((url) => { | ||
if (url.endsWith(signupPage.url)) { | ||
signupPage.get('email').type(email); | ||
signupPage.get('firstName').type(firstName); | ||
signupPage.get('lastName').type(lastName); | ||
signupPage.get('password').type(password); | ||
signupPage.get('submit').click(); | ||
} else { | ||
cy.log('User already signed up'); | ||
} | ||
}); | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
import './commands' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Load type definitions that come with Cypress module | ||
/// <reference types="cypress" /> | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
getByTestId(selector: string, ...args: (Partial<Loggable & Timeoutable & Withinable & Shadow> | undefined)[]): Chainable<JQuery<HTMLElement>> | ||
signin(email: string, password: string): void; | ||
signup(email: string, firstName: string, lastName: string, password: string): void; | ||
} | ||
} | ||
} | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type IE2ETestPageElement = (...args: unknown[]) => | ||
| Cypress.Chainable<JQuery<HTMLElement>> | ||
| Cypress.Chainable<JQuery<HTMLButtonElement>>; | ||
|
||
export interface IE2ETestPage { | ||
url?: string; | ||
elements: Record<string, IE2ETestPageElement>; | ||
get(id: string, ...args: unknown[]): ReturnType<IE2ETestPageElement>; | ||
} |
Oops, something went wrong.