De-lint test files and update test,build config

This commit is contained in:
gconsidine
2017-10-10 16:32:11 -04:00
parent 8b6cc0e323
commit 82f81752e4
61 changed files with 1335 additions and 991 deletions

View File

@@ -12,5 +12,4 @@ const actions = {
}
};
module.exports = actions;

View File

@@ -1,10 +1,8 @@
import { merge } from 'lodash';
const translated = "translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')";
const normalized = `normalize-space(${translated})`;
const inputContainerElements = {
lookup: 'button > i[class="fa fa-search"]',
error: '.at-InputMessage--rejected',
@@ -39,7 +37,6 @@ const inputContainerElements = {
}
};
const legacyContainerElements = merge({}, inputContainerElements, {
prompt: {
locateStrategy: 'xpath',
@@ -49,22 +46,21 @@ const legacyContainerElements = merge({}, inputContainerElements, {
popover: ':root div[id^="popover"]',
});
const generateInputSelectors = function(label, containerElements) {
const generateInputSelectors = (label, containerElements) => {
// descend until span with matching text attribute is encountered
let span = `.//span[text()="${label}"]`;
const span = `.//span[text()="${label}"]`;
// recurse upward until div with form-group in class attribute is encountered
let container = `${span}/ancestor::div[contains(@class, 'form-group')]`;
const container = `${span}/ancestor::div[contains(@class, 'form-group')]`;
// descend until element with form-control in class attribute is encountered
let input = `${container}//*[contains(@class, 'form-control')]`;
const input = `${container}//*[contains(@class, 'form-control')]`;
let inputContainer = {
const inputContainer = {
locateStrategy: 'xpath',
selector: container,
elements: containerElements
};
let inputElement = {
const inputElement = {
locateStrategy: 'xpath',
selector: input
};
@@ -72,15 +68,14 @@ const generateInputSelectors = function(label, containerElements) {
return { inputElement, inputContainer };
};
function checkAllFieldsDisabled () {
const client = this.client.api;
const checkAllFieldsDisabled = function() {
let client = this.client.api;
let selectors = this.props.formElementSelectors ? this.props.formElementSelectors : [
const selectors = this.props.formElementSelectors ? this.props.formElementSelectors : [
'.at-Input'
];
selectors.forEach(function(selector) {
selectors.forEach(selector => {
client.elements('css selector', selector, inputs => {
inputs.value.map(o => o.ELEMENT).forEach(id => {
client.elementIdAttribute(id, 'disabled', ({ value }) => {
@@ -89,37 +84,37 @@ const checkAllFieldsDisabled = function() {
});
});
});
};
}
const generatorOptions = {
default: inputContainerElements,
legacy: legacyContainerElements
};
const createFormSection = ({ selector, labels, strategy, props }) => {
const options = generatorOptions[strategy || 'default'];
const createFormSection = function({ selector, labels, strategy, props }) {
let options = generatorOptions[strategy || 'default'];
let formSection = {
const formSection = {
props,
selector,
sections: {},
elements: {},
commands: [{
checkAllFieldsDisabled: checkAllFieldsDisabled
}],
props: props
commands: [{ checkAllFieldsDisabled }]
};
for (let key in labels) {
let label = labels[key];
let { inputElement, inputContainer } = generateInputSelectors(label, options);
formSection.elements[key] = inputElement;
formSection.sections[key] = inputContainer;
if (!labels) {
return formSection;
}
Object.keys(labels)
.forEach(key => {
const label = labels[key];
const { inputElement, inputContainer } = generateInputSelectors(label, options);
formSection.elements[key] = inputElement;
formSection.sections[key] = inputContainer;
});
return formSection;
};

View File

@@ -1,5 +1,4 @@
import dynamicSection from './dynamicSection.js';
import dynamicSection from './dynamicSection';
const header = {
selector: 'thead',
@@ -7,7 +6,7 @@ const header = {
dynamicSection
},
commands: [{
findColumnByText(text) {
findColumnByText (text) {
return this.section.dynamicSection.create({
name: `column[${text}]`,
locateStrategy: 'xpath',
@@ -17,7 +16,7 @@ const header = {
locateStrategy: 'xpath',
selector: './/*[contains(@class, "fa-sort")]'
},
sorted: {
sorted: {
locateStrategy: 'xpath',
selector: './/*[contains(@class, "fa-sort-")]'
},
@@ -27,37 +26,32 @@ const header = {
}]
};
const createTableSection = function({ elements, sections, commands }) {
return {
selector: 'table',
sections: {
header,
dynamicSection
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`
});
},
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`
});
},
waitForRowCount(count) {
let countReached = `tbody tr:nth-of-type(${count})`;
this.waitForElementPresent(countReached);
waitForRowCount (count) {
const countReached = `tbody tr:nth-of-type(${count})`;
this.waitForElementPresent(countReached);
let countExceeded = `tbody tr:nth-of-type(${count + 1})`;
this.waitForElementNotPresent(countExceeded);
const countExceeded = `tbody tr:nth-of-type(${count + 1})`;
this.waitForElementNotPresent(countExceeded);
return this;
}
}]
};
};
return this;
}
}]
});
module.exports = createTableSection;

View File

@@ -1,10 +1,10 @@
const dynamicSection = {
selector: '.',
commands: [{
create({ name, locateStrategy, selector, elements, sections, commands }) {
let Section = this.constructor;
create ({ name, locateStrategy, selector, elements, sections, commands }) {
const Section = this.constructor;
let options = Object.assign(Object.create(this), {
const options = Object.assign(Object.create(this), {
name,
locateStrategy,
elements,

View File

@@ -8,5 +8,4 @@ const header = {
}
};
module.exports = header;

View File

@@ -1,7 +1,6 @@
import createTableSection from './createTableSection.js';
import pagination from './pagination.js';
import search from './search.js';
import createTableSection from './createTableSection';
import pagination from './pagination';
import search from './search';
const lookupModal = {
selector: '#form-modal',

View File

@@ -21,5 +21,4 @@ const navigation = {
}
};
module.exports = navigation;

View File

@@ -1,8 +1,7 @@
import actions from './actions.js';
import createTableSection from './createTableSection.js';
import pagination from './pagination.js';
import search from './search.js';
import actions from './actions';
import createTableSection from './createTableSection';
import pagination from './pagination';
import search from './search';
const permissions = {
selector: 'div[ui-view="related"]',
@@ -26,5 +25,4 @@ const permissions = {
}
};
module.exports = permissions;

View File

@@ -8,5 +8,4 @@ const search = {
}
};
module.exports = search;