test: Migrate small Cypress tests to Playwright (#18922)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
shortstacked
2025-08-29 09:04:47 +01:00
committed by GitHub
parent 1bc317dce5
commit 7dd89d77d9
18 changed files with 388 additions and 190 deletions

View File

@@ -1,34 +0,0 @@
import { NDV, WorkflowPage } from '../pages';
import { clearNotifications } from '../pages/notifications';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
describe('ADO-2230 NDV Pagination Reset', () => {
it('should reset pagaintion if data size changes to less than current page', () => {
// setup, load workflow with debughelper node with random seed
workflowPage.actions.visit();
cy.createFixtureWorkflow('NDV-debug-generate-data.json', 'Debug workflow');
workflowPage.actions.openNode('DebugHelper');
// execute node outputting 10 pages, check output of first page
ndv.actions.execute();
clearNotifications();
ndv.getters.outputTbodyCell(1, 1).invoke('text').should('eq', 'Terry.Dach@hotmail.com');
// open 4th page, check output
ndv.getters.pagination().should('be.visible');
ndv.getters.pagination().find('li.number').should('have.length', 5);
ndv.getters.pagination().find('li.number').eq(3).click();
ndv.getters.outputTbodyCell(1, 1).invoke('text').should('eq', 'Shane.Cormier68@yahoo.com');
// output a lot less data
ndv.getters.parameterInput('randomDataCount').find('input').clear().type('20');
ndv.actions.execute();
clearNotifications();
// check we are back to second page now
ndv.getters.pagination().find('li.number').should('have.length', 2);
ndv.getters.outputTbodyCell(1, 1).invoke('text').should('eq', 'Sylvia.Weber@hotmail.com');
});
});

View File

@@ -1,40 +0,0 @@
import { getOutputTableRow } from '../composables/ndv';
import { getCanvasNodes, openNode } from '../composables/workflow';
import SIMPLE_WORKFLOW from '../fixtures/Manual_wait_set.json';
import WORKFLOW_WITH_PINNED from '../fixtures/Webhook_set_pinned.json';
import { importWorkflow, visitDemoPage } from '../pages/demo';
import { errorToast } from '../pages/notifications';
describe('Demo', () => {
beforeEach(() => {
cy.overrideSettings({ previewMode: true });
});
it('can import template', () => {
visitDemoPage();
errorToast().should('not.exist');
importWorkflow(SIMPLE_WORKFLOW);
getCanvasNodes().should('have.length', 3);
});
it('can import workflow with pin data', () => {
visitDemoPage();
importWorkflow(WORKFLOW_WITH_PINNED);
getCanvasNodes().should('have.length', 2);
openNode('Webhook');
getOutputTableRow(0).should('include.text', 'headers');
getOutputTableRow(1).should('include.text', 'dragons');
});
it('can override theme to dark', () => {
visitDemoPage('dark');
cy.get('body').should('have.attr', 'data-theme', 'dark');
errorToast().should('not.exist');
});
it('can override theme to light', () => {
visitDemoPage('light');
cy.get('body').should('have.attr', 'data-theme', 'light');
errorToast().should('not.exist');
});
});

View File

@@ -1,42 +0,0 @@
import { WorkerViewPage } from '../pages';
const workerViewPage = new WorkerViewPage();
describe('Worker View (unlicensed)', () => {
beforeEach(() => {
cy.disableFeature('workerView');
cy.disableQueueMode();
});
it('should not show up in the menu sidebar', () => {
cy.signinAsMember(0);
cy.visit(workerViewPage.url);
workerViewPage.getters.menuItem().should('not.exist');
});
it('should show action box', () => {
cy.signinAsMember(0);
cy.visit(workerViewPage.url);
workerViewPage.getters.workerViewUnlicensed().should('exist');
});
});
describe('Worker View (licensed)', () => {
beforeEach(() => {
cy.enableFeature('workerView');
cy.enableQueueMode();
});
it('should show up in the menu sidebar', () => {
cy.signinAsOwner();
cy.enableQueueMode();
cy.visit(workerViewPage.url);
workerViewPage.getters.menuItem().should('exist');
});
it('should show worker list view', () => {
cy.signinAsMember(0);
cy.visit(workerViewPage.url);
workerViewPage.getters.workerViewLicensed().should('exist');
});
});

View File

@@ -1,35 +0,0 @@
import {
closeVersionUpdatesPanel,
getVersionCard,
getVersionUpdatesPanelOpenButton,
openWhatsNewMenu,
openVersionUpdatesPanel,
} from '../composables/versions';
import { WorkflowsPage } from '../pages/workflows';
const workflowsPage = new WorkflowsPage();
describe('Versions', () => {
it('should open updates panel', () => {
cy.overrideSettings({
releaseChannel: 'stable',
versionCli: '1.0.0',
versionNotifications: {
enabled: true,
endpoint: 'https://api.n8n.io/api/versions/',
whatsNewEnabled: true,
whatsNewEndpoint: 'https://api.n8n.io/api/whats-new',
infoUrl: 'https://docs.n8n.io/getting-started/installation/updating.html',
},
});
cy.visit(workflowsPage.url);
cy.wait('@loadSettings');
openWhatsNewMenu();
getVersionUpdatesPanelOpenButton().should('contain', '2 versions behind');
openVersionUpdatesPanel();
getVersionCard().should('have.length', 2);
closeVersionUpdatesPanel();
});
});

View File

@@ -1,34 +0,0 @@
import {
getBecomeTemplateCreatorCta,
getCloseBecomeTemplateCreatorCtaButton,
interceptCtaRequestWithResponse,
} from '../composables/becomeTemplateCreatorCta';
import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows';
const WorkflowsPage = new WorkflowsPageClass();
// Migrated to Playwright
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
describe.skip('Become creator CTA', () => {
it('should not show the CTA if user is not eligible', () => {
interceptCtaRequestWithResponse(false).as('cta');
cy.visit(WorkflowsPage.url);
cy.wait('@cta');
getBecomeTemplateCreatorCta().should('not.exist');
});
it('should show the CTA if the user is eligible', () => {
interceptCtaRequestWithResponse(true).as('cta');
cy.visit(WorkflowsPage.url);
cy.wait('@cta');
getBecomeTemplateCreatorCta().should('be.visible');
getCloseBecomeTemplateCreatorCtaButton().click();
getBecomeTemplateCreatorCta().should('not.exist');
});
});