diff --git a/frontend/src/__tests__/cypress/cypress/support/commands/application.ts b/frontend/src/__tests__/cypress/cypress/support/commands/application.ts index 7c5a8f106d..a1895d9e9d 100644 --- a/frontend/src/__tests__/cypress/cypress/support/commands/application.ts +++ b/frontend/src/__tests__/cypress/cypress/support/commands/application.ts @@ -1,7 +1,7 @@ import type { MatcherOptions } from '@testing-library/cypress'; import type { Matcher, MatcherOptions as DTLMatcherOptions } from '@testing-library/dom'; import type { UserAuthConfig, DashboardConfig } from '~/__tests__/cypress/cypress/types'; -import { TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { getDashboardConfig, getNotebookControllerConfig, @@ -148,7 +148,7 @@ declare global { } } -Cypress.Commands.add('visitWithLogin', (url, user = TEST_USER) => { +Cypress.Commands.add('visitWithLogin', (url, user = HTPASSWD_CLUSTER_ADMIN_USER) => { if (Cypress.env('MOCK')) { cy.visit(url); } else { diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/application.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/application.cy.ts index 5639858ff5..49786a8d3f 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/application.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/application.cy.ts @@ -1,8 +1,10 @@ -import { TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; describe('application', { testIsolation: false }, () => { it('should login and load page', () => { cy.visitWithLogin('/'); - cy.findByRole('banner', { name: 'page masthead' }).contains(TEST_USER.USERNAME); + cy.findByRole('banner', { name: 'page masthead' }).contains( + HTPASSWD_CLUSTER_ADMIN_USER.USERNAME, + ); }); }); diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectAdminPermissions.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectAdminPermissions.cy.ts index dc39216355..02e2af1708 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectAdminPermissions.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectAdminPermissions.cy.ts @@ -1,7 +1,10 @@ import type { DataScienceProjectData } from '~/__tests__/cypress/cypress/types'; import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects'; import { permissions } from '~/__tests__/cypress/cypress/pages/permissions'; -import { ADMIN_USER, TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { + HTPASSWD_CLUSTER_ADMIN_USER, + LDAP_CONTRIBUTOR_USER, +} from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { loadFixture } from '~/__tests__/cypress/cypress/utils/dataLoader'; import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker'; import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project'; @@ -37,7 +40,7 @@ describe('Verify that users can provide admin project permissions to non-admin u it('Verify that user can be added as an Admin for a Project', () => { // Authentication and navigation cy.step('Log into the application'); - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); // Project navigation, add user and provide admin permissions cy.step( @@ -50,21 +53,24 @@ describe('Verify that users can provide admin project permissions to non-admin u cy.step('Assign admin user Project Permissions'); permissions.findAddUserButton().click(); - permissions.getUserTable().findAddInput().type(TEST_USER.USERNAME); + permissions.getUserTable().findAddInput().type(LDAP_CONTRIBUTOR_USER.USERNAME); permissions .getUserTable() - .selectPermission(TEST_USER.USERNAME, 'Admin Edit the project and manage user access'); + .selectPermission( + LDAP_CONTRIBUTOR_USER.USERNAME, + 'Admin Edit the project and manage user access', + ); cy.step( - `Save the user and validate that ${TEST_USER.USERNAME} has been saved with admin permissions`, + `Save the user and validate that ${LDAP_CONTRIBUTOR_USER.USERNAME} has been saved with admin permissions`, ); permissions.getUserTable().findSaveNewButton().should('exist').and('be.visible').click(); - cy.contains(TEST_USER.USERNAME).should('exist'); + cy.contains(LDAP_CONTRIBUTOR_USER.USERNAME).should('exist'); }); it('Verify that user can access the created project with Admin rights', () => { // Authentication and navigation - cy.step(`Log into the application with ${TEST_USER.USERNAME}`); - cy.visitWithLogin('/', TEST_USER); + cy.step(`Log into the application with ${LDAP_CONTRIBUTOR_USER.USERNAME}`); + cy.visitWithLogin('/', LDAP_CONTRIBUTOR_USER); // Project navigation and validate permissions tab is accessible cy.step('Verify that the user has access to the created project and can access Permissions'); diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectContributorPermissions.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectContributorPermissions.cy.ts index b195df0057..6a849e6b52 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectContributorPermissions.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectContributorPermissions.cy.ts @@ -2,7 +2,10 @@ import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_com import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects'; import type { DataScienceProjectData } from '~/__tests__/cypress/cypress/types'; import { permissions } from '~/__tests__/cypress/cypress/pages/permissions'; -import { ADMIN_USER, TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { + HTPASSWD_CLUSTER_ADMIN_USER, + LDAP_CONTRIBUTOR_USER, +} from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { loadFixture } from '~/__tests__/cypress/cypress/utils/dataLoader'; import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker'; @@ -37,7 +40,7 @@ describe('Verify that users can provide contributor project permissions to non-a it('Verify that user can be added as a Contributor for a Project', () => { // Authentication and navigation cy.step('Log into the application'); - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); // Project navigation, add user and provide contributor permissions cy.step( @@ -50,22 +53,25 @@ describe('Verify that users can provide contributor project permissions to non-a cy.step('Assign contributor user Project Permissions'); permissions.findAddUserButton().click(); - permissions.getUserTable().findAddInput().type(TEST_USER.USERNAME); + permissions.getUserTable().findAddInput().type(LDAP_CONTRIBUTOR_USER.USERNAME); cy.debug(); permissions .getUserTable() - .selectPermission(TEST_USER.USERNAME, 'Contributor View and edit the project components'); + .selectPermission( + LDAP_CONTRIBUTOR_USER.USERNAME, + 'Contributor View and edit the project components', + ); cy.step( - `Save the user and validate that ${TEST_USER.USERNAME} has been saved with Contributor permissions`, + `Save the user and validate that ${LDAP_CONTRIBUTOR_USER.USERNAME} has been saved with Contributor permissions`, ); permissions.getUserTable().findSaveNewButton().should('exist').and('be.visible').click(); - cy.contains(TEST_USER.USERNAME).should('exist'); + cy.contains(LDAP_CONTRIBUTOR_USER.USERNAME).should('exist'); }); it('Verify that user can access the created project as a Contributor', () => { // Authentication and navigation - cy.step(`Log into the application with ${TEST_USER.USERNAME}`); - cy.visitWithLogin('/', TEST_USER); + cy.step(`Log into the application with ${LDAP_CONTRIBUTOR_USER.USERNAME}`); + cy.visitWithLogin('/', LDAP_CONTRIBUTOR_USER); // Project navigation and validate permissions tab is accessible cy.step('Verify that the user has access to the created project but cannot access Permissions'); diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectCreation.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectCreation.cy.ts index c96fd04fbb..3883680e36 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectCreation.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/dataScienceProjects/testProjectCreation.cy.ts @@ -1,5 +1,5 @@ import yaml from 'js-yaml'; -import { ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { projectListPage, createProjectModal, @@ -45,7 +45,7 @@ describe('Verify Data Science Project - Creation and Deletion', () => { it('Create and Delete a Data Science Project in RHOAI', () => { // Authentication and navigation cy.step('Log into the application'); - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); projectListPage.navigate(); // Initiate project creation diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts index 4b76b669eb..f554df571a 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/pipelines/pipelines.cy.ts @@ -1,5 +1,5 @@ import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project'; -import { ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { projectListPage, projectDetails } from '~/__tests__/cypress/cypress/pages/projects'; import { pipelineImportModal } from '~/__tests__/cypress/cypress/pages/pipelines/pipelineImportModal'; import { createRunPage } from '~/__tests__/cypress/cypress/pages/pipelines/createRunPage'; @@ -27,7 +27,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false } it('An admin User can Import and Run a Pipeline', () => { // Login as an admin - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); /** * Import Pipeline by URL from Project Details view diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/settings/clusterSettings/testAdminClusterSettings.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/settings/clusterSettings/testAdminClusterSettings.cy.ts index 293e48c539..e67e82746f 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/settings/clusterSettings/testAdminClusterSettings.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/settings/clusterSettings/testAdminClusterSettings.cy.ts @@ -1,4 +1,7 @@ -import { ADMIN_USER, TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { + HTPASSWD_CLUSTER_ADMIN_USER, + LDAP_CONTRIBUTOR_USER, +} from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { clusterSettings } from '~/__tests__/cypress/cypress/pages/clusterSettings'; import { pageNotfound } from '~/__tests__/cypress/cypress/pages/pageNotFound'; import type { DashboardConfig, NotebookControllerConfig } from '~/__tests__/cypress/cypress/types'; @@ -29,7 +32,7 @@ describe('Verify that only the Cluster Admin can access Cluster Settings', () => it('Admin should access Cluster Settings and see UI fields matching OpenShift configurations', () => { // Authentication and navigation cy.step('Log into the application'); - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); cy.step('Navigate to Cluster Settings'); clusterSettings.visit(); @@ -52,7 +55,7 @@ describe('Verify that only the Cluster Admin can access Cluster Settings', () => }); it('Test User - should not have access rights to view the Cluster Settings tab', () => { cy.step('Log into the application'); - cy.visitWithLogin('/', TEST_USER); + cy.visitWithLogin('/', LDAP_CONTRIBUTOR_USER); cy.step('Navigate to the Cluster Settings'); clusterSettings.visit(false); diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/clusterStorage.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/clusterStorage.cy.ts index 383f341683..c52cd21825 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/clusterStorage.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/clusterStorage.cy.ts @@ -1,4 +1,4 @@ -import { TEST_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { LDAP_CONTRIBUTOR_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { provisionClusterStorageSCFeature, tearDownClusterStorageSCFeature, @@ -12,7 +12,7 @@ const dspName = 'qe-cluster-storage-sc-dsp'; describe('Regular Users can make use of the Storage Classes in the Cluster Storage tab from DSP ', () => { before(() => { - provisionClusterStorageSCFeature(dspName, TEST_USER.USERNAME); + provisionClusterStorageSCFeature(dspName, LDAP_CONTRIBUTOR_USER.USERNAME); }); after(() => { @@ -20,7 +20,7 @@ describe('Regular Users can make use of the Storage Classes in the Cluster Stora }); it('If all SC are disabled except one, the SC dropdown should be disabled', () => { - cy.visitWithLogin('/projects', TEST_USER); + cy.visitWithLogin('/projects', LDAP_CONTRIBUTOR_USER); // Open the project projectListPage.filterProjectByName(dspName); projectListPage.findProjectLink(dspName).click(); diff --git a/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/storageClasses.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/storageClasses.cy.ts index 898d792c7a..f09a759a38 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/storageClasses.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/e2e/storageClasses/storageClasses.cy.ts @@ -1,4 +1,4 @@ -import { ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; +import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; import { verifyStorageClassConfig, provisionStorageClassFeature, @@ -26,7 +26,7 @@ describe('An admin user can manage Storage Classes from Settings -> Storage clas }); it('An admin user can enable a disabled Storage Class', () => { - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); storageClassesPage.navigate(); const scDisabledName = `${scName}-disabled-non-default`; // SC row exist @@ -51,7 +51,7 @@ describe('An admin user can manage Storage Classes from Settings -> Storage clas }); it('An admin user can disable an enabled Storage Class', () => { - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); storageClassesPage.navigate(); const scEnabledName = `${scName}-enabled-non-default`; // SC row exist @@ -76,7 +76,7 @@ describe('An admin user can manage Storage Classes from Settings -> Storage clas }); it('An admin user can set an enabled Storage Class as the default one', () => { - cy.visitWithLogin('/', ADMIN_USER); + cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); storageClassesPage.navigate(); const scToDefaultName = `${scName}-enabled-to-default`; const scToDefaultRow = storageClassesTable.getRowByConfigName(scToDefaultName); diff --git a/frontend/src/__tests__/cypress/cypress/types.ts b/frontend/src/__tests__/cypress/cypress/types.ts index 04e5c69280..e7b1ee9d10 100644 --- a/frontend/src/__tests__/cypress/cypress/types.ts +++ b/frontend/src/__tests__/cypress/cypress/types.ts @@ -81,7 +81,7 @@ export type CommandLineResult = { export type TestConfig = { ODH_DASHBOARD_URL: string; - TEST_USER: UserAuthConfig; + TEST_USER_3: UserAuthConfig; OCP_ADMIN_USER: UserAuthConfig; S3: AWSS3Buckets; }; diff --git a/frontend/src/__tests__/cypress/cypress/utils/e2eUsers.ts b/frontend/src/__tests__/cypress/cypress/utils/e2eUsers.ts index cad0486def..bbeee3235a 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/e2eUsers.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/e2eUsers.ts @@ -1,4 +1,6 @@ import type { UserAuthConfig } from '~/__tests__/cypress/cypress/types'; -export const TEST_USER: UserAuthConfig = Cypress.env('TEST_USER'); -export const ADMIN_USER: UserAuthConfig = Cypress.env('ADMIN_USER'); +export const LDAP_CONTRIBUTOR_USER: UserAuthConfig = Cypress.env('LDAP_CONTRIBUTOR_USER'); +export const HTPASSWD_CLUSTER_ADMIN_USER: UserAuthConfig = Cypress.env( + 'HTPASSWD_CLUSTER_ADMIN_USER', +); diff --git a/frontend/src/__tests__/cypress/cypress/utils/testConfig.ts b/frontend/src/__tests__/cypress/cypress/utils/testConfig.ts index 4efb321c05..d6dd1a6029 100644 --- a/frontend/src/__tests__/cypress/cypress/utils/testConfig.ts +++ b/frontend/src/__tests__/cypress/cypress/utils/testConfig.ts @@ -27,13 +27,13 @@ const testConfig: TestConfig | undefined = env.CY_TEST_CONFIG export const BASE_URL = testConfig?.ODH_DASHBOARD_URL || env.BASE_URL || ''; -const TEST_USER: UserAuthConfig = testConfig?.TEST_USER ?? { - AUTH_TYPE: env.TEST_USER_AUTH_TYPE || '', - USERNAME: env.TEST_USER_USERNAME || '', - PASSWORD: env.TEST_USER_PASSWORD || '', +const LDAP_CONTRIBUTOR_USER: UserAuthConfig = testConfig?.TEST_USER_3 ?? { + AUTH_TYPE: env.TEST_USER_3_AUTH_TYPE || '', + USERNAME: env.TEST_USER_3_USERNAME || '', + PASSWORD: env.TEST_USER_3_PASSWORD || '', }; -const ADMIN_USER: UserAuthConfig = testConfig?.OCP_ADMIN_USER ?? { +const HTPASSWD_CLUSTER_ADMIN_USER: UserAuthConfig = testConfig?.OCP_ADMIN_USER ?? { AUTH_TYPE: env.ADMIN_USER_AUTH_TYPE || '', USERNAME: env.ADMIN_USER_USERNAME || '', PASSWORD: env.ADMIN_USER_PASSWORD || '', @@ -54,8 +54,8 @@ const AWS_PIPELINES: AWSS3Buckets = { // spread the cypressEnv variables into the cypress config export const cypressEnv = { - TEST_USER, - ADMIN_USER, + LDAP_CONTRIBUTOR_USER, + HTPASSWD_CLUSTER_ADMIN_USER, AWS_PIPELINES, }; diff --git a/frontend/src/__tests__/cypress/test-variables.yml.example b/frontend/src/__tests__/cypress/test-variables.yml.example index 0cad9a7ed0..ea157e30e7 100644 --- a/frontend/src/__tests__/cypress/test-variables.yml.example +++ b/frontend/src/__tests__/cypress/test-variables.yml.example @@ -3,6 +3,10 @@ TEST_USER: AUTH_TYPE: foo-auth USERNAME: foo-user PASSWORD: foo-passwd +TEST_USER_3: + AUTH_TYPE: contributor-auth + USERNAME: contributor-username + PASSWORD: contributor-passwd OCP_ADMIN_USER: AUTH_TYPE: adm-auth USERNAME: adminuser