From 19b1cf89827a4b0b6c929a96457eef326f42294a Mon Sep 17 00:00:00 2001 From: Wilson Kurniawan Date: Sun, 16 Jan 2022 10:54:55 +0800 Subject: [PATCH] Improve student profile E2E stability --- .../e2e/pageobjects/StudentProfilePage.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/e2e/java/teammates/e2e/pageobjects/StudentProfilePage.java b/src/e2e/java/teammates/e2e/pageobjects/StudentProfilePage.java index ccf9e165a90d..22e3115c82cb 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/StudentProfilePage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/StudentProfilePage.java @@ -44,15 +44,6 @@ public class StudentProfilePage extends AppPage { @FindBy(className = "upload-edit-photo") private WebElement uploadPopupButton; - @FindBy(className = "profile-upload-picture-submit") - private WebElement uploadPictureSubmit; - - @FindBy(tagName = "tm-upload-edit-profile-picture-modal") - private WebElement uploadEditModal; - - @FindBy(className = "btn-space") - private List editPictureTools; - public StudentProfilePage(Browser browser) { super(browser); } @@ -125,11 +116,13 @@ private void selectGender(StudentProfileAttributes.Gender gender) { } public void uploadPicture() { + WebElement uploadPictureSubmit = browser.driver.findElement(By.className("profile-upload-picture-submit")); click(uploadPictureSubmit); waitForPageToLoad(true); } public void editProfilePhoto() { + List editPictureTools = browser.driver.findElements(By.className("btn-space")); WebElement editPictureRotateRight = editPictureTools.get(0); WebElement editPictureFlipHorizontal = editPictureTools.get(1); WebElement editPictureFlipVertical = editPictureTools.get(2); @@ -160,7 +153,9 @@ public void showPictureEditor() { } public void closePictureEditor() { + WebElement uploadEditModal = browser.driver.findElement(By.tagName("tm-upload-edit-profile-picture-modal")); click(uploadEditModal.findElement(By.className("close"))); + waitForElementStaleness(uploadEditModal); } public void verifyPhotoSize(int height, int width) { @@ -221,6 +216,6 @@ private void ensureGenderIsSelectedAs(StudentProfileAttributes.Gender gender) { } public void waitForUploadEditModalVisible() { - waitForElementVisibility(uploadEditModal); + waitForElementVisibility(By.tagName("tm-upload-edit-profile-picture-modal")); } }