Skip to content

Commit

Permalink
Cleanup selectors and constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyselov committed Jul 20, 2023
1 parent e5bcaa4 commit 6274aa9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 162 deletions.
2 changes: 0 additions & 2 deletions libs/ui-lib-tests/cypress/support/variables/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import './common';
import './cluster-list';
import './cluster-details';
import './host-discovery';
import './installation';
import './misc';
import './networking';
import './review-create';
import './test-constants';
import './storage-step';
19 changes: 0 additions & 19 deletions libs/ui-lib-tests/cypress/support/variables/installation.ts

This file was deleted.

7 changes: 0 additions & 7 deletions libs/ui-lib-tests/cypress/support/variables/storage-step.ts

This file was deleted.

31 changes: 0 additions & 31 deletions libs/ui-lib-tests/cypress/support/variables/test-constants.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
// timeouts
Cypress.env('DEFAULT_API_REQUEST_TIMEOUT', 20 * 1000);
Cypress.env('DEFAULT_CREATE_CLUSTER_BUTTON_SHOW_TIMEOUT', 60 * 1000);
Cypress.env('DEFAULT_SAVE_BUTTON_TIMEOUT', 30 * 1000);
Cypress.env('HOST_REGISTRATION_TIMEOUT', 11 * 1000);
Cypress.env('HOST_DISCOVERY_TIMEOUT', 11 * 1000);
Cypress.env('HOST_READY_TIMEOUT', 11 * 1000);
Cypress.env('VALIDATE_CHANGES_TIMEOUT', 10 * 1000);
Cypress.env('START_INSTALLATION_TIMEOUT', 2.5 * 60 * 1000);
Cypress.env('INSTALL_PREPARATION_TIMEOUT', 5 * 60 * 1000);
Cypress.env('GENERATE_ISO_TIMEOUT', 2 * 60 * 1000);
Cypress.env('FILE_DOWNLOAD_TIMEOUT', 60 * 1000);
Cypress.env('ISO_DOWNLOAD_TIMEOUT', 60 * 60 * 1000);
Cypress.env('CLUSTER_CREATION_TIMEOUT', 9000000);
Cypress.env('CLUSTER_REGISTRATION_TIMEOUT', 20 * 60 * 1000);
Cypress.env('DAY2_HOST_INSTALLATION_TIMEOUT', 10 * 60 * 1000);
Cypress.env('HOST_STATUS_INSUFFICIENT_TIMEOUT', 300000);
Cypress.env('NETWORK_LATENCY_ALERT_MESSAGE_TIMEOUT', 300000);
Cypress.env('WAIT_FOR_PROGRESS_STATUS_INSTALLED', 1800000);
Cypress.env('KUBECONFIG_DOWNLOAD_TIMEOUT', 300000);
Cypress.env('WAIT_FOR_HEADER_TIMEOUT', 120000);
Cypress.env('WAIT_FOR_CONSOLE_TIMEOUT', 2900000);
Cypress.env('DNS_RESOLUTION_ALERT_MESSAGE_TIMEOUT', 900000);
// Deployment
Cypress.env('NUM_MASTERS', parseInt(Cypress.env('NUM_MASTERS')));
Cypress.env('NUM_WORKERS', parseInt(Cypress.env('NUM_WORKERS')));
Cypress.env('MASTER_HOST_ROW_MAX_INDEX', Number(Cypress.env('NUM_MASTERS')) * 2 - 2);
Cypress.env(
'WORKER_HOST_ROW_MAX_INDEX',
(Number(Cypress.env('NUM_MASTERS')) + Number(Cypress.env('NUM_WORKERS'))) * 2 - 2,
);
Cypress.env('DISCOVERY_IMAGE_GLOB_PATTERN', 'discovery_image_*.iso');
Cypress.env('DISCOVERY_IMAGE_PATH', '/var/lib/libvirt/images/0/cluster-discovery.iso');
Cypress.env('DEFAULT_CLUSTER_NAME', 'ocp-edge-cluster-0');
Cypress.env('OPENSHIFT_CONF', '/etc/NetworkManager/dnsmasq.d/openshift.conf');
Cypress.env('HYPERVISOR_IP', '192.168.123.1');
Cypress.env('BAREMETAL_QE3', 'r640-u09.qe3.kni.lab.eng.bos.redhat.com');
Cypress.env('HOST_ROLE_MASTER_LABEL', 'Control plane node');
Cypress.env('HOST_ROLE_WORKER_LABEL', 'Worker');
Cypress.env('VMWARE_ENV', false);
Cypress.env('VMWARE_SNO', false);
Cypress.env('IS_BAREMETAL', false);
14 changes: 7 additions & 7 deletions libs/ui-lib-tests/cypress/views/hostsTableSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const hostsTableSection = {
numWorkers: number = Cypress.env('NUM_WORKERS'),
hostNames = Cypress.env('requestedHostnames'),
) => {
cy.get(Cypress.env('hostnameDataTestId'))
cy.get('[data-testid=host-name]')
.should('have.length', numMasters + numWorkers)
.each((hostName, idx) => {
expect(hostName).to.contain(hostNames[idx]);
Expand All @@ -16,22 +16,22 @@ export const hostsTableSection = {
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('roleDataLabel'))
cy.get('td[data-testid="host-role"]')
.should('have.length', numMasters + numWorkers)
.each((hostRole, idx) => {
const isMaster = idx <= numMasters - 1;
if (isMaster) {
expect(hostRole).to.contain(Cypress.env('HOST_ROLE_MASTER_LABEL'));
expect(hostRole).to.contain('Control plane node');
} else {
expect(hostRole).to.contain(Cypress.env('HOST_ROLE_WORKER_LABEL'));
expect(hostRole).to.contain('Worker');
}
});
},
validateHostCpuCores: (
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('cpuCoresDataLabel'))
cy.get('td[data-label="CPU Cores"]')
.should('have.length', numMasters + numWorkers)
.each((hostCpuCores, idx) => {
const isMaster = idx <= numMasters - 1;
Expand All @@ -46,7 +46,7 @@ export const hostsTableSection = {
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('memoryDataLabel'))
cy.get('td[data-label="Memory"]')
.should('have.length', numMasters + numWorkers)
.each((hostMemory, idx) => {
const isMaster = idx <= numMasters - 1;
Expand All @@ -61,7 +61,7 @@ export const hostsTableSection = {
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('totalStorageDataLabel'))
cy.get('td[data-label="Total storage"]')
.should('have.length', numMasters + numWorkers)
.each((hostDisk, idx) => {
const isMaster = idx <= numMasters - 1;
Expand Down
90 changes: 0 additions & 90 deletions libs/ui-lib-tests/cypress/views/installationPage.ts

This file was deleted.

15 changes: 9 additions & 6 deletions libs/ui-lib-tests/cypress/views/storagePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const storagePage = {
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('odfUsageDataLabel'))
cy.get('td[data-label="ODF Usage"]')
.should('have.length', numMasters + numWorkers)
.each((hostRole, idx) => {
const isMaster = idx <= numMasters - 1;
Expand All @@ -18,7 +18,7 @@ export const storagePage = {
numMasters: number = Cypress.env('NUM_MASTERS'),
numWorkers: number = Cypress.env('NUM_WORKERS'),
) => {
cy.get(Cypress.env('diskNumberDataLabel'))
cy.get('td[data-label="Number of disks"]')
.should('have.length', numMasters + numWorkers)
.each((hostDisk) => {
expect(hostDisk).to.contain('3');
Expand All @@ -28,7 +28,7 @@ export const storagePage = {
return cy.get(`input[id="select-formatted-${hostId}-${indexSelect}"]`);
},
validateSkipFormattingDisks: (hostId: string, numDisks: number) => {
cy.get(Cypress.env('skipFormattingDataLabel')).should('have.length', numDisks);
cy.get("td[data-label='Format?']").should('have.length', numDisks);
//Checking if checkboxes are checked/unchecked
storagePage.getSkipFormattingCheckbox(hostId, 0).should('not.be.checked');
storagePage.getSkipFormattingCheckbox(hostId, 1).should('be.checked');
Expand All @@ -39,17 +39,20 @@ export const storagePage = {
storagePage.getSkipFormattingCheckbox(hostId, 2).should('be.disabled');
},
validateSkipFormattingWarning: () => {
cy.get('.pf-c-alert__title').should('contain.text', Cypress.env('skipFormattingWarningTitle'));
cy.get('.pf-c-alert__title').should(
'contain.text',
'There might be issues with the boot order',
);
cy.get('.pf-c-alert__description').should(
'contain.text',
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.',
);
},
validateSkipFormattingIcon: (diskId: string) => {
//If a disk is skip formatting validate that warning icon is shown
cy.get(`[data-testid="disk-row-${diskId}"] [data-testid="disk-name"]`).within(
(/* $diskRow */) => {
cy.get('[role="img"]').should('have.attr', 'fill', Cypress.env('warningIconFillColor'));
cy.get('[role="img"]').should('have.attr', 'fill', '#f0ab00');
},
);
},
Expand Down

0 comments on commit 6274aa9

Please sign in to comment.