TagSpaces is an offline, open source, document manager with tagging support
add TST04 tests tag management (#1282)
Stanimir5065c8ff656c
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex ba240a0bc..6690b193d 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -974,36 +974,38 @@ const EntryProperties = (props: Props) => {}}onClick={toggleBackgroundColorPicker}/>- <ColorPickerDialog- color={currentEntry.color}- open={displayColorPicker}- setColor={handleChangeColor}- onClose={toggleBackgroundColorPicker}- presetColors={[- 'transparent',- '#FFFFFF44',- '#00000044',- '#ac725e44',- '#f83a2244',- '#fa573c44',- '#ff753744',- '#ffad4644',- '#42d69244',- '#00800044',- '#7bd14844',- '#fad16544',- '#92e1c044',- '#9fe1e744',- '#9fc6e744',- '#4986e744',- '#9a9cff44',- '#c2c2c244',- '#cca6ac44',- '#f691b244',- '#cd74e644',- '#a47ae244'- ]}- />+ {displayColorPicker && (+ <ColorPickerDialog+ color={currentEntry.color}+ open={displayColorPicker}+ setColor={handleChangeColor}+ onClose={toggleBackgroundColorPicker}+ presetColors={[+ 'transparent',+ '#FFFFFF44',+ '#00000044',+ '#ac725e44',+ '#f83a2244',+ '#fa573c44',+ '#ff753744',+ '#ffad4644',+ '#42d69244',+ '#00800044',+ '#7bd14844',+ '#fad16544',+ '#92e1c044',+ '#9fe1e744',+ '#9fc6e744',+ '#4986e744',+ '#9a9cff44',+ '#c2c2c244',+ '#cca6ac44',+ '#f691b244',+ '#cd74e644',+ '#a47ae244'+ ]}+ />+ )}</TransparentBackground></FormControl></div>diff --git a/app/components/dialogs/ColorPickerDialog.tsx b/app/components/dialogs/ColorPickerDialog.tsxindex cf528f356..504d2f2d6 100644--- a/app/components/dialogs/ColorPickerDialog.tsx+++ b/app/components/dialogs/ColorPickerDialog.tsx@@ -109,6 +109,7 @@ const ColorPickerDialog = (props: Props) => {{i18n.t('core:colorPickerDialogTitle')}</DialogTitle><DialogContent+ data-tid="colorPickerDialogContent"style={{marginLeft: 'auto',marginRight: 'auto'diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsxindex d707b6123..1b47cef08 100644--- a/app/components/dialogs/CreateTagGroupDialog.tsx+++ b/app/components/dialogs/CreateTagGroupDialog.tsx@@ -198,12 +198,14 @@ class CreateTagGroupDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayColorPicker}- setColor={this.handleChangeColor}- onClose={this.toggleDefaultTagBackgroundColorPicker}- color={this.state.color}- />+ {this.state.displayColorPicker && (+ <ColorPickerDialog+ open={this.state.displayColorPicker}+ setColor={this.handleChangeColor}+ onClose={this.toggleDefaultTagBackgroundColorPicker}+ color={this.state.color}+ />+ )}</FormControl><FormControl fullWidth={true}><FormHelperText style={styles.helpText}>@@ -219,12 +221,14 @@ class CreateTagGroupDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayTextColorPicker}- setColor={this.handleChangeTextColor}- onClose={this.toggleDefaultTagTextColorPicker}- color={this.state.textcolor}- />+ {this.state.displayTextColorPicker && (+ <ColorPickerDialog+ open={this.state.displayTextColorPicker}+ setColor={this.handleChangeTextColor}+ onClose={this.toggleDefaultTagTextColorPicker}+ color={this.state.textcolor}+ />+ )}</FormControl></DialogContent><DialogActions>diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsxindex 189c09884..9611a7d94 100644--- a/app/components/dialogs/EditTagDialog.tsx+++ b/app/components/dialogs/EditTagDialog.tsx@@ -242,12 +242,14 @@ class EditTagDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayColorPicker}- setColor={this.handleChangeColor}- onClose={this.toggleDefaultTagBackgroundColorPicker}- color={this.state.color}- />+ {this.state.displayColorPicker && (+ <ColorPickerDialog+ open={this.state.displayColorPicker}+ setColor={this.handleChangeColor}+ onClose={this.toggleDefaultTagBackgroundColorPicker}+ color={this.state.color}+ />+ )}</FormControl><FormControl fullWidth={true}><FormHelperText style={styles.helpText}>@@ -263,12 +265,14 @@ class EditTagDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayTextColorPicker}- setColor={this.handleChangeTextColor}- onClose={this.toggleDefaultTagTextColorPicker}- color={this.state.textcolor}- />+ {this.state.displayTextColorPicker && (+ <ColorPickerDialog+ open={this.state.displayTextColorPicker}+ setColor={this.handleChangeTextColor}+ onClose={this.toggleDefaultTagTextColorPicker}+ color={this.state.textcolor}+ />+ )}</FormControl></DialogContent><DialogActions>diff --git a/app/components/dialogs/EditTagGroupDialog.tsx b/app/components/dialogs/EditTagGroupDialog.tsxindex 2bbf17005..308673694 100644--- a/app/components/dialogs/EditTagGroupDialog.tsx+++ b/app/components/dialogs/EditTagGroupDialog.tsx@@ -231,12 +231,14 @@ class EditTagGroupDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayColorPicker}- setColor={this.handleChangeColor}- onClose={this.toggleDefaultTagBackgroundColorPicker}- color={this.state.color}- />+ {this.state.displayColorPicker && (+ <ColorPickerDialog+ open={this.state.displayColorPicker}+ setColor={this.handleChangeColor}+ onClose={this.toggleDefaultTagBackgroundColorPicker}+ color={this.state.color}+ />+ )}</FormControl><FormControl fullWidth={true}><FormHelperText style={styles.helpText}>@@ -252,12 +254,14 @@ class EditTagGroupDialog extends React.Component<Props, State> { </Button></TransparentBackground>- <ColorPickerDialog- open={this.state.displayTextColorPicker}- setColor={this.handleChangeTextColor}- onClose={this.toggleDefaultTagTextColorPicker}- color={this.state.textcolor}- />+ {this.state.displayTextColorPicker && (+ <ColorPickerDialog+ open={this.state.displayTextColorPicker}+ setColor={this.handleChangeTextColor}+ onClose={this.toggleDefaultTagTextColorPicker}+ color={this.state.textcolor}+ />+ )}</FormControl><FormControl><FormHelperText style={styles.helpText}>diff --git a/tests/e2e/general.helpers.js b/tests/e2e/general.helpers.jsindex 0d6fd2929..becf4f120 100644--- a/tests/e2e/general.helpers.js+++ b/tests/e2e/general.helpers.js@@ -120,7 +120,11 @@ export async function addInputKeys(tid, value) {}export async function setInputKeys(tid, value) {- const element = await global.client.$('[data-tid=' + tid + ']');+ return await setSelectorKeys('[data-tid=' + tid + ']', value);+}++export async function setSelectorKeys(selector, value) {+ const element = await global.client.$(selector);await element.waitUntil(async function() {// const displayed = await this.isDisplayed();@@ -130,12 +134,13 @@ export async function setInputKeys(tid, value) {{timeout: 5000,timeoutMsg:- 'setInputKeys selector ' + element.selector + ' to exist after 5s'+ 'setSelectorKeys selector ' + element.selector + ' to exist after 5s'});await element.click();- const elemInput = await global.client.$('[data-tid=' + tid + '] input');+ const elemInput = await element.$('input');+ // const elemInput = await global.client.$(selector + ' input');await elemInput.waitUntil(async function() {// const displayed = await this.isDisplayed();@@ -145,7 +150,7 @@ export async function setInputKeys(tid, value) {{timeout: 5000,timeoutMsg:- 'setInputKeys selector ' + element.selector + ' to exist after 5s'+ 'setSelectorKeys selector ' + element.selector + ' to exist after 5s'});diff --git a/tests/e2e/tag.e2e.js b/tests/e2e/tag.e2e.jsnew file mode 100644index 000000000..27374c4cf--- /dev/null+++ b/tests/e2e/tag.e2e.js@@ -0,0 +1,280 @@+/* Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved. */+import {+ clearInputValue,+ clickOn,+ expectElementExist,+ setInputKeys,+ setInputValue+} from './general.helpers';++const testTagName = 'testTag';+const newTagName = 'newTagName';+const arrTags = ['tag1', 'tag2', 'tag3'];+const testGroup = 'testGroupName';+const editedGroupName = 'testGroup';++export async function createTagGroup(tagGroupName) {+ await clickOn('[data-tid=tagLibraryMenu]');+ await clickOn('[data-tid=createNewTagGroup]');++ await setInputKeys('createTagGroupInput', tagGroupName);+ await clickOn('[data-tid=createTagGroupConfirmButton]');+}++export async function addTags(arrTags) {+ await clickOn('[data-tid=createTags]');+ await setInputKeys('addTagsInput', arrTags.join());+ await clickOn('[data-tid=createTagsConfirmButton]');+}++export async function tagMenu(tagName, menuOperation) {+ await clickOn('[data-tid=tagMoreButton_' + tagName + ']');+ await global.client.pause(500);+ await clickOn('[data-tid=' + menuOperation + ']');+}++describe('TST04 - Testing the tag library:', () => {+ beforeEach(async () => {+ await clickOn('[data-tid=tagLibrary]');+ });++ it('TST0401 - Should create a tag group [TST0401,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await expectElementExist(+ '[data-tid=tagLibraryTagGroupTitle_' + testGroup + ']',+ true+ );+ });++ it('TST0402 - Should delete tag group [TST0402,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await expectElementExist(+ '[data-tid=tagLibraryTagGroupTitle_' + testGroup + ']',+ true+ );++ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');+ await clickOn('[data-tid=deleteTagGroup]');+ await global.client.pause(500);+ await clickOn('[data-tid=confirmDeleteTagGroupDialog]');++ await expectElementExist(+ '[data-tid=tagLibraryTagGroupTitle_' + testGroup + ']',+ false+ );+ });++ it('TST0403 - Rename tag group [TST0403,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');+ await clickOn('[data-tid=editTagGroup]');+ await setInputKeys('editTagGroupInput', editedGroupName);+ await clickOn('[data-tid=editTagGroupConfirmButton]');+ await expectElementExist(+ '[data-tid=tagLibraryTagGroupTitle_' + editedGroupName + ']',+ true+ );+ });++ it('TST0404 - Change default tag group tag colors [TST0404,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');+ await clickOn('[data-tid=editTagGroup]');+ await clickOn('[data-tid=editTagGroupBackgroundColor]');+ await global.client.pause(500);+ // await setSelectorKeys('[data-tid="colorPickerDialogContent"]', '000000');+ const inputElem = await global.client.$(+ '//*[@data-tid="colorPickerDialogContent"]/div/div[3]/div[1]/div/input'+ );+ await clearInputValue(inputElem);+ await setInputValue(+ '//*[@data-tid="colorPickerDialogContent"]/div/div[3]/div[1]/div/input',+ '000000'+ );+ await global.client.pause(500);+ await clickOn('[data-tid=colorPickerConfirm]');+ await clickOn('[data-tid=editTagGroupSwitch]');+ await clickOn('[data-tid=editTagGroupConfirmButton]');+ await global.client.pause(500);+ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');+ await clickOn('[data-tid=editTagGroup]');+ const colorElem = await global.client.$(+ '[data-tid=editTagGroupBackgroundColor]'+ );+ const color = await colorElem.getCSSProperty('background');++ expect(color.value).toContain(+ 'rgb(0,0,0)'+ ); /*await openTagGroupMenu(+ testGroup+ );+ await delay(500);+ await addTag(newTagName);+ const style = await global.client.getAttribute(+ '//button[contains(., "' + newTagName + '")]',+ 'style'+ );+ await delay(500);+ expect(style).toContain('rgb(208, 107, 100)');*/+ // select color from ColorChoosier Dialog+ /*await global.client.click(+ '/html/body/div[18]/div/div[2]/div[2]/div/div[4]/div[4]/span/div'+ ); // TODO xpath is not accepted*/+ // modal confirmation+ /*await global.client.click(+ '/html/body/div[18]/div/div[2]/div[3]/div[2]/button'+ );*/+ });++ it('TST0405 - Should add tag to a tag group [TST0405,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');++ await addTags([newTagName]);+ await expectElementExist(+ '[data-tid=tagContainer_' + newTagName + ']',+ true+ );+ // // const addedTag = await global.client.getValue('[data-tid=' + newTagName + ']');+ // // const addedTag = await global.client.getText('//button[contains(., "newTagName")');+ /*await delay(500);+ expect(addedTag.selector).toBe('[data-tid=' + newTagName + ']');*/+ });++ it('TST0405 - Add tag (s) / Should add comma separated tags to a tag group [TST0405,web,minio,electron]', async () => {+ await createTagGroup(testGroup);+ await clickOn('[data-tid=tagLibraryMoreButton_' + testGroup + ']');+ await addTags(arrTags);++ for (let i = 0; i < arrTags.length; i++) {+ await expectElementExist(+ '[data-tid=tagContainer_' + arrTags[i] + ']',+ true+ );+ }+ });++ it('TST0407 - Should rename tag [TST0407,web,minio,electron]', async () => {+ await tagMenu('done', 'editTagDialog');+ await setInputKeys('editTagInput', testTagName);+ await clickOn('[data-tid=editTagConfirm]');++ await expectElementExist(+ '[data-tid=tagContainer_' + testTagName + ']',+ true+ );+ });++ it('TST0408 - Should delete tag from a tag group [TST0408,web,minio,electron]', async () => {+ await tagMenu('done', 'deleteTagDialog');+ await global.client.pause(500);+ await clickOn('[data-tid=confirmDeleteTagDialogTagMenu]');+ await expectElementExist('[data-tid=tagContainer_done]', false);+ });++ it('TST0409 - Should sort tags in a tag group lexicographically [TST0409,web,minio,electron]', async () => {+ await clickOn('[data-tid=tagLibraryMoreButton_ToDo_Workflow]');+ await clickOn('[data-tid=sortTagGroup]'); // TODO no validation, expect+ // const tagGroupElements = await global.client.getText('//button[contains(., "' + testTagName + '")]');+ // const tagGroupElements = await global.client.elements('tagGroupContainer_ToDo_Workflow');+ // expect(editedTag).toBe(testTagName);+ });++ it('TST0410 - Default colors for tags from settings [TST0410,web,minio,electron]', async () => {+ await clickOn('[data-tid=settings]');+ await global.client.pause(500);+ await clickOn('[data-tid=settingsToggleDefaultTagBackgroundColor]');++ await global.client.pause(500);+ // await setSelectorKeys('[data-tid="colorPickerDialogContent"]', '000000');+ const inputElem = await global.client.$(+ '//*[@data-tid="colorPickerDialogContent"]/div/div[3]/div[1]/div/input'+ );+ await clearInputValue(inputElem);+ await setInputValue(+ '//*[@data-tid="colorPickerDialogContent"]/div/div[3]/div[1]/div/input',+ '000000'+ );+ await global.client.pause(500);+ await clickOn('[data-tid=colorPickerConfirm]');+ await global.client.pause(500);+ await clickOn('[data-tid=closeSettingsDialog]');+ await global.client.pause(500);++ await clickOn('[data-tid=tagLibraryMenu]');+ await clickOn('[data-tid=createNewTagGroup]');++ const colorElem = await global.client.$(+ '[data-tid=createTagGroupBackgroundColor]'+ );+ const color = await colorElem.getCSSProperty('background');++ expect(color.value).toContain('rgb(0,0,0)');++ /* await global.client.waitForVisible('[data-tid=settings]');+ await global.client.click('[data-tid=settings]');+ await global.client.waitForVisible('[data-tid=settingsDialog]');+ await global.client.scroll(+ '[data-tid=settingsToggleDefaultTagBackgroundColor]',+ 200,+ 200+ );+ await global.client.waitForVisible(+ '[data-tid=settingsToggleDefaultTagBackgroundColor]'+ );+ await global.client.click(+ '[data-tid=settingsToggleDefaultTagBackgroundColor]'+ );+ await delay(500);*/++ // select color from ColorChoosier Dialog+ /*await global.client.click(+ '/html/body/div[33]/div/div[2]/div[2]/div/div[4]/div[4]/span/div'+ ); // TODO xpath not accpeted+ await delay(500);+ // modal confirmation+ await global.client.click(+ '/html/body/div[18]/div/div[2]/div[3]/div[2]/button'+ ); // TODO xpath not accepted+ await delay(500);+ await global.client.waitForVisible('[data-tid=closeSettingsDialog]');+ await global.client.click('[data-tid=closeSettingsDialog]');*/++ /*await global.client.waitForVisible('[data-tid=tagLibrary]');+ await global.client.click('[data-tid=tagLibrary]');+ await global.client.waitForVisible('[data-tid=tagLibraryMenu]');+ await global.client.click('[data-tid=tagLibraryMenu]');+ await global.client.waitForVisible('[data-tid=createNewTagGroup]');+ await global.client.click('[data-tid=createNewTagGroup]');+ await delay(500);+ const style = await global.client.getAttribute(+ '[data-tid=createTagGroupBackgroundColor]',+ 'style'+ );+ await delay(500);+ expect(style).toContain('rgb(208, 107, 100)');*/+ });++ it('TST0411 - Should move tag group down [TST0411]', async () => {+ await clickOn('[data-tid=tagLibraryMoreButton_ToDo_Workflow]');+ await clickOn('[data-tid=moveTagGroupDown]'); // TODO no test confirmation, expect+ // await global.client.getText('[data-tid=tagLibraryTagGroupList]').then((name) => {+ // let answerExpected = name.split(name.indexOf(groupName));+ // answerExpected = answerExpected[0];+ // // expect(groupName).toBe(answerExpected);+ // expect(answerExpected).toBe(groupName);+ // return true;+ // });+ });++ it('TST0412 - Should move tag group up [TST0412]', async () => {+ await clickOn('[data-tid=tagLibraryMoreButton_Common_Tags]');+ await clickOn('[data-tid=moveTagGroupUp]'); // TODO no test confirmation+ // await global.client.getText('[data-tid=tagLibraryTagGroupList]').then((name) => {+ // let answerExpected = name.split(name.indexOf(groupName));+ // answerExpected = answerExpected[0];+ // expect(groupName).toBe(answerExpected);+ // return true;+ // });+ });+});diff --git a/tests/e2e/tag.spec.js b/tests/e2e/tag.spec.jsdeleted file mode 100644index ccca8fb0d..000000000--- a/tests/e2e/tag.spec.js+++ /dev/null@@ -1,285 +0,0 @@-/* Copyright (c) 2016-present - TagSpaces UG (Haftungsbeschraenkt). All rights reserved. */-import { delay } from './hook';--const testTagName = 'testTag';-const newTagName = 'newTagName';-const commaSeparatedTags = 'tag1, tag2, tag3';-const testGroup = 'testGroupName';-const editedGroupName = 'testGroup';-const defaultDelay = 1500;--// TODO add test id for the create tag group--export async function openTagLibrary() {- await global.client.click('[data-tid=tagLibrary]');- await delay(defaultDelay);-}--export async function createTagGroup(tagGroupName) {- await global.client.click('[data-tid=tagLibraryMenu]');- await global.client.click('[data-tid=createNewTagGroup]');- await delay(500);- await global.client- .$('[data-tid=createTagGroupInput] input')- .setValue(tagGroupName);- await delay(500);- await global.client.click('[data-tid=createTagGroupConfirmButton]');- await delay(defaultDelay);-}--export async function openTagGroupMenu(tagGroupName) {- await delay(500);- await global.client.waitForVisible(- '[data-tid=tagLibraryMoreButton_' + tagGroupName + ']'- );- await global.client.click(- '[data-tid=tagLibraryMoreButton_' + tagGroupName + ']'- );-}--export async function addTag(tagName) {- await global.client.waitForVisible('[data-tid=createTags]');- await global.client.click('[data-tid=createTags]');- await delay(500);- await global.client.$('[data-tid=addTagsInput] input').setValue(tagName);- await global.client.click('[data-tid=createTagsConfirmButton]');-}--export async function tagMenu(tagName, menuOperation) {- await global.client.waitForVisible(- '[data-tid=tagMoreButton_' + tagName + ']'- );- await global.client.click('[data-tid=tagMoreButton_' + tagName + ']');- await global.client.waitForVisible('[data-tid=' + menuOperation + ']');- await global.client.click('[data-tid=' + menuOperation + ']');-}--describe('TST04 - Testing the tag library:', () => {- beforeEach(async () => {- await openTagLibrary();- });-- it('TST0401 - Should create a tag group', async () => {- await createTagGroup(testGroup);- const addedGroup = await global.client.getText(- '//h3[text()="' + testGroup + '"]'- );- expect(addedGroup).toBe(testGroup);- });-- it('TST0402 - Should delete tag group', async () => {- await createTagGroup(testGroup);- await delay(500);- await openTagGroupMenu(testGroup);- await global.client.waitForVisible('[data-tid=deleteTagGroup]');- await global.client.click('[data-tid=deleteTagGroup]');- await delay(500);- await global.client.click('[data-tid=confirmDeleteTagGroupDialog]');- await delay(500);- const group = await global.client.getText(- '[data-tid=tagLibraryTagGroupList]'- );- await delay(500);- expect(group.indexOf('tagGroupContainer_' + testGroup + '') >= 0).toBe(- false- );- });-- it('TST0403 - Rename tag group', async () => {- await createTagGroup(testGroup);- await openTagGroupMenu(testGroup);- await delay(defaultDelay);- await global.client.waitForVisible('[data-tid=editTagGroup]');- await global.client.click('[data-tid=editTagGroup]');- await delay(500);- await global.client- .$('[data-tid=editTagGroupInput] input')- .setValue(editedGroupName);- await delay(500);- await global.client.click('[data-tid=editTagGroupConfirmButton]');- await delay(500);- const renamedGroup = await global.client.getText(- '//h3[text()="' + editedGroupName + '"]'- );- expect(renamedGroup).toBe(editedGroupName);- });-- it('TST0404 - Change default tag group tag colors', async () => {- await createTagGroup(testGroup);- await openTagGroupMenu(testGroup);- await global.client.waitForVisible('[data-tid=editTagGroup]');- await global.client.click('[data-tid=editTagGroup]');- await delay(500);- await global.client.waitForVisible(- '[data-tid=editTagGroupBackgroundColor]'- );- await global.client.click('[data-tid=editTagGroupBackgroundColor]');- await delay(500);- // select color from ColorChoosier Dialog- await global.client.click(- '/html/body/div[18]/div/div[2]/div[2]/div/div[4]/div[4]/span/div'- ); // TODO xpath is not accepted- await delay(500);- // modal confirmation- await global.client.click(- '/html/body/div[18]/div/div[2]/div[3]/div[2]/button'- ); // ('[data-tid=editTag]'); // TODO xpath is not accepted- await delay(500);- await global.client.waitForVisible('[data-tid=editTagGroupSwitch]');- await global.client.click('[data-tid=editTagGroupSwitch]');- await global.client.waitForVisible('[data-tid=editTagGroupConfirmButton]');- await global.client.click('[data-tid=editTagGroupConfirmButton]');- await delay(500);- await openTagGroupMenu(testGroup);- await delay(500);- await addTag(newTagName);- const style = await global.client.getAttribute(- '//button[contains(., "' + newTagName + '")]',- 'style'- );- await delay(500);- expect(style).toContain('rgb(208, 107, 100)');- });-- it('TST0405 - Should add tag to a tag group', async () => {- await createTagGroup(testGroup);- await openTagGroupMenu(testGroup);- await addTag(newTagName);- const addedTag = await global.client.element(- '[data-tid=' + newTagName + ']'- );- // // const addedTag = await global.client.getValue('[data-tid=' + newTagName + ']');- // // const addedTag = await global.client.getText('//button[contains(., "newTagName")');- await delay(500);- expect(addedTag.selector).toBe('[data-tid=' + newTagName + ']');- });-- it('TST0405 - Add tag (s) / Should add comma separated tags to a tag group', async () => {- await createTagGroup(testGroup);- await openTagGroupMenu(testGroup);- await global.client.waitForVisible('[data-tid=createTags]');- await global.client.click('[data-tid=createTags]');- await delay(500);- await global.client- .$('[data-tid=addTagsInput] input')- .setValue(commaSeparatedTags);- await global.client.click('[data-tid=createTagsConfirmButton]');- await delay(500);- // const addedTag = await global.client.getText('//button[text()="' + commaSeparatedTags.split(',')[0] + '"]');- const tag1 = await global.client.element(- '[data-tid=' + commaSeparatedTags.split(',')[0] + ']'- );- const tag2 = await global.client.element(- '[data-tid=' + commaSeparatedTags.split(',')[1] + ']'- );- const tag3 = await global.client.element(- '[data-tid=' + commaSeparatedTags.split(',')[2] + ']'- );- // expect(tag1).toBe(commaSeparatedTags.split(',')[0]); // TODO try make it like this, evtl use getText- // expect(tag2.selector).toBe('[data-tid=' + commaSeparatedTags.split(',')[1] + ']');- // expect(tag3.selector).toBe('[data-tid=' + commaSeparatedTags.split(',')[2] + ']');- });-- it('TST0407 - Should rename tag', async () => {- await tagMenu('done', 'editTagDialog');- await delay(500);- await global.client- .$('[data-tid=editTagInput] input')- .setValue(testTagName);- await global.client.waitForVisible('[data-tid=editTagConfirm]');- await global.client.click('[data-tid=editTagConfirm]');- const editedTag = await global.client.getText(- '//button[contains(., "' + testTagName + '")]'- );- expect(editedTag).toBe(testTagName);- });-- it('TST0408 - Should delete tag from a tag group', async () => {- await tagMenu('done', 'deleteTagDialog');- await delay(500);- await global.client.click('[data-tid=confirmDeleteTagDialogTagMenu]');- await delay(500);- const elements = await global.client.getText(- '[data-tid=tagGroupContainer_ToDo_Workflow]'- ); // TODO do not use preexisting tag groups- await delay(500);- expect(elements.indexOf('done') >= 0).toBe(false);- });-- it('TST0409 - Should sort tags in a tag group lexicographically', async () => {- await openTagGroupMenu('ToDo_Workflow');- await global.client.waitForVisible('[data-tid=sortTagGroup]');- await global.client.click('[data-tid=sortTagGroup]'); // TODO no validation, expect- // const tagGroupElements = await global.client.getText('//button[contains(., "' + testTagName + '")]');- // const tagGroupElements = await global.client.elements('tagGroupContainer_ToDo_Workflow');- // expect(editedTag).toBe(testTagName);- });-- it('TST0410 - Default colors for tags from settings', async () => {- await global.client.waitForVisible('[data-tid=settings]');- await global.client.click('[data-tid=settings]');- await global.client.waitForVisible('[data-tid=settingsDialog]');- await global.client.scroll(- '[data-tid=settingsToggleDefaultTagBackgroundColor]',- 200,- 200- );- await global.client.waitForVisible(- '[data-tid=settingsToggleDefaultTagBackgroundColor]'- );- await global.client.click(- '[data-tid=settingsToggleDefaultTagBackgroundColor]'- );- await delay(500);- // select color from ColorChoosier Dialog- await global.client.click(- '/html/body/div[33]/div/div[2]/div[2]/div/div[4]/div[4]/span/div'- ); // TODO xpath not accpeted- await delay(500);- // modal confirmation- await global.client.click(- '/html/body/div[18]/div/div[2]/div[3]/div[2]/button'- ); // TODO xpath not accepted- await delay(500);- await global.client.waitForVisible('[data-tid=closeSettingsDialog]');- await global.client.click('[data-tid=closeSettingsDialog]');- await global.client.waitForVisible('[data-tid=tagLibrary]');- await global.client.click('[data-tid=tagLibrary]');- await global.client.waitForVisible('[data-tid=tagLibraryMenu]');- await global.client.click('[data-tid=tagLibraryMenu]');- await global.client.waitForVisible('[data-tid=createNewTagGroup]');- await global.client.click('[data-tid=createNewTagGroup]');- await delay(500);- const style = await global.client.getAttribute(- '[data-tid=createTagGroupBackgroundColor]',- 'style'- );- await delay(500);- expect(style).toContain('rgb(208, 107, 100)');- });-- it('TST0411 - Should move tag group down', async () => {- await openTagGroupMenu('ToDo_Workflow');- await global.client.waitForVisible('[data-tid=moveTagGroupDown]');- await global.client.click('[data-tid=moveTagGroupDown]'); // TODO no test confirmation, expect- // await global.client.getText('[data-tid=tagLibraryTagGroupList]').then((name) => {- // let answerExpected = name.split(name.indexOf(groupName));- // answerExpected = answerExpected[0];- // // expect(groupName).toBe(answerExpected);- // expect(answerExpected).toBe(groupName);- // return true;- // });- });-- it('TST0412 - Should move tag group up', async () => {- await openTagGroupMenu('Common_Tags');- await global.client.waitForVisible('[data-tid=moveTagGroupUp]');- await global.client.click('[data-tid=moveTagGroupUp]'); // TODO no test confirmation- // await global.client.getText('[data-tid=tagLibraryTagGroupList]').then((name) => {- // let answerExpected = name.split(name.indexOf(groupName));- // answerExpected = answerExpected[0];- // expect(groupName).toBe(answerExpected);- // return true;- // });- });-});