Selenium: Fix unexpected fails in the "refactor" package (#8119)
parent
38038f66a7
commit
4720cb71eb
|
|
@ -486,13 +486,24 @@ public class Refactor {
|
|||
waitElementVisibility(newNameFileInput).sendKeys(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* type into refactoring widget field any key with clear
|
||||
*
|
||||
* @param keys
|
||||
*/
|
||||
public void clearFieldAndSendKeys(String keys) {
|
||||
waitElementVisibility(newNameFileInput).clear();
|
||||
waitExpectedText(newNameFileInput, "");
|
||||
waitElementVisibility(newNameFileInput).sendKeys(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* wait new name into the ''New Name field'
|
||||
*
|
||||
* @param expectedName expected name in new name field
|
||||
*/
|
||||
public void waitTextIntoNewNameField(final String expectedName) {
|
||||
waitExpectedText(NEW_NAME_FIELD, expectedName);
|
||||
waitExpectedText(By.xpath(NEW_NAME_FIELD), expectedName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -529,7 +540,7 @@ public class Refactor {
|
|||
* @param expectedText expected error
|
||||
*/
|
||||
public void waitTextInErrorMessage(String expectedText) {
|
||||
waitExpectedText(ERROR_CONTAINER_OF_COMPILATION_FORM, expectedText);
|
||||
waitExpectedText(By.xpath(ERROR_CONTAINER_OF_COMPILATION_FORM), expectedText);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -676,17 +687,17 @@ public class Refactor {
|
|||
loadPageWait.until(attributeToBe(element, "value", expectedText));
|
||||
}
|
||||
|
||||
private void waitExpectedText(String elementXpath, String expectedText) {
|
||||
private void waitExpectedText(By locator, String expectedText) {
|
||||
loadPageWait.until(
|
||||
(ExpectedCondition<Boolean>)
|
||||
driver -> waitElementVisibility(elementXpath).getText().equals(expectedText));
|
||||
driver -> waitElementVisibility(locator).getAttribute("value").equals(expectedText));
|
||||
}
|
||||
|
||||
private WebElement waitElementVisibility(WebElement element) {
|
||||
return loadPageWait.until(visibilityOf(element));
|
||||
}
|
||||
|
||||
private WebElement waitElementVisibility(String elementXpath) {
|
||||
return loadPageWait.until(visibilityOfElementLocated(By.xpath(elementXpath)));
|
||||
private WebElement waitElementVisibility(By locator) {
|
||||
return loadPageWait.until(visibilityOfElementLocated(locator));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.eclipse.che.selenium.pageobject.Refactor;
|
|||
import org.eclipse.che.selenium.refactor.Services;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.TimeoutException;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
@ -70,6 +71,16 @@ public class RenamePrivateFieldTest {
|
|||
.expandSpringProjectNodes(PROJECT_NAME);
|
||||
}
|
||||
|
||||
@AfterMethod
|
||||
public void closeForm() {
|
||||
if (refactor.isWidgetOpened()) {
|
||||
refactor.clickCancelButtonRefactorForm();
|
||||
}
|
||||
if (editor.isAnyTabsOpened()) {
|
||||
editor.closeAllTabs();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkRenamePrivateField0() throws Exception {
|
||||
setFieldsForTest("test0");
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class RenamePackageSpringTest {
|
|||
refactor.waitRenamePackageFormIsOpen();
|
||||
refactor.setAndWaitStateUpdateReferencesCheckbox(true);
|
||||
loader.waitOnClosed();
|
||||
refactor.sendKeysIntoField("org.eclipse.dev.examples");
|
||||
refactor.sendKeysIntoField(NEW_NAME_PACKAGE);
|
||||
waitTextIntoNewNameField(NEW_NAME_PACKAGE);
|
||||
loader.waitOnClosed();
|
||||
refactor.clickOkButtonRefactorForm();
|
||||
|
|
@ -110,7 +110,7 @@ public class RenamePackageSpringTest {
|
|||
refactor.waitRenamePackageFormIsOpen();
|
||||
refactor.setAndWaitStateUpdateReferencesCheckbox(true);
|
||||
loader.waitOnClosed();
|
||||
refactor.sendKeysIntoField("org.eclipse.dev.examples");
|
||||
refactor.sendKeysIntoField(OLD_NAME_PACKAGE);
|
||||
waitTextIntoNewNameField(OLD_NAME_PACKAGE);
|
||||
loader.waitOnClosed();
|
||||
refactor.clickOkButtonRefactorForm();
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ public class RenamePackageTest {
|
|||
refactor.setAndWaitStateUpdateReferencesCheckbox(true);
|
||||
refactor.setAndWaitStateRenameSubpackagesCheckbox(true);
|
||||
refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(true);
|
||||
refactor.sendKeysIntoField("test4.q");
|
||||
refactor.clearFieldAndSendKeys("test4.q");
|
||||
waitTextInNewNameField("test4.q");
|
||||
loader.waitOnClosed();
|
||||
refactor.typeAndWaitFileNamePatterns("*.txt");
|
||||
|
|
@ -493,7 +493,7 @@ public class RenamePackageTest {
|
|||
refactor.setAndWaitStateRenameSubpackagesCheckbox(true);
|
||||
refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false);
|
||||
loader.waitOnClosed();
|
||||
refactor.sendKeysIntoField("test7.q");
|
||||
refactor.clearFieldAndSendKeys("test7.q");
|
||||
waitTextInNewNameField("test7.q");
|
||||
loader.waitOnClosed();
|
||||
clickOkButtonIntoRefactorForm();
|
||||
|
|
@ -586,7 +586,7 @@ public class RenamePackageTest {
|
|||
refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false);
|
||||
refactor.setAndWaitStateCommentsAndStringsCheckbox(true);
|
||||
loader.waitOnClosed();
|
||||
refactor.sendKeysIntoField("your.pack");
|
||||
refactor.clearFieldAndSendKeys("your.pack");
|
||||
waitTextInNewNameField("your.pack");
|
||||
loader.waitOnClosed();
|
||||
refactor.clickOkButtonRefactorForm();
|
||||
|
|
|
|||
Loading…
Reference in New Issue