diff --git a/integration-tests/support/pages/AddComponentPage.ts b/integration-tests/support/pages/AddComponentPage.ts index d30e71e81..b61cb928c 100644 --- a/integration-tests/support/pages/AddComponentPage.ts +++ b/integration-tests/support/pages/AddComponentPage.ts @@ -34,11 +34,11 @@ export class AddComponentPage extends AbstractWizardPage { } clickNext() { - cy.get(addComponentPagePO.next).trigger('click'); + cy.get(addComponentPagePO.next).click({ force: true }); } - loginByToken(username: string, token: string){ - cy.contains('button', addComponentPagePO.useTokenButton, {timeout : 120000}).click(); + loginByToken(username: string, token: string) { + cy.contains('button', addComponentPagePO.useTokenButton, { timeout: 120000 }).click(); cy.get(addComponentPagePO.username).type(username); cy.get(addComponentPagePO.token).type(token, { log: false }); cy.wait(2000); diff --git a/integration-tests/support/pages/ComponentsPage.ts b/integration-tests/support/pages/ComponentsPage.ts index 5b3f7ce62..1eb341669 100644 --- a/integration-tests/support/pages/ComponentsPage.ts +++ b/integration-tests/support/pages/ComponentsPage.ts @@ -76,7 +76,8 @@ export class ComponentPage extends AbstractWizardPage { } createApplication() { - cy.get(ComponentsPagePO.create).trigger('click'); + cy.get(ComponentsPagePO.create).click({ force: true }); + cy.get(ComponentsPagePO.create).click({ force: true }); cy.get(ComponentsPagePO.create).should('be.disabled'); Common.waitForLoad(); } diff --git a/integration-tests/support/pages/CreateApplicationPage.ts b/integration-tests/support/pages/CreateApplicationPage.ts index 0708c4895..de0336803 100644 --- a/integration-tests/support/pages/CreateApplicationPage.ts +++ b/integration-tests/support/pages/CreateApplicationPage.ts @@ -17,11 +17,12 @@ export class CreateApplicationPage extends AbstractWizardPage { cy.get(createApplicationPagePO.applicationName).clear(); } - clickCreateApplication() { - cy.get('body').then(body => { + clickCreateApplication() { + cy.get('body').then((body) => { if (body.find("h4:contains('No applications')").length > 0) { cy.get('.pf-c-empty-state__content') - .contains(createApplicationPagePO.createApplication).click({ force: true }); + .contains(createApplicationPagePO.createApplication) + .click({ force: true }); } else { cy.contains(createApplicationPagePO.createApplication).click({ force: true }); } @@ -31,6 +32,6 @@ export class CreateApplicationPage extends AbstractWizardPage { } clickNext() { - cy.get(createApplicationPagePO.next).trigger('click'); + cy.get(createApplicationPagePO.next).click({ force: true }); } } diff --git a/integration-tests/support/pages/hacbs/AddIntegrationTestPage.ts b/integration-tests/support/pages/hacbs/AddIntegrationTestPage.ts index 8664196ac..6df52ac82 100644 --- a/integration-tests/support/pages/hacbs/AddIntegrationTestPage.ts +++ b/integration-tests/support/pages/hacbs/AddIntegrationTestPage.ts @@ -1,22 +1,22 @@ import { addIntegrationTestStepPO } from '../../pageObjects/hacbs-po'; export class AddIntegrationTestPage { - enterDisplayName(displayName: string) { - cy.get(addIntegrationTestStepPO.displayNameInput).clear().type(displayName); - } - enterContainerImage(containerImage: string) { - cy.get(addIntegrationTestStepPO.containerImageInput).clear().type(containerImage); - } - enterPipelineName(pipelineName: string) { - cy.get(addIntegrationTestStepPO.pipelineNameInput).clear().type(pipelineName); - } - markOptionalForRelease() { - cy.get(addIntegrationTestStepPO.optionalreleaseCheckbox).click(); - } - clickNext() { - cy.get(addIntegrationTestStepPO.next).trigger('click'); - } - clickAdd() { - cy.get(addIntegrationTestStepPO.add).click(); - } + enterDisplayName(displayName: string) { + cy.get(addIntegrationTestStepPO.displayNameInput).clear().type(displayName); + } + enterContainerImage(containerImage: string) { + cy.get(addIntegrationTestStepPO.containerImageInput).clear().type(containerImage); + } + enterPipelineName(pipelineName: string) { + cy.get(addIntegrationTestStepPO.pipelineNameInput).clear().type(pipelineName); + } + markOptionalForRelease() { + cy.get(addIntegrationTestStepPO.optionalreleaseCheckbox).click(); + } + clickNext() { + cy.get(addIntegrationTestStepPO.next).click({ force: true }); + } + clickAdd() { + cy.get(addIntegrationTestStepPO.add).click(); + } } diff --git a/integration-tests/support/pages/hacbs/CreateBuildPage.ts b/integration-tests/support/pages/hacbs/CreateBuildPage.ts index e9d0d1244..ebb36f602 100644 --- a/integration-tests/support/pages/hacbs/CreateBuildPage.ts +++ b/integration-tests/support/pages/hacbs/CreateBuildPage.ts @@ -1,7 +1,7 @@ import { createBuildStepPO } from '../../pageObjects/hacbs-po'; export class CreateBuildPage { - clickNext() { - cy.get(createBuildStepPO.next).trigger('click'); - } + clickNext() { + cy.get(createBuildStepPO.next).click({ force: true }); + } } diff --git a/integration-tests/utils/Applications.ts b/integration-tests/utils/Applications.ts index 3a1f6de98..8f99167f3 100644 --- a/integration-tests/utils/Applications.ts +++ b/integration-tests/utils/Applications.ts @@ -23,6 +23,7 @@ export class Applications { cy.testA11y(`${pageTitles.createApp} page`); createApplicationPage.setApplicationName(name); createApplicationPage.clickNext(); + createApplicationPage.clickNext(); cy.testA11y(`Select source form`); } } diff --git a/integration-tests/utils/HACBSApplications.ts b/integration-tests/utils/HACBSApplications.ts index d0ce90a1f..9348366a4 100644 --- a/integration-tests/utils/HACBSApplications.ts +++ b/integration-tests/utils/HACBSApplications.ts @@ -1,5 +1,11 @@ import { applicationDetailPagePO } from '../support/pageObjects/createApplication-po'; -import { overviewTabPO, componentsTabPO, integrationTestsTabPO, actionsDropdown, addIntegrationTestStepPO } from '../support/pageObjects/hacbs-po'; +import { + overviewTabPO, + componentsTabPO, + integrationTestsTabPO, + actionsDropdown, + addIntegrationTestStepPO, +} from '../support/pageObjects/hacbs-po'; import { AddComponentPage } from '../support/pages/AddComponentPage'; import { ComponentPage } from '../support/pages/ComponentsPage'; import { AddIntegrationTestPage } from '../support/pages/hacbs/AddIntegrationTestPage'; @@ -10,102 +16,109 @@ import { Common } from './Common'; import { OverviewTabPage } from '../support/pages/hacbs/tabs/OverviewTabPage'; export class HACBSApplications { - static deleteApplication(applicationName: string) { - Applications.deleteApplication(applicationName); - } - - static createApplication(name: string) { - Applications.createApplication(name); - } - - static createComponent(publicGitRepo: string, componentName: string, integrationTestName: string, optionalForRelease: boolean = false) { - addComponentStep(publicGitRepo); - reviewComponentsStep(componentName); - createBuildStep(); - addIntegrationTestStep(integrationTestName, optionalForRelease); - } - - static createdComponentExists(componentName: string, applicationName: string) { - this.goToComponentsTab(); - - Common.verifyPageTitle(applicationName); - Common.waitForLoad(); - this.getComponentListItem(componentName).should('exist'); - } - - static getComponentListItem(application: string) { - return cy.contains(applicationDetailPagePO.item, application, { timeout: 60000 }); - } - - static clickActionsDropdown(dropdownItem: string) { - cy.get(actionsDropdown.dropdown).click(); - cy.contains(dropdownItem).click(); - } - - static goToOverviewTab() { - cy.get(overviewTabPO.clickTab).click(); - return new OverviewTabPage(); - } - - static goToComponentsTab() { - cy.get(componentsTabPO.clickTab).click(); - return new ComponentsTabPage(); - } - - static goToIntegrationTestsTab() { - cy.get(integrationTestsTabPO.clickTab).click(); - } + static deleteApplication(applicationName: string) { + Applications.deleteApplication(applicationName); + } + + static createApplication(name: string) { + Applications.createApplication(name); + } + + static createComponent( + publicGitRepo: string, + componentName: string, + integrationTestName: string, + optionalForRelease: boolean = false, + ) { + addComponentStep(publicGitRepo); + reviewComponentsStep(componentName); + createBuildStep(); + addIntegrationTestStep(integrationTestName, optionalForRelease); + } + + static createdComponentExists(componentName: string, applicationName: string) { + this.goToComponentsTab(); + + Common.verifyPageTitle(applicationName); + Common.waitForLoad(); + this.getComponentListItem(componentName).should('exist'); + } + + static getComponentListItem(application: string) { + return cy.contains(applicationDetailPagePO.item, application, { timeout: 60000 }); + } + + static clickActionsDropdown(dropdownItem: string) { + cy.get(actionsDropdown.dropdown).click(); + cy.contains(dropdownItem).click(); + } + + static goToOverviewTab() { + cy.get(overviewTabPO.clickTab).click(); + return new OverviewTabPage(); + } + + static goToComponentsTab() { + cy.get(componentsTabPO.clickTab).click(); + return new ComponentsTabPage(); + } + + static goToIntegrationTestsTab() { + cy.get(integrationTestsTabPO.clickTab).click(); + } } function addComponentStep(publicGitRepo: string) { - const addComponent = new AddComponentPage(); + const addComponent = new AddComponentPage(); - // Enter git repo URL - addComponent.setSource(publicGitRepo); - // Check if the source is validated - addComponent.waitRepoValidated(); - // Setup Git Options - addComponent.clickGitOptions(); + // Enter git repo URL + addComponent.setSource(publicGitRepo); + // Check if the source is validated + addComponent.waitRepoValidated(); + // Setup Git Options + addComponent.clickGitOptions(); - addComponent.clickNext(); + addComponent.clickNext(); } - function reviewComponentsStep(componentName: string) { - const componentPage = new ComponentPage(); + const componentPage = new ComponentPage(); - // Edit component name - componentPage.editComponentName(componentName + "-temp"); - cy.contains('div', componentName + "-temp").should('be.visible'); + // Edit component name + componentPage.editComponentName(componentName + '-temp'); + cy.contains('div', componentName + '-temp').should('be.visible'); - // Switch back to orginal name - componentPage.editComponentName(componentName); - cy.contains('div', componentName).should('be.visible');; + // Switch back to orginal name + componentPage.editComponentName(componentName); + cy.contains('div', componentName).should('be.visible'); - //Create Application - componentPage.createApplication(); + //Create Application + componentPage.createApplication(); } - function createBuildStep() { - new CreateBuildPage().clickNext(); + new CreateBuildPage().clickNext(); } - export function addIntegrationTestStep(displayName: string, optionalForRelease: boolean = false) { - const addIntegrationTestPage = new AddIntegrationTestPage(); - const containerImage = 'quay.io/kpavic/test-bundle:pipeline' - const pipelineName = 'demo-pipeline' - - addIntegrationTestPage.enterDisplayName(displayName); - addIntegrationTestPage.enterContainerImage(containerImage); - addIntegrationTestPage.enterPipelineName(pipelineName); - - if (optionalForRelease) { - addIntegrationTestPage.markOptionalForRelease(); + const addIntegrationTestPage = new AddIntegrationTestPage(); + const containerImage = 'quay.io/kpavic/test-bundle:pipeline'; + const pipelineName = 'demo-pipeline'; + + addIntegrationTestPage.enterDisplayName(displayName); + addIntegrationTestPage.enterContainerImage(containerImage); + addIntegrationTestPage.enterPipelineName(pipelineName); + + if (optionalForRelease) { + addIntegrationTestPage.markOptionalForRelease(); + } + + cy.get('body').then((body) => { + if (body.find('button[type="submit"]').length > 0) { + addIntegrationTestPage.clickNext(); + addIntegrationTestPage.clickNext(); + } else { + addIntegrationTestPage.clickAdd(); } - - cy.get('body').then(body => { - (body.find('button[type="submit"]').length > 0)? addIntegrationTestPage.clickNext() : addIntegrationTestPage.clickAdd(); - }); + }); } diff --git a/package-lock.json b/package-lock.json index afcc2a94d..80a2fef1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "dayjs": "^1.10.8", "file-saver": "1.3.x", "formik": "^2.2.9", - "formik-pf": "^0.0.1-alpha9", + "formik-pf": "^0.0.1-alpha10", "history": "5.3.0", "i18next": "^19.8.3", "js-base64": "^2.5.1", @@ -8090,9 +8090,9 @@ } }, "node_modules/formik-pf": { - "version": "0.0.1-alpha9", - "resolved": "https://registry.npmjs.org/formik-pf/-/formik-pf-0.0.1-alpha9.tgz", - "integrity": "sha512-thSBtspaLQUo//OOQ/WNefzMPZV00sTu3odFjDzzKmJNmJv/dAl9r45EoLwjTR3d8BsCymXek9ymhkm6o/RsQg==", + "version": "0.0.1-alpha10", + "resolved": "https://registry.npmjs.org/formik-pf/-/formik-pf-0.0.1-alpha10.tgz", + "integrity": "sha512-9QyBtNMvSKjd3JQmXhCLos8taqZTzTngbQ6O+xAHoPVoB0nl805M44JGlPWAo4WgkZNK87h7cJENgyzCD1rLbQ==", "peerDependencies": { "@patternfly/react-core": "^4.202.16", "@types/react": "^17.0.2", @@ -24880,9 +24880,9 @@ } }, "formik-pf": { - "version": "0.0.1-alpha9", - "resolved": "https://registry.npmjs.org/formik-pf/-/formik-pf-0.0.1-alpha9.tgz", - "integrity": "sha512-thSBtspaLQUo//OOQ/WNefzMPZV00sTu3odFjDzzKmJNmJv/dAl9r45EoLwjTR3d8BsCymXek9ymhkm6o/RsQg==" + "version": "0.0.1-alpha10", + "resolved": "https://registry.npmjs.org/formik-pf/-/formik-pf-0.0.1-alpha10.tgz", + "integrity": "sha512-9QyBtNMvSKjd3JQmXhCLos8taqZTzTngbQ6O+xAHoPVoB0nl805M44JGlPWAo4WgkZNK87h7cJENgyzCD1rLbQ==" }, "forwarded": { "version": "0.2.0", diff --git a/package.json b/package.json index a158c8124..a1cc6c997 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dayjs": "^1.10.8", "file-saver": "1.3.x", "formik": "^2.2.9", - "formik-pf": "^0.0.1-alpha9", + "formik-pf": "^0.0.1-alpha10", "history": "5.3.0", "i18next": "^19.8.3", "js-base64": "^2.5.1",