Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium: Adapt selenium tests after merging JDT.LS branch in master #11715

Merged
merged 4 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE;
import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.FOLDER;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import com.google.inject.name.Named;
Expand All @@ -47,6 +48,7 @@
import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor;
import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -217,7 +219,14 @@ private void importPlainJavaApp(String url, String nameApp, String typeProject)
projectWizard.waitCreateProjectWizardForm();
projectWizard.selectTypeProject(typeProject);
projectWizard.clickNextButton();
projectWizard.waitExpTextInSourceFolder("src", Wizard.TypeFolder.SOURCE_FOLDER);

try {
projectWizard.waitExpTextInSourceFolder("src", Wizard.TypeFolder.SOURCE_FOLDER);
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/11516");
}

projectWizard.clickSaveButton();
projectWizard.waitCloseProjectConfigForm();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR;
import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING;
import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.net.URL;
Expand All @@ -30,6 +31,7 @@
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Refactor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -110,7 +112,14 @@ public void checkCodeAssistAfterMoveItem() {
editor.goToCursorPositionVisible(33, 5);
editor.launchPropositionAssistPanel();
loader.waitOnClosed();
editor.waitTextIntoFixErrorProposition("Import 'A5' (p1)");

try {
editor.waitTextIntoFixErrorProposition("Import 'A5' (p1)");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/11701");
}

editor.enterTextIntoFixErrorPropByEnter("Import 'A5' (p1)");
editor.waitTextIntoEditor("import p1.A5;");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public void checkMoveItem0() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A0.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand All @@ -145,8 +145,8 @@ public void checkMoveItem1() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A1.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand Down Expand Up @@ -176,7 +176,6 @@ public void checkMoveItem2() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
Expand All @@ -189,52 +188,51 @@ public void checkMoveItem2() throws Exception {

@Test
public void checkMoveItem3() throws Exception {
setFieldsForTest("test3");
setFieldsForTestB("test3");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A3.java");
setFieldsForTest("test5");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A5.java");
editor.waitActive();
editor.waitTextIntoEditor(contentFromInA);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/fred3/B3.java");
editor.waitActive();
editor.waitTextIntoEditor(contentFromInB);
projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/r/A3.java");
projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A5.java");
projectExplorer.launchRefactorMoveByKeyboard();
refactor.waitMoveItemFormIsOpen();
refactor.clickOnExpandIconTree(PROJECT_NAME);
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.chooseDestinationForItem("r");
refactor.waitTextInErrorMessage("A file or folder cannot be moved to its own parent.");
refactor.chooseDestinationForItem("r.r");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
editor.waitTextIntoEditor(contentFromOutB);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A3.java");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A5.java");
editor.waitTextIntoEditor(contentFromOutA);
projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/r/A3.java");
projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A5.java");
}

@Test
public void checkMoveItem5() throws Exception {
setFieldsForTest("test5");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A5.java");
setFieldsForTest("test3");
setFieldsForTestB("test3");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A3.java");
editor.waitActive();
editor.waitTextIntoEditor(contentFromInA);
projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A5.java");
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/fred3/B3.java");
editor.waitActive();
editor.waitTextIntoEditor(contentFromInB);
projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/r/A3.java");
projectExplorer.launchRefactorMoveByKeyboard();
refactor.waitMoveItemFormIsOpen();
refactor.clickOnExpandIconTree(PROJECT_NAME);
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("r");
refactor.waitTextInErrorMessage("A file or folder cannot be moved to its own parent.");
refactor.chooseDestinationForItem("r.r");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A5.java");
editor.waitTextIntoEditor(contentFromOutB);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A3.java");
editor.waitTextIntoEditor(contentFromOutA);
projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A5.java");
projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/r/A3.java");
}

@Test
Expand All @@ -250,8 +248,8 @@ public void checkMoveItem6() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A6.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand All @@ -276,8 +274,8 @@ public void checkMoveItem7() throws Exception {
refactor.chooseDestinationForItem("(default package)");
refactor.waitTextInMoveForm("Java references will not be updated.");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/A7.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand All @@ -297,8 +295,8 @@ public void checkMoveItem8() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/Klass.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand All @@ -319,8 +317,8 @@ public void checkMoveItem9() throws Exception {
refactor.clickOnExpandIconTree("/src/main/java");
refactor.chooseDestinationForItem("p1");
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitMoveItemFormIsClosed();
loader.waitOnClosed();
events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT);
projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A9.java");
editor.waitTextIntoEditor(contentFromOutA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*/
package org.eclipse.che.selenium.refactor.packages;

import static org.testng.Assert.fail;

import com.google.inject.Inject;
import java.net.URL;
import java.nio.file.Paths;
Expand All @@ -27,6 +29,7 @@
import org.eclipse.che.selenium.pageobject.Menu;
import org.eclipse.che.selenium.pageobject.ProjectExplorer;
import org.eclipse.che.selenium.pageobject.Refactor;
import org.openqa.selenium.TimeoutException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -158,12 +161,12 @@ public class RenamePackageTest {
+ "}\n";

private static String TEST10_HIERAR_OUT =
"package your.pack;\n"
"package yo_ur.pack;\n"
+ "\n"
+ "public class C {\n"
+ "/*\n"
+ "your.pack\n"
+ "your.pack.subpack\n"
+ "yo_ur.pack\n"
+ "yo_ur.pack.subpack\n"
+ "m_y.pack2\n"
+ "m_y.pack2.subpack\n"
+ "not.m_y.pack.subpack\n"
Expand Down Expand Up @@ -373,6 +376,14 @@ public void checkTest3() {
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/main");
projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/main/Textfile.txt");
editor.waitTextIntoEditor(TEST12_RENAME_WITH_RESOURCE_OUT);

try {
projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/src/main/java/mine");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/11713");
}

editor.closeFileByNameWithSaving("Textfile.txt");
}

Expand Down Expand Up @@ -567,6 +578,7 @@ public void checkTestHierarchical9_1() {
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/your");
projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/your/MyA.java");
editor.waitTextIntoEditor(TEST9_HIERAR_OUT);
projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/src/main/java/my");
editor.closeFileByNameWithSaving("MyA");
}

Expand All @@ -585,14 +597,22 @@ public void checkTestHierarchical10() {
refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false);
refactor.setAndWaitStateCommentsAndStringsCheckbox(true);
loader.waitOnClosed();
refactor.clearFieldAndSendKeys("your.pack");
refactor.waitTextIntoNewNameField("your.pack");
refactor.clearFieldAndSendKeys("yo_ur.pack");
refactor.waitTextIntoNewNameField("yo_ur.pack");
loader.waitOnClosed();
refactor.clickOkButtonRefactorForm();
loader.waitOnClosed();
refactor.waitRenamePackageFormIsClosed();
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/your/pack");
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/yo_ur/pack");
editor.waitTextIntoEditor(TEST10_HIERAR_OUT);

try {
projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/src/main/java/m_y");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/11713");
}

editor.closeFileByNameWithSaving("C");
}

Expand Down Expand Up @@ -621,6 +641,14 @@ public void checkTestDisableImport11() {
refactor.waitRenamePackageFormIsClosed();
projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/your_/pack");
editor.waitTextIntoEditor(TEST11_DISABLED_IMPORT_OUT);

try {
projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/src/main/java/my_");
} catch (TimeoutException ex) {
// remove try-catch block after issue has been resolved
fail("Known permanent failure https://github.com/eclipse/che/issues/11713");
}

editor.closeFileByNameWithSaving("C");
}

Expand Down