mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
users e2e
This commit is contained in:
11
awx/ui/test/e2e/commands/logout.js
Normal file
11
awx/ui/test/e2e/commands/logout.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Logout from the current session by clicking on the power off button on the
|
||||||
|
* navigation menu.
|
||||||
|
*/
|
||||||
|
exports.command = function logout () {
|
||||||
|
const logoutButton = '.at-Layout-topNav i.fa-power-off';
|
||||||
|
this
|
||||||
|
.waitForElementVisible(logoutButton)
|
||||||
|
.click(logoutButton)
|
||||||
|
.waitForElementPresent('#login-button');
|
||||||
|
};
|
||||||
@@ -9,6 +9,8 @@ import pagination from './sections/pagination';
|
|||||||
import permissions from './sections/permissions';
|
import permissions from './sections/permissions';
|
||||||
import search from './sections/search';
|
import search from './sections/search';
|
||||||
|
|
||||||
|
const row = '#users_table .List-tableRow';
|
||||||
|
|
||||||
const details = createFormSection({
|
const details = createFormSection({
|
||||||
selector: 'form',
|
selector: 'form',
|
||||||
props: {
|
props: {
|
||||||
@@ -40,6 +42,15 @@ module.exports = {
|
|||||||
this.api.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724
|
this.api.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724
|
||||||
return this.navigate();
|
return this.navigate();
|
||||||
},
|
},
|
||||||
|
search (username) {
|
||||||
|
this.section.list.section.search
|
||||||
|
.setValue('@input', username)
|
||||||
|
.click('@searchButton');
|
||||||
|
this.waitForSpinny();
|
||||||
|
this.waitForElementNotPresent(`${row}:nth-of-type(2)`);
|
||||||
|
this.expect.element('.List-titleBadge').text.to.contain('1');
|
||||||
|
this.expect.element(row).text.contain(username);
|
||||||
|
},
|
||||||
}],
|
}],
|
||||||
sections: {
|
sections: {
|
||||||
header,
|
header,
|
||||||
|
|||||||
@@ -47,25 +47,13 @@ module.exports = {
|
|||||||
.setValue('@confirmPassword', store.user.password)
|
.setValue('@confirmPassword', store.user.password)
|
||||||
.click('@save');
|
.click('@save');
|
||||||
client.waitForSpinny();
|
client.waitForSpinny();
|
||||||
users.section.list.section.search
|
users.search(store.user.username);
|
||||||
.setValue('@input', store.user.username)
|
|
||||||
.click('@searchButton');
|
|
||||||
client.waitForSpinny();
|
|
||||||
users.waitForElementNotPresent(`${row}:nth-of-type(2)`);
|
|
||||||
users.expect.element('.List-titleBadge').text.to.contain('1');
|
|
||||||
users.expect.element(row).text.contain(store.user.username);
|
|
||||||
},
|
},
|
||||||
'edit an user': client => {
|
'edit an user': client => {
|
||||||
const users = client.page.users();
|
const users = client.page.users();
|
||||||
users.load();
|
users.load();
|
||||||
client.waitForSpinny();
|
client.waitForSpinny();
|
||||||
users.section.list.section.search
|
users.search(store.user.username);
|
||||||
.setValue('@input', store.user.username)
|
|
||||||
.click('@searchButton');
|
|
||||||
client.waitForSpinny();
|
|
||||||
users.waitForElementNotPresent(`${row}:nth-of-type(2)`);
|
|
||||||
users.expect.element('.List-titleBadge').text.to.contain('1');
|
|
||||||
users.expect.element(row).text.contain(store.user.username);
|
|
||||||
const editButton = `${row} i[class*="fa-pencil"]`;
|
const editButton = `${row} i[class*="fa-pencil"]`;
|
||||||
users.waitForElementVisible(editButton).click(editButton);
|
users.waitForElementVisible(editButton).click(editButton);
|
||||||
users.section.edit
|
users.section.edit
|
||||||
@@ -74,13 +62,33 @@ module.exports = {
|
|||||||
.setValue('@lastName', store.user.lastName)
|
.setValue('@lastName', store.user.lastName)
|
||||||
.click('@save');
|
.click('@save');
|
||||||
client.waitForSpinny();
|
client.waitForSpinny();
|
||||||
users.section.list.section.search
|
users.search(store.user.username);
|
||||||
.setValue('@input', store.user.username)
|
|
||||||
.click('@searchButton');
|
|
||||||
client.waitForSpinny();
|
|
||||||
users.waitForElementNotPresent(`${row}:nth-of-type(2)`);
|
|
||||||
users.expect.element(row).text.contain(`${store.user.username}\n${store.user.firstName[0].toUpperCase() + store.user.firstName.slice(1)}\n${store.user.lastName}`);
|
users.expect.element(row).text.contain(`${store.user.username}\n${store.user.firstName[0].toUpperCase() + store.user.firstName.slice(1)}\n${store.user.lastName}`);
|
||||||
},
|
},
|
||||||
|
'check if the new user can login': (client) => {
|
||||||
|
client.logout();
|
||||||
|
client.login(store.user.username, store.user.password);
|
||||||
|
client.logout();
|
||||||
|
client.login();
|
||||||
|
},
|
||||||
|
'delete the user': (client) => {
|
||||||
|
const users = client.page.users();
|
||||||
|
users.load();
|
||||||
|
client.waitForSpinny();
|
||||||
|
users.search(store.user.username);
|
||||||
|
const deleteButton = `${row} i[class*="fa-trash-o"]`;
|
||||||
|
const modalAction = '.modal-dialog #prompt_action_btn';
|
||||||
|
users
|
||||||
|
.waitForElementVisible(deleteButton)
|
||||||
|
.click(deleteButton)
|
||||||
|
.waitForElementVisible(modalAction)
|
||||||
|
.click(modalAction)
|
||||||
|
.waitForSpinny();
|
||||||
|
const searchResults = '.List-searchNoResults';
|
||||||
|
users
|
||||||
|
.waitForElementVisible(searchResults)
|
||||||
|
.expect.element(searchResults).text.contain('No records matched your search.');
|
||||||
|
},
|
||||||
after: client => {
|
after: client => {
|
||||||
client.end();
|
client.end();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user