admin login stepdefinition moved from addUsersContext file to loginContext file
This commit is contained in:
parent
15dfcdb8e3
commit
741700db7a
@ -20,7 +20,7 @@ module.exports = {
|
|||||||
chromeOptions : {
|
chromeOptions : {
|
||||||
args : ['disable-gpu', 'window-size=1280,1024'],
|
args : ['disable-gpu', 'window-size=1280,1024'],
|
||||||
w3c : false
|
w3c : false
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
userIsLoggedIn: async function (login) {
|
userIsLoggedIn: async function (login) {
|
||||||
await this.useXpath()
|
await this.waitForElementNotPresent('@loginTable')
|
||||||
|
.useXpath()
|
||||||
.waitForElementVisible('@userLogin')
|
.waitForElementVisible('@userLogin')
|
||||||
.expect.element('@userLogin')
|
.expect.element('@userLogin')
|
||||||
.text.to.equal(login);
|
.text.to.equal(login);
|
||||||
|
|||||||
@ -5,12 +5,6 @@ const assert = require('assert');
|
|||||||
let response;
|
let response;
|
||||||
let Login = {};
|
let Login = {};
|
||||||
|
|
||||||
Given('the administrator has logged in using the webUI', async function () {
|
|
||||||
await client.page.loginPage().navigate().waitForLoginPage();
|
|
||||||
await client.page.loginPage().userLogsInWithUsernameAndPassword(client.globals.adminUsername, client.globals.adminPassword);
|
|
||||||
return client.page.loginPage().userIsLoggedIn(client.globals.adminUsername);
|
|
||||||
});
|
|
||||||
|
|
||||||
Given('the administrator has browsed to the new users page', function () {
|
Given('the administrator has browsed to the new users page', function () {
|
||||||
return client.page.homePage().browsedToNewUserPage();
|
return client.page.homePage().browsedToNewUserPage();
|
||||||
});
|
});
|
||||||
@ -153,4 +147,4 @@ const getResponseMessage = async function (expectedResponseMessage) {
|
|||||||
const actualResponseMessage = json_response['error']['0'];
|
const actualResponseMessage = json_response['error']['0'];
|
||||||
return assert.strictEqual(actualResponseMessage, expectedResponseMessage,
|
return assert.strictEqual(actualResponseMessage, expectedResponseMessage,
|
||||||
`the expected response message was ${expectedResponseMessage} but got ${actualResponseMessage}`);
|
`the expected response message was ${expectedResponseMessage} but got ${actualResponseMessage}`);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
const { Given, When, Then } = require('cucumber')
|
const { Given, When, Then } = require('cucumber')
|
||||||
const { client } = require('nightwatch-api')
|
const { client } = require('nightwatch-api')
|
||||||
|
|
||||||
|
Given('the administrator has logged in using the webUI', async function () {
|
||||||
|
await client.page.loginPage().navigate().waitForLoginPage();
|
||||||
|
await client.page.loginPage().userLogsInWithUsernameAndPassword(client.globals.adminUsername, client.globals.adminPassword);
|
||||||
|
return client.page.loginPage().userIsLoggedIn(client.globals.adminUsername);
|
||||||
|
});
|
||||||
|
|
||||||
Given('the user has browsed to the login page', function () {
|
Given('the user has browsed to the login page', function () {
|
||||||
return client.page.loginPage().navigate();
|
return client.page.loginPage().navigate();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user