From 9e71760af7a97f5ff537eb8724d2e353cc5f6477 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Fri, 27 Jul 2018 00:55:06 -0400 Subject: [PATCH] add jobs portal relaunch test --- .../client/features/jobs/jobsList.view.html | 2 +- .../features/portalMode/index.view.html | 2 + .../templates/templatesList.view.html | 4 +- .../lib/components/list/row.directive.js | 1 - .../lib/components/list/row.partial.html | 2 +- awx/ui/test/e2e/objects/portal.js | 13 ++++ .../tests/test-jobs-portal-list-actions.js | 69 +++++++++++++++++++ 7 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 awx/ui/test/e2e/objects/portal.js create mode 100644 awx/ui/test/e2e/tests/test-jobs-portal-list-actions.js diff --git a/awx/ui/client/features/jobs/jobsList.view.html b/awx/ui/client/features/jobs/jobsList.view.html index 1740fdcdff..c5856604c4 100644 --- a/awx/ui/client/features/jobs/jobsList.view.html +++ b/awx/ui/client/features/jobs/jobsList.view.html @@ -15,7 +15,7 @@ - +
My Jobs diff --git a/awx/ui/client/features/templates/templatesList.view.html b/awx/ui/client/features/templates/templatesList.view.html index 5d392312ea..86cb1e0b64 100644 --- a/awx/ui/client/features/templates/templatesList.view.html +++ b/awx/ui/client/features/templates/templatesList.view.html @@ -38,9 +38,9 @@ + invalid-tooltip="vm.invalidTooltip" + id="row-{{ template.id }}">
+
diff --git a/awx/ui/test/e2e/objects/portal.js b/awx/ui/test/e2e/objects/portal.js new file mode 100644 index 0000000000..0ec48e8942 --- /dev/null +++ b/awx/ui/test/e2e/objects/portal.js @@ -0,0 +1,13 @@ +module.exports = { + url () { + return `${this.api.globals.launch_url}/#/portal/myjobs`; + }, + sections: {}, + elements: {}, + commands: [{ + load () { + this.api.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724 + return this.navigate(); + }, + }], +}; diff --git a/awx/ui/test/e2e/tests/test-jobs-portal-list-actions.js b/awx/ui/test/e2e/tests/test-jobs-portal-list-actions.js new file mode 100644 index 0000000000..d39a871f25 --- /dev/null +++ b/awx/ui/test/e2e/tests/test-jobs-portal-list-actions.js @@ -0,0 +1,69 @@ +import { + getJob, + getJobTemplateAdmin +} from '../fixtures'; + +let data; + +module.exports = { + before: (client, done) => { + const resources = [ + getJobTemplateAdmin('test-actions'), + getJob('test-actions'), + ]; + + Promise.all(resources) + .then(([admin, job]) => { + data = { admin, job }; + + client.login(data.admin.username); + client.waitForAngular(); + + done(); + }); + }, + 'relaunch a job from the \'all jobs\' list': client => { + const portal = client.page.portal(); + + const allJobsButton = '#all-jobs-btn'; + const relaunch = `#job-${data.job.id} i[class*="launch"]`; + const search = '#portal-container-jobs smart-search input'; + const spinny = 'div.spinny'; + + portal.load(); + + portal.expect.element(allJobsButton).visible; + portal.expect.element(allJobsButton).enabled; + portal.click(allJobsButton); + + portal.waitForElementVisible(spinny); + portal.waitForElementNotVisible(spinny); + + const query = `id:>${data.job.id - 1} id:<${data.job.id + 1}`; + + portal.expect.element(search).visible; + portal.expect.element(search).enabled; + portal.sendKeys(search, query); + portal.sendKeys(search, client.Keys.ENTER); + + portal.waitForElementVisible(spinny); + portal.waitForElementNotVisible(spinny); + + portal.expect.element(relaunch).visible; + portal.expect.element(relaunch).enabled; + portal.click(relaunch); + + portal.waitForElementVisible(spinny); + portal.waitForElementNotVisible(spinny); + + const jobDetails = 'at-job-details'; + const output = './/span[normalize-space(text())=\'"msg": "Hello World!"\']'; + + client.waitForElementVisible(jobDetails, 10000); + client.useXpath(); + client.waitForElementVisible(output, 60000); + client.useCss(); + + client.end(); + } +};