-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegistrationPage.js
67 lines (61 loc) · 4 KB
/
RegistrationPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// RegistrationPage.js
const { By, Key, until } = require('selenium-webdriver');
class RegistrationPage {
constructor(driver) {
this.driver = driver;
this.fields = {
firstname: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/two-column-form/div/peb-form-field-input[1]/div/div'),
inputField: By.xpath('//input[@formcontrolname="firstName"]'),
value: ''
},
lastname: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/two-column-form/div/peb-form-field-input[2]/div/div'),
inputField: By.xpath('//input[@formcontrolname="lastName"]'),
value: ''
},
email: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/peb-form-field-input[1]/div/div'),
inputField: By.xpath('//input[@formcontrolname="email"]'),
value: ''
},
password: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/peb-form-field-input[2]/div/div'),
inputField: By.xpath('//input[@formcontrolname="password"]'),
value: ''
},
confirmpassword: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/peb-form-field-input[3]/div/div'),
inputField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-personal-registration/entry-layout/div/div/div/entry-create-personal-form/form/div[2]/peb-form-background/div/peb-form-field-input[3]/div/div/div/input'),
value: ''
},
companyname: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-business-registration/entry-layout/div/div/div/entry-default-business-registration/entry-create-business-form/form/peb-form-background/div/peb-form-field-input/div/div'),
inputField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-business-registration/entry-layout/div/div/div/entry-default-business-registration/entry-create-business-form/form/peb-form-background/div/peb-form-field-input/div/div/div/input'),
value: ''
},
phonenumber: {
clickField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-business-registration/entry-layout/div/div/div/entry-default-business-registration/entry-create-business-form/form/peb-form-background/div/two-column-form/div/peb-form-field-input/div/div'),
inputField: By.xpath('/html/body/app-root/app-lazy/entry-registration/entry-business-registration/entry-layout/div/div/div/entry-default-business-registration/entry-create-business-form/form/peb-form-background/div/two-column-form/div/peb-form-field-input/div/div/div/input'),
value: ''
}
};
}
async enterFieldData(fieldKey, value) {
let field = this.fields[fieldKey];
let clickField = await this.driver.wait(until.elementLocated(field.clickField));
await this.driver.wait(until.elementIsVisible(clickField));
await this.driver.wait(until.elementIsEnabled(clickField));
await clickField.click();
let inputField = await this.driver.wait(until.elementLocated(field.inputField));
await this.driver.wait(until.elementIsVisible(inputField));
await this.driver.wait(until.elementIsEnabled(inputField));
await inputField.clear();
await inputField.sendKeys(value);
field.value = value;
}
async navigateTo(url) {
await this.driver.get(url);
}
}
module.exports = RegistrationPage;