mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
ci: Do not reset the server for every e2e sub-test (no-changelog) (#5521)
This commit is contained in:
committed by
GitHub
parent
88de6613bd
commit
d09ca875ec
@@ -27,7 +27,7 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
|
||||
respondWith,
|
||||
responseData,
|
||||
executeNow = true,
|
||||
} = options;
|
||||
} = options;
|
||||
|
||||
workflowPage.actions.addInitialNodeToCanvas('Webhook');
|
||||
workflowPage.actions.openNode('Webhook');
|
||||
@@ -47,43 +47,43 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
|
||||
if (authentication) {
|
||||
cy.getByTestId('parameter-input-authentication').click();
|
||||
cy.getByTestId('parameter-input-authentication')
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(authentication)
|
||||
.click();
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(authentication)
|
||||
.click();
|
||||
}
|
||||
|
||||
if (responseCode) {
|
||||
cy.getByTestId('parameter-input-responseCode')
|
||||
.find('.parameter-input')
|
||||
.find('input')
|
||||
.clear()
|
||||
.type(responseCode.toString());
|
||||
.find('.parameter-input')
|
||||
.find('input')
|
||||
.clear()
|
||||
.type(responseCode.toString());
|
||||
}
|
||||
|
||||
if (respondWith) {
|
||||
cy.getByTestId('parameter-input-responseMode').click();
|
||||
cy.getByTestId('parameter-input-responseMode')
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(respondWith)
|
||||
.click();
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(respondWith)
|
||||
.click();
|
||||
}
|
||||
|
||||
if (responseData) {
|
||||
cy.getByTestId('parameter-input-responseData').click();
|
||||
cy.getByTestId('parameter-input-responseData')
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(responseData)
|
||||
.click();
|
||||
.find('.el-select-dropdown')
|
||||
.find('.option-headline')
|
||||
.contains(responseData)
|
||||
.click();
|
||||
}
|
||||
|
||||
if (executeNow) {
|
||||
ndv.actions.execute();
|
||||
cy.wait(waitForWebhook);
|
||||
|
||||
cy.request(method, '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request(method, '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
ndv.getters.outputPanel().contains('headers');
|
||||
});
|
||||
@@ -91,36 +91,41 @@ const simpleWebhookCall = (options: SimpleWebhookCallOptions) => {
|
||||
};
|
||||
|
||||
describe('Webhook Trigger node', async () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.resetAll();
|
||||
cy.skipSetup();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
workflowPage.actions.visit();
|
||||
cy.waitForLoad();
|
||||
|
||||
cy.window()
|
||||
// @ts-ignore
|
||||
.then(win => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload));
|
||||
.then(
|
||||
(win) => win.onBeforeUnload && win.removeEventListener('beforeunload', win.onBeforeUnload),
|
||||
);
|
||||
});
|
||||
|
||||
it('should listen for a GET request', () => {
|
||||
simpleWebhookCall({method: 'GET', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'GET', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
|
||||
it('should listen for a POST request', () => {
|
||||
simpleWebhookCall({method: 'POST', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'POST', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
|
||||
it('should listen for a DELETE request', () => {
|
||||
simpleWebhookCall({method: 'DELETE', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'DELETE', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
it('should listen for a HEAD request', () => {
|
||||
simpleWebhookCall({method: 'HEAD', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'HEAD', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
it('should listen for a PATCH request', () => {
|
||||
simpleWebhookCall({method: 'PATCH', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'PATCH', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
it('should listen for a PUT request', () => {
|
||||
simpleWebhookCall({method: 'PUT', webhookPath: uuid(), executeNow: true});
|
||||
simpleWebhookCall({ method: 'PUT', webhookPath: uuid(), executeNow: true });
|
||||
});
|
||||
|
||||
it('should listen for a GET request and respond with Respond to Webhook node', () => {
|
||||
@@ -138,7 +143,10 @@ describe('Webhook Trigger node', async () => {
|
||||
workflowPage.actions.openNode('Set');
|
||||
cy.get('.add-option').click();
|
||||
cy.get('.add-option').find('.el-select-dropdown__item').contains('Number').click();
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('MyValue');
|
||||
cy.get('.fixed-collection-parameter')
|
||||
.getByTestId('parameter-input-name')
|
||||
.clear()
|
||||
.type('MyValue');
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().type('1234');
|
||||
ndv.getters.backToCanvas().click();
|
||||
|
||||
@@ -147,7 +155,7 @@ describe('Webhook Trigger node', async () => {
|
||||
workflowPage.actions.executeWorkflow();
|
||||
cy.wait(waitForWebhook);
|
||||
|
||||
cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body.MyValue).to.eq(1234);
|
||||
});
|
||||
@@ -165,7 +173,7 @@ describe('Webhook Trigger node', async () => {
|
||||
ndv.actions.execute();
|
||||
cy.wait(waitForWebhook);
|
||||
|
||||
cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(201);
|
||||
});
|
||||
});
|
||||
@@ -184,14 +192,17 @@ describe('Webhook Trigger node', async () => {
|
||||
workflowPage.actions.openNode('Set');
|
||||
cy.get('.add-option').click();
|
||||
cy.get('.add-option').find('.el-select-dropdown__item').contains('Number').click();
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('MyValue');
|
||||
cy.get('.fixed-collection-parameter')
|
||||
.getByTestId('parameter-input-name')
|
||||
.clear()
|
||||
.type('MyValue');
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().type('1234');
|
||||
ndv.getters.backToCanvas().click();
|
||||
|
||||
workflowPage.actions.executeWorkflow();
|
||||
cy.wait(waitForWebhook);
|
||||
|
||||
cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body.MyValue).to.eq(1234);
|
||||
});
|
||||
@@ -213,10 +224,14 @@ describe('Webhook Trigger node', async () => {
|
||||
cy.get('.add-option').click();
|
||||
cy.get('.add-option').find('.el-select-dropdown__item').contains('String').click();
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-name').clear().type('data');
|
||||
cy.get('.fixed-collection-parameter').getByTestId('parameter-input-value').clear().find('input').invoke('val', cowBase64).trigger('blur');
|
||||
cy.get('.fixed-collection-parameter')
|
||||
.getByTestId('parameter-input-value')
|
||||
.clear()
|
||||
.find('input')
|
||||
.invoke('val', cowBase64)
|
||||
.trigger('blur');
|
||||
ndv.getters.backToCanvas().click();
|
||||
|
||||
|
||||
workflowPage.actions.addNodeToCanvas('Move Binary Data');
|
||||
workflowPage.actions.zoomToFit();
|
||||
|
||||
@@ -232,7 +247,7 @@ describe('Webhook Trigger node', async () => {
|
||||
workflowPage.actions.executeWorkflow();
|
||||
cy.wait(waitForWebhook);
|
||||
|
||||
cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(Object.keys(response.body).includes('data')).to.be.true;
|
||||
});
|
||||
@@ -249,7 +264,7 @@ describe('Webhook Trigger node', async () => {
|
||||
});
|
||||
ndv.actions.execute();
|
||||
cy.wait(waitForWebhook);
|
||||
cy.request('GET', '/webhook-test/'+ webhookPath).then((response) => {
|
||||
cy.request('GET', '/webhook-test/' + webhookPath).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body.MyValue).to.be.undefined;
|
||||
});
|
||||
@@ -273,28 +288,29 @@ describe('Webhook Trigger node', async () => {
|
||||
cy.wait(waitForWebhook);
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/'+ webhookPath,
|
||||
url: '/webhook-test/' + webhookPath,
|
||||
auth: {
|
||||
'user': 'username',
|
||||
'pass': 'password',
|
||||
user: 'username',
|
||||
pass: 'password',
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
})
|
||||
.then((response) => {
|
||||
expect(response.status).to.eq(403);
|
||||
}).then(() => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/'+ webhookPath,
|
||||
auth: {
|
||||
'user': 'test',
|
||||
'pass': 'test',
|
||||
},
|
||||
failOnStatusCode: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
.then((response) => {
|
||||
expect(response.status).to.eq(403);
|
||||
})
|
||||
.then(() => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/' + webhookPath,
|
||||
auth: {
|
||||
user: 'test',
|
||||
pass: 'test',
|
||||
},
|
||||
failOnStatusCode: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should listen for a GET request with Header Authentication', () => {
|
||||
@@ -315,25 +331,26 @@ describe('Webhook Trigger node', async () => {
|
||||
cy.wait(waitForWebhook);
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/'+ webhookPath,
|
||||
url: '/webhook-test/' + webhookPath,
|
||||
headers: {
|
||||
test: 'wrong',
|
||||
},
|
||||
failOnStatusCode: false,
|
||||
})
|
||||
.then((response) => {
|
||||
expect(response.status).to.eq(403);
|
||||
}).then(() => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/'+ webhookPath,
|
||||
headers: {
|
||||
test: 'test',
|
||||
},
|
||||
failOnStatusCode: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
.then((response) => {
|
||||
expect(response.status).to.eq(403);
|
||||
})
|
||||
.then(() => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: '/webhook-test/' + webhookPath,
|
||||
headers: {
|
||||
test: 'test',
|
||||
},
|
||||
failOnStatusCode: true,
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user