AtTopbar.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const { I } = inject();
  2. module.exports = {
  3. _topbarLocator: locate({ css: ".lsf-topbar" }),
  4. _topbarAnnotationsToggle: locate({ css: ".lsf-annotations-list__selected" }),
  5. _annotationsList: locate({ css: ".lsf-annotations-list__list" }),
  6. _annotationsListItemSelector: ".lsf-annotations-list__entity",
  7. seeAnnotationAt(index = 0) {
  8. this.openAnnotaions();
  9. I.seeElement(this._annotationsList.find(this._annotationsListItemSelector).at(index));
  10. this.closeAnnotations();
  11. },
  12. openAnnotaions() {
  13. I.dontSee(this._annotationsList);
  14. I.click(this._topbarAnnotationsToggle);
  15. I.seeElement(this._annotationsList);
  16. },
  17. closeAnnotations() {
  18. I.seeElement(this._annotationsList);
  19. I.click(this._topbarAnnotationsToggle);
  20. I.dontSee(this._annotationsList);
  21. },
  22. selectAnnotationAt(index = 0) {
  23. I.click(this._annotationsList.find(this._annotationsListItemSelector).at(index));
  24. },
  25. see(text) {
  26. I.see(text, this._topbarLocator);
  27. },
  28. dontSee(text) {
  29. I.dontSee(text, this._topbarLocator);
  30. },
  31. seeElement(locator) {
  32. I.seeElement(this.locate(locator));
  33. },
  34. clickText(text) {
  35. I.click(this._topbarLocator.withText(`${text}`));
  36. },
  37. clickAria(label) {
  38. I.click(`[aria-label="${label}"]`, this._topbarLocator);
  39. },
  40. click(locator) {
  41. I.click(this.locate(locator));
  42. },
  43. locate(locator) {
  44. return this._topbarLocator.find(locator);
  45. },
  46. };