Skip to content

Commit

Permalink
rework 'waitTextInErrorMessage' method in the 'Refactor' page-object …
Browse files Browse the repository at this point in the history
…and add aftermethod logic to the three tests (#8141)
  • Loading branch information
Ohrimenko1988 committed Jan 3, 2018
1 parent b88cd99 commit c8346b2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,12 @@ public void waitTextIntoNamePatternsField(final String expectedText) {
* @param expectedText expected error
*/
public void waitTextInErrorMessage(String expectedText) {
waitExpectedText(By.xpath(ERROR_CONTAINER_OF_COMPILATION_FORM), expectedText);
loadPageWait.until(
(ExpectedCondition<Boolean>)
driver ->
waitElementVisibility(By.xpath(ERROR_CONTAINER_OF_COMPILATION_FORM))
.getText()
.equals(expectedText));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Refactor;
import org.openqa.selenium.Keys;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -63,6 +64,16 @@ public void prepare() throws Exception {
loader.waitOnClosed();
}

@AfterMethod
public void closeForm() {
if (refactor.isWidgetOpened()) {
refactor.clickCancelButtonRefactorForm();
}
if (editor.isAnyTabsOpened()) {
editor.closeAllTabs();
}
}

@Test
public void testFail0() throws Exception {
setFieldsForTest("testfail0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Refactor;
import org.openqa.selenium.Keys;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -65,6 +66,16 @@ public void prepare() throws Exception {
loader.waitOnClosed();
}

@AfterMethod
public void closeForm() {
if (refactor.isWidgetOpened()) {
refactor.clickCancelButtonRefactorForm();
}
if (editor.isAnyTabsOpened()) {
editor.closeAllTabs();
}
}

@Test
public void testFail0() throws Exception {
setFieldsForTest("testfail0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.openqa.selenium.WebDriverException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -88,6 +89,16 @@ public void setFieldsForTest(Method method) {
}
}

@AfterMethod
public void closeForm() {
if (refactor.isWidgetOpened()) {
refactor.clickCancelButtonRefactorForm();
}
if (editor.isAnyTabsOpened()) {
editor.closeAllTabs();
}
}

@Test
public void testFail26() {
loader.waitOnClosed();
Expand Down

0 comments on commit c8346b2

Please sign in to comment.