Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve text assertions #2236

Merged
merged 3 commits into from
Jun 30, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe(`Assisted Installer Multinode Cluster Installation`, () => {
commonActions.waitForNext();
commonActions.clickNextButton();

cy.get('h2').should('contain', 'Host discovery');
commonActions.verifyIsAtStep('Host discovery');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe(`Assisted Installer Multinode Host discovery`, () => {

describe('Downloading the Discovery ISO', () => {
it('Should generate discovery ISO and wait for generate to complete', () => {
bareMetalDiscoveryPage.getAddHostsButton().should('contain', 'Add hosts');
bareMetalDiscoveryPage.getAddHostsButton().should('contain.text', 'Add hosts');
bareMetalDiscoveryPage.openAddHostsModal();

bareMetalDiscoveryIsoModal.getGenerateDiscoveryIso().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(`Assisted Installer Multinode Review`, () => {
beforeEach(() => {
cy.loadAiAPIIntercepts(null);
commonActions.visitClusterDetailsPage();
commonActions.getHeader('h2').should('contain', 'Review and create');
commonActions.verifyIsAtStep('Review and create');
});

describe('Cluster summary', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe(`Assisted Installer SNO Cluster Installation`, () => {
commonActions.visitNewClusterPage();

clusterDetailsPage.inputClusterName();
clusterDetailsPage.inputbaseDnsDomain();
clusterDetailsPage.inputBaseDnsDomain();
clusterDetailsPage.inputOpenshiftVersion();

clusterDetailsPage.enableSno();
Expand All @@ -46,7 +46,7 @@ describe(`Assisted Installer SNO Cluster Installation`, () => {
commonActions.waitForNext();
commonActions.clickNextButton();

commonActions.getHeader('h2').should('contain', 'Host discovery');
commonActions.verifyIsAtStep('Host discovery');
});

it('Show the dev-preview badge for SNO', () => {
Expand All @@ -55,7 +55,7 @@ describe(`Assisted Installer SNO Cluster Installation`, () => {
clusterDetailsPage.enableSno();
commonActions
.getWarningAlert()
.should('contain', 'Limitations for using Single Node OpenShift');
.should('contain.text', 'Limitations for using Single Node OpenShift');
});

it('Lists the new cluster', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe(`Assisted Installer SNO Host discovery`, () => {

describe('Downloading the Discovery ISO', () => {
it('Should generate discovery ISO and wait for generate to complete', () => {
bareMetalDiscoveryPage.getAddHostsButton().should('contain', 'Add host');
bareMetalDiscoveryPage.getAddHostsButton().should('contain.text', 'Add host');
bareMetalDiscoveryPage.openAddHostsModal();

bareMetalDiscoveryIsoModal.getGenerateDiscoveryIso().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(`Assisted Installer SNO Review`, () => {
beforeEach(() => {
cy.loadAiAPIIntercepts(null);
commonActions.visitClusterDetailsPage();
commonActions.getHeader('h2').should('contain', 'Review and create');
commonActions.verifyIsAtStep('Review and create');
});

describe('Cluster summary', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ describe(`Assisted Installer Cluster Installation with Custom Manifests`, () =>
commonActions.visitNewClusterPage();

clusterDetailsPage.inputClusterName();
clusterDetailsPage.inputbaseDnsDomain();
clusterDetailsPage.inputBaseDnsDomain();
clusterDetailsPage.inputOpenshiftVersion();

clusterDetailsPage.inputPullSecret();
clusterDetailsPage.getCustomManifestCheckbox().should('be.visible').check();
clusterDetailsPage.getCustomManifestCheckbox().should('be.checked');
commonActions.getInfoAlert().should('contain', 'This is an advanced configuration feature.');
commonActions
.getInfoAlert()
.should('contain.text', 'This is an advanced configuration feature.');
commonActions.getWizardStepNav('Custom manifests').should('exist');
commonActions.waitForNext();
commonActions.clickNextButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe(`Assisted Installer Custom manifests step`, () => {
commonActions.visitClusterDetailsPage();
});

describe('Modifyng existing Custom Manifests', () => {
describe('Modifying existing Custom Manifests', () => {
it('Can configure custom manifests step and next button is disabled', () => {
cy.wait('@list-manifests').then(() => {
commonActions
Expand All @@ -36,17 +36,20 @@ describe(`Assisted Installer Custom manifests step`, () => {
customManifestsPage.fileUpload(0).attachFile(`custom-manifests/files/img.png`);
customManifestsPage
.getYamlContentError()
.contains('File type is not supported. File type must be yaml, yml or json.');
.should('contain.text', 'File type is not supported. File type must be yaml, yml or json.');
commonActions.getNextButton().should('be.disabled');
});
it('Incorrect file name', () => {
customManifestsPage.getFileName(0).clear().type('test.txt');
customManifestsPage
.getFileNameError()
.contains('Must have a yaml, yml or json extension and can not contain /.');
.should('contain.text', 'Must have a yaml, yml or json extension and can not contain /.');
customManifestsPage
.getAlertTitle()
.contains('Custom manifests configuration contains missing or invalid fields');
.should(
'contain.text',
'Custom manifests configuration contains missing or invalid fields',
);
commonActions.getNextButton().should('be.disabled');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ describe(`Assisted Installer Review and create step with custom manifests`, () =
.getWizardStepNav('Review and create')
.should('have.class', ACTIVE_NAV_ITEM_CLASS);
reviewAndCreatePage.getCustomManifestsSection().click();
reviewAndCreatePage.getCustomManifestsDetail().contains('manifests/manifest1.yaml');
reviewAndCreatePage
.getCustomManifestsDetail()
.should('contain.text', 'manifests/manifest1.yaml');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe(`Assisted Installer Dualstack Review`, () => {
beforeEach(() => {
cy.loadAiAPIIntercepts(null);
commonActions.visitClusterDetailsPage();
commonActions.getHeader('h2').should('contain', 'Review and create');
commonActions.verifyIsAtStep('Review and create');
});

it('Should be ready to install', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe(`Assisted Installer Disk Encryption`, () => {
utils.setLastWizardSignal('CLUSTER_CREATED');

commonActions.clickNextButton();
cy.get('h2').should('contain', 'Host discovery');
commonActions.verifyIsAtStep('Host discovery');
bareMetalDiscoveryPage.setClusterIdFromUrl();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe(`Assisted Installer Static IP Cluster Creation`, () => {
utils.setLastWizardSignal('CLUSTER_CREATED');
});

cy.get('h2').should('contain', 'Static network configurations');
commonActions.verifyIsAtStep('Static network configurations');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe(`Assisted Installer Static IP YAML configuration`, () => {
});

it('Can show the correct type view', () => {
commonActions.getHeader('h2').contains('Static network configurations');
commonActions.verifyIsAtStep('Static network configurations');
staticIpPage.getYamlViewSelect().should('be.enabled');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Assisted Installer UI behaviour - cluster creation', () => {

clusterDetailsPage
.getSelectedOpenShiftVersion()
.should('contain', `OpenShift ${versionsFixtures.getDefaultOpenShiftVersion()}`);
.should('contain.text', `OpenShift ${versionsFixtures.getDefaultOpenShiftVersion()}`);

// Checking that the submitting value (item ID) for each version is correct
clusterDetailsPage.openOpenshiftVersionDropdown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Assisted Installer UI behaviour - cluster updates', () => {
navbar.clickOnNavItem('Cluster details');
commonActions.clickNextButton();
commonActions.clickNextButton();
commonActions.getHeader('h2').should('contain', 'Host discovery');
commonActions.verifyIsAtStep('Host discovery');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Cypress.env(
'skipFormattingWarningDesc',
'You have opted out of formatting bootable disks on some hosts. To ensure the hosts reboot into the expected installation disk, manual user intervention might be required during OpenShift installation.',
);
Cypress.env('warningIconPath', 'M569');
Cypress.env('warningIconFillColor', '#f0ab00');
8 changes: 4 additions & 4 deletions libs/ui-lib-tests/cypress/views/bareMetalDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const bareMetalDiscoveryPage = {
});
},
waitForHostRowToContain: (text, timeout = Cypress.env('HOST_DISCOVERY_TIMEOUT')) => {
cy.get('table.hosts-table > tbody > tr', { timeout: timeout }).should('contain', text);
cy.get('table.hosts-table > tbody > tr', { timeout: timeout }).should('contain.text', text);
},
selectHostRowKebabAction: (rowIndex, actionItem) => {
cy.get(`[data-testid=host-row-${rowIndex}] > .pf-c-table__action .pf-c-dropdown__toggle`)
Expand Down Expand Up @@ -98,21 +98,21 @@ export const bareMetalDiscoveryPage = {
validateHostRowColumnValue: (hostRowIndex, columnDataTestId, value) => {
cy.get(
`[data-testid=host-row-${hostRowIndex}] > [data-testid=${columnDataTestId}] > .pf-m-align-items-center > .pf-l-flex > .pf-c-button`,
).should('contain', value);
).should('contain.text', value);
},
sortCpuAscending: () => {
// first click will sort in Ascending order (lowest to highest)
cy.get(`${Cypress.env('colHeaderCpuCoresId')} > .pf-c-table__button`).click();
cy.get(`${Cypress.env('colHeaderCpuCoresId')} > .pf-c-table__button > div > span > svg > path`)
.invoke('attr', 'd')
.should('contain', 'M88');
.should('contain.text', 'M88');
},
sortCpuDescending: () => {
// second click will sort in Descending order (highest to lowest)
cy.get(`${Cypress.env('colHeaderCpuCoresId')} > .pf-c-table__button`).click();
cy.get(`${Cypress.env('colHeaderCpuCoresId')} > .pf-c-table__button > div > span > svg > path`)
.invoke('attr', 'd')
.should('contain', 'M168');
.should('contain.text', 'M168');
},
clickSaveEditHostsForm: () => {
cy.get(Cypress.env('submitButton')).click();
Expand Down
14 changes: 7 additions & 7 deletions libs/ui-lib-tests/cypress/views/bareMetalDiscoveryIsoModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export const bareMetalDiscoveryIsoModal = {
'contain',
'Add host', // TODO variation for SNO
);
cy.get('.pf-c-form__label-text').should('contain', 'SSH public key');
cy.get('.pf-c-form__label-text').should('contain.text', 'SSH public key');
cy.get('#sshPublicKey-filename')
.invoke('attr', 'placeholder')
.should('contain', 'Drag a file here or browse to upload');
.should('contain.text', 'Drag a file here or browse to upload');
cy.get('#sshPublicKey-browse-button')
.invoke('attr', 'aria-disabled')
.should('contain', 'false');
.should('contain.text', 'false');
});
},
getMinimalIsoOption: () => {
Expand All @@ -31,7 +31,7 @@ export const bareMetalDiscoveryIsoModal = {
bareMetalDiscoveryIsoModal.getSshPublicKey().should('be.visible');
if (sshKey) {
bareMetalDiscoveryIsoModal.getSshPublicKey().fill(sshKey);
bareMetalDiscoveryIsoModal.getSshPublicKey().invoke('text').should('contain', sshKey);
bareMetalDiscoveryIsoModal.getSshPublicKey().invoke('text').should('contain.text', sshKey);
} else {
// trigger empty ssh key error field helper
bareMetalDiscoveryIsoModal.getSshPublicKey().clear().type(' {backspace}');
Expand Down Expand Up @@ -65,7 +65,7 @@ export const bareMetalDiscoveryIsoModal = {
return cy.get('#form-input-hostname-field-helper');
},
validateChangeHostnameHelperTextError: (msg) => {
cy.get('.pf-m-error').should('contain', msg);
cy.get('.pf-m-error').should('contain.text', msg);
},
validateNeverShareWarning: () => {
cy.get('.pf-c-modal-box__body > .pf-c-alert').should(
Expand Down Expand Up @@ -105,7 +105,7 @@ export const bareMetalDiscoveryIsoModal = {
bareMetalDiscoveryIsoModal.getImageTypeDropdown().within(() => {
cy.get('li').contains(typeLabel).click();
});
bareMetalDiscoveryIsoModal.getSelectedImageType().should('contain', typeLabel);
bareMetalDiscoveryIsoModal.getSelectedImageType().should('contain.text', typeLabel);
},
getCancelGenerateDiscoveryIsoButton: () => {
return cy.get('.pf-c-modal-box__footer > .pf-m-link');
Expand Down Expand Up @@ -141,7 +141,7 @@ export const bareMetalDiscoveryIsoModal = {
}
},
waitForIsoGeneration: (timeout = Cypress.env('GENERATE_ISO_TIMEOUT')) => {
cy.get('h4', { timeout: timeout }).should('contain', Cypress.env('isoReadyToDownloadText'));
cy.get('h4', { timeout }).should('contain.text', Cypress.env('isoReadyToDownloadText'));
},
verifyDownloadIsoLinks: () => {
return cy
Expand Down
19 changes: 9 additions & 10 deletions libs/ui-lib-tests/cypress/views/clusterDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const clusterDetailsPage = {
clusterDetailsPage.getOpenshiftVersionDropdown().within(() => {
cy.get('li').contains(version).click();
});
clusterDetailsPage.getSelectedOpenShiftVersion().should('contain', `OpenShift ${version}`);
clusterDetailsPage.getSelectedOpenShiftVersion().should('contain.text', `OpenShift ${version}`);
},
getPullSecret: () => {
return cy.get(Cypress.env('pullSecretFieldId'));
Expand All @@ -36,22 +36,22 @@ export const clusterDetailsPage = {
}
clusterDetailsPage.getPullSecret().clear();
cy.pasteText(Cypress.env('pullSecretFieldId'), pullSecret);
clusterDetailsPage.getPullSecret().should('contain', pullSecret);
clusterDetailsPage.getPullSecret().should('contain.text', pullSecret);
},
checkAiTechSupportLevel: () => {
cy.get(Cypress.env('assistedInstallerSupportLevel'))
.should('be.visible')
.contains(Cypress.env('techPreviewSupportLevel'));
.should('contain.text', Cypress.env('techPreviewSupportLevel'));
},
checkSnoDevSupportLevel: () => {
cy.get(Cypress.env('snoSupportLevel'))
.should('be.visible')
.contains(Cypress.env('devPreviewSupportLevel'));
.should('contain.text', Cypress.env('devPreviewSupportLevel'));
},
getBaseDnsDomain: () => {
return cy.get(Cypress.env('baseDnsDomainFieldId'));
},
inputbaseDnsDomain: (dns = Cypress.env('DNS_DOMAIN_NAME')) => {
inputBaseDnsDomain: (dns = Cypress.env('DNS_DOMAIN_NAME')) => {
clusterDetailsPage.getBaseDnsDomain().clear().type(dns).should('have.value', dns);
},
getSno: () => {
Expand All @@ -69,10 +69,9 @@ export const clusterDetailsPage = {
},
selectCpuArchitecture: (cpuArchitecture) => {
cy.get(`ul.pf-c-dropdown__menu li[id=${cpuArchitecture}] a`).click();
cy.get(`${Cypress.env('cpuArchitectureFieldId')} .pf-c-dropdown__toggle-text`).contains(
cpuArchitecture,
{ matchCase: false },
);
cy.get(`${Cypress.env('cpuArchitectureFieldId')} .pf-c-dropdown__toggle-text`)
.invoke('text')
.should('match', new RegExp(cpuArchitecture, 'i'));
},
CpuArchitectureExists: (cpuArchitecture) => {
cy.get(`ul.pf-c-dropdown__menu li[id=${cpuArchitecture}] a`).should('exist');
Expand Down Expand Up @@ -102,7 +101,7 @@ export const clusterDetailsPage = {
validateInputNameFieldHelper: (status) => {
cy.get(`[aria-label='Validation'] > svg`)
.invoke('attr', 'fill')
.should('contain', status === 'fail' ? '#c9190b' : '#3e8635');
.should('contain.text', status === 'fail' ? '#c9190b' : '#3e8635');
},
getClusterNameFieldValidator: () => {
return cy.get(Cypress.env('clusterNameFieldValidator'));
Expand Down
4 changes: 2 additions & 2 deletions libs/ui-lib-tests/cypress/views/clusterList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const clusterListPage = {
},
openCluster: (clusterName = Cypress.env('CLUSTER_NAME')) => {
cy.getClusterNameLinkSelector(clusterName).click();
cy.get('.pf-c-breadcrumb__list > :nth-child(3)').contains(clusterName);
cy.get('.pf-c-breadcrumb__list > :nth-child(3)').should('contain', clusterName);
cy.get(Cypress.env('clusterNameFieldId')).should('have.value', clusterName);
},
deleteCluster: (clusterName = Cypress.env('CLUSTER_NAME')) => {
Expand Down Expand Up @@ -46,7 +46,7 @@ export const clusterListPage = {
.within(() => {
cy.get('td[data-label="Provider (Location)"]', {
timeout: timeout,
}).should('contain', provider);
}).should('contain.text', provider);
});
},
filterSearchString: (searchString) => {
Expand Down
Loading