Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeAlonso committed Jul 31, 2024
1 parent 28d8d14 commit e74ac03
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class RunDetails extends PipelinesTopology {
return new DetailsItem(() => cy.findByTestId(`detail-item-${key}`));
}

private findStatusLabel(timeout: number = 180000) {
private findStatusLabel(timeout = 180000) {
return cy.get(
'h1[data-testid="app-page-title"] .pf-v5-l-split__item:last-child .pf-v5-c-label__text',
{ timeout: timeout }
{ timeout },
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { pipelineImportModal } from '~/__tests__/cypress/cypress/pages/pipelines
import { pipelinesGlobal } from '~/__tests__/cypress/cypress/pages/pipelines/pipelinesGlobal';
import { pipelinesTable } from '~/__tests__/cypress/cypress/pages/pipelines/pipelinesTable';
import { createRunPage } from '~/__tests__/cypress/cypress/pages/pipelines/createRunPage';
import { pipelineDetails, pipelineRunDetails } from '~/__tests__/cypress/cypress/pages/pipelines/topology';
import {
pipelineDetails,
pipelineRunDetails,
} from '~/__tests__/cypress/cypress/pages/pipelines/topology';

const projectName = 'test-pipelines-prj';
const dspaSecretName = 'dashboard-dspa-secret';
Expand All @@ -38,9 +41,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false }
AWS_DEFAULT_REGION: Buffer.from(AWS_BUCKETS.BUCKET_2.REGION).toString('base64'),
AWS_S3_BUCKET: Buffer.from(AWS_BUCKETS.BUCKET_2.NAME).toString('base64'),
AWS_S3_ENDPOINT: Buffer.from(AWS_BUCKETS.BUCKET_2.ENDPOINT).toString('base64'),
AWS_SECRET_ACCESS_KEY: Buffer.from(AWS_BUCKETS.AWS_SECRET_ACCESS_KEY).toString(
'base64',
),
AWS_SECRET_ACCESS_KEY: Buffer.from(AWS_BUCKETS.AWS_SECRET_ACCESS_KEY).toString('base64'),
};
cy.fixture('resources/yaml/data_connection.yml').then((yamlContent) => {
const modifiedYamlContent = replacePlaceholdersInYaml(
Expand All @@ -57,9 +58,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false }
DSPA_SECRET_NAME: dspaSecretName,
NAMESPACE: projectName,
AWS_ACCESS_KEY_ID: Buffer.from(AWS_BUCKETS.AWS_ACCESS_KEY_ID).toString('base64'),
AWS_SECRET_ACCESS_KEY: Buffer.from(AWS_BUCKETS.AWS_SECRET_ACCESS_KEY).toString(
'base64',
),
AWS_SECRET_ACCESS_KEY: Buffer.from(AWS_BUCKETS.AWS_SECRET_ACCESS_KEY).toString('base64'),
};
cy.fixture('resources/yaml/dspa_secret.yml').then((yamlContent) => {
const modifiedYamlContent = replacePlaceholdersInYaml(yamlContent, dspaSecretReplacements);
Expand Down Expand Up @@ -88,6 +87,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);

Expand All @@ -98,7 +98,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false }

// Open the project
projectListPage.findProjectLink(projectName).click();

// Increasing the timeout to ~3mins so the DSPA can be loaded
projectDetails.findImportPipelineButton(180000).click();

Expand All @@ -120,7 +120,7 @@ describe('An admin user can import and run a pipeline', { testIsolation: false }
* Run the Pipeline using the Actions button in the pipeline detail view
*/

pipelineDetails.selectActionDropdownItem("Create run");
pipelineDetails.selectActionDropdownItem('Create run');

//Fill the Create run fields
createRunPage.findExperimentSelect().click();
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/__tests__/cypress/cypress/utils/ocCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,5 @@ export const createOpenShiftProject = (projectName: string, displayName?: string
*/
export const deleteOpenShiftProject = (projectName: string) => {
const ocCommand = `oc delete project ${projectName}`;
return cy.exec(ocCommand, { failOnNonZeroExit: false}).then(() => {
return;
});
};
return cy.exec(ocCommand, { failOnNonZeroExit: false }).then(() => {});
};
17 changes: 12 additions & 5 deletions frontend/src/__tests__/cypress/cypress/utils/testConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import path from 'path';
import { env } from 'process';
import dotenv from 'dotenv';
import YAML from 'yaml';
import type { UserAuthConfig, TestConfig, AWSS3BucketDetails, AWSS3Buckets } from '~/__tests__/cypress/cypress/types';
import type {
UserAuthConfig,
TestConfig,
AWSS3BucketDetails,
AWSS3Buckets,
} from '~/__tests__/cypress/cypress/types';

[
`.env.cypress${env.CY_MOCK ? '.mock' : ''}.local`,
Expand Down Expand Up @@ -37,12 +42,14 @@ const ADMIN_USER: UserAuthConfig = testConfig?.OCP_ADMIN_USER ?? {
const AWS_PIPELINES_BUCKET_DETAILS: AWSS3BucketDetails = {
NAME: testConfig?.S3.BUCKET_2.NAME || env.AWS_PIPELINES_BUCKET_NAME || '',
REGION: testConfig?.S3.BUCKET_2.REGION || env.AWS_PIPELINES_BUCKET_REGION || '',
ENDPOINT: testConfig?.S3.BUCKET_2.ENDPOINT || env.AWS_PIPELINES_BUCKET_ENDPOINT || ''
ENDPOINT: testConfig?.S3.BUCKET_2.ENDPOINT || env.AWS_PIPELINES_BUCKET_ENDPOINT || '',
};
const AWS_PIPELINES: AWSS3Buckets = {
AWS_ACCESS_KEY_ID: testConfig?.S3.AWS_ACCESS_KEY_ID || env.AWS_PIPELINES_BUCKET_ACCESS_KEY_ID || '',
AWS_SECRET_ACCESS_KEY: testConfig?.S3.AWS_SECRET_ACCESS_KEY || env.AWS_PIPELINES_BUCKET_SECRET_ACCESS_KEY || '',
BUCKET_2: AWS_PIPELINES_BUCKET_DETAILS
AWS_ACCESS_KEY_ID:
testConfig?.S3.AWS_ACCESS_KEY_ID || env.AWS_PIPELINES_BUCKET_ACCESS_KEY_ID || '',
AWS_SECRET_ACCESS_KEY:
testConfig?.S3.AWS_SECRET_ACCESS_KEY || env.AWS_PIPELINES_BUCKET_SECRET_ACCESS_KEY || '',
BUCKET_2: AWS_PIPELINES_BUCKET_DETAILS,
};

// spread the cypressEnv variables into the cypress config
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/__tests__/cypress/test-variables.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ OCP_ADMIN_USER:
AUTH_TYPE: adm-auth
USERNAME: adminuser
PASSWORD: adminuser-passwd
AWS_PIPELINES_BUCKET:
BUCKET_NAME: bucket
AWS_ACCESS_KEY_ID: access-key
AWS_SECRET_ACCESS_KEY: secret
AWS_ENDPOINT: endpoint
AWS_REGION: region
S3:
AWS_ACCESS_KEY_ID: access_key
AWS_SECRET_ACCESS_KEY: secret_key
BUCKET_2:
NAME: pipeline-bucket-name
REGION: pipeline-bucket-region
ENDPOINT: https://pipeline-bucket-endpoint.com/

0 comments on commit e74ac03

Please sign in to comment.