From 4639ee1a68730a74abe5c738d333f5b539370102 Mon Sep 17 00:00:00 2001 From: Robert Sun <107655677+rsun19@users.noreply.github.com> Date: Fri, 21 Jun 2024 13:51:13 -0400 Subject: [PATCH] configured default environment for cypress --- frontend/.eslintrc | 16 ++++++++++++++++ .../cypress/pages/components/JupyterCard.ts | 2 +- .../cypress/tests/mocked/application.cy.ts | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/.eslintrc b/frontend/.eslintrc index ec95917b9b..23116e4c02 100755 --- a/frontend/.eslintrc +++ b/frontend/.eslintrc @@ -327,6 +327,22 @@ } ] } + }, + { + "files": ["src/__tests__/cypress/**"], + "rules": { + "no-restricted-syntax": [ + "error", + { + "selector": "Literal[value=/\\bRed Hat OpenShift AI\\b/i],JSXText[value=/\\bRed Hat OpenShift AI\\b/i]", + "message": "Do not hard code product name `Red Hat OpenShift AI`. Use `Cypress.env('ODH_PRODUCT_NAME')` instead." + }, + { + "selector": "Literal[value=/\\bOpen Data Hub\\b/i],JSXText[value=/\\bOpen Data Hub\\b/i]", + "message": "Do not hard code product name `Open Data Hub`. Use `Cypress.env('ODH_PRODUCT_NAME')` instead." + } + ] + } } ] } diff --git a/frontend/src/__tests__/cypress/cypress/pages/components/JupyterCard.ts b/frontend/src/__tests__/cypress/cypress/pages/components/JupyterCard.ts index 693249946a..51d5579eaa 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/components/JupyterCard.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/components/JupyterCard.ts @@ -10,7 +10,7 @@ export class JupyterCard extends Card { .findByTestId('tooltip-img') .trigger('mouseenter') .then(() => { - cy.findByText('Open Data Hub certified and supported'); + cy.findByText(`${Cypress.env('ODH_PRODUCT_NAME')} certified and supported`); }); } diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/application.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/application.cy.ts index a75deaadc9..7ca21277ee 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/application.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/application.cy.ts @@ -30,7 +30,7 @@ describe('Application', () => { const applicationLauncher = appChrome.getApplicationLauncher(); applicationLauncher.toggleAppLauncherButton(); const applicationLauncherMenuGroup = applicationLauncher.getApplicationLauncherMenuGroup( - 'Open Data Hub Applications', + `${Cypress.env('ODH_PRODUCT_NAME')} Applications`, ); applicationLauncherMenuGroup.shouldHaveApplicationLauncherItem('OpenShift Cluster Manager'); applicationLauncher.toggleAppLauncherButton();