diff --git a/projects/nshmp-apps/cypress/utils/index.ts b/projects/nshmp-apps/cypress/utils/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..c556eb19ebb4a9d01c26985bb03b5dbec3b2667f --- /dev/null +++ b/projects/nshmp-apps/cypress/utils/index.ts @@ -0,0 +1,7 @@ +export * from './dashboard.utils'; +export * from './gmm-lib.utils'; +export * from './hazard-lib.utils'; +export * from './nshmp-lib.utils'; +export * from './nshmp-template.utils'; +export * from './plot-lib.utils'; +export * from './utils'; diff --git a/projects/nshmp-apps/cypress/utils/utils.ts b/projects/nshmp-apps/cypress/utils/utils.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf4eaf1d2a535479cb4dd213002e0b2245adfea3 --- /dev/null +++ b/projects/nshmp-apps/cypress/utils/utils.ts @@ -0,0 +1,26 @@ +export function hasDownloadedFile(filename: string) { + const downloadsFolder = Cypress.config('downloadsFolder'); + const file = `${downloadsFolder}/${filename}`; + + cy.readFile(file).should('exist').should('have.length.above', 1); +} + +export function setInput(inputClass: string, value: string) { + cy.get('nshmp-template-control-panel') + .find(inputClass) + .find('input') + .scrollIntoView() + .should('be.visible') + .clear() + .type(value) + .should('have.value', value); +} +export function selectMatOption(value: string) { + cy.get('.cdk-overlay-container') + .find('mat-option') + .each(option => { + if (option.attr('ng-reflect-value') === value) { + cy.wrap(option).click(); + } + }); +}