Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(editor): Add deprecation warnings for e2e page classes (no-changelog) #12489

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cypress/composables/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function getNodeByName(name: string) {
);
}

export function getWorkflowHistoryCloseButton() {
return cy.getByTestId('workflow-history-close-button');
}

export function disableNode(name: string) {
const target = getNodeByName(name);
target.rightclick(name ? 'center' : 'topLeft', { force: true });
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/27-cloud.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import planData from '../fixtures/Plan_data_opt_in_trial.json';
import {
BannerStack,
MainSidebar,
WorkflowPage,
visitPublicApiPage,
Expand All @@ -11,7 +10,6 @@ import {
const NUMBER_OF_AI_CREDITS = 100;

const mainSidebar = new MainSidebar();
const bannerStack = new BannerStack();
const workflowPage = new WorkflowPage();
const workflowsPage = new WorkflowsPage();

Expand Down Expand Up @@ -48,11 +46,11 @@ describe('Cloud', () => {
it('should render trial banner for opt-in cloud user', () => {
visitWorkflowPage();

bannerStack.getters.banner().should('be.visible');
cy.getByTestId('banner-stack').should('be.visible');

mainSidebar.actions.signout();

bannerStack.getters.banner().should('not.be.visible');
cy.getByTestId('banner-stack').should('not.be.visible');
});
});

Expand Down
12 changes: 4 additions & 8 deletions cypress/e2e/30-editor-after-route-changes.cy.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { getWorkflowHistoryCloseButton } from '../composables/workflow';
import {
CODE_NODE_NAME,
EDIT_FIELDS_SET_NODE_NAME,
IF_NODE_NAME,
SCHEDULE_TRIGGER_NODE_NAME,
} from '../constants';
import {
WorkflowExecutionsTab,
WorkflowPage as WorkflowPageClass,
WorkflowHistoryPage,
} from '../pages';
import { WorkflowExecutionsTab, WorkflowPage as WorkflowPageClass } from '../pages';

const workflowPage = new WorkflowPageClass();
const executionsTab = new WorkflowExecutionsTab();
const workflowHistoryPage = new WorkflowHistoryPage();

const createNewWorkflowAndActivate = () => {
workflowPage.actions.visit();
Expand Down Expand Up @@ -92,7 +88,7 @@ const switchBetweenEditorAndHistory = () => {
cy.wait(['@getVersion']);

cy.intercept('GET', '/rest/workflows/*').as('workflowGet');
workflowHistoryPage.getters.workflowHistoryCloseButton().click();
getWorkflowHistoryCloseButton().click();
cy.wait(['@workflowGet']);
cy.wait(1000);

Expand Down Expand Up @@ -168,7 +164,7 @@ describe('Editor actions should work', () => {
cy.wait(['@getVersion']);

cy.intercept('GET', '/rest/workflows/*').as('workflowGet');
workflowHistoryPage.getters.workflowHistoryCloseButton().click();
getWorkflowHistoryCloseButton().click();
cy.wait(['@workflowGet']);
cy.wait(1000);

Expand Down
12 changes: 5 additions & 7 deletions cypress/e2e/35-admin-user-smoke-test.cy.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { SettingsPage } from '../pages/settings';

const settingsPage = new SettingsPage();
const url = '/settings';

describe('Admin user', { disableAutoLogin: true }, () => {
it('should see same Settings sub menu items as instance owner', () => {
cy.signinAsOwner();
cy.visit(settingsPage.url);
cy.visit(url);

let ownerMenuItems = 0;

settingsPage.getters.menuItems().then(($el) => {
cy.getByTestId('menu-item').then(($el) => {
ownerMenuItems = $el.length;
});

cy.signout();
cy.signinAsAdmin();
cy.visit(settingsPage.url);
cy.visit(url);

settingsPage.getters.menuItems().should('have.length', ownerMenuItems);
cy.getByTestId('menu-item').should('have.length', ownerMenuItems);
});
});
9 changes: 0 additions & 9 deletions cypress/pages/bannerStack.ts

This file was deleted.

8 changes: 8 additions & 0 deletions cypress/pages/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import type { IE2ETestPage } from '../types';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class BasePage implements IE2ETestPage {
getters = {};

Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from './base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class CredentialsPage extends BasePage {
url = '/home/credentials';

Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/features/ai-assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ const AI_ASSISTANT_FEATURE = {
disabledFor: 'control',
};

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class AIAssistant extends BasePage {
url = '/workflows/new';

Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/features/node-creator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from '../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class NodeCreator extends BasePage {
url = '/workflow/new';

Expand Down
2 changes: 0 additions & 2 deletions cypress/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export * from './settings-users';
export * from './settings-log-streaming';
export * from './sidebar';
export * from './ndv';
export * from './bannerStack';
export * from './workflow-executions-tab';
export * from './signin';
export * from './workflow-history';
export * from './workerView';
export * from './settings-public-api';
8 changes: 8 additions & 0 deletions cypress/pages/mfa-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { SigninPage } from './signin';
import { WorkflowsPage } from './workflows';
import { N8N_AUTH_COOKIE } from '../constants';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class MfaLoginPage extends BasePage {
url = '/mfa';

Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/modals/change-password-modal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from './../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class ChangePasswordModal extends BasePage {
getters = {
modalContainer: () => cy.getByTestId('changePassword-modal').last(),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/modals/credentials-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { getCredentialSaveButton, saveCredential } from '../../composables/modal
import { getVisibleSelect } from '../../utils';
import { BasePage } from '../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class CredentialsModal extends BasePage {
getters = {
newCredentialModal: () => cy.getByTestId('selectCredential-modal', { timeout: 5000 }),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/modals/message-box.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from '../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class MessageBox extends BasePage {
getters = {
modal: () => cy.get('.el-message-box', { withinSubject: null }),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/modals/mfa-setup-modal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from './../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class MfaSetupModal extends BasePage {
getters = {
modalContainer: () => cy.getByTestId('changePassword-modal').last(),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/modals/workflow-sharing-modal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from '../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class WorkflowSharingModal extends BasePage {
getters = {
modal: () => cy.getByTestId('workflowShare-modal', { timeout: 5000 }),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/ndv.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { BasePage } from './base';
import { getVisiblePopper, getVisibleSelect } from '../utils';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class NDV extends BasePage {
getters = {
container: () => cy.getByTestId('ndv'),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/settings-log-streaming.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { BasePage } from './base';
import { getVisibleSelect } from '../utils';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class SettingsLogStreamingPage extends BasePage {
url = '/settings/log-streaming';

Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/settings-personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import { MfaSetupModal } from './modals/mfa-setup-modal';
const changePasswordModal = new ChangePasswordModal();
const mfaSetupModal = new MfaSetupModal();

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class PersonalSettingsPage extends BasePage {
url = '/settings/personal';

Expand Down
9 changes: 0 additions & 9 deletions cypress/pages/settings-usage.ts

This file was deleted.

8 changes: 8 additions & 0 deletions cypress/pages/settings-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const workflowsPage = new WorkflowsPage();
const mainSidebar = new MainSidebar();
const settingsSidebar = new SettingsSidebar();

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class SettingsUsersPage extends BasePage {
url = '/settings/users';

Expand Down
11 changes: 0 additions & 11 deletions cypress/pages/settings.ts

This file was deleted.

8 changes: 8 additions & 0 deletions cypress/pages/sidebar/main-sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { BasePage } from '../base';
import { WorkflowsPage } from '../workflows';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class MainSidebar extends BasePage {
getters = {
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/sidebar/settings-sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { BasePage } from '../base';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class SettingsSidebar extends BasePage {
getters = {
menuItem: (id: string) => cy.getByTestId('menu-item').get('#' + id),
Expand Down
8 changes: 8 additions & 0 deletions cypress/pages/signin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { BasePage } from './base';
import { WorkflowsPage } from './workflows';
import { N8N_AUTH_COOKIE } from '../constants';

/**
* @deprecated Use functional composables from @composables instead.
* If a composable doesn't exist for your use case, please create a new one in:
* cypress/composables
*
* This class-based approach is being phased out in favor of more modular functional composables.
* Each getter and action in this class should be moved to individual composable functions.
*/
export class SigninPage extends BasePage {
url = '/signin';

Expand Down
Loading
Loading