Added cucumber tests (wip)
This commit is contained in:
parent
d798aa2cdf
commit
fb3511b264
11 changed files with 272 additions and 11 deletions
30
cucumber/features/steps_definitions/helper.js
Normal file
30
cucumber/features/steps_definitions/helper.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
|
||||
function makeid(size) {
|
||||
let text = '';
|
||||
const possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for (let i = 0; i < size; i += 1) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
export const randomUsername = () => makeid(7);
|
||||
|
||||
export const randomPassword = () => randomUsername();
|
||||
|
||||
export const randomEmail = () => `${randomUsername()}@example.com`;
|
||||
|
||||
export const goHome = (client) => {
|
||||
client.url(process.env.ROOT_URL);
|
||||
client.waitForVisible('#react-root', 10000);
|
||||
expect(client.isVisible('#react-root')).toBe(true);
|
||||
client.waitUntil(() => client.isVisible('.pg-loading-center-middle') === false, 5000);
|
||||
client.waitUntil(() => client.isVisible('.pg-loading-center-middle') === false, 5000);
|
||||
// Close alert
|
||||
if (client.isVisible('.bert-content')) {
|
||||
client.click('.bert-content');
|
||||
}
|
||||
if (client.isVisible('#acceptCookies')) {
|
||||
client.click('#acceptCookies');
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue