update object fields and commands

This commit is contained in:
Jake McDermott
2017-10-10 19:14:04 -04:00
parent d4af743805
commit b5899c193a
7 changed files with 245 additions and 35 deletions

View File

@@ -26,32 +26,51 @@ const header = {
}]
};
module.exports = ({ elements, sections, commands }) => ({
selector: 'table',
sections: {
header,
dynamicSection
},
commands: [{
findRowByText (text) {
return this.section.dynamicSection.create({
elements,
sections,
commands,
name: `row[${text}]`,
locateStrategy: 'xpath',
selector: `.//tbody/tr/td//*[normalize-space(text())='${text}']/ancestor::tr`
});
const createTableSection = ({ elements, sections, commands }) => {
const tableSection = {
selector: 'table',
sections: {
header,
dynamicSection
},
waitForRowCount (count) {
const countReached = `tbody tr:nth-of-type(${count})`;
this.waitForElementPresent(countReached);
commands: [{
findRowByText (text) {
return this.section.dynamicSection.create({
elements,
sections,
commands,
name: `row[${text}]`,
locateStrategy: 'xpath',
selector: `.//tbody/tr/td//*[normalize-space(text())='${text}']/ancestor::tr`
});
},
findRowByIndex (index) {
return this.section.dynamicSection.create({
elements,
sections,
commands,
name: `row[${index}]`,
locateStrategy: 'xpath',
selector: `.//tbody/tr[${index}]`
});
},
clickRowByIndex (index) {
this.findRowByIndex(index).click('@self');
return this;
},
waitForRowCount (count) {
const countReached = this.findRowByIndex(count);
countReached.waitForElementVisible('@self', 10000);
const countExceeded = `tbody tr:nth-of-type(${count + 1})`;
this.waitForElementNotPresent(countExceeded);
const countExceeded = this.findRowByIndex(count + 1);
countExceeded.waitForElementNotPresent('@self', 10000);
return this;
}
}]
});
return this;
}
}]
};
return tableSection;
};
module.exports = createTableSection;

View File

@@ -8,7 +8,8 @@ const lookupModal = {
close: 'i[class="fa fa-times-circle"]',
title: 'div[class^="Form-title"]',
select: 'button[class*="save"]',
cancel: 'button[class*="cancel"]'
cancel: 'button[class*="cancel"]',
save: 'button[class*="save"]'
},
sections: {
search,

View File

@@ -1,9 +1,10 @@
const search = {
selector: 'smart-search',
locateStrategy: 'css selector',
elements: {
clearAll: '.SmartSearch-clearAll',
searchButton: '.SmartSearch-searchButton',
input: '.SmartSearch-input',
clearAll: 'a[class*="clear"]',
searchButton: 'i[class$="search"]',
input: 'input',
tags: '.SmartSearch-tagContainer'
}
};