1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-09 17:50:52 +03:00

test(editor): Fix flaky workflow tags e2e tests and store screenshots from CI runs (#4903)

* test(editor): Fix flaky add tags e2e specs, and upload cypress artifacts on failure

* Only run smoke test to debug the pipeline

* Add waitForLoad command and revert debugging changes
This commit is contained in:
OlegIvaniv 2022-12-13 11:55:51 +01:00 committed by GitHub
parent b4d3f12b51
commit 297a043875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 5 deletions

View File

@ -63,6 +63,15 @@ jobs:
pnpm cypress:install
pnpm test:e2e:all
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: |
cypress/screenshots
retention-days: 1
- name: Notify Slack on failure
uses: act10ns/slack@v2.0.0
if: failure()

View File

@ -33,6 +33,7 @@ describe('Node Creator', () => {
}).as('nodesIntercept');
cy.visit(nodeCreatorFeature.url);
cy.waitForLoad();
});
it('should open node creator on trigger tab if no trigger is on canvas', () => {
@ -94,7 +95,6 @@ describe('Node Creator', () => {
})
it('should add manual trigger node', () => {
cy.get('.el-loading-mask').should('not.exist');
nodeCreatorFeature.getters.canvasAddButton().click();
nodeCreatorFeature.getters.getCreatorItem('Manually').click();

View File

@ -13,6 +13,7 @@ describe('Workflow Actions', () => {
cy.resetAll();
cy.skipSetup();
WorkflowPage.actions.visit();
cy.waitForLoad();
});
it('should be able to save on button click', () => {
@ -66,6 +67,7 @@ describe('Workflow Actions', () => {
it('should add more tags', () => {
WorkflowPage.getters.newTagLink().click();
WorkflowPage.actions.addTags(TEST_WF_TAGS);
WorkflowPage.getters.isWorkflowSaved();
WorkflowPage.getters.firstWorkflowTagElement().click();
WorkflowPage.actions.addTags(['Another one']);
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length + 1);
@ -84,7 +86,7 @@ describe('Workflow Actions', () => {
WorkflowPage.getters.newTagLink().click();
WorkflowPage.actions.addTags(TEST_WF_TAGS);
WorkflowPage.getters.firstWorkflowTagElement().click();
WorkflowPage.getters.workflowTagsDropdown().find('li').first().click();
WorkflowPage.getters.workflowTagsDropdown().find('li.selected').first().click();
cy.get('body').type('{enter}');
WorkflowPage.getters.workflowTagElements().should('have.length', TEST_WF_TAGS.length - 1);
});

View File

@ -22,7 +22,7 @@ export class NodeCreator extends BasePage {
};
actions = {
openNodeCreator: () => {
cy.get('.el-loading-mask').should('not.exist');
cy.waitForLoad();
this.getters.plusButton().click();
this.getters.nodeCreator().should('be.visible')
},

View File

@ -38,8 +38,7 @@ export class WorkflowPage extends BasePage {
actions = {
visit: () => {
cy.visit(this.url);
cy.getByTestId('node-view-loader', { timeout: 5000 }).should('not.exist');
cy.get('.el-loading-mask', { timeout: 5000 }).should('not.exist');
cy.waitForLoad();
},
addInitialNodeToCanvas: (nodeDisplayName: string) => {
this.getters.canvasPlusButton().click();
@ -98,6 +97,9 @@ export class WorkflowPage extends BasePage {
this.getters.workflowTagsInput().type('{enter}');
});
cy.get('body').type('{enter}');
// For a brief moment the Element UI tag component shows the tags as(+X) string
// so we need to wait for it to disappear
this.getters.workflowTagsContainer().should('not.contain', `+${tags.length}`);
},
zoomToFit: () => {
cy.getByTestId('zoom-to-fit').click();

View File

@ -50,6 +50,11 @@ Cypress.Commands.add('findChildByTestId', { prevSubject: true }, (subject: Cypre
return subject.find(`[data-test-id="${childTestId}"]`);
})
Cypress.Commands.add('waitForLoad', () => {
cy.getByTestId('node-view-loader').should('not.exist', { timeout: 10000 });
cy.get('.el-loading-mask').should('not.exist', { timeout: 10000 });
})
Cypress.Commands.add(
'signin',
({ email, password }) => {

View File

@ -24,6 +24,7 @@ declare global {
setupOwner(payload: SetupPayload): void;
skipSetup(): void;
resetAll(): void;
waitForLoad(): void;
grantBrowserPermissions(...permissions: string[]): void;
readClipboard(): Chainable<string>;
paste(pastePayload: string): void,