Skip to content

Commit

Permalink
ci/ui: add checksum file check to cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Dec 11, 2024
1 parent 6535d33 commit 86b5630
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
18 changes: 16 additions & 2 deletions tests/cypress/latest/e2e/unit_tests/seed_image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
import '~/support/commands';
import filterTests from '~/support/filterTests.js';
import * as cypressLib from '@rancher-ecp-qa/cypress-library';
import { isBootType } from '~/support/utils';
import { isBootType, isRancherManagerVersion, isUIVersion } from '~/support/utils';

filterTests(['main'], () => {
Cypress.config();
Expand All @@ -41,7 +41,21 @@ filterTests(['main'], () => {
cy.exec('rm -f cypress/downloads/*', { failOnNonZeroExit: false });
cy.clickNavMenu(["Advanced", "Seed Images"]);
cy.getBySel(selectors.sortableTableRow).contains('Download').click();
cy.verifyDownload(isBootType('iso') ? '.iso' : '.img', { contains: true, timeout: 300000, interval: 5000 });
if (isBootType('iso')) {
cy.verifyDownload('.iso', { contains: true, timeout: 300000, interval: 5000 });
} else {
// .img will be removed in next elemental UI, only .raw will be available
let extension = 'img';
isRancherManagerVersion('2.10') ? extension = 'raw' : null;
cy.verifyDownload('.'+extension, { contains: true, timeout: 300000, interval: 5000 });
}
// The following line will replace the confition just above very soon
//cy.verifyDownload(isBootType('iso') ? '.iso' : '.raw', { contains: true, timeout: 300000, interval: 5000 });
// Check we can download the checksum file (only in dev UI for now)
if (isUIVersion('dev')) {
cy.getBySel('download-checksum-btn-list').click();
cy.verifyDownload('.sh256', { contains: true, timeout: 60000, interval: 5000 });
}
});
});
});
11 changes: 10 additions & 1 deletion tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,19 @@ Cypress.Commands.add('createMachReg', (
// and RAW feature is not already available in stable
// upgrade condition will be removed in next elemental stable version
if (utils.isBootType('raw') && !utils.isCypressTag('upgrade')) {
cy.verifyDownload('.img', { contains: true, timeout: 300000, interval: 5000 });
// .img will be removed in next elemental UI, only .raw will be available
let extension = 'img';
utils.isRancherManagerVersion('2.10') ? extension = 'raw' : null;
cy.verifyDownload('.'+extension, { contains: true, timeout: 300000, interval: 5000 });
} else {
cy.verifyDownload('.iso', { contains: true, timeout: 300000, interval: 5000 });
}

// Check we can download the checksum file (only in dev UI for now)
if (utils.isUIVersion('dev')) {
cy.getBySel('download-checksum-btn').click();
cy.verifyDownload('.sh256', { contains: true, timeout: 60000, interval: 5000 });
}
}

// Try to download the registration file and check it
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/start-cypress-tests
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ docker run -v $PWD:/workdir -w /workdir \

if [[ ! -f ${ELEMENTAL_MEDIA_PATH} ]]; then
# Move elemental image into the expected folder
for EXT in iso img; do
for EXT in iso img raw; do
mv downloads/*.${EXT} ${ELEMENTAL_MEDIA_PATH} 2>/dev/null || true
done
fi
Expand Down

0 comments on commit 86b5630

Please sign in to comment.