test: Add e2e tests for cred setup on workflow editor (no-changelog) (#8245)

## Summary

Follow-up to https://github.com/n8n-io/n8n/pull/8240

Adds e2e tests for the template credential setup in workflow editor


## Related tickets and issues

https://linear.app/n8n/issue/ADO-1463/feature-enable-users-to-close-and-re-open-the-setup
This commit is contained in:
Tomi Turtiainen
2024-01-08 11:35:18 +02:00
committed by GitHub
parent 3cf6704dbb
commit 008fd5a917
9 changed files with 144 additions and 42 deletions

View File

@@ -1,6 +1,12 @@
import 'cypress-real-events';
import { WorkflowPage } from '../pages';
import { BACKEND_BASE_URL, INSTANCE_MEMBERS, INSTANCE_OWNER, N8N_AUTH_COOKIE } from '../constants';
import {
BACKEND_BASE_URL,
INSTANCE_ADMIN,
INSTANCE_MEMBERS,
INSTANCE_OWNER,
N8N_AUTH_COOKIE,
} from '../constants';
Cypress.Commands.add('getByTestId', (selector, ...args) => {
return cy.get(`[data-test-id="${selector}"]`, ...args);
@@ -51,6 +57,10 @@ Cypress.Commands.add('signin', ({ email, password }) => {
);
});
Cypress.Commands.add('signinAsOwner', () => {
cy.signin({ email: INSTANCE_OWNER.email, password: INSTANCE_OWNER.password });
});
Cypress.Commands.add('signout', () => {
cy.request('POST', `${BACKEND_BASE_URL}/rest/logout`);
cy.getCookie(N8N_AUTH_COOKIE).should('not.exist');
@@ -183,3 +193,11 @@ Cypress.Commands.add('shouldNotHaveConsoleErrors', () => {
cy.wrap(spy).should('not.have.been.called');
});
});
Cypress.Commands.add('resetDatabase', () => {
cy.request('POST', `${BACKEND_BASE_URL}/rest/e2e/reset`, {
owner: INSTANCE_OWNER,
members: INSTANCE_MEMBERS,
admin: INSTANCE_ADMIN,
});
});