ci: Refactor e2e tests to be less flaky (no-changelog) (#9695)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-11 14:45:15 +02:00
committed by GitHub
parent bc35e8c33d
commit 3d0393c739
39 changed files with 485 additions and 539 deletions

View File

@@ -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']);
},
};
}