mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
ci: Refactor e2e tests to be less flaky (no-changelog) (#9695)
This commit is contained in:
committed by
GitHub
parent
bc35e8c33d
commit
3d0393c739
@@ -5,6 +5,7 @@ export class TemplatesPage extends BasePage {
|
||||
|
||||
getters = {
|
||||
useTemplateButton: () => cy.getByTestId('use-template-button'),
|
||||
description: () => cy.getByTestId('template-description'),
|
||||
templateCards: () => cy.getByTestId('template-card'),
|
||||
firstTemplateCard: () => this.getters.templateCards().first(),
|
||||
allCategoriesFilter: () => cy.getByTestId('template-filter-all-categories'),
|
||||
@@ -14,50 +15,30 @@ export class TemplatesPage extends BasePage {
|
||||
collectionCountLabel: () => cy.getByTestId('collection-count-label'),
|
||||
templateCountLabel: () => cy.getByTestId('template-count-label'),
|
||||
templatesLoadingContainer: () => cy.getByTestId('templates-loading-container'),
|
||||
expandCategoriesButton: () => cy.getByTestId('expand-categories-button'),
|
||||
};
|
||||
|
||||
actions = {
|
||||
openSingleTemplateView: (templateId: number) => {
|
||||
cy.visit(`${this.url}/${templateId}`);
|
||||
cy.waitForLoad();
|
||||
},
|
||||
|
||||
openOnboardingFlow: (id: number, name: string, workflow: object, templatesHost: string) => {
|
||||
const apiResponse = {
|
||||
id,
|
||||
name,
|
||||
workflow,
|
||||
};
|
||||
openOnboardingFlow: () => {
|
||||
cy.intercept('POST', '/rest/workflows').as('createWorkflow');
|
||||
cy.intercept('GET', `${templatesHost}/api/workflows/templates/${id}`, {
|
||||
statusCode: 200,
|
||||
body: apiResponse,
|
||||
}).as('getTemplate');
|
||||
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
|
||||
|
||||
cy.visit(`/workflows/onboarding/${id}`);
|
||||
cy.visit('/workflows/onboarding/1');
|
||||
cy.window().then((win) => {
|
||||
win.preventNodeViewBeforeUnload = true;
|
||||
});
|
||||
|
||||
cy.wait('@getTemplate');
|
||||
cy.wait(['@createWorkflow', '@getWorkflow']);
|
||||
cy.wait(['@getTemplate', '@createWorkflow', '@getWorkflow']);
|
||||
},
|
||||
|
||||
importTemplate: (id: number, name: string, workflow: object, templatesHost: string) => {
|
||||
const apiResponse = {
|
||||
id,
|
||||
name,
|
||||
workflow,
|
||||
};
|
||||
cy.intercept('GET', `${templatesHost}/api/workflows/templates/${id}`, {
|
||||
statusCode: 200,
|
||||
body: apiResponse,
|
||||
}).as('getTemplate');
|
||||
importTemplate: () => {
|
||||
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
|
||||
|
||||
cy.visit(`/workflows/templates/${id}`);
|
||||
cy.visit('/workflows/templates/1');
|
||||
cy.window().then((win) => {
|
||||
win.preventNodeViewBeforeUnload = true;
|
||||
});
|
||||
|
||||
cy.wait('@getTemplate');
|
||||
cy.wait('@getWorkflow');
|
||||
cy.wait(['@getTemplate', '@getWorkflow']);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user