Skip to content

Instantly share code, notes, and snippets.

@patricksevat
Created November 20, 2019 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patricksevat/024146bc284e434ccc77ab5e661f636a to your computer and use it in GitHub Desktop.
Save patricksevat/024146bc284e434ccc77ab5e661f636a to your computer and use it in GitHub Desktop.
Naive, not DRY implementation of an Component Object
// ./objects/features/bank-account.ts
export class BankAccountObject {
// internal id
componentName = 'bank-account';
// this is the root element: <my-bank-account />
element = 'my-bank-account';
// this is a (deep) element that renders latest
elementToRender = '#async-fetch-bank-account-balance';
render = async () => {
// retrieve 'my-bank-account #async-fetch-bank-account-balance'
const checkRenderedElement = await $(`${this.element} ${this.elementToRender}`);
// make sure that the element exists on the DOM within 20s
await checkRenderedElement.waitForExist(20000);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment