Annotations.ts 771 B

123456789101112131415161718192021222324252627282930313233
  1. import Helper from "@codeceptjs/helper";
  2. class Annotations extends Helper {
  3. get _playwright() {
  4. return this.helpers.Playwright;
  5. }
  6. _locateButton(text) {
  7. return locate("button").withText(text);
  8. }
  9. async _clickButton(text) {
  10. const buttonLocator = this._locateButton(text);
  11. await this._playwright.waitForEnabled(buttonLocator, 10);
  12. await this._playwright.click(buttonLocator);
  13. }
  14. async submitAnnotation() {
  15. await this._clickButton("Submit");
  16. }
  17. async updateAnnotation() {
  18. await this._clickButton("Update");
  19. }
  20. async seeAnnotationSubmitted() {
  21. await this._playwright.dontSeeElement(this._locateButton("Submit"));
  22. await this._playwright.seeElement(this._locateButton("Update"));
  23. }
  24. }
  25. module.exports = Annotations;