From 65ae869b7f11ef0ff9d38e307683160d62af25b0 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 25 Mar 2022 17:22:05 -0600 Subject: [PATCH] add hazard utils --- .../cypress/utils/hazard-lib.utils.ts | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/nshmp-apps/cypress/utils/hazard-lib.utils.ts diff --git a/projects/nshmp-apps/cypress/utils/hazard-lib.utils.ts b/projects/nshmp-apps/cypress/utils/hazard-lib.utils.ts new file mode 100644 index 000000000..10e6fa00d --- /dev/null +++ b/projects/nshmp-apps/cypress/utils/hazard-lib.utils.ts @@ -0,0 +1,48 @@ +import * as utils from './utils'; + +export function hasHazardModelMenu() { + it('Has model menu', () => { + cy.get('nshmp-template-control-panel') + .find('hazard-lib-model-form') + .scrollIntoView() + .find('mat-select') + .should('be.visible'); + }); +} + +export function setHazardCommonControlPanel() { + utils.setInput('.latitude-input', '34'); + utils.setInput('.longitude-input', '-118'); + cy.get('nshmp-template-control-panel') + .find('hazard-lib-site-class-form') + .scrollIntoView() + .find('mat-select') + .click(); + utils.selectMatOption('BC'); + utils.setInput('hazard-lib-return-period-form', '2475'); +} + +export function setHazardMaxDirection() { + cy.get('nshmp-template-control-panel') + .find('hazard-lib-max-direction-form') + .scrollIntoView() + .find('mat-checkbox') + .should('not.have.class', 'mat-checkbox-checked') + .should('be.visible') + .find('label') + .click() + .parent() + .should('have.class', 'mat-checkbox-checked'); +} +export function setHazardTruncate() { + cy.get('nshmp-template-control-panel') + .find('hazard-lib-truncation-form') + .scrollIntoView() + .find('mat-checkbox') + .should('not.have.class', 'mat-checkbox-checked') + .should('be.visible') + .find('label') + .click() + .parent() + .should('have.class', 'mat-checkbox-checked'); +} -- GitLab