moh-common-lib
Version:
A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).
127 lines (126 loc) • 4.95 kB
TypeScript
import { WebElement } from 'protractor';
/**
* AbstractTestPage provides common functionality for e2e tests that make use of
* the MoH Common Lib. For example, `getNameComponent()` and
* `getNameComponentVal()` both correspond to the NameComponent.
*/
export declare abstract class AbstractTestPage {
/**
* Clicking this button should complete the page, navigate to the next one.
* We default it to `.form-bar .submit` but you may overwrite as necessary.
*/
continueButton: WebElement;
/**
* This is the 'Skip To Content' button for Screen Readers that appears when
* tabbed to. May be overwritten as necessary.
*/
skipToContentButton: WebElement;
/**
* Every class should override this to point to the page it is testing.
* Calling navigateTo should go to the corresponding url this page tests. *
*
* Note - We encourage hardcoding all links in e2e tests and _not_ sharing a
* constants file with the application. While this leads to more work, it
* avoids the case where incorrect constants (e.g. a typo in a URL) pass the
* tests.
*
@example
* return browser.get('/enrolment/profile');
*/
abstract navigateTo(): any;
continue(): void;
getContinueButton(): WebElement;
/** Scrolls down to the bottom of the page */
scrollDown(): void;
clickSkipToContent(): void;
/**
* **NameComponent** - Returns the NameComponent for an associated human
* readable label. If the label is a duplicate it will grab the first one
* only.
*
* TODO: Update to "common-name" component when it's imported from PRIME
*
* @param labelName Human redable label name.
*/
getNameComponent(labelName: string): Promise<WebElement>;
/**
* **NameComponent** - Returns the value within a given NameComponent
*
* TODO: Update to "common-name" component when it's imported from PRIME
*
* @param labelName Human readable label name
*/
getNameComponentVal(labelName: string): Promise<string>;
formErrors(): import("protractor").ElementArrayFinder;
/**
* Selects from an ng-select component. This includes DropdownComponent
* others, like country, province, etc.
*
* TODO - Need to test this works! Right now just copied from GitHub with
* minor tweaks. IDEA - Mirror getNameComponent, where we lookup via the label
* text and use the 'for' attribute.
*
* @param labelId corresponds to labelForId on the <ng-select>
* @param optionText the option we want to select
*/
selectOption(labelId: string, optionText: string): void;
/**
* Works on same NgSelect components but it sends custom text instead of
* selecting a given choice.
* @param labelId corresponds to labelForId on the <ng-select>
* @param data the text we want to type
*/
typeOption(labelId: string, data: string): void;
/**
* Enter text into an input via ng-reflect-name component
* @param refNameVal Value of ng-reflect-name component
* @param text Text to enter into the input
*/
typeText(refNameVal: string, text: string): void;
/**
* Clicks the button based on the text specified
* @param classVal Human readable class value for a button
* @param text Text inside the button
*/
clickButton(classVal: string, text: string): void;
/**
* Clicks the check box based on the ng-reflect-name component
* @param refNameVal Value of ng-reflect-name component
*/
clickCheckBox(refNameVal: string): void;
/**
* Clicks the checkbox which means the user agrees with the info collection notice.
* InfoColectionNoticeComponent <common-collection-modal>
*/
agreeConsentModal(): void;
/**
* Clicks continue inside the modal
* InfoColectionNoticeComponent <common-collection-modal>
*/
clickConsentModalContinue(): void;
/**
* Checks if the consent modal is currently displayed or not
*/
checkConsentModal(): import("selenium-webdriver").promise.Promise<boolean>;
/**
* Scrolls up to the top of the page
*/
scrollUp(): void;
/**
* Types the text inside the first ocurrence of input field
* @param refNameVal Value of ng-reflect-name component
* @param text Text to enter into the input
*/
typeTextFirstOccurrence(refNameVal: string, text: string): void;
/**
* Clicks the link based from the label and text provided
* @param label
* @param text
*/
clickLink(label: string, text: string): void;
/**
* Counts the number of options inside a dropdown box
* @param refNameVal
*/
countLength(refNameVal: string): import("protractor").ElementArrayFinder;
}