|
1 | 1 | package pageobject;
|
2 | 2 |
|
| 3 | +import org.openqa.selenium.JavascriptExecutor; |
3 | 4 | import org.openqa.selenium.WebElement;
|
4 | 5 | import org.openqa.selenium.support.FindBy;
|
5 | 6 |
|
6 | 7 | public class UserProfilePageObject extends BasePageObject {
|
7 | 8 |
|
8 |
| - @FindBy(xpath = "//*[@id = 'mw-input-wppassword']") |
9 |
| - protected WebElement changePasswordButton; |
| 9 | + @FindBy(xpath = "//*[@type='submit']") |
| 10 | + protected WebElement submitButton; |
10 | 11 |
|
11 |
| - @FindBy(xpath = "//*[@name='password']") |
12 |
| - protected WebElement passwordElement; |
| 12 | + @FindBy(id = "mw-prefsection-rendering-dateformat") |
| 13 | + protected WebElement dateFormatElement; |
13 | 14 |
|
14 |
| - @FindBy(xpath = "//*[@name='retype']") |
15 |
| - protected WebElement retypePasswordElement; |
| 15 | + @FindBy(id = "ooui-php-497") |
| 16 | + protected WebElement appearanceButton; |
16 | 17 |
|
17 |
| - @FindBy(xpath = "//*[@type='submit']") |
18 |
| - protected WebElement changeCredentialButton; |
| 18 | + @FindBy(xpath = "//*[@class='mw-notification-content']") |
| 19 | + protected WebElement notificationElement; |
| 20 | + |
| 21 | + @FindBy(xpath = "//label[@for='ooui-php-84']") |
| 22 | + protected WebElement oldDataFormatElement; |
| 23 | + |
| 24 | + @FindBy(xpath = "//label[@for='ooui-php-85']") |
| 25 | + protected WebElement newDataFormatElement; |
19 | 26 |
|
20 | 27 | public UserProfilePageObject(DriverHolder driverHolder) {
|
21 | 28 | super(driverHolder.getDriver());
|
22 | 29 | }
|
23 | 30 |
|
24 |
| - public void setUserNewPassword(String userPassword) { |
25 |
| - waitForVisibility(passwordElement); |
26 |
| - passwordElement.clear(); |
27 |
| - passwordElement.sendKeys(userPassword); |
| 31 | + public void clickAppearanceButton() { |
| 32 | + waitForVisibility(appearanceButton).click(); |
| 33 | + } |
| 34 | + |
| 35 | + public void chooseNewDataFormat() { |
| 36 | + waitForVisibility(newDataFormatElement).click(); |
| 37 | + } |
| 38 | + |
| 39 | + public boolean isNotificationDisplayed() { |
| 40 | + return waitForVisibility(notificationElement).isDisplayed(); |
28 | 41 | }
|
29 | 42 |
|
30 |
| - public void retypeUserPassword(String userPassword) { |
31 |
| - waitForVisibility(retypePasswordElement); |
32 |
| - retypePasswordElement.clear(); |
33 |
| - retypePasswordElement.sendKeys(userPassword); |
| 43 | + public void clickSubmitButton() { |
| 44 | + waitForVisibility(submitButton).click(); |
34 | 45 | }
|
35 | 46 |
|
36 |
| - public void clickChangePasswordButton() { |
37 |
| - waitForVisibility(changePasswordButton); |
38 |
| - changePasswordButton.click(); |
| 47 | + public void scrollToDataFormat() { |
| 48 | + JavascriptExecutor jsExecutor = (JavascriptExecutor) getDriver(); |
| 49 | + jsExecutor.executeScript("arguments[0].scrollIntoView(true);", dateFormatElement); |
39 | 50 | }
|
40 | 51 |
|
41 |
| - public void clickChangeCredentialButton() { |
42 |
| - waitForVisibility(changeCredentialButton); |
43 |
| - changeCredentialButton.click(); |
| 52 | + public void chooseOldDataFormat() { |
| 53 | + waitForVisibility(oldDataFormatElement).click(); |
44 | 54 | }
|
45 | 55 |
|
46 | 56 | }
|
0 commit comments