mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
test: autocomplete dropdown for tag has at least one non-empty item
This commit is contained in:
parent
8db7974a2b
commit
64bc485c85
1 changed files with 34 additions and 1 deletions
|
|
@ -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();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue