diff --git a/e2e/src/autocomplete-dropdown.e2e.ts b/e2e/src/autocomplete-dropdown.e2e.ts index 05b384b2a3..1b7aa22b3a 100644 --- a/e2e/src/autocomplete-dropdown.e2e.ts +++ b/e2e/src/autocomplete-dropdown.e2e.ts @@ -2,7 +2,10 @@ import { NBrowser } from '../n-browser-interface'; import { cssSelectors, WORK_VIEW_URL } from '../e2e.const'; const AUTOCOMPLETE = 'mention-list'; -const { READY_TO_WORK_BTN } = cssSelectors; +const AUTOCOMPLETE_ITEM = `${AUTOCOMPLETE} .mention-active`; +const AUTOCOMPLETE_ITEM_TEXT = `${AUTOCOMPLETE_ITEM} .mention-item`; +const { EXPAND_TAG_BTN, READY_TO_WORK_BTN, TAGS } = cssSelectors; +const TAG = `${TAGS} div.tag`; module.exports = { '@tags': ['task', 'short-syntax', 'autocomplete'], @@ -16,4 +19,34 @@ module.exports = { .assert.elementPresent(AUTOCOMPLETE) .end(); }, + 'should have at least one tag in the autocomplete dropdown': (browser: NBrowser) => { + const newTagTitle = 'angular'; + browser + .loadAppAndClickAwayWelcomeDialog() + .waitForElementVisible(EXPAND_TAG_BTN) + .click(EXPAND_TAG_BTN) + .execute( + (tagSelector) => { + const tagElem = document.querySelector(tagSelector); + if (!tagElem) { + return false; + } + return true; + }, + [TAG], + (result) => { + console.log('Has at least one tag', result.value); + if (!result.value) { + browser.addTaskWithNewTag(newTagTitle); + } + }, + ); + browser + .draftTask('Test the presence of tag in autcomplete #') + .waitForElementPresent(AUTOCOMPLETE) + .assert.visible(AUTOCOMPLETE_ITEM) + .expect.element(AUTOCOMPLETE_ITEM_TEXT) + .text.to.match(/.+/g); + browser.end(); + }, };