From 8539eae1143076b12baf32fccf5fdef06f5c850c Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 11 Jan 2019 12:49:40 -0500 Subject: [PATCH] Fixes for e2e tests --- .../credential-types/credential-types.list.js | 2 +- .../src/organizations/organizations.list.js | 2 +- .../list-generator/list-generator.factory.js | 2 +- awx/ui/test/e2e/objects/inventories.js | 2 +- awx/ui/test/e2e/objects/templates.js | 37 +++--- .../tests/test-credentials-add-edit-aws.js | 7 +- .../tests/test-credentials-add-edit-gce.js | 2 +- .../test-credentials-add-edit-insights.js | 2 +- .../test-credentials-add-edit-machine.js | 14 +-- .../test-credentials-add-edit-network.js | 2 +- .../tests/test-credentials-add-edit-scm.js | 2 +- .../tests/test-credentials-add-edit-vault.js | 2 +- .../tests/test-credentials-list-actions.js | 2 +- .../test-credentials-lookup-organization.js | 90 +++++++------ .../e2e/tests/test-credentials-search-sort.js | 36 ++---- .../tests/test-inventories-list-actions.js | 6 +- .../test-inventory-scripts-list-actions.js | 4 +- .../tests/test-notifications-list-actions.js | 4 +- .../e2e/tests/test-projects-list-actions.js | 2 +- .../e2e/tests/test-templates-list-actions.js | 4 +- awx/ui/test/e2e/tests/test-xss.js | 118 ++++++++++-------- 21 files changed, 166 insertions(+), 176 deletions(-) diff --git a/awx/ui/client/src/credential-types/credential-types.list.js b/awx/ui/client/src/credential-types/credential-types.list.js index e98ba0f404..db6a1abde8 100644 --- a/awx/ui/client/src/credential-types/credential-types.list.js +++ b/awx/ui/client/src/credential-types/credential-types.list.js @@ -23,7 +23,7 @@ export default ['i18n', function(i18n){ key: true, label: i18n._('Name'), columnClass: 'col-md-4 col-sm-9 col-xs-9', - modalColumnClass: 'col-md-11', + modalColumnClass: 'col-sm-12', awToolTip: '{{credential_type.description | sanitize}}', dataPlacement: 'top' }, diff --git a/awx/ui/client/src/organizations/organizations.list.js b/awx/ui/client/src/organizations/organizations.list.js index 3337dc2a87..0a5da6c056 100644 --- a/awx/ui/client/src/organizations/organizations.list.js +++ b/awx/ui/client/src/organizations/organizations.list.js @@ -21,7 +21,7 @@ export default [function() { name: { key: true, label: 'Name', - columnClass: 'col-lg-4 col-md-6 col-sm-8 col-xs-8', + columnClass: 'col-sm-12', awToolTip: '{{organization.description | sanitize}}', dataPlacement: 'top' }, diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index 63311abf1b..bab6a479f0 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -562,7 +562,7 @@ export default ['$compile', 'Attr', 'Icon', } if(options.mode === 'edit' && list.fieldActions) { - html += "
"; html += (list.fieldActions.label === undefined || list.fieldActions.label) ? i18n._("Actions") : ""; diff --git a/awx/ui/test/e2e/objects/inventories.js b/awx/ui/test/e2e/objects/inventories.js index dd60b80164..4a1262325f 100644 --- a/awx/ui/test/e2e/objects/inventories.js +++ b/awx/ui/test/e2e/objects/inventories.js @@ -88,7 +88,7 @@ module.exports = { } }, list: { - selector: '.Panel', + selector: '.at-Panel', elements: { badge: 'span[class~="badge"]', title: 'div[class="List-titleText"]', diff --git a/awx/ui/test/e2e/objects/templates.js b/awx/ui/test/e2e/objects/templates.js index f672f3040f..c0fd1f5f09 100644 --- a/awx/ui/test/e2e/objects/templates.js +++ b/awx/ui/test/e2e/objects/templates.js @@ -119,16 +119,7 @@ module.exports = { }, sections: { search, - pagination, - table: createTableSection({ - elements: { - name: 'td[class~="name-column"]', - kind: 'td[class~="type-column"]' - }, - sections: { - actions - } - }) + pagination } } }, @@ -184,9 +175,10 @@ module.exports = { .waitForElementVisible('div.spinny') .waitForElementNotVisible('div.spinny'); - this.section.lookupInventory.section.table - .waitForRowCount(1) - .clickRowByIndex(1); + this.api + .waitForElementNotPresent('#inventories_table .List-tableRow:nth-child(2)') + .waitForElementVisible('#inventories_table .List-tableRow:nth-child(1) input[type="radio"]') + .click('#inventories_table .List-tableRow:nth-child(1) input[type="radio"]') this.section.lookupInventory.expect.element('@save').enabled; @@ -210,9 +202,10 @@ module.exports = { .waitForElementVisible('div.spinny') .waitForElementNotVisible('div.spinny'); - this.section.lookupProject.section.table - .waitForRowCount(1) - .clickRowByIndex(1); + this.api + .waitForElementNotPresent('#projects_table .List-tableRow:nth-child(2)') + .waitForElementVisible('#projects_table .List-tableRow:nth-child(1) input[type="radio"]') + .click('#projects_table .List-tableRow:nth-child(1) input[type="radio"]'); this.section.lookupProject.expect.element('@save').enabled; @@ -250,9 +243,9 @@ module.exports = { .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="checkbox"]') - .click('multi-credential-modal tbody tr:nth-child(1) input[type="checkbox"]') + .waitForElementNotPresent('multi-credential-modal .List-tableRow:nth-child(2)') + .waitForElementVisible('multi-credential-modal .List-tableRow:nth-child(1) input[type="checkbox"]') + .click('multi-credential-modal .List-tableRow:nth-child(1) input[type="checkbox"]') .click('multi-credential-modal button[class*="save"]') .pause(1000); @@ -276,9 +269,9 @@ module.exports = { .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"]') + .waitForElementNotPresent('multi-credential-modal .List-tableRow:nth-child(2)') + .waitForElementVisible('multi-credential-modal .List-tableRow:nth-child(1) input[type="radio"]') + .click('multi-credential-modal .List-tableRow:nth-child(1) input[type="radio"]') .click('multi-credential-modal button[class*="save"]') .pause(1000); diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-aws.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-aws.js index 5da3e727ae..5e1bf4df68 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-aws.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-aws.js @@ -118,18 +118,17 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); + const row = '#credentials_table .List-tableRow'; const { search } = credentials.section.list.section; - const { table } = credentials.section.list.section; search .waitForElementVisible('@input') .setValue('@input', `name:${store.credential.name}`) .click('@searchButton'); - table.waitForRowCount(1); - table.findRowByText(store.credential.name) - .waitForElementVisible('@self'); + credentials.waitForElementNotPresent(`${row}:nth-of-type(2)`); + credentials.expect.element(row).text.contain(store.credential.name); client.end(); } diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-gce.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-gce.js index b7457d81b6..f1733f78f5 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-gce.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-gce.js @@ -160,7 +160,7 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; credentials.section.list.section.search .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-insights.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-insights.js index b4798df500..85e62312c9 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-insights.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-insights.js @@ -122,7 +122,7 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; credentials.section.list.section.search .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-machine.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-machine.js index 2912a0d2ab..ce04aac0fe 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-machine.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-machine.js @@ -193,16 +193,14 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; - credentials.section.list.section.search - .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) - .waitForElementVisible('@searchButton', AWX_E2E_TIMEOUT_LONG) - .sendKeys('@input', `name:${store.credential.name}`) - .sendKeys('@input', client.Keys.ENTER); + const { search } = credentials.section.list.section; - client.pause(1000); - client.waitForElementNotVisible('div.spinny'); + search + .waitForElementVisible('@input') + .setValue('@input', `name:${store.credential.name}`) + .click('@searchButton'); credentials.waitForElementNotPresent(`${row}:nth-of-type(2)`); credentials.expect.element(row).text.contain(store.credential.name); diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-network.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-network.js index 63669b543b..2afd82ab1a 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-network.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-network.js @@ -193,7 +193,7 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; credentials.section.list.section.search .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-scm.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-scm.js index 744a98b14f..863ab2473f 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-scm.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-scm.js @@ -162,7 +162,7 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; credentials.section.list.section.search .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) diff --git a/awx/ui/test/e2e/tests/test-credentials-add-edit-vault.js b/awx/ui/test/e2e/tests/test-credentials-add-edit-vault.js index b017651de3..207fe2b255 100644 --- a/awx/ui/test/e2e/tests/test-credentials-add-edit-vault.js +++ b/awx/ui/test/e2e/tests/test-credentials-add-edit-vault.js @@ -123,7 +123,7 @@ module.exports = { }, 'credential is searchable after saving': client => { const credentials = client.page.credentials(); - const row = '#credentials_table tbody tr'; + const row = '#credentials_table .List-tableRow'; credentials.section.list.section.search .waitForElementVisible('@input', AWX_E2E_TIMEOUT_LONG) diff --git a/awx/ui/test/e2e/tests/test-credentials-list-actions.js b/awx/ui/test/e2e/tests/test-credentials-list-actions.js index c3b0400802..1e5feafbf6 100644 --- a/awx/ui/test/e2e/tests/test-credentials-list-actions.js +++ b/awx/ui/test/e2e/tests/test-credentials-list-actions.js @@ -39,7 +39,7 @@ module.exports = { credentials.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; credentials.waitForElementNotPresent(toast); diff --git a/awx/ui/test/e2e/tests/test-credentials-lookup-organization.js b/awx/ui/test/e2e/tests/test-credentials-lookup-organization.js index 2880a5ce13..264a098d58 100644 --- a/awx/ui/test/e2e/tests/test-credentials-lookup-organization.js +++ b/awx/ui/test/e2e/tests/test-credentials-lookup-organization.js @@ -51,24 +51,23 @@ module.exports = { const credentials = client.page.credentials(); const { details } = credentials.section.add.section; const { lookupModal } = credentials.section; - const { table } = lookupModal.section; details.section.organization.expect.element('@lookup').visible; credentials.expect.section('@lookupModal').present; - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(6) input[type="radio"]').not.present; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(6) input[type="radio"]').not.present; lookupModal.expect.element('@select').visible; lookupModal.expect.element('@select').not.enabled; - table.click('tbody tr:nth-child(2)'); - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').selected; + lookupModal.click('.List-tableRow:nth-child(2)'); + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').selected; lookupModal.expect.element('@select').visible; lookupModal.expect.element('@select').enabled; @@ -76,58 +75,53 @@ module.exports = { 'sort and unsort the table by name with an item selected': client => { const credentials = client.page.credentials(); const { lookupModal } = credentials.section; - const { table } = lookupModal.section; - const column = table.section.header.findColumnByText('Name'); + lookupModal.expect.element('#organization-name-header').visible; + lookupModal.expect.element('#organization-name-header').visible; - column.expect.element('@self').visible; - column.expect.element('@sortable').visible; - - column.click('@self'); + lookupModal.click('#organization-name-header'); credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; - column.click('@self'); + lookupModal.click('#organization-name-header'); credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; }, 'use the pagination controls with an item selected': client => { const credentials = client.page.credentials(); const { lookupModal } = credentials.section; - const { table } = lookupModal.section; const { pagination } = lookupModal.section; pagination.click('@next'); credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; - + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; pagination.click('@previous'); credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; pagination.click('@last'); credentials.waitForElementVisible('div.spinny'); @@ -137,21 +131,21 @@ module.exports = { credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; pagination.click('@first'); credentials.waitForElementVisible('div.spinny'); credentials.waitForElementNotVisible('div.spinny'); - table.expect.element('tbody tr:nth-child(1) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(2) input[type="radio"]').selected; - table.expect.element('tbody tr:nth-child(3) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(4) input[type="radio"]').not.selected; - table.expect.element('tbody tr:nth-child(5) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(1) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(2) input[type="radio"]').selected; + lookupModal.expect.element('.List-tableRow:nth-child(3) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(4) input[type="radio"]').not.selected; + lookupModal.expect.element('.List-tableRow:nth-child(5) input[type="radio"]').not.selected; client.end(); } diff --git a/awx/ui/test/e2e/tests/test-credentials-search-sort.js b/awx/ui/test/e2e/tests/test-credentials-search-sort.js index cd46775aae..89fad80bf5 100644 --- a/awx/ui/test/e2e/tests/test-credentials-search-sort.js +++ b/awx/ui/test/e2e/tests/test-credentials-search-sort.js @@ -1,6 +1,3 @@ -const columns = ['Name', 'Kind', 'Owners', 'Actions']; -const sortable = ['Name']; - module.exports = { before: (client, done) => { const credentials = client.page.credentials(); @@ -18,37 +15,26 @@ module.exports = { }, 'expected table columns are visible': client => { const credentials = client.page.credentials(); - const { table } = credentials.section.list.section; - columns.forEach(label => { - table.section.header.findColumnByText(label) - .expect.element('@self').visible; - }); + credentials.expect.element('#credential-name-header').visible; + credentials.expect.element('#credential-kind-header').visible; + credentials.expect.element('#credential-owners-header').visible; + credentials.expect.element('#credential-actions-header').visible; }, 'only fields expected to be sortable show sort icon': client => { const credentials = client.page.credentials(); - const { table } = credentials.section.list.section; - sortable.forEach(label => { - table.section.header.findColumnByText(label) - .expect.element('@sortable').visible; - }); + credentials.expect.element('#credential-name-header > i.columnSortIcon').visible; }, 'sort all columns expected to be sortable': client => { const credentials = client.page.credentials(); - const { table } = credentials.section.list.section; - sortable.forEach(label => { - const column = table.section.header.findColumnByText(label); - - column.click('@self'); - - credentials - .waitForElementVisible('div.spinny') - .waitForElementNotVisible('div.spinny'); - - column.expect.element('@sorted').visible; - }); + credentials.expect.element('#credential-name-header > i.columnSortIcon.fa-sort-up').visible; + credentials.click('#credential-name-header'); + credentials + .waitForElementVisible('div.spinny') + .waitForElementNotVisible('div.spinny'); + credentials.expect.element('#credential-name-header > i.columnSortIcon.fa-sort-down').visible; client.end(); } diff --git a/awx/ui/test/e2e/tests/test-inventories-list-actions.js b/awx/ui/test/e2e/tests/test-inventories-list-actions.js index 55f19438d4..d50be7fc33 100644 --- a/awx/ui/test/e2e/tests/test-inventories-list-actions.js +++ b/awx/ui/test/e2e/tests/test-inventories-list-actions.js @@ -42,7 +42,7 @@ module.exports = { inventories.waitForElementVisible('div.spinny'); inventories.waitForElementNotVisible('div.spinny'); - inventories.expect.element(`#inventories_table tr[id="${data.inventoryNoSource.id}"]`).visible; + inventories.expect.element(`#inventories_table .List-tableRow[id="${data.inventoryNoSource.id}"]`).visible; inventories.expect.element('i[class*="copy"]').visible; inventories.expect.element('i[class*="copy"]').enabled; @@ -51,7 +51,7 @@ module.exports = { inventories.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; inventories.waitForElementNotPresent(toast); @@ -99,7 +99,7 @@ module.exports = { inventories.waitForElementVisible('div.spinny'); inventories.waitForElementNotVisible('div.spinny'); - inventories.expect.element(`#inventories_table tr[id="${data.inventory.id}"]`).visible; + inventories.expect.element(`#inventories_table .List-tableRow[id="${data.inventory.id}"]`).visible; inventories.expect.element('#copy-action').visible; inventories.expect.element('#copy-action[class*="btn-disabled"]').present; diff --git a/awx/ui/test/e2e/tests/test-inventory-scripts-list-actions.js b/awx/ui/test/e2e/tests/test-inventory-scripts-list-actions.js index 9e801f2ecc..262266aecb 100644 --- a/awx/ui/test/e2e/tests/test-inventory-scripts-list-actions.js +++ b/awx/ui/test/e2e/tests/test-inventory-scripts-list-actions.js @@ -30,7 +30,7 @@ module.exports = { inventoryScripts.waitForElementVisible('div.spinny'); inventoryScripts.waitForElementNotVisible('div.spinny'); - inventoryScripts.expect.element(`#inventory_scripts_table tr[id="${data.inventoryScript.id}"]`).visible; + inventoryScripts.expect.element(`#inventory_scripts_table .List-tableRow[id="${data.inventoryScript.id}"]`).visible; inventoryScripts.expect.element('i[class*="copy"]').visible; inventoryScripts.expect.element('i[class*="copy"]').enabled; @@ -39,7 +39,7 @@ module.exports = { inventoryScripts.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; inventoryScripts.waitForElementNotPresent(toast); diff --git a/awx/ui/test/e2e/tests/test-notifications-list-actions.js b/awx/ui/test/e2e/tests/test-notifications-list-actions.js index f87957d3a9..376aa2f0ed 100644 --- a/awx/ui/test/e2e/tests/test-notifications-list-actions.js +++ b/awx/ui/test/e2e/tests/test-notifications-list-actions.js @@ -30,7 +30,7 @@ module.exports = { notifications.waitForElementVisible('div.spinny'); notifications.waitForElementNotVisible('div.spinny'); - notifications.expect.element(`#notification_templates_table tr[id="${data.notification.id}"]`).visible; + notifications.expect.element(`#notification_templates_table .List-tableRow[id="${data.notification.id}"]`).visible; notifications.expect.element('i[class*="copy"]').visible; notifications.expect.element('i[class*="copy"]').enabled; @@ -39,7 +39,7 @@ module.exports = { notifications.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; notifications.waitForElementNotPresent(toast); diff --git a/awx/ui/test/e2e/tests/test-projects-list-actions.js b/awx/ui/test/e2e/tests/test-projects-list-actions.js index f01921dad5..fa025c851c 100644 --- a/awx/ui/test/e2e/tests/test-projects-list-actions.js +++ b/awx/ui/test/e2e/tests/test-projects-list-actions.js @@ -40,7 +40,7 @@ module.exports = { projects.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; projects.waitForElementNotPresent(toast); diff --git a/awx/ui/test/e2e/tests/test-templates-list-actions.js b/awx/ui/test/e2e/tests/test-templates-list-actions.js index e324209704..78b6e93241 100644 --- a/awx/ui/test/e2e/tests/test-templates-list-actions.js +++ b/awx/ui/test/e2e/tests/test-templates-list-actions.js @@ -54,7 +54,7 @@ module.exports = { templates.waitForElementNotVisible('div.spinny'); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; templates.waitForElementNotPresent(toast); @@ -114,7 +114,7 @@ module.exports = { .waitForAngular(); const activityStream = 'bread-crumb > div i[class$="icon-activity-stream"]'; - const activityRow = '#activities_table tr td[class*="description-column"] a'; + const activityRow = '#activities_table .List-tableCell[class*="description-column"] a'; const toast = 'div[class="Toast-icon"]'; templates.waitForElementNotPresent(toast); diff --git a/awx/ui/test/e2e/tests/test-xss.js b/awx/ui/test/e2e/tests/test-xss.js index d33ee0b754..0233cddee1 100644 --- a/awx/ui/test/e2e/tests/test-xss.js +++ b/awx/ui/test/e2e/tests/test-xss.js @@ -83,7 +83,6 @@ module.exports = { }, 'check template form for unsanitized content': client => { const multiCredentialOpen = 'multi-credential button i[class*="search"]'; - const multiCredentialExit = 'multi-credential-modal button[class*="exit"]'; client.navigateTo(urls.jobTemplate, false); @@ -101,10 +100,14 @@ module.exports = { client.expect.element('#xss').not.present; client.expect.element('[class=xss]').not.present; - client.click(multiCredentialExit); + client.pause(500); - client.pause(500).expect.element('div.spinny').not.visible; - client.expect.element('#multi-credential-modal').not.present; + client.waitForElementVisible('#multi-credential-modal .Form-exit'); + client.waitForElementNotVisible('.overlay'); + + client.click('#multi-credential-modal .Form-exit'); + + client.waitForElementNotPresent('#multi-credential-modal'); }, 'check template list for unsanitized content': client => { const itemRow = `#row-${data.jobTemplate.id}`; @@ -160,7 +163,7 @@ module.exports = { }, 'check user roles list for unsanitized content': client => { const adminRole = data.project.summary_fields.object_roles.admin_role; - const itemDelete = `#permissions_table tr[id="${adminRole.id}"] #delete-action`; + const itemDelete = `#permissions_table .List-tableRow[id="${adminRole.id}"] #delete-action`; client.expect.element('#permissions_tab').visible; client.expect.element('#permissions_tab').enabled; @@ -225,14 +228,16 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check notification list for unsanitized content': client => { - const itemRow = `#notification_templates_table tr[id="${data.notification.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#notification_templates_table .List-tableRow[id="${data.notification.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.notification.id - 1} id:<${data.notification.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div.at-Panel smart-search input', `id:>${data.notification.id - 1} id:<${data.notification.id + 1}`); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -279,11 +284,13 @@ module.exports = { 'check organization list for unsanitized content': client => { const itemName = '#OrgCards h3[class*="-label"]'; - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.organization.id - 1} id:<${data.organization.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div.at-Panel smart-search input', `id:>${data.organization.id - 1} id:<${data.organization.id + 1}`); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -327,14 +334,16 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check inventory list for unsanitized content': client => { - const itemRow = `#inventories_table tr[id="${data.inventory.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#inventories_table .List-tableRow[id="${data.inventory.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.inventory.id - 1} id:<${data.inventory.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div.at-Panel smart-search input', `id:>${data.inventory.id - 1} id:<${data.inventory.id + 1}`); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -387,14 +396,16 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check inventory script list for unsanitized content': client => { - const itemRow = `#inventory_scripts_table tr[id="${data.inventoryScript.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#inventory_scripts_table .List-tableRow[id="${data.inventoryScript.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.inventoryScript.id - 1} id:<${data.inventoryScript.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div.at-Panel smart-search input', `id:>${data.inventoryScript.id - 1} id:<${data.inventoryScript.id + 1}`); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -439,7 +450,7 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check project roles list for unsanitized content': client => { - const itemDelete = `#permissions_table tr[id="${data.user.id}"] div[class*="RoleList-deleteContainer"]`; + const itemDelete = `#permissions_table .List-tableRow[id="${data.user.id}"] div[class*="RoleList-deleteContainer"]`; client.expect.element('#permissions_tab').visible; client.expect.element('#permissions_tab').enabled; @@ -456,7 +467,9 @@ module.exports = { client.expect.element('div[ui-view="related"] smart-search input').enabled; client.sendKeys('div[ui-view="related"] smart-search input', `id:>${data.user.id - 1} id:<${data.user.id + 1}`); - client.sendKeys('div[ui-view="related"] smart-search input', client.Keys.ENTER); + client.waitForElementNotPresent('div[ui-view="related"] smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div[ui-view="related"] smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').not.visible; @@ -515,7 +528,9 @@ module.exports = { client.expect.element('.at-Panel smart-search input').enabled; client.sendKeys('.at-Panel smart-search input', `id:>${data.project.id - 1} id:<${data.project.id + 1}`); - client.sendKeys('.at-Panel smart-search input', client.Keys.ENTER); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').not.visible; @@ -560,14 +575,16 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check credential list for unsanitized content': client => { - const itemRow = `#credentials_table tr[id="${data.credential.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#credentials_table .List-tableRow[id="${data.credential.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; client.expect.element('div[ui-view="list"] smart-search').visible; client.expect.element('div[ui-view="list"] smart-search input').enabled; client.sendKeys('div[ui-view="list"] smart-search input', `id:>${data.credential.id - 1} id:<${data.credential.id + 1}`); - client.sendKeys('div[ui-view="list"] smart-search input', client.Keys.ENTER); + client.waitForElementNotPresent('div[ui-view="list"] smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div[ui-view="list"] smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -612,14 +629,16 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check team list for unsanitized content': client => { - const itemRow = `#teams_table tr[id="${data.team.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#teams_table .List-tableRow[id="${data.team.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.team.id - 1} id:<${data.team.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div.at-Panel smart-search input', `id:>${data.team.id - 1} id:<${data.team.id + 1}`); + client.waitForElementNotPresent('div.at-Panel smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div.at-Panel smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; @@ -666,8 +685,8 @@ module.exports = { client.expect.element('[class=xss]').not.present; }, 'check job schedules view for unsanitized content': client => { - const itemRow = `#schedules_table tr[id="${data.jobTemplateSchedule.id}"]`; - const itemName = `${itemRow} td[class*="name-"] a`; + const itemRow = `#schedules_table .List-tableRow[id="${data.jobTemplateSchedule.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="name-"] a`; client.navigateTo(urls.jobsSchedules); @@ -686,22 +705,23 @@ module.exports = { }); }, 'check host recent jobs popup for unsanitized content': client => { - const itemRow = `#hosts_table tr[id="${data.host.id}"]`; - const itemName = `${itemRow} td[class*="active_failures-"] a`; - const popOver = `${itemRow} td[class*="active_failures-"] div[class*="popover"]`; + const itemRow = `#hosts_table .List-tableRow[id="${data.host.id}"]`; + const itemName = `${itemRow} .List-tableCell[class*="active_failures-"] a`; client.navigateTo(urls.inventoryHosts); - client.expect.element('div[class^="Panel"] smart-search').visible; - client.expect.element('div[class^="Panel"] smart-search input').enabled; + client.expect.element('div.at-Panel smart-search').visible; + client.expect.element('div.at-Panel smart-search input').enabled; - client.sendKeys('div[class^="Panel"] smart-search input', `id:>${data.host.id - 1} id:<${data.host.id + 1}`); - client.sendKeys('div[class^="Panel"] smart-search input', client.Keys.ENTER); + client.sendKeys('div[ui-view="form"] smart-search input', `id:>${data.host.id - 1} id:<${data.host.id + 1}`); + client.waitForElementNotPresent('div[ui-view="form"] smart-search .SmartSearch-searchButton--disabled'); + client.waitForElementNotVisible('.overlay'); + client.click('div[ui-view="form"] smart-search .SmartSearch-searchButton'); client.expect.element('div.spinny').visible; client.expect.element('div.spinny').not.visible; client.click(itemName); - client.expect.element(popOver).present; + client.expect.element('body > div.popover').present; client.expect.element('[class=xss]').not.present;