mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix: Fix randomly failing scheduler node e2e tests (no-changelog) (#6430)
* fix: fix randomly failing scheduler node e2e tests (no-changelog) * chore: rename variable name * fix: update all cy.request calls to use backend base url * fix: add back mistkenly removed workflowId code * fix: remove unnecessary .then * fix: update how workflowId is retrieved
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
export const BACKEND_BASE_URL = 'http://localhost:5678';
|
||||||
|
|
||||||
export const N8N_AUTH_COOKIE = 'n8n-auth';
|
export const N8N_AUTH_COOKIE = 'n8n-auth';
|
||||||
|
|
||||||
export const DEFAULT_USER_EMAIL = 'nathan@n8n.io';
|
export const DEFAULT_USER_EMAIL = 'nathan@n8n.io';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { WorkflowPage, WorkflowsPage, NDV } from '../pages';
|
import { WorkflowPage, WorkflowsPage, NDV } from '../pages';
|
||||||
|
import { BACKEND_BASE_URL } from '../constants';
|
||||||
|
|
||||||
const workflowsPage = new WorkflowsPage();
|
const workflowsPage = new WorkflowsPage();
|
||||||
const workflowPage = new WorkflowPage();
|
const workflowPage = new WorkflowPage();
|
||||||
@@ -39,44 +40,34 @@ describe('Schedule Trigger node', async () => {
|
|||||||
workflowPage.actions.activateWorkflow();
|
workflowPage.actions.activateWorkflow();
|
||||||
workflowPage.getters.activatorSwitch().should('have.class', 'is-checked');
|
workflowPage.getters.activatorSwitch().should('have.class', 'is-checked');
|
||||||
|
|
||||||
cy.request('GET', '/rest/workflows')
|
cy.url().then((url) => {
|
||||||
.then((response) => {
|
const workflowId = url.split('/').pop();
|
||||||
|
|
||||||
|
cy.wait(1200);
|
||||||
|
cy.request('GET', `${BACKEND_BASE_URL}/rest/executions`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(response.body.data).to.have.length(1);
|
expect(workflowId).to.not.be.undefined;
|
||||||
const workflowId = response.body.data[0].id.toString();
|
expect(response.body.data.results.length).to.be.greaterThan(0);
|
||||||
expect(workflowId).to.not.be.empty;
|
const matchingExecutions = response.body.data.results.filter(
|
||||||
return workflowId;
|
(execution: any) => execution.workflowId === workflowId,
|
||||||
})
|
);
|
||||||
.then((workflowId) => {
|
expect(matchingExecutions).to.have.length(1);
|
||||||
|
|
||||||
cy.wait(1200);
|
cy.wait(1200);
|
||||||
cy.request('GET', '/rest/executions')
|
cy.request('GET', `${BACKEND_BASE_URL}/rest/executions`).then((response) => {
|
||||||
.then((response) => {
|
expect(response.status).to.eq(200);
|
||||||
expect(response.status).to.eq(200);
|
expect(response.body.data.results.length).to.be.greaterThan(0);
|
||||||
expect(response.body.data.results.length).to.be.greaterThan(0);
|
const matchingExecutions = response.body.data.results.filter(
|
||||||
const matchingExecutions = response.body.data.results.filter(
|
(execution: any) => execution.workflowId === workflowId,
|
||||||
(execution: any) => execution.workflowId === workflowId,
|
);
|
||||||
);
|
expect(matchingExecutions).to.have.length(2);
|
||||||
expect(matchingExecutions).to.have.length(1);
|
|
||||||
return workflowId;
|
workflowPage.actions.activateWorkflow();
|
||||||
})
|
workflowPage.getters.activatorSwitch().should('not.have.class', 'is-checked');
|
||||||
.then((workflowId) => {
|
cy.visit(workflowsPage.url);
|
||||||
cy.wait(1200);
|
workflowsPage.actions.deleteWorkFlow('Schedule Trigger Workflow');
|
||||||
cy.request('GET', '/rest/executions')
|
});
|
||||||
.then((response) => {
|
|
||||||
expect(response.status).to.eq(200);
|
|
||||||
expect(response.body.data.results.length).to.be.greaterThan(0);
|
|
||||||
const matchingExecutions = response.body.data.results.filter(
|
|
||||||
(execution: any) => execution.workflowId === workflowId,
|
|
||||||
);
|
|
||||||
expect(matchingExecutions).to.have.length(2);
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
workflowPage.actions.activateWorkflow();
|
|
||||||
workflowPage.getters.activatorSwitch().should('not.have.class', 'is-checked');
|
|
||||||
cy.visit(workflowsPage.url);
|
|
||||||
workflowsPage.actions.deleteWorkFlow('Schedule Trigger Workflow');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { WorkflowPage, NDV, CredentialsModal } from '../pages';
|
import { WorkflowPage, NDV, CredentialsModal } from '../pages';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { cowBase64 } from '../support/binaryTestFiles';
|
import { cowBase64 } from '../support/binaryTestFiles';
|
||||||
|
import { BACKEND_BASE_URL } from '../constants';
|
||||||
|
|
||||||
const workflowPage = new WorkflowPage();
|
const workflowPage = new WorkflowPage();
|
||||||
const ndv = new NDV();
|
const ndv = new NDV();
|
||||||
@@ -83,7 +84,7 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
|
|||||||
ndv.actions.execute();
|
ndv.actions.execute();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
|
|
||||||
cy.request(method, '/webhook-test/' + webhookPath).then((response) => {
|
cy.request(method, `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
ndv.getters.outputPanel().contains('headers');
|
ndv.getters.outputPanel().contains('headers');
|
||||||
});
|
});
|
||||||
@@ -98,12 +99,10 @@ describe('Webhook Trigger node', async () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
workflowPage.actions.visit();
|
workflowPage.actions.visit();
|
||||||
|
|
||||||
cy.window().then(
|
cy.window().then((win) => {
|
||||||
(win) => {
|
// @ts-ignore
|
||||||
// @ts-ignore
|
win.preventNodeViewBeforeUnload = true;
|
||||||
win.preventNodeViewBeforeUnload = true;
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should listen for a GET request', () => {
|
it('should listen for a GET request', () => {
|
||||||
@@ -154,7 +153,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
workflowPage.actions.executeWorkflow();
|
workflowPage.actions.executeWorkflow();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
|
|
||||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(response.body.MyValue).to.eq(1234);
|
expect(response.body.MyValue).to.eq(1234);
|
||||||
});
|
});
|
||||||
@@ -172,7 +171,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
ndv.actions.execute();
|
ndv.actions.execute();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
|
|
||||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(201);
|
expect(response.status).to.eq(201);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -201,7 +200,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
workflowPage.actions.executeWorkflow();
|
workflowPage.actions.executeWorkflow();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
|
|
||||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(response.body.MyValue).to.eq(1234);
|
expect(response.body.MyValue).to.eq(1234);
|
||||||
});
|
});
|
||||||
@@ -246,7 +245,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
workflowPage.actions.executeWorkflow();
|
workflowPage.actions.executeWorkflow();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
|
|
||||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(Object.keys(response.body).includes('data')).to.be.true;
|
expect(Object.keys(response.body).includes('data')).to.be.true;
|
||||||
});
|
});
|
||||||
@@ -263,7 +262,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
});
|
});
|
||||||
ndv.actions.execute();
|
ndv.actions.execute();
|
||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
cy.request('GET', `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`).then((response) => {
|
||||||
expect(response.status).to.eq(200);
|
expect(response.status).to.eq(200);
|
||||||
expect(response.body.MyValue).to.be.undefined;
|
expect(response.body.MyValue).to.be.undefined;
|
||||||
});
|
});
|
||||||
@@ -287,7 +286,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/webhook-test/' + webhookPath,
|
url: `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`,
|
||||||
auth: {
|
auth: {
|
||||||
user: 'username',
|
user: 'username',
|
||||||
pass: 'password',
|
pass: 'password',
|
||||||
@@ -300,7 +299,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/webhook-test/' + webhookPath,
|
url: `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`,
|
||||||
auth: {
|
auth: {
|
||||||
user: 'test',
|
user: 'test',
|
||||||
pass: 'test',
|
pass: 'test',
|
||||||
@@ -330,7 +329,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
cy.wait(waitForWebhook);
|
cy.wait(waitForWebhook);
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/webhook-test/' + webhookPath,
|
url: `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`,
|
||||||
headers: {
|
headers: {
|
||||||
test: 'wrong',
|
test: 'wrong',
|
||||||
},
|
},
|
||||||
@@ -342,7 +341,7 @@ describe('Webhook Trigger node', async () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/webhook-test/' + webhookPath,
|
url: `${BACKEND_BASE_URL}/webhook-test/${webhookPath}`,
|
||||||
headers: {
|
headers: {
|
||||||
test: 'test',
|
test: 'test',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user