mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
update object fields and commands
This commit is contained in:
@@ -20,6 +20,11 @@ const standardInvDetails = createFormSection({
|
|||||||
'#inventory_form .ui-spinner-input',
|
'#inventory_form .ui-spinner-input',
|
||||||
'#inventory_form .ScheduleToggle-switch'
|
'#inventory_form .ScheduleToggle-switch'
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
labels: {
|
||||||
|
name: 'Name',
|
||||||
|
description: 'Description',
|
||||||
|
organization: 'Organization'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,7 +88,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
selector: 'div[ui-view="list"]',
|
selector: '.Panel',
|
||||||
elements: {
|
elements: {
|
||||||
badge: 'span[class~="badge"]',
|
badge: 'span[class~="badge"]',
|
||||||
title: 'div[class="List-titleText"]',
|
title: 'div[class="List-titleText"]',
|
||||||
@@ -109,5 +114,19 @@ module.exports = {
|
|||||||
elements: {
|
elements: {
|
||||||
cancel: 'button[class*="Form-cancelButton"]',
|
cancel: 'button[class*="Form-cancelButton"]',
|
||||||
save: 'button[class*="Form-saveButton"]'
|
save: 'button[class*="Form-saveButton"]'
|
||||||
}
|
},
|
||||||
|
commands: [{
|
||||||
|
selectAdd (name) {
|
||||||
|
this.api.waitForElementVisible('button span[class="List-dropdownCarat"]');
|
||||||
|
this.expect.element('button span[class="List-dropdownCarat"]').enabled;
|
||||||
|
this.api.click('button span[class="List-dropdownCarat"]');
|
||||||
|
|
||||||
|
this.api.useXpath();
|
||||||
|
this.api.waitForElementVisible(`.//a[normalize-space(text())="${name}"]`);
|
||||||
|
this.api.click(`//a[normalize-space(text())="${name}"]`);
|
||||||
|
this.api.useCss();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ const details = createFormSection({
|
|||||||
'#organization_form .Form-lookupButton',
|
'#organization_form .Form-lookupButton',
|
||||||
'#organization_form #InstanceGroups'
|
'#organization_form #InstanceGroups'
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
labels: {
|
||||||
|
name: 'Name',
|
||||||
|
description: 'Description'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
selector: 'div[ui-view="list"]',
|
selector: '.Panel',
|
||||||
elements: {
|
elements: {
|
||||||
badge: 'span[class~="badge"]',
|
badge: 'span[class~="badge"]',
|
||||||
title: 'div[class="List-titleText"]',
|
title: 'div[class="List-titleText"]',
|
||||||
|
|||||||
@@ -26,32 +26,51 @@ const header = {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ({ elements, sections, commands }) => ({
|
const createTableSection = ({ elements, sections, commands }) => {
|
||||||
selector: 'table',
|
const tableSection = {
|
||||||
sections: {
|
selector: 'table',
|
||||||
header,
|
sections: {
|
||||||
dynamicSection
|
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`
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
waitForRowCount (count) {
|
commands: [{
|
||||||
const countReached = `tbody tr:nth-of-type(${count})`;
|
findRowByText (text) {
|
||||||
this.waitForElementPresent(countReached);
|
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})`;
|
const countExceeded = this.findRowByIndex(count + 1);
|
||||||
this.waitForElementNotPresent(countExceeded);
|
countExceeded.waitForElementNotPresent('@self', 10000);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
});
|
};
|
||||||
|
|
||||||
|
return tableSection;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = createTableSection;
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ const lookupModal = {
|
|||||||
close: 'i[class="fa fa-times-circle"]',
|
close: 'i[class="fa fa-times-circle"]',
|
||||||
title: 'div[class^="Form-title"]',
|
title: 'div[class^="Form-title"]',
|
||||||
select: 'button[class*="save"]',
|
select: 'button[class*="save"]',
|
||||||
cancel: 'button[class*="cancel"]'
|
cancel: 'button[class*="cancel"]',
|
||||||
|
save: 'button[class*="save"]'
|
||||||
},
|
},
|
||||||
sections: {
|
sections: {
|
||||||
search,
|
search,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
const search = {
|
const search = {
|
||||||
selector: 'smart-search',
|
selector: 'smart-search',
|
||||||
|
locateStrategy: 'css selector',
|
||||||
elements: {
|
elements: {
|
||||||
clearAll: '.SmartSearch-clearAll',
|
clearAll: 'a[class*="clear"]',
|
||||||
searchButton: '.SmartSearch-searchButton',
|
searchButton: 'i[class$="search"]',
|
||||||
input: '.SmartSearch-input',
|
input: 'input',
|
||||||
tags: '.SmartSearch-tagContainer'
|
tags: '.SmartSearch-tagContainer'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import actions from './sections/actions';
|
import actions from './sections/actions';
|
||||||
import breadcrumb from './sections/breadcrumb';
|
import breadcrumb from './sections/breadcrumb';
|
||||||
import createFormSection from './sections/createFormSection';
|
import createFormSection from './sections/createFormSection';
|
||||||
@@ -20,9 +22,25 @@ const details = createFormSection({
|
|||||||
'#job_template_form .ui-spinner-input',
|
'#job_template_form .ui-spinner-input',
|
||||||
'#job_template_form .ScheduleToggle-switch'
|
'#job_template_form .ScheduleToggle-switch'
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
labels: {
|
||||||
|
name: 'Name',
|
||||||
|
description: 'Description',
|
||||||
|
playbook: 'Playbook'
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const lookupInventory = _.merge({}, lookupModal, {
|
||||||
|
locateStrategy: 'xpath',
|
||||||
|
selector: './/div[text()="Select inventory"]/ancestor::div[contains(@class, "modal-content")]'
|
||||||
|
});
|
||||||
|
|
||||||
|
const lookupProject = _.merge({}, lookupModal, {
|
||||||
|
locateStrategy: 'xpath',
|
||||||
|
selector: './/div[text()="Select project"]/ancestor::div[contains(@class, "modal-content")]'
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
url () {
|
url () {
|
||||||
return `${this.api.globals.launch_url}/#/templates`;
|
return `${this.api.globals.launch_url}/#/templates`;
|
||||||
@@ -31,7 +49,8 @@ module.exports = {
|
|||||||
header,
|
header,
|
||||||
navigation,
|
navigation,
|
||||||
breadcrumb,
|
breadcrumb,
|
||||||
lookupModal,
|
lookupInventory,
|
||||||
|
lookupProject,
|
||||||
addJobTemplate: {
|
addJobTemplate: {
|
||||||
selector: 'div[ui-view="form"]',
|
selector: 'div[ui-view="form"]',
|
||||||
sections: {
|
sections: {
|
||||||
@@ -71,7 +90,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
selector: 'div[ui-view="list"]',
|
selector: '.Panel',
|
||||||
elements: {
|
elements: {
|
||||||
badge: 'span[class~="badge"]',
|
badge: 'span[class~="badge"]',
|
||||||
title: 'div[class="List-titleText"]',
|
title: 'div[class="List-titleText"]',
|
||||||
@@ -95,5 +114,152 @@ module.exports = {
|
|||||||
elements: {
|
elements: {
|
||||||
cancel: 'button[class*="Form-cancelButton"]',
|
cancel: 'button[class*="Form-cancelButton"]',
|
||||||
save: 'button[class*="Form-saveButton"]'
|
save: 'button[class*="Form-saveButton"]'
|
||||||
}
|
},
|
||||||
|
commands: [{
|
||||||
|
clickWhenEnabled (selector) {
|
||||||
|
this.api.waitForElementVisible(selector);
|
||||||
|
this.expect.element(selector).enabled;
|
||||||
|
this.click(selector);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectAdd (name) {
|
||||||
|
this.clickWhenEnabled('button span[class="List-dropdownCarat"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.useXpath()
|
||||||
|
.waitForElementVisible(`.//a[normalize-space(text())="${name}"]`)
|
||||||
|
.click(`//a[normalize-space(text())="${name}"]`)
|
||||||
|
.useCss();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectPlaybook (name) {
|
||||||
|
this.clickWhenEnabled('label[for="playbook"] + div span[class$="arrow"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.useXpath()
|
||||||
|
.waitForElementVisible(`//li[contains(text(), "${name}")]`)
|
||||||
|
.click(`//li[contains(text(), "${name}")]`)
|
||||||
|
.useCss();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectInventory (name) {
|
||||||
|
this.clickWhenEnabled('label[for="inventory"] + div i[class$="search"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
this.section.lookupInventory.section.search
|
||||||
|
.waitForElementVisible('@input')
|
||||||
|
.waitForElementVisible('@searchButton')
|
||||||
|
.sendKeys('@input', name)
|
||||||
|
.click('@searchButton')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
this.section.lookupInventory.section.table
|
||||||
|
.waitForRowCount(1)
|
||||||
|
.clickRowByIndex(1);
|
||||||
|
|
||||||
|
this.section.lookupInventory.expect.element('@save').enabled;
|
||||||
|
|
||||||
|
this.section.lookupInventory
|
||||||
|
.click('@save');
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectProject (name) {
|
||||||
|
this.clickWhenEnabled('label[for="project"] + div i[class$="search"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
this.section.lookupProject.section.search
|
||||||
|
.waitForElementVisible('@input')
|
||||||
|
.waitForElementVisible('@searchButton')
|
||||||
|
.sendKeys('@input', name)
|
||||||
|
.click('@searchButton')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
this.section.lookupProject.section.table
|
||||||
|
.waitForRowCount(1)
|
||||||
|
.clickRowByIndex(1);
|
||||||
|
|
||||||
|
this.section.lookupProject.expect.element('@save').enabled;
|
||||||
|
|
||||||
|
this.section.lookupProject
|
||||||
|
.click('@save')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectVaultCredential (name) {
|
||||||
|
this.clickWhenEnabled('label[for="credential"] + div i[class$="search"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.waitForElementVisible('#multi-credential-kind-select + span span[class$="arrow"]')
|
||||||
|
.click('#multi-credential-kind-select + span span[class$="arrow"]')
|
||||||
|
.useXpath()
|
||||||
|
.waitForElementVisible('//li[contains(text(), "Vault")]')
|
||||||
|
.click('//li[contains(text(), "Vault")]')
|
||||||
|
.useCss()
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.waitForElementVisible('multi-credential-modal smart-search input')
|
||||||
|
.waitForElementVisible('multi-credential-modal smart-search i[class$="search"]')
|
||||||
|
.sendKeys('multi-credential-modal smart-search input', name)
|
||||||
|
.click('multi-credential-modal smart-search i[class$="search"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.click('multi-credential-modal smart-search a[class*="clear"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.sendKeys('multi-credential-modal smart-search input', name)
|
||||||
|
.click('multi-credential-modal smart-search i[class$="search"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.waitForElementNotPresent('multi-credential-modal tbody tr:nth-child(2)')
|
||||||
|
.waitForElementVisible('multi-credential-modal tbody tr:nth-child(1) input[type="radio"]')
|
||||||
|
.click('multi-credential-modal tbody tr:nth-child(1) input[type="radio"]')
|
||||||
|
.click('multi-credential-modal button[class*="save"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
selectMachineCredential (name) {
|
||||||
|
this.clickWhenEnabled('label[for="credential"] + div i[class$="search"]');
|
||||||
|
|
||||||
|
this.api
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.waitForElementVisible('#multi-credential-kind-select + span span[class$="arrow"]')
|
||||||
|
.click('#multi-credential-kind-select + span span[class$="arrow"]')
|
||||||
|
.useXpath()
|
||||||
|
.waitForElementVisible('//li[contains(text(), "Machine")]')
|
||||||
|
.click('//li[contains(text(), "Machine")]')
|
||||||
|
.useCss()
|
||||||
|
.waitForElementVisible('multi-credential-modal smart-search input')
|
||||||
|
.waitForElementVisible('multi-credential-modal smart-search i[class$="search"]')
|
||||||
|
.sendKeys('multi-credential-modal smart-search input', name)
|
||||||
|
.click('multi-credential-modal smart-search i[class$="search"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny')
|
||||||
|
.waitForElementNotPresent('multi-credential-modal tbody tr:nth-child(2)')
|
||||||
|
.waitForElementVisible('multi-credential-modal tbody tr:nth-child(1) input[type="radio"]')
|
||||||
|
.click('multi-credential-modal tbody tr:nth-child(1) input[type="radio"]')
|
||||||
|
.click('multi-credential-modal button[class*="save"]')
|
||||||
|
.waitForElementVisible('div.spinny')
|
||||||
|
.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user