Skip to content
Open
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
6 changes: 6 additions & 0 deletions e2e-tests/support/pageObjects/pages-po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const latestCommitsTabPO = {
clickTab: '[data-test="activity__tabItem latest-commits"]',
};

export const compActivityPipelinerunsTabPO = {
clickTab: '[data-test="comp__activity__tabItem pipelineruns"]',
};

export const pipelinerunsTabPO = {
clickTab: '[data-test="activity__tabItem pipelineruns"]',

Expand All @@ -50,6 +54,8 @@ export const pipelinerunsTabPO = {

pipelineRunsListTable: 'Pipeline run List',
ariaLabelPipelineRunsListTable: '[aria-label="Pipeline run List"]',
pipelineRunRow: (runNamePrefix: string) =>
`[aria-label="Pipeline run List"] [data-test^="${runNamePrefix}"]`,
vulnerabilityColumn: '[data-test="vulnerabilities"]',
vulnerabilityScanStatus: '[data-test*="scan-status"]',
};
Expand Down
22 changes: 21 additions & 1 deletion e2e-tests/support/pages/ComponentDetailsPage.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
import { APIHelper } from '../../utils/APIHelper';
import { Common } from '../../utils/Common';
import { UIhelper } from '../../utils/UIhelper';
import { UIhelperPO } from '../pageObjects/global-po';
import { buildLogModalContentPO } from '../pageObjects/createApplication-po';
import { componentDetailsPO } from '../pageObjects/pages-po';
import {
activityTabPO,
compActivityPipelinerunsTabPO,
componentDetailsPO,
} from '../pageObjects/pages-po';

export class ComponentDetailsPage {
static openTab(tab: ComponentPageTabs) {
UIhelper.clickTab(tab);
}

static verifyPipelineRunIsVisible(plrName: string) {
cy.get(activityTabPO.clickTab, { timeout: 30000 }).click();
Common.waitForLoad();
cy.get(compActivityPipelinerunsTabPO.clickTab, { timeout: 30000 }).click();
Common.waitForLoad();
cy.contains(UIhelperPO.tableRow('Pipeline run List'), plrName, {
// extended timeout: GitHub synchronization can occasionally take some time,
// which causes PR creation to take longer.
timeout: 1200000, // 20min
}).should('be.visible');
ComponentDetailsPage.openTab(ComponentPageTabs.detail);
Common.waitForLoad();
}

static checkBuildImage() {
cy.get(componentDetailsPO.buildImage)
.invoke('val')
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/tests/basic-happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe('Basic Happy Path', () => {
// Pipeline build plan was removed from the Pipeline runs Tab
// See https://issues.redhat.com/browse/KFLUXBUGS-603
ComponentsTabPage.openComponent(componentName);
ComponentDetailsPage.verifyPipelineRunIsVisible(`${componentName}-on-pull`);
componentPage.clickMergePullRequest();

APIHelper.mergePR(
Expand Down
23 changes: 8 additions & 15 deletions e2e-tests/utils/Applications.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pageTitles, FULL_APPLICATION_TITLE } from '../support/constants/PageTitle';
import { addComponentPagePO } from '../support/pageObjects/createApplication-po';
import { actions, breadcrumb } from '../support/pageObjects/global-po';
import { actions, breadcrumb, UIhelperPO } from '../support/pageObjects/global-po';
import {
actionsDropdown,
componentsTabPO,
Expand All @@ -24,20 +24,13 @@ import { UIhelper } from './UIhelper';
export class Applications {
static checkPipelineStatuses(componentName: string, statuses: string[]) {
const pipelineRunName = `${componentName}-on-pull-request`;

UIhelper.getTableRow('Pipeline run List', pipelineRunName).should(($row) => {
const rowText = $row.text();
if (!rowText.includes(pipelineRunName)) {
return false;
}

const $statusElement = $row.find('[data-test="status"]');
if ($statusElement.length > 0) {
const statusText = $statusElement.text();
return statuses.some((status) => statusText.includes(status));
}

return statuses.some((status) => rowText.includes(status));
cy.get(pipelinerunsTabPO.pipelineRunRow(pipelineRunName), { timeout: 90000 }).should(($row) => {
const text = $row.text();
const hasExpected = statuses.some((s) => text.includes(s));
expect(
hasExpected,
`Pipeline run row should show one of [${statuses.join(', ')}]; got: "${text.trim().slice(0, 100)}..."`,
).to.be.true;
});
}

Expand Down
Loading