From 41b5fb4f9003b7554513bc1dd56100159225cf00 Mon Sep 17 00:00:00 2001 From: Dmytro Nochevnov Date: Fri, 19 Jul 2019 15:30:29 +0300 Subject: [PATCH] Remove/disable GWT-related code in Java selenium E2E tests (#13829) Signed-off-by: Dmytro Nochevnov --- pom.xml | 2 +- selenium/che-selenium-core/pom.xml | 9 - .../che/selenium/core/client/GitHubKey.java | 54 ++ .../core/client/TestGitHubServiceClient.java | 1 - selenium/che-selenium-test/pom.xml | 9 - .../pageobject/debug/AbstractDebugConfig.java | 152 ---- .../pageobject/debug/CppDebugConfig.java | 85 --- .../selenium/pageobject/debug/DebugPanel.java | 648 ---------------- .../pageobject/debug/JavaDebugConfig.java | 59 -- .../pageobject/debug/NodeJsDebugConfig.java | 86 --- .../pageobject/debug/PhpDebugConfig.java | 116 --- .../plugins/JavaTestRunnerPluginConsole.java | 259 ------- .../upload/AbstractUploadDialogPage.java | 85 --- .../upload/UploadDirectoryDialogPage.java | 87 --- .../upload/UploadFileDialogPage.java | 70 -- .../CheckFindActionFeatureInCheTest.java | 125 --- ...heckOpenedDialogThroughFindActionTest.java | 53 -- .../selenium/assistant/KeyBindingsTest.java | 119 --- .../assistant/OrganizeImportsTest.java | 166 ---- .../che/selenium/dashboard/AccountTest.java | 2 +- .../selenium/dashboard/CreateFactoryTest.java | 3 + .../selenium/dashboard/CreateStackTest.java | 144 ---- .../dashboard/DeleteRunningWorkspaceTest.java | 3 + .../DeleteStoppingWorkspaceTest.java | 3 + .../dashboard/ImportProjectFromZipTest.java | 121 --- .../dashboard/RenameWorkspaceTest.java | 3 + .../selenium/dashboard/StacksListTest.java | 192 ----- .../AddWorkspaceToOrganizationTest.java | 2 +- .../AdminOfParentOrganizationTest.java | 2 +- .../AdminOfSubOrganizationTest.java | 2 +- .../CreateRootOrganizationTest.java | 2 +- .../DeleteOrganizationByBulkTest.java | 2 +- .../DeleteOrganizationInListTest.java | 2 +- .../organization/DeleteOrganizationTest.java | 2 +- .../organization/FilterOrganizationTest.java | 2 +- .../organization/MemberOrganizationTest.java | 2 +- .../organization/OrganizationMembersTest.java | 2 +- .../organization/RenameOrganizationTest.java | 2 +- .../ShareWorkspaceMemberTest.java | 2 +- .../organization/ShareWorkspaceOwnerTest.java | 9 +- .../SystemAdminOrganizationTest.java | 2 +- .../UserEmptyOrganizationTest.java | 2 +- .../AddOrImportProjectFormTest.java | 512 ------------- .../workspaces/WorkspacesListTest.java | 2 + .../WorkspaceDetailsMachineActionsTest.java | 261 ------- .../WorkspaceDetailsMachinesRamTest.java | 111 --- .../details/WorkspaceDetailsOverviewTest.java | 3 + .../details/WorkspaceDetailsProjectsTest.java | 3 + .../WorkspaceDetailsSingleMachineTest.java | 245 ------ .../debugger/BreakpointReorderingTest.java | 127 ---- .../ChangeVariableWithEvaluatingTest.java | 194 ----- .../debugger/CheckBreakPointStateTest.java | 129 ---- .../debugger/ConditionalBreakpointsTest.java | 195 ----- .../debugger/CppProjectDebuggingTest.java | 143 ---- .../debugger/DebugExternalClassTest.java | 176 ----- .../che/selenium/debugger/DebuggerUtils.java | 80 -- .../debugger/DebuggerWatchExpressionTest.java | 164 ---- .../InnerClassAndLambdaDebuggingTest.java | 208 ----- .../MultimoduleProjectDebuggingTest.java | 236 ------ .../selenium/debugger/NodeJsDebugTest.java | 154 ---- .../debugger/PhpProjectDebuggingTest.java | 244 ------ .../selenium/debugger/RunToCursorTest.java | 140 ---- ...pOverStepReturnWithChangeVariableTest.java | 223 ------ .../che/selenium/debugger/ThreadDumpTest.java | 167 ---- .../CheckReplaceFeatureInEditorTest.java | 112 --- .../editor/CheckRestoringSplitEditorTest.java | 159 ---- .../CheckSearchFeatureInEditorTest.java | 110 --- ...CheckWorkingWithTabByUsingTabListTest.java | 98 --- ...WorkingWithTabsByUsingContextMenuTest.java | 150 ---- .../editor/ContextMenuEditorTest.java | 367 --------- .../editor/SplitEditorFeatureTest.java | 208 ----- .../AutocompleteFeaturesInEditorTest.java | 240 ------ .../autocomplete/AutocompleteJSFilesTest.java | 149 ---- .../AutocompleteProposalJavaDocTest.java | 276 ------- .../AutocompleteWithInheritTest.java | 126 --- ...tocompleteFeaturesInTheTestFolderTest.java | 187 ----- ...ditorMemberActiveLineForOpenedTabTest.java | 143 ---- .../autocomplete/EditorValidationTest.java | 116 --- .../editor/autocomplete/FormatterTest.java | 120 --- .../editor/autocomplete/InheritClassTest.java | 151 ---- .../autocomplete/JavaDocPopupLinkTest.java | 117 --- .../editor/autocomplete/JavaDocPopupTest.java | 234 ------ .../autocomplete/OpenDeclarationTest.java | 154 ---- .../QuickFixAndCodeAssistantFeaturesTest.java | 121 --- .../autocomplete/ShowHintsCommandTest.java | 127 ---- .../CheckFactoryWithMultiModuleTest.java | 109 --- ...ckFactoryWithPerClickCreatePolicyTest.java | 92 --- ...eckFactoryWithPerUserCreatePolicyTest.java | 98 --- .../CheckFactoryWithSincePolicyTest.java | 91 --- .../CheckFactoryWithSparseCheckoutTest.java | 93 --- .../CheckFactoryWithUntilPolicyTest.java | 93 --- .../factory/CheckOpenFileFeatureTest.java | 129 ---- .../factory/CheckRunCommandFeatureTest.java | 126 --- .../factory/CheckSkipRootFolderTest.java | 98 --- .../CheckWelcomePanelOnCodenvyTest.java | 97 --- .../CreateFactoryFromUiWithKeepDirTest.java | 242 ------ .../CreateNamedFactoryFromDashboardTest.java | 127 ---- ...DirectUrlFactoryWithKeepDirectoryTest.java | 10 +- .../DirectUrlFactoryWithRootFolderTest.java | 10 +- ...irectUrlFactoryWithSpecificBranchTest.java | 11 +- .../CheckDeletingProjectByApiTest.java | 67 -- .../CheckFileWatcherExcludeFeatureTest.java | 173 ----- .../filewatcher/EditFilesWithTabsTest.java | 140 ---- .../filewatcher/RefactoringFeatureTest.java | 156 ---- .../RemoveFilesWithActiveTabs.java | 197 ----- .../UpdateFilesWithoutIDETest.java | 121 --- .../che/selenium/git/AddFilesToIndexTest.java | 238 ------ .../che/selenium/git/AmendCommitTest.java | 178 ----- .../AuthorizeOnGithubFromPreferencesTest.java | 167 ---- .../eclipse/che/selenium/git/BranchTest.java | 321 -------- .../selenium/git/CheckoutReferenceTest.java | 216 ------ .../git/CheckoutToRemoteBranchTest.java | 190 ----- ...hWhichAlreadyHasLinkedLocalBranchTest.java | 75 -- .../git/CommitFilesByMultiSelectTest.java | 297 -------- .../che/selenium/git/CommitFilesTest.java | 330 -------- .../git/CreateAndDeleteLocalBranchTest.java | 111 --- ...etchAndMergeRemoteBranchIntoLocalTest.java | 159 ---- .../selenium/git/GitChangeMarkersTest.java | 209 ----- .../che/selenium/git/GitColorsTest.java | 253 ------ .../che/selenium/git/GitCompareTest.java | 283 ------- .../che/selenium/git/GitPanelTest.java | 428 ----------- .../che/selenium/git/GitPullConflictTest.java | 159 ---- .../eclipse/che/selenium/git/GitPullTest.java | 135 ---- .../che/selenium/git/GitResetTest.java | 126 --- .../selenium/git/ImportWizardFormTest.java | 717 ------------------ ...nitializeAndDeleteLocalRepositoryTest.java | 138 ---- .../che/selenium/git/OpenOnGitHubTest.java | 160 ---- .../selenium/git/PullRequestPluginTest.java | 344 --------- .../git/PullRequestPluginWithForkTest.java | 162 ---- .../che/selenium/git/PushingChangesTest.java | 165 ---- .../che/selenium/git/RevertCommitTest.java | 166 ---- .../che/selenium/git/SetGitCommitterTest.java | 59 -- .../selenium/gwt/CheckSimpleGwtAppTest.java | 151 ---- .../AutocompleteCommandsEditorTest.java | 187 ----- ...icFunctionalityInCommandsExplorerTest.java | 130 ---- ...eckIntelligenceCommandFromToolbarTest.java | 217 ------ .../CommandsEditorTest.java | 126 --- .../CommandsPaletteTest.java | 147 ---- .../MacrosCommandsEditorTest.java | 169 ----- .../PreviewUrlIntoCommandsEditorTest.java | 125 --- .../ApacheCamelFileEditingTest.java | 153 ---- .../languageserver/ClangFileEditingTest.java | 188 ----- .../languageserver/GolangFileEditingTest.java | 365 --------- .../languageserver/JsonFileEditingTest.java | 248 ------ .../languageserver/TypeScriptEditingTest.java | 253 ------ .../languageserver/YamlFileEditingTest.java | 312 -------- .../csharp/CSharpClassRenamingTest.java | 97 --- .../CSharpFileAdvancedOperationsTest.java | 124 --- .../csharp/CSharpFileEditingTest.java | 145 ---- .../php/PhpAssistantFeaturesTest.java | 191 ----- .../php/PhpFileEditingTest.java | 139 ---- .../python/PythonAssistantFeaturesTest.java | 165 ---- .../python/PythonFileEditingTest.java | 142 ---- .../CheckGeneratingMavenArchetypeTest.java | 99 --- .../mavenplugin/CheckMavenPluginTest.java | 153 ---- .../mavenplugin/GenerateEffectivePomTest.java | 108 --- .../CheckCreatingProjectInEmptyWsTest.java | 133 ---- .../miscellaneous/CheckMacrosFeatureTest.java | 136 ---- ...kspaceAfterStoppingWsAgentProcessTest.java | 135 ---- .../ConvertToMavenProjectTest.java | 128 ---- ...ConvertToProjectFromConfigurationTest.java | 194 ----- .../miscellaneous/DialogAboutTest.java | 48 -- .../FileStructureBaseOperationTest.java | 129 ---- .../FileStructureByKeyboardTest.java | 121 --- .../FileStructureCodeEditorTest.java | 118 --- .../miscellaneous/FileStructureNodesTest.java | 211 ------ .../miscellaneous/FindTextFeatureTest.java | 482 ------------ .../FindUsagesBaseOperationTest.java | 216 ------ .../ImplementationBaseOperationsTest.java | 181 ----- .../MachinesAsynchronousStartTest.java | 169 ----- .../miscellaneous/NavigateToFileTest.java | 259 ------- .../miscellaneous/OpenInTerminalTest.java | 173 ----- ...lveDependencyAfterRecreateProjectTest.java | 120 --- .../miscellaneous/ServerRuntimeInfoTest.java | 70 -- .../miscellaneous/TerminalTypingTest.java | 120 --- .../WorkingWithSplitPanelTest.java | 224 ------ .../WorkingWithTerminalTest.java | 388 ---------- .../opendeclaration/Eclipse0087Test.java | 69 -- .../opendeclaration/Eclipse0091Test.java | 66 -- .../opendeclaration/Eclipse0093Test.java | 68 -- .../opendeclaration/Eclipse0097Test.java | 67 -- .../opendeclaration/Eclipse0114Test.java | 71 -- .../opendeclaration/Eclipse0115Test.java | 67 -- .../opendeclaration/Eclipse0119Test.java | 67 -- .../opendeclaration/Eclipse0120Test.java | 63 -- .../opendeclaration/Eclipse0121Test.java | 67 -- .../opendeclaration/Eclipse0122Test.java | 66 -- .../plainjava/ConfigureClasspathBaseTest.java | 112 --- .../ConfigureSomeSourceFoldersTest.java | 126 --- ...lainJavaProjectConfigureClasspathTest.java | 208 ----- .../plainjava/RunPlainJavaProjectTest.java | 245 ------ .../CheckErrorsWarningsTabTest.java | 167 ---- .../preferences/ContributeTabTest.java | 276 ------- ...kAutoSaveForFileWhichAlreadyExistTest.java | 127 ---- .../CheckCollapseAllNodesProjectTest.java | 95 --- .../CheckCopyCutFeaturesForFilesTest.java | 129 ---- .../CheckDisplayingArtifactIdTest.java | 95 --- ...WhenCreationDuplicateFolderOrFileTest.java | 102 --- ...enFolderAndFileCreatedFromCommandTest.java | 125 --- .../CheckOnValidAndInvalidClassNameTest.java | 137 ---- ...CheckOnValidAndInvalidPackageNameTest.java | 154 ---- ...CheckRecentFilesAndRevealResourceTest.java | 118 --- .../CheckRefreshProjectTreeTest.java | 94 --- .../CheckShowHideHiddenFilesTest.java | 97 --- .../CheckTreeStructureAfterCloseTest.java | 89 --- .../ClosingSeveralOpenFilesTest.java | 84 -- .../projectexplorer/CreateNewFoldersTest.java | 94 --- ...CreateNewJavaFilesFromContextMenuTest.java | 119 --- .../CreateNewJavaFilesTest.java | 124 --- ...ateNewNotJavaFilesFromContextMenuTest.java | 154 ---- .../CreateNewNotJavaFilesTest.java | 165 ---- .../CreateNewPackageFromContextMenuTest.java | 80 -- ...PackagesWithHelpCreationJavaClassTest.java | 100 --- .../CreateProjectInSelectedFolderTest.java | 111 --- .../projectexplorer/CreateProjectTest.java | 101 --- .../CreateProjectsForArtikPluginTest.java | 145 ---- .../DeleteFilesFromContextMenuTest.java | 146 ---- .../projectexplorer/DeleteFilesTest.java | 144 ---- .../DeletePackageFromContextMenuTest.java | 142 ---- .../projectexplorer/DeletePackageTest.java | 142 ---- .../DeletePackageWithOpenedFilesTabTest.java | 148 ---- .../projectexplorer/DeleteProjectsTest.java | 153 ---- .../projectexplorer/DownloadProjectTest.java | 254 ------- ...FileNotExistIntoEditorAfterDeleteTest.java | 146 ---- .../FileOpenedAfterCreationTest.java | 101 --- ...FileNotExistIntoEditorAfterDeleteTest.java | 104 --- .../NavigationByKeyboardTest.java | 214 ------ .../OpenFileWithHelpContextMenuTest.java | 225 ------ .../projectexplorer/PreviewHtmlFileTest.java | 113 --- .../RenameJustCreatedNotJavaFileTest.java | 99 --- .../projectexplorer/RenameProjectTest.java | 109 --- .../RenamedAlreadyCreatedNotJavaFileTest.java | 94 --- .../ShowFileReferenceTest.java | 72 -- .../UploadIntoProjectTest.java | 297 -------- ...enExternalLibraryFileAfterRefreshTest.java | 83 -- .../TransitiveDependencyTest.java | 105 --- .../dependencies/UpdateListOfLibraryTest.java | 175 ----- .../fields/FailNotPrivateFieldTest.java | 196 ----- .../refactor/fields/FailPrivateFieldTest.java | 176 ----- .../fields/RenameNotPrivateFieldTest.java | 469 ------------ .../fields/RenamePrivateFieldSmokeTest.java | 118 --- .../fields/RenamePrivateFieldTest.java | 404 ---------- .../methods/RenameMethodInInterfaceTest.java | 240 ------ .../methods/RenamePrivateMethodTest.java | 232 ------ .../methods/RenameStaticMethodsTest.java | 222 ------ .../methods/RenameVirtualMethodsTest.java | 216 ------ .../move/CodeAssistAfterMoveItemTest.java | 117 --- .../refactor/move/FailMoveItemTest.java | 118 --- .../selenium/refactor/move/MoveItemsTest.java | 354 --------- .../move/MoveJavaClassToSubpackageTest.java | 80 -- .../MoveJavaFileInNewSourceFolderTest.java | 132 ---- .../packages/RenamePackageSmokeTest.java | 97 --- .../packages/RenamePackageSpringTest.java | 146 ---- .../refactor/packages/RenamePackageTest.java | 699 ----------------- .../parameters/FailParametersTest.java | 187 ----- .../parameters/RenameParametersTest.java | 324 -------- .../preview/CheckTreeInRefactorPanelTest.java | 91 --- .../preview/PreviewRefactoringTest.java | 155 ---- .../selenium/refactor/types/GenericsTest.java | 130 ---- .../refactor/types/IllegalTypeNameTest.java | 104 --- .../refactor/types/RenameTypeTest.java | 203 ----- .../refactor/types/TestAnnotationsTest.java | 120 --- .../refactor/types/TestEnumerationsTest.java | 123 --- .../selenium/refactor/types/TestFailTest.java | 152 ---- .../che/selenium/swagger/SwaggerTest.java | 14 +- .../selenium/testrunner/CompileCommand.java | 63 -- ...uginJunit4CheckRunSuitesAndScopesTest.java | 143 ---- .../testrunner/JavaTestPluginJunit4Test.java | 177 ----- .../testrunner/JavaTestPluginTestNgTest.java | 216 ------ .../selenium/theia/TheiaBuildPluginTest.java | 1 + .../workspaces/CheckStopStartWsTest.java | 50 -- .../CheckStoppingWsByTimeoutTest.java | 3 + .../CreateWorkspaceOnDashboardTest.java | 4 +- .../ProjectStateAfterRefreshTest.java | 4 +- .../ProjectStateAfterRenameWorkspaceTest.java | 3 + ...ProjectStateAfterWorkspaceRestartTest.java | 7 +- ...spaceFromOfficialUbuntuImageStartTest.java | 41 - .../suites/CheOneThreadTestsSuite.xml | 6 +- .../resources/suites/CheProdPreviewSuite.xml | 9 - .../src/test/resources/suites/CheSuite.xml | 208 +---- .../test/resources/suites/SmokeTestsSuite.xml | 31 - 281 files changed, 146 insertions(+), 39779 deletions(-) create mode 100644 selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/GitHubKey.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/AbstractDebugConfig.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/CppDebugConfig.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/DebugPanel.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/JavaDebugConfig.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/NodeJsDebugConfig.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/PhpDebugConfig.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/plugins/JavaTestRunnerPluginConsole.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/AbstractUploadDialogPage.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadDirectoryDialogPage.java delete mode 100644 selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadFileDialogPage.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckFindActionFeatureInCheTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckOpenedDialogThroughFindActionTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/KeyBindingsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/OrganizeImportsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateStackTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromZipTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/StacksListTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/AddOrImportProjectFormTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachineActionsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachinesRamTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsSingleMachineTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/BreakpointReorderingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ChangeVariableWithEvaluatingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CheckBreakPointStateTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ConditionalBreakpointsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CppProjectDebuggingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebugExternalClassTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerUtils.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerWatchExpressionTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/InnerClassAndLambdaDebuggingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/MultimoduleProjectDebuggingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/PhpProjectDebuggingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/RunToCursorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/StepIntoStepOverStepReturnWithChangeVariableTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ThreadDumpTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckReplaceFeatureInEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckRestoringSplitEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckSearchFeatureInEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabByUsingTabListTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabsByUsingContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/ContextMenuEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/SplitEditorFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteFeaturesInEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteJSFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteProposalJavaDocTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteWithInheritTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/CheckAutocompleteFeaturesInTheTestFolderTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorMemberActiveLineForOpenedTabTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorValidationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/FormatterTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/InheritClassTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupLinkTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/OpenDeclarationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/QuickFixAndCodeAssistantFeaturesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/ShowHintsCommandTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithMultiModuleTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerClickCreatePolicyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerUserCreatePolicyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSincePolicyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSparseCheckoutTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithUntilPolicyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckOpenFileFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckRunCommandFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckSkipRootFolderTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckWelcomePanelOnCodenvyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateFactoryFromUiWithKeepDirTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashboardTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckDeletingProjectByApiTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckFileWatcherExcludeFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/EditFilesWithTabsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RefactoringFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RemoveFilesWithActiveTabs.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/UpdateFilesWithoutIDETest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AddFilesToIndexTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AmendCommitTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromPreferencesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/BranchTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutReferenceTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchWhichAlreadyHasLinkedLocalBranchTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesByMultiSelectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CreateAndDeleteLocalBranchTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/FetchAndMergeRemoteBranchIntoLocalTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitChangeMarkersTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitColorsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitCompareTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPanelTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullConflictTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitResetTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/ImportWizardFormTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/InitializeAndDeleteLocalRepositoryTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/OpenOnGitHubTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginWithForkTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PushingChangesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/RevertCommitTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/SetGitCommitterTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/gwt/CheckSimpleGwtAppTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/AutocompleteCommandsEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckBasicFunctionalityInCommandsExplorerTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckIntelligenceCommandFromToolbarTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsPaletteTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/MacrosCommandsEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/PreviewUrlIntoCommandsEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ClangFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/GolangFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/JsonFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/TypeScriptEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/YamlFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpClassRenamingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileAdvancedOperationsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/php/PhpAssistantFeaturesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/php/PhpFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonAssistantFeaturesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonFileEditingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckGeneratingMavenArchetypeTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckMavenPluginTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/GenerateEffectivePomTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckCreatingProjectInEmptyWsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckMacrosFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckRestoringWorkspaceAfterStoppingWsAgentProcessTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectFromConfigurationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/DialogAboutTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureBaseOperationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureByKeyboardTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureCodeEditorTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureNodesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindTextFeatureTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindUsagesBaseOperationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ImplementationBaseOperationsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/MachinesAsynchronousStartTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/OpenInTerminalTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ResolveDependencyAfterRecreateProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ServerRuntimeInfoTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/TerminalTypingTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithSplitPanelTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithTerminalTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0087Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0091Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0093Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0097Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0114Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0115Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0119Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0120Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0121Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0122Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureClasspathBaseTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureSomeSourceFoldersTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/PlainJavaProjectConfigureClasspathTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/RunPlainJavaProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/CheckErrorsWarningsTabTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/ContributeTabTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckAutoSaveForFileWhichAlreadyExistTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCollapseAllNodesProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCopyCutFeaturesForFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckDisplayingArtifactIdTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckErrorMessageWhenCreationDuplicateFolderOrFileTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckHiddenFolderAndFileCreatedFromCommandTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidClassNameTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidPackageNameTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRecentFilesAndRevealResourceTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRefreshProjectTreeTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckShowHideHiddenFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckTreeStructureAfterCloseTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ClosingSeveralOpenFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewFoldersTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesFromContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesFromContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackageFromContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackagesWithHelpCreationJavaClassTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectInSelectedFolderTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectsForArtikPluginTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesFromContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageFromContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageWithOpenedFilesTabTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteProjectsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DownloadProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileNotExistIntoEditorAfterDeleteTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileOpenedAfterCreationTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/JustCreatedFileNotExistIntoEditorAfterDeleteTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/NavigationByKeyboardTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/OpenFileWithHelpContextMenuTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/PreviewHtmlFileTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameJustCreatedNotJavaFileTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenamedAlreadyCreatedNotJavaFileTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ShowFileReferenceTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/UploadIntoProjectTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/OpenExternalLibraryFileAfterRefreshTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/TransitiveDependencyTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/UpdateListOfLibraryTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailNotPrivateFieldTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailPrivateFieldTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenameNotPrivateFieldTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldSmokeTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameMethodInInterfaceTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenamePrivateMethodTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameStaticMethodsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameVirtualMethodsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/CodeAssistAfterMoveItemTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/FailMoveItemTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveItemsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaClassToSubpackageTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaFileInNewSourceFolderTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSmokeTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSpringTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/FailParametersTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/RenameParametersTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/CheckTreeInRefactorPanelTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/PreviewRefactoringTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/GenericsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/IllegalTypeNameTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/RenameTypeTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestAnnotationsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestEnumerationsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestFailTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/CompileCommand.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4CheckRunSuitesAndScopesTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4Test.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStopStartWsTest.java delete mode 100644 selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/WorkspaceFromOfficialUbuntuImageStartTest.java diff --git a/pom.xml b/pom.xml index 16b5cb7bcb4..c95a288952d 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ dashboard workspace-loader assembly - + selenium scm:git:git@github.com:eclipse/che.git diff --git a/selenium/che-selenium-core/pom.xml b/selenium/che-selenium-core/pom.xml index 2a1665f6c24..29aa7f9a9ac 100644 --- a/selenium/che-selenium-core/pom.xml +++ b/selenium/che-selenium-core/pom.xml @@ -107,10 +107,6 @@ org.eclipse.che.multiuser che-multiuser-api-permission-shared - - org.eclipse.che.plugin - che-plugin-github-shared - org.kohsuke github-api @@ -144,11 +140,6 @@ che-core-commons-inject provided - - org.eclipse.che.plugin - che-plugin-github-server - provided - ch.qos.logback logback-classic diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/GitHubKey.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/GitHubKey.java new file mode 100644 index 00000000000..b05adb68957 --- /dev/null +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/GitHubKey.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2012-2018 Red Hat, Inc. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + */ +package org.eclipse.che.selenium.core.client; + +import org.eclipse.che.dto.shared.DTO; + +@DTO +public class GitHubKey { + private int id; + private String key; + private String url; + private String title; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestGitHubServiceClient.java b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestGitHubServiceClient.java index 37e2fa1ec26..d796c750261 100644 --- a/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestGitHubServiceClient.java +++ b/selenium/che-selenium-core/src/main/java/org/eclipse/che/selenium/core/client/TestGitHubServiceClient.java @@ -29,7 +29,6 @@ import org.eclipse.che.api.core.rest.HttpJsonRequestFactory; import org.eclipse.che.api.core.rest.HttpJsonResponse; import org.eclipse.che.dto.server.JsonStringMapImpl; -import org.eclipse.che.plugin.github.shared.GitHubKey; import org.slf4j.Logger; /** @author Mihail Kuznyetsov. */ diff --git a/selenium/che-selenium-test/pom.xml b/selenium/che-selenium-test/pom.xml index 31fdc79a4e2..82c207632b0 100644 --- a/selenium/che-selenium-test/pom.xml +++ b/selenium/che-selenium-test/pom.xml @@ -67,10 +67,6 @@ org.eclipse.che.core che-core-api-core - - org.eclipse.che.core - che-core-api-debug-shared - org.eclipse.che.core che-core-api-dto @@ -147,11 +143,6 @@ che-multiuser-api-permission runtime - - org.eclipse.che.plugin - che-plugin-github-server - runtime - ch.qos.logback logback-classic diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/AbstractDebugConfig.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/AbstractDebugConfig.java deleted file mode 100644 index 480eda94c55..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/AbstractDebugConfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.debug.AbstractDebugConfig.Locators.DEBUG_CONFIGURATION_WIDGET_ID; - -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -/** - * @author Dmytro Nochevnov - * @author Musienko Maxim - */ -@Singleton -public abstract class AbstractDebugConfig { - private SeleniumWebDriverHelper seleniumWebDriverHelper; - - protected final SeleniumWebDriver seleniumWebDriver; - - public AbstractDebugConfig( - SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { - this.seleniumWebDriver = seleniumWebDriver; - this.seleniumWebDriverHelper = seleniumWebDriverHelper; - PageFactory.initElements(seleniumWebDriver, this); - } - - interface Locators { - String DEBUG_CONFIGURATION_WIDGET_ID = "editDebugConfigurationsView"; - - String NAME_OF_DEBUG_CONFIG_FIELD_XPATH = - "//div[@id='editDebugConfigurationsView']//div[text()='Name']/following-sibling::input"; - - String DEBUG_CONFIG_SAVE_BTN_XPATH = - "//button[@id='window-edit-debug-configurations-save' and not(@disabled)]"; - String DEBUG_CONFIG_CLOSE_BTN_XPATH = "window-edit-debug-configurations-close"; - - String CONFIG_ITEM_XPATH_TEMPLATE = - "//div[@id='editDebugConfigurationsView']//div[contains(@id, 'gwt-debug-debug-configuration') and text()='%s']"; - String REMOVE_CONFIG_BUTTON_XPATH_TEMPLATE = CONFIG_ITEM_XPATH_TEMPLATE + "/span/span[1]"; - - String DELETE_CONFIGURATION_DIALOG_TITLE_XPATH = "//div[text()='Delete Configuration']"; - - String DEBUG_BUTTON_ID = "window-edit-debug-configurations-debug"; - } - - @FindBy(id = DEBUG_CONFIGURATION_WIDGET_ID) - WebElement debugConfigurationsView; - - @FindBy(xpath = Locators.NAME_OF_DEBUG_CONFIG_FIELD_XPATH) - WebElement nameFieldOfDebugConf; - - @FindBy(id = Locators.DEBUG_CONFIG_CLOSE_BTN_XPATH) - WebElement configCloseBtn; - - @FindBy(id = Locators.DEBUG_BUTTON_ID) - WebElement debugButton; - - @FindBy(xpath = Locators.DEBUG_CONFIG_SAVE_BTN_XPATH) - WebElement configSaveBtn; - - @FindBy(xpath = Locators.DELETE_CONFIGURATION_DIALOG_TITLE_XPATH) - WebElement deleteConfigurationDialogTitle; - - /** Wait opening of the Debug configuration widget */ - public void waitDebugConfigurationIsOpened() { - seleniumWebDriverHelper.waitVisibility(debugConfigurationsView, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - /** Wait closing of the Debug configuration widget */ - public void waitDebugConfigurationIsClosed() { - seleniumWebDriverHelper.waitInvisibility( - By.id(DEBUG_CONFIGURATION_WIDGET_ID), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - /** - * Remove debug config with certain name and then close Debug Configuration form. - * - * @param configName name of configuration to remove. - */ - public void removeConfig(String configName) { - String configItemXpath = String.format(Locators.CONFIG_ITEM_XPATH_TEMPLATE, configName); - seleniumWebDriverHelper.waitAndClick(By.xpath(configItemXpath)); - String removeConfigButtonXpath = - String.format(Locators.REMOVE_CONFIG_BUTTON_XPATH_TEMPLATE, configName); - seleniumWebDriverHelper.waitAndClick(By.xpath(removeConfigButtonXpath)); - seleniumWebDriverHelper.waitVisibility(deleteConfigurationDialogTitle); - seleniumWebDriverHelper.waitAndClick(By.id(AskDialog.OK_BTN_ID)); - seleniumWebDriverHelper.waitInvisibility(By.id(AskDialog.OK_BTN_ID)); - seleniumWebDriverHelper.waitInvisibility(By.xpath(configItemXpath)); - close(); - } - - /** - * Return xpath to submenu of "Run > Debug" command - * - * @param projectName - * @return - */ - public String getXpathToІRunDebugCommand(String projectName) { - return String.format( - "//*[@id=\"%1$s/%2$s\" or @id=\"topmenu/Run/Debug/Debug '%2$s'\"]", - TestMenuCommandsConstants.Run.DEBUG, projectName); - } - - /** - * Create debug configuration with default parameters and certain name. - * - * @param configName name of configuration - */ - void createConfigWithoutClosingDialog(String configName) { - waitDebugConfigurationIsOpened(); - expandDebugCategory(); - seleniumWebDriverHelper.waitVisibility(nameFieldOfDebugConf); - nameFieldOfDebugConf.clear(); - nameFieldOfDebugConf.sendKeys(configName); - clickOnSaveBtn(); - } - - /** Expand the debugger type icon '+' */ - public abstract void expandDebugCategory(); - - protected void clickOnSaveBtn() { - seleniumWebDriverHelper.waitAndClick(configSaveBtn); - } - - protected void close() { - seleniumWebDriverHelper.waitAndClick(configCloseBtn); - waitDebugConfigurationIsClosed(); - } - - protected void clickOnDebugAndWaitClosing() { - seleniumWebDriverHelper.waitAndClick(debugButton); - waitDebugConfigurationIsClosed(); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/CppDebugConfig.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/CppDebugConfig.java deleted file mode 100644 index 11824f725df..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/CppDebugConfig.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ATTACHING_ELEM_TO_DOM_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - -/** - * @author Dmytro Nochevnov - * @author Musienko Maxim - */ -@Singleton -public class CppDebugConfig extends AbstractDebugConfig { - - @Inject - public CppDebugConfig( - SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { - super(seleniumWebDriver, seleniumWebDriverHelper); - PageFactory.initElements(seleniumWebDriver, this); - } - - interface Locators { - - String DEBUG_CATEGORY_EXPAND_ICON_XPATH = - "//div[@id='gwt-debug-debugConfigurationTypesPanel']//span[text()='GDB']/following-sibling::span"; - - String DEBUG_PORT_INPUT_XPATH = - "//div[@id='gwt-debug-gdbDebugConfigurationPageView-mainPanel']//input[@type='text' and preceding-sibling::div[text()='Port']]"; - } - - @FindBy(xpath = Locators.DEBUG_CATEGORY_EXPAND_ICON_XPATH) - WebElement debugCategoryExpandIcon; - - @FindBy(xpath = Locators.DEBUG_PORT_INPUT_XPATH) - WebElement debugPortInput; - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName) { - createConfigWithoutClosingDialog(configName); - close(); - } - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName, int debugPort) { - createConfigWithoutClosingDialog(configName); - - // set debug port - new WebDriverWait(seleniumWebDriver, ATTACHING_ELEM_TO_DOM_SEC) - .until(ExpectedConditions.visibilityOf(debugPortInput)); - debugPortInput.clear(); - debugPortInput.sendKeys(String.valueOf(debugPort)); - - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOf(configSaveBtn)) - .click(); - - close(); - } - - @Override - public void expandDebugCategory() { - new WebDriverWait(seleniumWebDriver, ATTACHING_ELEM_TO_DOM_SEC) - .until(ExpectedConditions.visibilityOf(debugCategoryExpandIcon)) - .click(); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/DebugPanel.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/DebugPanel.java deleted file mode 100644 index 41fa729f1b1..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/DebugPanel.java +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.MINIMUM_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; -import static org.openqa.selenium.By.cssSelector; -import static org.openqa.selenium.By.id; -import static org.openqa.selenium.By.tagName; -import static org.openqa.selenium.By.xpath; -import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated; -import static org.testng.Assert.assertEquals; - -import com.google.common.base.Function; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.eclipse.che.api.debug.shared.model.BreakpointConfiguration; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebDriverException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedCondition; -import org.openqa.selenium.support.ui.ExpectedConditions; - -/** - * Page Object for Debugger panel. - * - * @author Musienko Maxim - * @author Oleksandr Andriienko - */ -@Singleton -public class DebugPanel { - - private final SeleniumWebDriver seleniumWebDriver; - private final Loader loader; - private final CodenvyEditor editor; - private final CommandsExplorer commandsExplorer; - private final WebDriverWaitFactory webDriverWaitFactory; - private final SeleniumWebDriverHelper seleniumWebDriverHelper; - - @Inject - public DebugPanel( - SeleniumWebDriver seleniumWebDriver, - Loader loader, - CodenvyEditor editor, - CommandsExplorer commandsExplorer, - WebDriverWaitFactory webDriverWaitFactory, - SeleniumWebDriverHelper seleniumWebDriverHelper) { - this.seleniumWebDriver = seleniumWebDriver; - this.loader = loader; - this.editor = editor; - this.commandsExplorer = commandsExplorer; - this.webDriverWaitFactory = webDriverWaitFactory; - this.seleniumWebDriverHelper = seleniumWebDriverHelper; - - PageFactory.initElements(seleniumWebDriver, this); - } - - private interface Locators { - String DEBUGGER_PANEL_TAB = "gwt-debug-partButton-Debug"; - String FRAMES_LIST_ID = "gwt-debug-debugger-frames-list"; - String THREADS_LIST_ID = "gwt-debug-debugger-threads-list"; - String VARIABLES_TREE_ID = "gwt-debug-debugger-tree"; - String VARIABLES_TREE_SELECT_NODE = "//div[@id='" + VARIABLES_TREE_ID + "']//div[text()='%s']"; - String EXECUTION_POINT = "gwt-debug-execution-point"; - } - - private interface LocatorsTextAreaDialogWindow { - String AGREE_BUTTON = "debugger-textarea-dialog-agree-btn"; - String CANCEL_BTN = "debugger-textarea-dialog-cancel-btn"; - String TEXTAREA = "gwt-debug-value-text-area"; - } - - public interface DebuggerActionButtons { - String RESUME_BTN_ID = "gwt-debug-ActionButton/resumeExecution-true"; - String RUN_TO_CURSOR = "gwt-debug-ActionButton/runToCursor-true"; - String STEP_INTO = "gwt-debug-ActionButton/stepInto-true"; - String STEP_OVER = "gwt-debug-ActionButton/stepOver-true"; - String STEP_OUT = "gwt-debug-ActionButton/stepOut-true"; - String BTN_DISCONNECT = "gwt-debug-ActionButton/disconnectDebug-true"; - String REMOVE_ALL_BREAKPOINTS = "gwt-debug-ActionButton/null-true"; - String EVALUATE_EXPRESSIONS = "gwt-debug-ActionButton/evaluateExpression-true"; - - String CHANGE_DEBUG_TREE_NODE = "gwt-debug-ActionButton/editDebugVariable-true"; - String ADD_WATCH_EXPRESSION = "gwt-debug-ActionButton/addWatchExpression-true"; - String REMOVE_WATCH_EXPRESSION = "gwt-debug-ActionButton/removeWatchExpression-true"; - } - - private interface BreakpointsPanel { - String ID = "gwt-debug-debugger-breakpointsPanel"; - String BREAKPOINT_ITEM = "//div[@id='gwt-debug-debugger-breakpointsPanel']//td[text()='%s']"; - String CONTEXT_MENU_CONFIGURE_BREAKPOINT = "contextMenu/Configure"; - String CONTEXT_MENU_DISABLE_BREAKPOINT = "contextMenu/Disable"; - String CONTEXT_MENU_DELETE_BREAKPOINT = "contextMenu/Delete"; - } - - private interface BreakpointConfigurationWindow { - String BREAKPOINT_CONDITION_TEXT = - "//table[@id='gwt-debug-breakpoint-configuration-window']//input[@id='gwt-debug-breakpoint-condition-text']"; - String BREAKPOINT_CONDITION_ENABLED = - "//table[@id='gwt-debug-breakpoint-configuration-window']//label[@id='gwt-debug-breakpoint-condition-enabled-label']"; - String APPLY_BTN = - "//table[@id='gwt-debug-breakpoint-configuration-window']//button[@id='gwt-debug-apply-btn']"; - String SUSPEND_NONE = - "//table[@id='gwt-debug-breakpoint-configuration-window']//label[@id='gwt-debug-breakpoint-suspend-none-label']"; - String SUSPEND_THREAD = - "//table[@id='gwt-debug-breakpoint-configuration-window']//label[@id='gwt-debug-breakpoint-suspend-thread-label']"; - String SUSPEND_ALL = - "//table[@id='gwt-debug-breakpoint-configuration-window']//label[@id='gwt-debug-breakpoint-suspend-all-label']"; - } - - private interface FramesPanel { - String THREAD_NOT_SUSPENDED_HOLDER = "gwt-debug-thread-not-suspended"; - } - - public enum BreakpointState { - ACTIVE, - INACTIVE, - DISABLED - } - - @FindBy(id = BreakpointsPanel.ID) - WebElement breakpointPanel; - - @FindBy(id = Locators.DEBUGGER_PANEL_TAB) - WebElement debuggerTab; - - @FindBy(id = Locators.VARIABLES_TREE_ID) - WebElement debuggerTree; - - @FindBy(id = LocatorsTextAreaDialogWindow.TEXTAREA) - WebElement textAreaForm; - - @FindBy(id = LocatorsTextAreaDialogWindow.AGREE_BUTTON) - WebElement saveTextAreaDialogBtn; - - @FindBy(id = LocatorsTextAreaDialogWindow.CANCEL_BTN) - WebElement cancelTextAreaDialogChangesBtn; - - @FindBy(id = Locators.FRAMES_LIST_ID) - WebElement frames; - - @FindBy(id = Locators.THREADS_LIST_ID) - WebElement threads; - - /** Wait while debugger panel will be clear for all breakpoints */ - public void waitWhileAllBreakPointsOnEditorPanelDisapper() { - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.invisibilityOfElementLocated(cssSelector("div.breakpoint"))); - } - - /** - * Wait specified content in the IDE breakpoint panel - * - * @param content - */ - public void waitContentInBreakPointPanel(final String content) { - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until( - (WebDriver webDriver) -> { - return breakpointPanel.getText().contains(content); - }); - } - - /** Wait disappearance any breakpoints from debugger breakpoints panel */ - public void waitBreakPointsPanelIsEmpty() { - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until((WebDriver webDriver) -> breakpointPanel.getText().isEmpty()); - } - - /** Wait while the Variables panel appears */ - public void waitVariablesPanel() { - webDriverWaitFactory.get(20).until(ExpectedConditions.visibilityOf(debuggerTree)); - } - - /** - * Wait expected text in variable panel - * - * @param text expected text - */ - public void waitTextInVariablesPanel(final String text) { - waitVariablesPanel(); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until((ExpectedCondition) (webDriver -> debuggerTree.getText().contains(text))); - } - - /** - * Wait text {@code text} is not present in variable panel - * - * @param text expected text - */ - public void waitTextIsNotPresentInVariablesPanel(final String text) { - waitVariablesPanel(); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until((ExpectedCondition) (webDriver -> !debuggerTree.getText().contains(text))); - } - - /** Select node in debugger tree by node {@code text} */ - public void selectNodeInDebuggerTree(String nodeText) { - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until( - visibilityOfElementLocated( - xpath(format(Locators.VARIABLES_TREE_SELECT_NODE, nodeText)))); - seleniumWebDriver - .findElement(xpath(format(Locators.VARIABLES_TREE_SELECT_NODE, nodeText))) - .click(); - } - - /** - * Click on specific button on Debugger panel - * - * @param buttonIdLocator use interface DebuggerActionButtons for select buttonIdLocator - */ - public void clickOnButton(String buttonIdLocator) { - loader.waitOnClosed(); - - webDriverWaitFactory - .get(LOADER_TIMEOUT_SEC) - .until(visibilityOfElementLocated(id(buttonIdLocator))); - seleniumWebDriver.findElement(id(buttonIdLocator)).click(); - loader.waitOnClosed(); - } - - /** Wait appearance text area form */ - public void waitAppearTextAreaForm() { - webDriverWaitFactory.get(20).until(ExpectedConditions.visibilityOf(textAreaForm)); - } - - /** Wait disappear text area form */ - public void waitDisappearTextAreaForm() { - webDriverWaitFactory - .get(20) - .until( - ExpectedConditions.invisibilityOfElementLocated( - xpath(LocatorsTextAreaDialogWindow.TEXTAREA))); - } - - /** - * Clear text from text area dialog and type new value - * - * @param value new value - */ - public void typeNewValueInTheDialog(String value) { - waitAppearTextAreaForm(); - textAreaForm.clear(); - textAreaForm.sendKeys(value); - } - - /** - * Clear text area, type new value, save changes by clicking agree button and close form. - * - * @param newValue new value to save - */ - public void typeAndSaveTextAreaDialog(String newValue) { - typeNewValueInTheDialog(newValue); - saveTextAreaDialogBtn.click(); - waitDisappearTextAreaForm(); - loader.waitOnClosed(); - } - - /** - * Type user expression to the IDE Enter an expression field - * - * @param expression user expression - */ - public void typeEvaluateExpression(String expression) { - String exprFieldLocator = - "//div[text()='Enter an expression:']/parent::div/following-sibling::div/input"; - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath(exprFieldLocator))) - .clear(); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath(exprFieldLocator))) - .sendKeys(expression); - } - - /** - * Wait expected value in the Result field after evaluating - * - * @param expVal exoected value - */ - public void waitExpectedResultInEvaluateExpression(final String expVal) { - final String locator = "//div[text()='Result:']/parent::div/following-sibling::div/textarea"; - WebElement webElement = - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath(locator))); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until( - (ExpectedCondition) - webDriver -> { - return webElement.getAttribute("value").equals(expVal); - }); - } - - /** Click on evaluate exp. button */ - public void clickEvaluateBtn() { - String locator = "//button[text()='Evaluate']"; - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath(locator))) - .click(); - } - - /** Click on close evaluate exp. button */ - public void clickCloseEvaluateBtn() { - String locator = "//button[text()='Evaluate']/preceding-sibling::button"; - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath(locator))) - .click(); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until(ExpectedConditions.invisibilityOfElementLocated(xpath(locator))); - } - - /** - * Check debugger button panel - * - * @return true if present on page and false on other cases - */ - public boolean isDebuggerBtnPanelPresent() { - - try { - return seleniumWebDriver - .findElement(id(DebuggerActionButtons.REMOVE_ALL_BREAKPOINTS)) - .isDisplayed(); - } catch (Exception ex) { - return false; - } - } - - /** - * Wait text in debug highlighted area (red line into Che editor under debugger) - * - * @param text the text under debug - highlighter - */ - public void waitDebugHighlightedText(String text) { - StringBuilder highLightedText = new StringBuilder(); - String locatorWithHiglightedText = - "//div[@id='gwt-debug-editorPartStack-contentPanel']//div[@active]//div[@class='textviewContent' and @contenteditable='true']//span[@debugid='debug-line']"; - List hilightedElements = - webDriverWaitFactory - .get(LOADER_TIMEOUT_SEC) - .until( - ExpectedConditions.presenceOfAllElementsLocatedBy( - xpath(locatorWithHiglightedText))); - for (WebElement hilightedElement : hilightedElements) { - highLightedText.append(hilightedElement.getText()); - } - webDriverWaitFactory - .get(MINIMUM_SEC) - .until( - (WebDriver driver) -> { - return highLightedText.toString().contains(text); - }); - } - - /** - * Wait highlighter in the specified position - * - * @param numOfPosition - */ - public void waitBreakPointHighlighterInDefinedPosition(int numOfPosition) { - editor.waitActive(); - List editorLines = - seleniumWebDriver.findElements( - xpath( - "//div[@id='gwt-debug-editorPartStack-contentPanel']//div[@active]//div[@class='textviewContent' and @contenteditable='true']/div")); - webDriverWaitFactory - .get(LOAD_PAGE_TIMEOUT_SEC) - .until( - (WebDriver driver) -> { - try { - return editorLines - .get(numOfPosition - 1) - .findElement(tagName("span")) - .getAttribute("debugid") - .equals("debug-line"); - } catch (Exception e) { - return false; - } - }); - } - - /** Open debug panel by clicking on "Debug" tab. */ - public void openDebugPanel() { - if (!isDebuggerBtnPanelPresent()) { - debuggerTab.click(); - } - } - - /** - * Click on "Remove All Breakpoints" button in Debug panel and wait until breakpoints go away from - * Debug panel. - */ - public void removeAllBreakpoints() { - clickOnButton(DebuggerActionButtons.REMOVE_ALL_BREAKPOINTS); - waitWhileAllBreakPointsOnEditorPanelDisapper(); - waitBreakPointsPanelIsEmpty(); - } - - /** - * This method use for stopping Debugger using UI. Check if debugger panel presents. If present - * click on remove all breakpoints button. than click on stop debugger session button, if some web - * element covers the panel - browser will be refreshed for closing. If the Debugger have not - * appeared on UI. After stopping the debugger we call clean up command for tomcat (the command - * should be prepared in a test. The command stop the tomcat and clea webapp folder) - * - * @param cleanUpTomcat - */ - public void stopDebuggerWithUiAndCleanUpTomcat(String cleanUpTomcat) { - // if something went wrong on ui we refresh browser and try to click on remove all breakpoints - // button again - if (isDebuggerBtnPanelPresent()) { - try { - removeAllBreakpoints(); - } catch (WebDriverException ex) { - seleniumWebDriver.navigate().refresh(); - clickOnButton(DebuggerActionButtons.REMOVE_ALL_BREAKPOINTS); - } - clickOnButton(DebuggerActionButtons.BTN_DISCONNECT); - } - - try { - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.runCommandByName(cleanUpTomcat); - } catch (TimeoutException ex) { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.runCommandByName(cleanUpTomcat); - } - } - - public String getVariables() { - waitVariablesPanel(); - return debuggerTree.getText(); - } - - public void waitFramesListPanelReady() { - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until((Function) webDriver -> !frames.getText().isEmpty()); - } - - public String[] getFrames() { - waitFramesListPanelReady(); - return frames.getText().split("\n"); - } - - /** Waits */ - public void waitThreadListPanelReady() { - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until((Function) webDriver -> !threads.getText().isEmpty()); - } - - public void selectFrame(int frameIndex) { - waitFramesListPanelReady(); - - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath("//td[text()='" + getFrames()[frameIndex] + "']"))) - .click(); - } - - public String[] getThreads() { - waitThreadListPanelReady(); - return threads.getText().split("\n"); - } - - public String getSelectedThread() { - waitThreadListPanelReady(); - - String selectedThreadId = threads.getAttribute("value"); - for (String thread : getThreads()) { - if (thread.contains("@" + selectedThreadId + " in")) { - return thread; - } - } - - return null; - } - - public void selectThread(String threadName) { - waitThreadListPanelReady(); - - threads.click(); - webDriverWaitFactory - .get(REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(visibilityOfElementLocated(xpath("//*[contains(text(),'\"" + threadName + "\"@')]"))) - .click(); - threads.click(); - } - - public void configureBreakpoint( - String fileName, int lineNumber, BreakpointConfiguration breakpointConfiguration) { - String breakpointItem = format(BreakpointsPanel.BREAKPOINT_ITEM, fileName + ":" + lineNumber); - - seleniumWebDriverHelper.waitAndContextClick( - xpath(breakpointItem), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - seleniumWebDriverHelper.waitAndClick( - id(BreakpointsPanel.CONTEXT_MENU_CONFIGURE_BREAKPOINT), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - - if (breakpointConfiguration.isConditionEnabled()) { - seleniumWebDriverHelper.waitAndClick( - xpath(BreakpointConfigurationWindow.BREAKPOINT_CONDITION_ENABLED), - REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - - seleniumWebDriverHelper.waitAndSendKeysTo( - xpath(BreakpointConfigurationWindow.BREAKPOINT_CONDITION_TEXT), - breakpointConfiguration.getCondition(), - REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - if (breakpointConfiguration.getSuspendPolicy() != null) { - switch (breakpointConfiguration.getSuspendPolicy()) { - case ALL: - seleniumWebDriverHelper.waitAndClick( - xpath(BreakpointConfigurationWindow.SUSPEND_ALL), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - break; - - case THREAD: - seleniumWebDriverHelper.waitAndClick( - xpath(BreakpointConfigurationWindow.SUSPEND_THREAD), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - break; - - default: - seleniumWebDriverHelper.waitAndClick( - xpath(BreakpointConfigurationWindow.SUSPEND_NONE), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - break; - } - } - - seleniumWebDriverHelper.waitAndClick( - xpath(BreakpointConfigurationWindow.APPLY_BTN), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - public void navigateToBreakpoint(String fileName, int lineNumber) { - String breakpointItem = format(BreakpointsPanel.BREAKPOINT_ITEM, fileName + ":" + lineNumber); - seleniumWebDriverHelper.waitVisibility(xpath(breakpointItem), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - seleniumWebDriverHelper.doubleClick(xpath(breakpointItem)); - } - - public void disableBreakpoint(String fileName, int lineNumber) { - String breakpointItem = format(BreakpointsPanel.BREAKPOINT_ITEM, fileName + ":" + lineNumber); - seleniumWebDriverHelper.waitAndContextClick( - xpath(breakpointItem), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - seleniumWebDriverHelper.waitAndClick( - id(BreakpointsPanel.CONTEXT_MENU_DISABLE_BREAKPOINT), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - public void deleteBreakpoint(String fileName, int lineNumber) { - String breakpointItem = format(BreakpointsPanel.BREAKPOINT_ITEM, fileName + ":" + lineNumber); - seleniumWebDriverHelper.waitAndContextClick( - xpath(breakpointItem), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - seleniumWebDriverHelper.waitAndClick( - id(BreakpointsPanel.CONTEXT_MENU_DELETE_BREAKPOINT), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - public List getAllBreakpoints() { - String breakpointsPanelContent = - seleniumWebDriverHelper.waitVisibilityAndGetText( - id(BreakpointsPanel.ID), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - - return Stream.of(breakpointsPanelContent.split("\n")) - .filter(s -> !s.equals("?")) - .collect(Collectors.toList()); - } - - public void waitBreakpointState( - String filePath, int lineNumber, BreakpointState state, boolean conditional) { - - String breakpointClass = "breakpoint"; - switch (state) { - case ACTIVE: - breakpointClass += " active"; - break; - case INACTIVE: - breakpointClass += " inactive"; - break; - default: - breakpointClass += " disabled"; - } - - String breakpointXPath = - format( - "//div[@id='gwt-debug-debugger-breakpointsPanel']//div[@id='%s' and @class='%s']", - filePath + ":" + lineNumber, breakpointClass); - - WebElement webElement = - seleniumWebDriverHelper.waitVisibility( - xpath(breakpointXPath), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - - if (conditional) { - assertEquals(webElement.getText(), "?"); - } - } - - public void waitThreadNotSuspendedHolderVisible() { - seleniumWebDriverHelper.waitVisibility( - id(FramesPanel.THREAD_NOT_SUSPENDED_HOLDER), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - public void waitThreadNotSuspendedHolderHidden() { - seleniumWebDriverHelper.waitInvisibility( - id(FramesPanel.THREAD_NOT_SUSPENDED_HOLDER), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } - - public String getExecutionPoint() { - return seleniumWebDriverHelper.waitVisibilityAndGetText( - id(Locators.EXECUTION_POINT), REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/JavaDebugConfig.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/JavaDebugConfig.java deleted file mode 100644 index bb61820d2d9..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/JavaDebugConfig.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ATTACHING_ELEM_TO_DOM_SEC; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - -/** - * @author Dmytro Nochevnov - * @author Musienko Maxim - */ -@Singleton -public class JavaDebugConfig extends AbstractDebugConfig { - @Inject - public JavaDebugConfig( - SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { - super(seleniumWebDriver, seleniumWebDriverHelper); - PageFactory.initElements(seleniumWebDriver, this); - } - - interface Locators { - String DEBUG_CATEGORY_EXPAND_ICON_XPATH = - "//div[@id='gwt-debug-debugConfigurationTypesPanel']//span[text()='Java']/following-sibling::span"; - } - - @FindBy(xpath = Locators.DEBUG_CATEGORY_EXPAND_ICON_XPATH) - WebElement debugCategoryExpandIcon; - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName) { - createConfigWithoutClosingDialog(configName); - close(); - } - - @Override - public void expandDebugCategory() { - new WebDriverWait(seleniumWebDriver, ATTACHING_ELEM_TO_DOM_SEC) - .until(ExpectedConditions.visibilityOf(debugCategoryExpandIcon)) - .click(); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/NodeJsDebugConfig.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/NodeJsDebugConfig.java deleted file mode 100644 index f9eeb7c1c41..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/NodeJsDebugConfig.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -/** - * @author Dmytro Nochevnov - * @author Musienko Maxim - */ -@Singleton -public class NodeJsDebugConfig extends AbstractDebugConfig { - - private SeleniumWebDriverHelper seleniumWebDriverHelper; - - @Inject - public NodeJsDebugConfig( - SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { - super(seleniumWebDriver, seleniumWebDriverHelper); - this.seleniumWebDriverHelper = seleniumWebDriverHelper; - PageFactory.initElements(seleniumWebDriver, this); - } - - interface Locators { - String DEBUG_CATEGORY_EXPAND_ICON_XPATH = - "//div[@id='gwt-debug-debugConfigurationTypesPanel']//span[text()='NodeJs']/following-sibling::span"; - - String NODE_JS_SCRIPT_FIELD_CSS = - "div#gwt-debug-nodeJsDebugConfigurationPageView-mainPanel>input"; - } - - @FindBy(xpath = Locators.DEBUG_CATEGORY_EXPAND_ICON_XPATH) - WebElement debugCategoryExpandIcon; - - @FindBy(css = Locators.NODE_JS_SCRIPT_FIELD_CSS) - WebElement scriptNodeJsField; - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName) { - createConfigWithoutClosingDialog(configName); - close(); - } - - /** - * Set path defined by user to js. file - * - * @param pathToNodeJsFile the defined path - */ - public void setPathToScriptForNodeJs(String pathToNodeJsFile) { - seleniumWebDriverHelper.waitVisibility(scriptNodeJsField).clear(); - scriptNodeJsField.sendKeys(pathToNodeJsFile); - } - - @Override - public void expandDebugCategory() { - seleniumWebDriverHelper.waitAndClick(debugCategoryExpandIcon); - } - - public void saveConfiguration() { - clickOnSaveBtn(); - } - - public void saveConfigurationAndclose() { - saveConfiguration(); - close(); - } - - public void clickOnDebugButtonAndWaitClosing() { - clickOnDebugAndWaitClosing(); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/PhpDebugConfig.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/PhpDebugConfig.java deleted file mode 100644 index 70957acd5f7..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/debug/PhpDebugConfig.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.debug; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ATTACHING_ELEM_TO_DOM_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; - -/** - * @author Dmytro Nochevnov - * @author Musienko Maxim - */ -@Singleton -public class PhpDebugConfig extends AbstractDebugConfig { - - @Inject - public PhpDebugConfig( - SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { - super(seleniumWebDriver, seleniumWebDriverHelper); - PageFactory.initElements(seleniumWebDriver, this); - } - - interface Locators { - - String DEBUG_CATEGORY_EXPAND_ICON_XPATH = - "//div[@id='gwt-debug-debugConfigurationTypesPanel']//span[text()='PHP']/following-sibling::span"; - - String BREAK_AT_FIRST_LINE_LABEL_XPATH = - "//div[@id='gwt-debug-zendDebugConfigurationPageView-mainPanel']//label[text()='Break at first line']"; - - String BREAK_AT_FIRST_LINE_CHECKBOX_XPATH = - "//div[@id='gwt-debug-zendDebugConfigurationPageView-mainPanel']//input[@type='checkbox' and following-sibling::label[text()='Break at first line']]"; - - String DEBUG_PORT_INPUT_XPATH = - "//div[@id='gwt-debug-zendDebugConfigurationPageView-mainPanel']//input[@type='text' and preceding-sibling::div[text()='Debug port']]"; - } - - @FindBy(xpath = Locators.DEBUG_CATEGORY_EXPAND_ICON_XPATH) - WebElement debugCategoryExpandIcon; - - @FindBy(xpath = Locators.BREAK_AT_FIRST_LINE_LABEL_XPATH) - WebElement breakAtFirstLineLabel; - - @FindBy(xpath = Locators.DEBUG_PORT_INPUT_XPATH) - WebElement debugPortInput; - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName) { - createConfigWithoutClosingDialog(configName); - close(); - } - - /** Create debug configuration and close dialog. */ - public void createConfig(String configName, boolean breakAtFirstLine, int debugPort) { - createConfigWithoutClosingDialog(configName); - - // set debug port - new WebDriverWait(seleniumWebDriver, ATTACHING_ELEM_TO_DOM_SEC) - .until(ExpectedConditions.visibilityOf(debugPortInput)); - debugPortInput.clear(); - debugPortInput.sendKeys(String.valueOf(debugPort)); - - // setup "break at first line" checkbox - ensureBreakAtFirstLineCheckboxState(breakAtFirstLine); - - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOf(configSaveBtn)) - .click(); - - close(); - } - - /** - * Check if state of "break at first line" checkbox equals to breakAtFirstLine parameter. - * - * @param breakAtFirstLine - */ - private void ensureBreakAtFirstLineCheckboxState(boolean breakAtFirstLine) { - boolean isSelected = - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until( - ExpectedConditions.presenceOfElementLocated( - By.xpath(Locators.BREAK_AT_FIRST_LINE_CHECKBOX_XPATH))) - .isSelected(); - - if (isSelected != breakAtFirstLine) { - breakAtFirstLineLabel.click(); - } - } - - @Override - public void expandDebugCategory() { - new WebDriverWait(seleniumWebDriver, ATTACHING_ELEM_TO_DOM_SEC) - .until(ExpectedConditions.visibilityOf(debugCategoryExpandIcon)) - .click(); - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/plugins/JavaTestRunnerPluginConsole.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/plugins/JavaTestRunnerPluginConsole.java deleted file mode 100644 index 29a34f515e7..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/plugins/JavaTestRunnerPluginConsole.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.plugins; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ATTACHING_ELEM_TO_DOM_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.action.ActionsFactory; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.By; -import org.openqa.selenium.NotFoundException; -import org.openqa.selenium.StaleElementReferenceException; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindAll; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.FluentWait; -import org.openqa.selenium.support.ui.WebDriverWait; - -/** @author Dmytro Nochevnov */ -@Singleton -public class JavaTestRunnerPluginConsole extends Consoles { - - private static final String TEST_RESULT_TREE_XPATH_TEMPLATE = - "//div[contains(@id,'gwt-uid')]//div[text()='%s']"; - private static final String TEST_OUTPUT_XPATH = - "//div[@focused]//div[@id='gwt-debug-commandConsoleLines']//pre"; - private static final String METHODS_MARKED_AS_PASSED = "gwt-debug-test-state-passed"; - private static final String METHODS_MARKED_AS_FAILED = "gwt-debug-test-state-failed"; - private static final String METHODS_MARKED_AS_IGNORED = "gwt-debug-test-state-ignore"; - private static final String TEST_RESULT_NAVIGATION_TREE = "gwt-debug-test-tree-navigation-panel"; - - @FindAll({@FindBy(xpath = TEST_OUTPUT_XPATH)}) - private List testOutput; - - @FindBy(id = METHODS_MARKED_AS_PASSED) - private WebElement passedMethod; - - @FindBy(id = METHODS_MARKED_AS_IGNORED) - private WebElement ignoredMethod; - - @FindBy(id = METHODS_MARKED_AS_FAILED) - private WebElement failedMethod; - - @FindAll({@FindBy(id = METHODS_MARKED_AS_FAILED)}) - private List failedMethods; - - @FindAll({@FindBy(id = METHODS_MARKED_AS_PASSED)}) - private List passedMethods; - - @FindAll({@FindBy(id = METHODS_MARKED_AS_IGNORED)}) - private List ignoredMethods; - - @FindBy(id = TEST_RESULT_NAVIGATION_TREE) - private WebElement resultTreeMainForm; - - @Inject - public JavaTestRunnerPluginConsole( - SeleniumWebDriver seleniumWebDriver, - Loader loader, - ActionsFactory actionsFactory, - SeleniumWebDriverHelper seleniumWebDriverHelper, - ProjectExplorer projectExplorer, - AskDialog askDialog, - WebDriverWaitFactory webDriverWaitFactory) { - super( - seleniumWebDriver, - loader, - actionsFactory, - seleniumWebDriverHelper, - projectExplorer, - askDialog, - webDriverWaitFactory); - PageFactory.initElements(seleniumWebDriver, this); - } - - public enum JunitMethodsState { - PASSED, - FAILED, - IGNORED - } - - /** @return Stack trace displayed in the right test result panel. */ - public String getTestErrorMessage() { - return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOfAllElements(testOutput)) - .stream() - .map(WebElement::getText) - .collect(Collectors.joining()); - } - - /** - * Wait single method in the result tree marked as failed (red color). - * - * @param nameOfFailedMethods name of that should fail - */ - public void waitMethodMarkedAsFailed(String nameOfFailedMethods) { - FluentWait wait = - new FluentWait(seleniumWebDriver) - .withTimeout(ATTACHING_ELEM_TO_DOM_SEC, TimeUnit.SECONDS) - .pollingEvery(200, TimeUnit.MILLISECONDS) - .ignoring(NotFoundException.class, StaleElementReferenceException.class); - String xpathToExpectedMethod = "//span[@id='%s']/following-sibling::*/div[text()='%s']"; - wait.until( - ExpectedConditions.visibilityOfElementLocated( - By.xpath( - String.format( - xpathToExpectedMethod, METHODS_MARKED_AS_FAILED, nameOfFailedMethods)))); - } - - /** - * Wait single method in the result tree marked as failed (red color). - * - * @param nameOfFailedMethods name of that should fail - */ - public void waitMethodMarkedAsIgnored(String nameOfFailedMethods) { - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.presenceOfElementLocated(By.id(METHODS_MARKED_AS_IGNORED))) - .findElement(By.xpath(String.format("//div[text()='%s']", nameOfFailedMethods))); - } - - /** - * Wait single method in the result tree marked as passed (green color). - * - * @param nameOfFailedMethods name of expected method - */ - public void waitMethodMarkedAsPassed(String nameOfFailedMethods) { - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.presenceOfElementLocated(By.id(METHODS_MARKED_AS_PASSED))) - .findElement(By.xpath(String.format("//div[text()='%s']", nameOfFailedMethods))); - } - - /** - * Wait the FQN of the test class in result tree class that has been launched. - * - * @param fqn - */ - public void waitFqnOfTesClassInResultTree(String fqn) { - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until( - ExpectedConditions.visibilityOfElementLocated( - By.xpath(String.format(TEST_RESULT_TREE_XPATH_TEMPLATE, fqn)))); - } - - /** - * Get all name of the test methods form the test result tree marked with defined status (may be - * passed, failed or ignored). - * - * @param methodState the enumeration with defined status - * @return the list with names of methods with defined status - */ - public List getAllNamesOfMethodsMarkedDefinedStatus(JunitMethodsState methodState) { - List definedMethods = null; - switch (methodState) { - case PASSED: - definedMethods = getNamesOfMethodsWithDefinedStatus(METHODS_MARKED_AS_PASSED); - break; - case FAILED: - definedMethods = getNamesOfMethodsWithDefinedStatus(METHODS_MARKED_AS_FAILED); - break; - case IGNORED: - definedMethods = getNamesOfMethodsWithDefinedStatus(METHODS_MARKED_AS_IGNORED); - break; - } - return definedMethods; - } - - private List getNamesOfMethodsWithDefinedStatus(String definedMethod) { - return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.id(definedMethod))) - .stream() - .map(WebElement::getText) - .collect(Collectors.toList()); - } - - /** - * Get text from the test result tree. Mote! This method represent only text from test result tree - * without styles and formatting - * - * @return text representation of results of the test result tree widget - */ - public String getTextFromResultTree() { - return new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOf(resultTreeMainForm)) - .getText(); - } - - /** - * Click on the item in the result tree. If will be some items with the same name - will select - * first. - * - * @param item name of the item (method or fqn of test class) in the test result tree - */ - public void selectItemInResultTree(String item) { - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOf(resultTreeMainForm)) - .findElement(By.xpath(String.format("//div[text()='%s']", item))) - .click(); - } - - /** - * Click on failed, passed or ignored method of the result tree. If in the result tree will be - * methods with the same statuses and names - will be selected first method in the DOM methods - * with the same statuses and names - will be selected first method in the DOM - * - * @param nameOfMethod - * @param methodState - */ - public void selectMethodWithDefinedStatus(JunitMethodsState methodState, String nameOfMethod) { - WebDriverWait wait = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - switch (methodState) { - case PASSED: - wait.until(ExpectedConditions.presenceOfElementLocated(By.id(METHODS_MARKED_AS_PASSED))) - .findElement( - By.xpath( - String.format("//div[@style='color: green;' and text()='%s']", nameOfMethod))) - .click(); - break; - case FAILED: - wait.until(ExpectedConditions.presenceOfElementLocated(By.id(METHODS_MARKED_AS_FAILED))) - .findElement( - By.xpath( - String.format("//div[@style='color: red;' and text()='%s']", nameOfMethod))) - .click(); - break; - case IGNORED: - wait.until(ExpectedConditions.presenceOfElementLocated(By.id(METHODS_MARKED_AS_IGNORED))) - .findElement( - By.xpath( - String.format( - "//div[@style[contains(.,'color: yellow')] and text()='%s']", - nameOfMethod))) - .click(); - break; - } - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/AbstractUploadDialogPage.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/AbstractUploadDialogPage.java deleted file mode 100644 index 66211465180..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/AbstractUploadDialogPage.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.upload; - -import static java.util.Arrays.asList; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; - -import java.io.IOException; -import java.nio.file.Path; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; -import org.openqa.selenium.support.ui.ExpectedCondition; - -public abstract class AbstractUploadDialogPage { - private static final String CHOOSE_FILE_BUTTON_ID = "gwt-debug-file-uploadFile-ChooseFile"; - - final SeleniumWebDriverHelper seleniumWebDriverHelper; - private final WebDriverWaitFactory webDriverWaitFactory; - - @FindBy(id = CHOOSE_FILE_BUTTON_ID) - private WebElement chooseFileButton; - - public AbstractUploadDialogPage( - SeleniumWebDriver seleniumWebDriver, - SeleniumWebDriverHelper seleniumWebDriverHelper, - WebDriverWaitFactory webDriverWaitFactory) { - this.seleniumWebDriverHelper = seleniumWebDriverHelper; - this.webDriverWaitFactory = webDriverWaitFactory; - PageFactory.initElements(seleniumWebDriver, this); - } - - public void waitOnOpen() { - seleniumWebDriverHelper.waitAllVisibility(asList(getTitle(), chooseFileButton)); - } - - public void waitOnClose() { - seleniumWebDriverHelper.waitAllInvisibility(asList(getTitle(), chooseFileButton)); - } - - public String selectResourceToUpload(Path resourceToUpload) throws IOException { - String uploadingFileName = - seleniumWebDriverHelper.selectResourceToUpload(chooseFileButton, resourceToUpload); - webDriverWaitFactory - .get(DEFAULT_TIMEOUT) - .until((ExpectedCondition) driver -> isUploadButtonEnabled()); - - return uploadingFileName; - } - - private boolean isUploadButtonEnabled() { - return getUploadButton().getCssValue("background-color").equals("rgba(74, 144, 226, 1)"); - } - - public void clickOnUploadButton() { - WebElement uploadButton = getUploadButton(); - seleniumWebDriverHelper.waitVisibility(uploadButton); - uploadButton.click(); - } - - public void selectOverwriteIfFileExistsCheckbox() { - seleniumWebDriverHelper.waitAndSetCheckbox( - getOverwriteIfExistsCheckbox(), getOverwriteIfExistsCheckboxLabel(), true); - } - - abstract WebElement getTitle(); - - abstract WebElement getUploadButton(); - - abstract WebElement getOverwriteIfExistsCheckbox(); - - abstract WebElement getOverwriteIfExistsCheckboxLabel(); -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadDirectoryDialogPage.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadDirectoryDialogPage.java deleted file mode 100644 index b17f06c841b..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadDirectoryDialogPage.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.upload; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; - -@Singleton -public class UploadDirectoryDialogPage extends AbstractUploadDialogPage { - private static final String UPLOAD_BUTTON_ID = "file-uploadFolder-upload"; - private static final String TITLE_XPATH = "//div[text()='Upload Folder']"; - - private static final String OVERWRITE_FOLDER_CHECKBOX_ID = - "gwt-debug-file-uploadFolder-overwrite-input"; - private static final String OVERWRITE_FOLDER_CHECKBOX_LABEL_ID = - "gwt-debug-file-uploadFolder-overwrite-label"; - - private static final String SKIP_ROOT_FOLDER_CHECKBOX_ID = - "gwt-debug-file-uploadFolder-skipFirstLevel-input"; - private static final String SKIP_ROOT_FOLDER_CHECKBOX_LABEL_ID = - "gwt-debug-file-uploadFolder-skipFirstLevel-label"; - - @FindBy(id = UPLOAD_BUTTON_ID) - private WebElement uploadButton; - - @FindBy(xpath = TITLE_XPATH) - private WebElement title; - - @FindBy(id = OVERWRITE_FOLDER_CHECKBOX_ID) - private WebElement overwriteIfFolderExistsCheckbox; - - @FindBy(id = OVERWRITE_FOLDER_CHECKBOX_LABEL_ID) - private WebElement overwriteIfFolderExistsCheckboxLabel; - - @FindBy(id = SKIP_ROOT_FOLDER_CHECKBOX_ID) - private WebElement skipRootFolderCheckbox; - - @FindBy(id = SKIP_ROOT_FOLDER_CHECKBOX_LABEL_ID) - private WebElement skipRootFolderCheckboxLabel; - - @Inject - public UploadDirectoryDialogPage( - SeleniumWebDriver seleniumWebDriver, - SeleniumWebDriverHelper seleniumWebDriverHelper, - WebDriverWaitFactory webDriverWaitFactory) { - super(seleniumWebDriver, seleniumWebDriverHelper, webDriverWaitFactory); - } - - public void selectSkipRootFolderCheckbox() { - seleniumWebDriverHelper.waitAndSetCheckbox( - skipRootFolderCheckbox, skipRootFolderCheckboxLabel, true); - } - - @Override - WebElement getTitle() { - return title; - } - - @Override - WebElement getUploadButton() { - return uploadButton; - } - - @Override - WebElement getOverwriteIfExistsCheckbox() { - return overwriteIfFolderExistsCheckbox; - } - - @Override - WebElement getOverwriteIfExistsCheckboxLabel() { - return overwriteIfFolderExistsCheckboxLabel; - } -} diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadFileDialogPage.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadFileDialogPage.java deleted file mode 100644 index c2e3bb8d778..00000000000 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/upload/UploadFileDialogPage.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.pageobject.upload; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; - -@Singleton -public class UploadFileDialogPage extends AbstractUploadDialogPage { - private static final String UPLOAD_BUTTON_ID = "file-uploadFile-upload"; - private static final String TITLE_XPATH = "//div[text()='Upload File']"; - private static final String OVERWRITE_FILE_CHECKBOX_ID = - "gwt-debug-file-uploadFile-overwrite-input"; - private static final String OVERWRITE_FILE_CHECKBOX_LABEL_ID = - "gwt-debug-file-uploadFile-overwrite-label"; - - @FindBy(id = UPLOAD_BUTTON_ID) - private WebElement uploadButton; - - @FindBy(xpath = TITLE_XPATH) - private WebElement title; - - @FindBy(id = OVERWRITE_FILE_CHECKBOX_ID) - private WebElement overwriteIfFileExistsCheckbox; - - @FindBy(id = OVERWRITE_FILE_CHECKBOX_LABEL_ID) - private WebElement overwriteIfFileExistsCheckboxLabel; - - @Inject - public UploadFileDialogPage( - SeleniumWebDriver seleniumWebDriver, - SeleniumWebDriverHelper seleniumWebDriverHelper, - WebDriverWaitFactory webDriverWaitFactory) { - super(seleniumWebDriver, seleniumWebDriverHelper, webDriverWaitFactory); - } - - @Override - WebElement getTitle() { - return title; - } - - @Override - WebElement getUploadButton() { - return uploadButton; - } - - @Override - WebElement getOverwriteIfExistsCheckbox() { - return overwriteIfFileExistsCheckbox; - } - - @Override - WebElement getOverwriteIfExistsCheckboxLabel() { - return overwriteIfFileExistsCheckboxLabel; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckFindActionFeatureInCheTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckFindActionFeatureInCheTest.java deleted file mode 100644 index f9e3ce241cb..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckFindActionFeatureInCheTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.assistant; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.FindAction; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckFindActionFeatureInCheTest { - private static final String FIRST_ACTION_NAME = "config"; - private static final String SECOND_ACTION_NAME = "commands"; - private static final String THIRD_ACTION_NAME = "che"; - - private static final String FIRST_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Update Project Configuration... Project\n" - + "Configure Classpath Project\n" - + "Edit Debug Configurations... [Alt+Shift+F9] Run"; - - private static final String SECOND_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Commands Palette [Shift+F10] Run"; - - private static final String THIRD_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Branches... [Ctrl+B] GitCommandGroup\n" + "Checkout Reference... GitCommandGroup"; - - private static final String FIRST_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Update Project Configuration... Project\n" - + "Configure \n" - + "Configure Classpath Project\n" - + "Edit Debug Configurations... [Alt+Shift+F9] Run\n" - + "breakpointConfiguration "; - - private static final String SECOND_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Commands \n" - + "Commands [Ctrl+Alt+4] Tool Windows\n" - + "Commands \n" - + "Commands Palette [Shift+F10] Run"; - private static final String THIRD_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX = - "Branches... [Ctrl+B] GitCommandGroup\n" + "Checkout Reference... GitCommandGroup"; - - private static final String PROJECT_NAME = - NameGenerator.generate(CheckFindActionFeatureInCheTest.class.getSimpleName(), 4); - - @Inject private TestWorkspace testWorkspace; - @Inject private FindAction findAction; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Ide ide; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = this.getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(testWorkspace); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.FIND_ACTION); - findAction.setCheckBoxInSelectedPosition(); - } - - @Test(dataProvider = "checkingDataAllActionsData") - public void checkSearchActionsForAllItemsTest(String actionName, String result) { - checkAction(actionName, result); - } - - @Test(dataProvider = "checkingDataWithMenuActionsOnly", priority = 1) - public void checkSearchActionsForMenuItemsTest(String actionName, String result) { - findAction.setCheckBoxInNotSelectedPosition(); - checkAction(actionName, result); - } - - @DataProvider - private Object[][] checkingDataWithMenuActionsOnly() { - return new Object[][] { - {FIRST_ACTION_NAME, FIRST_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX}, - {SECOND_ACTION_NAME, SECOND_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX}, - {THIRD_ACTION_NAME, THIRD_EXPECTED_ITEMS_WITH_DISABLED_NONE_MENU_ACTIONS_CHECKBOX} - }; - } - - @DataProvider - private Object[][] checkingDataAllActionsData() { - return new Object[][] { - {FIRST_ACTION_NAME, FIRST_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX}, - {SECOND_ACTION_NAME, SECOND_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX}, - {THIRD_ACTION_NAME, THIRD_EXPECTED_ITEMS_WITH_ENABLED_NONE_MENU_ACTIONS_CHECKBOX} - }; - } - - private void checkAction(String actionName, String expectedResult) { - findAction.typeTextIntoFindActionForm(actionName); - findAction.waitTextInFormFindAction(expectedResult); - findAction.clearTextBoxActionForm(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckOpenedDialogThroughFindActionTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckOpenedDialogThroughFindActionTest.java deleted file mode 100644 index b17292a8cab..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/CheckOpenedDialogThroughFindActionTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.assistant; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.DialogAbout; -import org.eclipse.che.selenium.pageobject.FindAction; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckOpenedDialogThroughFindActionTest { - - @Inject private TestWorkspace testWorkspace; - @Inject private FindAction findAction; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Ide ide; - @Inject private DialogAbout dialogAbout; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void findActionAndRunItTest() { - projectExplorer.waitProjectExplorer(); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.FIND_ACTION); - findAction.clearTextBoxActionForm(); - findAction.typeTextIntoFindActionForm("Abo"); - findAction.waitTextInFormFindAction("About Help"); - findAction.clickOnFoundAction("About"); - dialogAbout.waitAboutDialogIsOpen(); - dialogAbout.closeAboutDialog(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/KeyBindingsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/KeyBindingsTest.java deleted file mode 100644 index 35a60329cfd..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/KeyBindingsTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.assistant; - -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.KeyBindings; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NavigateToFile; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class KeyBindingsTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 6); - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private KeyBindings keyBindings; - @Inject private NavigateToFile navigateToFile; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private CheTerminal terminal; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient projectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = KeyBindings.class.getResource("/projects/default-spring-project"); - projectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(testWorkspace); - } - - @Test - public void enterKeyCombinationTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - loader.waitOnClosed(); - keyBindings.enterKeyCombination(Keys.CONTROL, Keys.ALT, Keys.getKeyFromUnicode('n')); - navigateToFile.waitFormToOpen(); - navigateToFile.closeNavigateToFileForm(); - keyBindings.enterKeyCombination(Keys.ALT, Keys.F12); - terminal.waitFirstTerminalTab(); - WaitUtils.sleepQuietly(1); - consoles.closeTerminalIntoConsoles(); - consoles.closeProcessesArea(); - } - - @Test(priority = 1) - public void searchKeyBindingsTest() throws Exception { - projectExplorer.waitProjectExplorer(); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.KEY_BINDINGS); - keyBindings.checkSearchResultKeyBinding("open", 4); - keyBindings.clickOkButton(); - } - - @Test(priority = 2) - public void dialogAboutKeyBindingTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - - projectExplorer.quickExpandWithJavaScript(); - - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitActive(); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.KEY_BINDINGS); - loader.waitOnClosed(); - - URL resource = KeyBindingsTest.class.getResource("key-bindings.txt"); - List expectedBindings = - Files.readAllLines(Paths.get(resource.toURI()), Charset.forName("UTF-8")); - - assertTrue(keyBindings.checkAvailabilityAllKeyBindings(expectedBindings)); - keyBindings.clickOkButton(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/OrganizeImportsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/OrganizeImportsTest.java deleted file mode 100644 index e1437c84167..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/assistant/OrganizeImportsTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.assistant; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.OrganizeImports; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class OrganizeImportsTest { - private static final String PROJECT_NAME = - NameGenerator.generate(OrganizeImportsTest.class.getSimpleName(), 4); - private static final String PATH_TO_CLASS_IN_SPRING_PACKAGE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/" + "AppController.java"; - private static final String TEST_FILE_NAME = "TestClass.java"; - private static final String PATH_TO_A_PACKAGE = PROJECT_NAME + "/src/main/java/a"; - private static final String PATH_TO_B_PACKAGE = PROJECT_NAME + "/src/main/java/b"; - private static final String NAME_OF_A_PACKAGE = "a.TestClass"; - private static final String NAME_OF_B_PACKAGE = "b.TestClass"; - private static final String NAME_OF_LIST_PACKAGE = "java.util.List"; - private static final String TEST_METHOD = - "package a;\n" - + "public class TestClass{\n" - + " public static void testMethod(){\n" - + " \n" - + " };\n" - + "}"; - private static final String CALL_TEST_TEXT = - "TestClass.testMethod();\n" + " List testList=new ArrayList<>();"; - - @Inject private TestWorkspace testWorkspace; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Ide ide; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private OrganizeImports organizeImports; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = - OrganizeImportsTest.this.getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void organizeImportsTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_CLASS_IN_SPRING_PACKAGE); - loader.waitOnClosed(); - editor.waitActive(); - editor.setCursorToLine(16); - editor.deleteCurrentLine(); - editor.waitMarkerInPosition(ERROR, 25); - editor.waitMarkerInPosition(ERROR, 37); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.ORGANIZE_IMPORTS); - loader.waitOnClosed(); - Assert.assertTrue( - editor.checkWhatTextLinePresentOnce( - "import org.springframework.web.servlet.ModelAndView;")); - - editor.setCursorToLine(21); - editor.typeTextIntoEditorWithoutDelayForSaving( - "import org.springframework.web.servlet.ModelAndView;"); - loader.waitOnClosed(); - editor.waitAllMarkersInvisibility(ERROR); - editor.goToCursorPositionVisible(21, 8); - editor.launchPropositionAssistPanel(); - editor.enterTextIntoFixErrorPropByEnter("Organize imports"); - loader.waitOnClosed(); - - try { - Assert.assertTrue( - editor.checkWhatTextLinePresentOnce( - "import org.springframework.web.servlet.ModelAndView;")); - } catch (org.openqa.selenium.StaleElementReferenceException ex) { - editor.selectTabByName("AppController"); - Assert.assertTrue( - editor.checkWhatTextLinePresentOnce( - "import org.springframework.web.servlet.ModelAndView;")); - } - editor.goToCursorPositionVisible(30, 23); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.QUICK_FIX); - editor.waitPropositionAssistContainer(); - loader.waitOnClosed(); - createNewStructure(); - editor.setCursorToLine(36); - editor.typeTextIntoEditor(CALL_TEST_TEXT); - editor.waitMarkerInPosition(ERROR, 37); - editor.waitMarkerInPosition(ERROR, 38); - - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.ORGANIZE_IMPORTS); - - loader.waitOnClosed(); - organizeImports.waitOrganizeImportsDialog(); - organizeImports.selectImport(NAME_OF_A_PACKAGE); - organizeImports.clickOnNextButton(); - organizeImports.selectImport(NAME_OF_LIST_PACKAGE); - organizeImports.clickOnBackButton(); - organizeImports.selectImport(NAME_OF_B_PACKAGE); - organizeImports.clickOnNextButton(); - organizeImports.clickOnFinishButton(); - loader.waitOnClosed(); - editor.waitAllMarkersInvisibility(ERROR); - - Assert.assertTrue(editor.checkWhatTextLinePresentOnce("import b.TestClass;")); - Assert.assertTrue(editor.checkWhatTextLinePresentOnce("import java.util.ArrayList;")); - Assert.assertTrue(editor.checkWhatTextLinePresentOnce("import java.util.List;")); - } - - private void createNewStructure() throws Exception { - testProjectServiceClient.createFolder(testWorkspace.getId(), PATH_TO_A_PACKAGE); - testProjectServiceClient.createFolder(testWorkspace.getId(), PATH_TO_B_PACKAGE); - testProjectServiceClient.createFileInProject( - testWorkspace.getId(), PATH_TO_A_PACKAGE, TEST_FILE_NAME, TEST_METHOD); - testProjectServiceClient.createFileInProject( - testWorkspace.getId(), PATH_TO_B_PACKAGE, TEST_FILE_NAME, TEST_METHOD); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/AccountTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/AccountTest.java index df04d7338c0..f9a2de1f528 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/AccountTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/AccountTest.java @@ -28,7 +28,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class AccountTest { private Account changedTestUserAccount; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateFactoryTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateFactoryTest.java index d4300d7eaee..6ef46fe9bb3 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateFactoryTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateFactoryTest.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.dashboard; import static org.eclipse.che.commons.lang.NameGenerator.generate; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.WEB_JAVA_SPRING; import static org.eclipse.che.selenium.pageobject.dashboard.factories.CreateFactoryPage.TabNames.CONFIG_TAB_ID; import static org.eclipse.che.selenium.pageobject.dashboard.factories.CreateFactoryPage.TabNames.GIT_TAB_ID; @@ -51,6 +52,8 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class CreateFactoryTest { private static final String PROJECT_WS_NAME = generate("project-ws", 4); private static final String NO_PROJECT_WS_NAME = generate("no-project-ws", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateStackTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateStackTest.java deleted file mode 100644 index b5418bbd72a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/CreateStackTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.pageobject.dashboard.BuildStackFromRecipe; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.stacks.StackDetails; -import org.eclipse.che.selenium.pageobject.dashboard.stacks.Stacks; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class CreateStackTest { - private static final String COMPOSE_RECIPE = - "services:\n" - + " db:\n" - + " image: eclipse/mysql\n" - + "environment:\n" - + " MYSQL_ROOT_PASSWORD: password\n" - + "MYSQL_DATABASE: petclinic\n" - + "MYSQL_USER: petclinic\n" - + "MYSQL_PASSWORD: password\n" - + "\b\bmem_limit: 1073741824\n" - + "\b\bdev-machine:\n" - + " image: eclipse/ubuntu_jdk8\n" - + "mem_limit: 2147483648\n" - + "depends_on:\n" - + " - db"; - private static final String DOCKERIMAGE_RECIPE = "eclipse/ubuntu_jdk8"; - private static final String DOCKERFILE_RECIPE = "FROM eclipse/ubuntu_jdk8"; - private static final String KUBERNETES_RECIPE = - "---\n" - + "kind: List\n" - + "items:\n" - + "-\n" - + " apiVersion: v1\n" - + "kind: Pod\n" - + "metadata:\n" - + " name: ws\n" - + "\b\bspec:\n" - + " containers:\n" - + " -\n" - + " image: eclipse/ubuntu_jdk8\n" - + "name: dev-machine"; - - @Inject private Stacks stacks; - @Inject private Dashboard dashboard; - @Inject private StackDetails stackDetails; - @Inject private BuildStackFromRecipe buildStackFromRecipe; - - @BeforeClass - public void setUp() throws Exception { - dashboard.open(); - } - - @BeforeMethod - public void openStacksListPage() { - dashboard.waitDashboardToolbarTitle(); - dashboard.selectStacksItemOnDashboard(); - stacks.waitToolbarTitleName(); - - stacks.clickOnAddStackButton(); - buildStackFromRecipe.waitCreateStackDialogVisible(); - } - - @AfterClass - public void deleteCreatedStacks() { - dashboard.selectStacksItemOnDashboard(); - stacks.waitToolbarTitleName(); - - stacks.selectAllStacksByBulk(); - - if (stacks.isDeleteStackButtonEnabled()) { - stacks.clickOnDeleteStackButton(); - stacks.clickOnDeleteDialogButton(); - - dashboard.waitNotificationMessage("Selected stacks have been successfully removed."); - dashboard.waitNotificationIsClosed(); - } - } - - @Test(groups = {TestGroup.DOCKER}) - public void createStackFromComposeRecipe() { - createStack("compose", COMPOSE_RECIPE); - } - - @Test - public void createStackFromDockerimageRecipe() { - createStack("dockerimage", DOCKERIMAGE_RECIPE); - } - - @Test(groups = {TestGroup.DOCKER}) - public void createStackFromDockerfileRecipe() { - createStack("dockerfile", DOCKERFILE_RECIPE); - } - - @Test(groups = {TestGroup.OPENSHIFT}) - public void createStackFromKubernetesRecipe() { - createStack("kubernetes", KUBERNETES_RECIPE); - } - - @Test(groups = {TestGroup.OPENSHIFT}) - public void createStackFromOpenshiftRecipe() { - createStack("openshift", KUBERNETES_RECIPE); - } - - private void createStack(String stackName, String recipe) { - String name = generate(stackName, 5); - - buildStackFromRecipe.selectTabByName(stackName); - - // wait for editor to be active for typing after tab selection - WaitUtils.sleepQuietly(1); - buildStackFromRecipe.enterRecipe(recipe); - - // wait that recipe is valid and create stack - buildStackFromRecipe.checkRecipeIsCorrect(); - buildStackFromRecipe.waitOkButtonEnabled(); - buildStackFromRecipe.clickOnOkButton(); - buildStackFromRecipe.waitCreateStackDialogClosed(); - - // check that stack was created correctly and save changes - stackDetails.waitToolbar(); - stackDetails.setStackName(name); - stackDetails.clickOnSaveChangesButton(); - stackDetails.waitToolbarWithStackName(name); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteRunningWorkspaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteRunningWorkspaceTest.java index b3edaa89541..25f1d2d05b7 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteRunningWorkspaceTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteRunningWorkspaceTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.dashboard; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.OVERVIEW; @@ -27,6 +28,8 @@ import org.testng.annotations.Test; /** @author Andrey Chizhikov */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class DeleteRunningWorkspaceTest { @Inject private Dashboard dashboard; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteStoppingWorkspaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteStoppingWorkspaceTest.java index 69f025a24c1..f9d56e06df8 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteStoppingWorkspaceTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/DeleteStoppingWorkspaceTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.dashboard; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPED; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.OVERVIEW; @@ -25,6 +26,8 @@ import org.testng.annotations.Test; /** @author Andrey Chizhikov */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class DeleteStoppingWorkspaceTest { @Inject private Dashboard dashboard; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromZipTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromZipTest.java deleted file mode 100644 index c3ed9b518e7..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/ImportProjectFromZipTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Sources.ZIP; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspaceProvider; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack; -import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.eclipse.che.selenium.pageobject.theia.TheiaIde; -import org.eclipse.che.selenium.pageobject.theia.TheiaProjectTree; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -@Test(groups = UNDER_REPAIR) -public class ImportProjectFromZipTest { - - private final String WORKSPACE = generate("ImptPrjFromZip", 4); - private static final String PROJECT_NAME = "master"; - - @Inject private Dashboard dashboard; - @Inject private NewWorkspace newWorkspace; - @Inject private ProjectSourcePage projectSourcePage; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private DefaultTestUser defaultTestUser; - @Inject private Workspaces workspaces; - @Inject private TestGitHubRepository testRepo; - @Inject private TestWorkspaceProvider testWorkspaceProvider; - @Inject private TheiaIde theiaIde; - @Inject private TheiaProjectTree theiaProjectTree; - - // it is used to read workspace logs on test failure - private TestWorkspace testWorkspace; - - @BeforeClass - public void setUp() throws IOException { - Path entryPath = Paths.get(getClass().getResource("/projects/java-multimodule").getPath()); - testRepo.addContent(entryPath); - - dashboard.open(); - } - - @AfterClass - public void tearDown() throws Exception { - workspaceServiceClient.delete(WORKSPACE, defaultTestUser.getName()); - } - - @Test - public void importProjectFromZipTest() { - String testRepoFullName = testRepo.getFullName(); - String zipUrl = - String.format("%s/%s/%s", "https://github.com", testRepoFullName, "archive/master.zip"); - - dashboard.waitDashboardToolbarTitle(); - dashboard.selectWorkspacesItemOnDashboard(); - - workspaces.clickOnAddWorkspaceBtn(); - newWorkspace.waitToolbar(); - - // we are selecting 'Java' stack from the 'All Stack' tab for compatibility with OSIO - newWorkspace.selectStack(Stack.JAVA_MAVEN); - newWorkspace.typeWorkspaceName(WORKSPACE); - - projectSourcePage.clickOnAddOrImportProjectButton(); - projectSourcePage.selectSourceTab(ZIP); - projectSourcePage.typeZipLocation(zipUrl); - projectSourcePage.skipRootFolder(); - projectSourcePage.clickOnAddProjectButton(); - - newWorkspace.clickOnCreateButtonAndOpenInIDE(); - // store info about created workspace to make SeleniumTestHandler.captureTestWorkspaceLogs() - // possible to read logs in case of test failure - testWorkspace = testWorkspaceProvider.getWorkspace(WORKSPACE, defaultTestUser); - - theiaIde.switchToIdeFrame(); - theiaIde.waitTheiaIde(); - theiaIde.waitLoaderInvisibility(); - theiaIde.waitTheiaIdeTopPanel(); - theiaProjectTree.waitFilesTab(); - - // wait the project in the tree - theiaProjectTree.clickOnFilesTab(); - theiaProjectTree.waitProjectsRootItem(); - theiaProjectTree.waitProjectAreaOpened(); - theiaIde.waitTheiaIdeTopPanel(); - theiaProjectTree.waitFilesTab(); - - try { - theiaProjectTree.waitItem(PROJECT_NAME); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/13579"); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java index 715680bde7d..47f86c423d1 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/RenameWorkspaceTest.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.dashboard; import static org.eclipse.che.commons.lang.NameGenerator.generate; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.OVERVIEW; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces.Status.STOPPED; import static org.testng.Assert.assertFalse; @@ -31,6 +32,8 @@ import org.testng.annotations.Test; /** @author Andrey Chizhikov */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class RenameWorkspaceTest { private static final int MIN_WORKSPACE_NAME_SIZE = 3; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/StacksListTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/StacksListTest.java deleted file mode 100644 index ae8d2624fc6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/StacksListTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.constant.TestStacksConstants.ANDROID; -import static org.eclipse.che.selenium.core.constant.TestStacksConstants.BLANK; -import static org.eclipse.che.selenium.core.constant.TestStacksConstants.JAVA; -import static org.eclipse.che.selenium.core.constant.TestStacksConstants.JAVA_MYSQL; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.Collections; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.stacks.StackDetails; -import org.eclipse.che.selenium.pageobject.dashboard.stacks.Stacks; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class StacksListTest { - - @Inject private StackDetails stackDetails; - @Inject private Dashboard dashboard; - @Inject private Stacks stacks; - - @BeforeClass - public void setUp() throws Exception { - dashboard.open(); - } - - @BeforeMethod - public void openStacksListPage() { - dashboard.waitDashboardToolbarTitle(); - dashboard.selectStacksItemOnDashboard(); - stacks.waitToolbarTitleName(); - } - - @AfterClass - public void deleteCreatedStacks() { - dashboard.selectStacksItemOnDashboard(); - stacks.waitToolbarTitleName(); - stacks.selectAllStacksByBulk(); - deleteStack(); - } - - @Test - public void checkStacksList() { - // check UI views of Stacks list - stacks.waitToolbarTitleName(); - stacks.waitDocumentationLink(); - stacks.waitAddStackButton(); - stacks.waitBuildStackFromRecipeButton(); - stacks.waitFilterStacksField(); - - // check that all Stack list headers are present - ArrayList headers = stacks.getStacksListHeaders(); - assertTrue(headers.contains("NAME")); - assertTrue(headers.contains("DESCRIPTION")); - assertTrue(headers.contains("COMPONENTS")); - assertTrue(headers.contains("ACTIONS")); - - // check Android stack info - assertTrue(stacks.isStackItemExisted(ANDROID.getName())); - assertEquals( - stacks.getStackDescription(ANDROID.getName()), - "Default Android Stack with Java 1.8 and Android SDK"); - assertEquals(stacks.getStackComponents(ANDROID.getName()), "Centos, JDK, Maven, Android API"); - } - - @Test - public void checkStacksSelectingByCheckbox() { - String stackName = createDuplicatedStack(JAVA_MYSQL.getName()); - - // select stacks by checkbox and check it is selected - stacks.selectStackByCheckbox(stackName); - assertTrue(stacks.isStackChecked(stackName)); - stacks.selectStackByCheckbox(stackName); - assertFalse(stacks.isStackChecked(stackName)); - - // click on the Bulk button and check that created stack is checked - stacks.selectAllStacksByBulk(); - assertTrue(stacks.isStackChecked(stackName)); - } - - @Test - public void checkStacksFiltering() { - // filter stacks by nonexistent name - stacks.typeToSearchInput("*"); - stacks.waitNoStacksFound(); - - // search stacks by a full name - stacks.typeToSearchInput(JAVA.getName()); - assertTrue(stacks.isStackItemExisted(JAVA.getName())); - assertTrue(stacks.isStackItemExisted(JAVA_MYSQL.getName())); - assertFalse(stacks.isStackItemExisted(BLANK.getName())); - - stacks.typeToSearchInput(BLANK.getName()); - assertTrue(stacks.isStackItemExisted(BLANK.getName())); - assertFalse(stacks.isStackItemExisted(JAVA.getName())); - assertFalse(stacks.isStackItemExisted(JAVA_MYSQL.getName())); - - // search stacks by a part name - stacks.typeToSearchInput(BLANK.getName().substring(BLANK.getName().length() / 2)); - assertTrue(stacks.isStackItemExisted(BLANK.getName())); - assertFalse(stacks.isStackItemExisted(JAVA.getName())); - assertFalse(stacks.isStackItemExisted(JAVA_MYSQL.getName())); - } - - @Test - public void checkStacksSorting() { - ArrayList stackNamesListBeforeSorting, stackNamesListAfterSorting; - // click on sort button to initialize it - stacks.clickOnSortStacksByNameButton(); - - // get stacks names list and click on sort stacks button - stackNamesListBeforeSorting = stacks.getStacksNamesList(); - stacks.clickOnSortStacksByNameButton(); - - // check that Stacks list reverted - stackNamesListAfterSorting = stacks.getStacksNamesList(); - Collections.reverse(stackNamesListBeforeSorting); - assertEquals(stackNamesListBeforeSorting, stackNamesListAfterSorting); - - stacks.clickOnSortStacksByNameButton(); - stackNamesListBeforeSorting = stacks.getStacksNamesList(); - Collections.reverse(stackNamesListAfterSorting); - assertEquals(stackNamesListBeforeSorting, stackNamesListAfterSorting); - } - - @Test - public void checkStackActionButtons() { - String stackName; - - // create stack duplicate by Duplicate Stack button - stackName = createDuplicatedStack(JAVA.getName()); - assertTrue(stacks.isDuplicatedStackExisted(stackName)); - - // delete stack by the Action delete stack button - deleteStackByActionDeleteButton(stackName); - - stackName = createDuplicatedStack(BLANK.getName()); - assertTrue(stacks.isDuplicatedStackExisted(stackName)); - deleteStackByActionDeleteButton(stackName); - } - - private void deleteStack() { - stacks.clickOnDeleteStackButton(); - stacks.clickOnDeleteDialogButton(); - dashboard.waitNotificationMessage("Selected stacks have been successfully removed."); - dashboard.waitNotificationIsClosed(); - } - - private String createDuplicatedStack(String stack) { - String createdStackName = ""; - - dashboard.selectStacksItemOnDashboard(); - stacks.waitToolbarTitleName(); - stacks.clickOnDuplicateStackButton(stack); - - for (String name : stacks.getStacksNamesList()) { - if (name.contains(stack + "-copy-")) { - createdStackName = name; - } - } - - return createdStackName; - } - - private void deleteStackByActionDeleteButton(String name) { - // delete stack by the Action delete stack button - stacks.clickOnDeleteActionButton(name); - stacks.clickOnDeleteDialogButton(); - dashboard.waitNotificationMessage(format("Stack %s has been successfully removed.", name)); - dashboard.waitNotificationIsClosed(); - assertFalse(stacks.isStackItemExisted(name)); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AddWorkspaceToOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AddWorkspaceToOrganizationTest.java index 1dc7a9f7b72..1de8d68fcbf 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AddWorkspaceToOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AddWorkspaceToOrganizationTest.java @@ -33,7 +33,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class AddWorkspaceToOrganizationTest { private static final String WORKSPACE_FOR_ADMIN_1 = generate("workspace", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfParentOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfParentOrganizationTest.java index 619b74c831e..9beeecd7584 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfParentOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfParentOrganizationTest.java @@ -44,7 +44,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class AdminOfParentOrganizationTest { private int initialOrgCount; private TestOrganizationServiceClient userTestOrganizationServiceClient; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfSubOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfSubOrganizationTest.java index 38d3288b86e..eaf638b8ec0 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfSubOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/AdminOfSubOrganizationTest.java @@ -42,7 +42,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class AdminOfSubOrganizationTest { private int initialOrgNumber; private TestOrganizationServiceClient testOrganizationServiceClient; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/CreateRootOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/CreateRootOrganizationTest.java index 4f230078a80..38bcea50809 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/CreateRootOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/CreateRootOrganizationTest.java @@ -35,7 +35,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class CreateRootOrganizationTest { private static final String PARENT_ORG_NAME = generate("parent-", 4); private static final String CHILD_ORG_NAME = generate("child-", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationByBulkTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationByBulkTest.java index c345367cf7a..a493b0f2de2 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationByBulkTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationByBulkTest.java @@ -35,7 +35,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class DeleteOrganizationByBulkTest { private static final int TEST_ROOT_ORG_NUMBER = 2; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationInListTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationInListTest.java index 163fef0bb84..cd80121d0f9 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationInListTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationInListTest.java @@ -35,7 +35,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class DeleteOrganizationInListTest { private int initialOrgNumber; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationTest.java index 1536393434e..9c039f46469 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/DeleteOrganizationTest.java @@ -34,7 +34,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class DeleteOrganizationTest { private int initialOrgNumber; private TestOrganizationServiceClient testOrganizationServiceClient; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/FilterOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/FilterOrganizationTest.java index 852582efc91..a2ffaa5c521 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/FilterOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/FilterOrganizationTest.java @@ -37,7 +37,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class FilterOrganizationTest { private static final String WRONG_ORG_NAME = generate("wrong-org-", 7); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/MemberOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/MemberOrganizationTest.java index 81860b23050..d9099235627 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/MemberOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/MemberOrganizationTest.java @@ -42,7 +42,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class MemberOrganizationTest { private int initialOrgNumber; private TestOrganizationServiceClient testOrganizationServiceClient; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/OrganizationMembersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/OrganizationMembersTest.java index e4278b24532..b1af52cf38e 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/OrganizationMembersTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/OrganizationMembersTest.java @@ -33,7 +33,7 @@ import org.testng.annotations.Test; /** @author Sergey Skorik */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class OrganizationMembersTest { private static final String NEW_ORG_NAME = generate("new-org-", 5); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/RenameOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/RenameOrganizationTest.java index 214443597d8..fde3cb256ba 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/RenameOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/RenameOrganizationTest.java @@ -36,7 +36,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class RenameOrganizationTest { private static final String NEW_PARENT_ORG_NAME = generate("new-parent-", 5); private static final String NEW_CHILD_ORG_NAME = generate("new-child-", 5); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceMemberTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceMemberTest.java index 62620c4f3f3..ae0a4c26f88 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceMemberTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceMemberTest.java @@ -47,7 +47,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class ShareWorkspaceMemberTest { private static final String WORKSPACE_NAME = generate("workspace", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceOwnerTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceOwnerTest.java index dfb9a9c120e..41154cafb16 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceOwnerTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/ShareWorkspaceOwnerTest.java @@ -37,14 +37,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -@Test( - groups = { - TestGroup.MULTIUSER, - TestGroup.DOCKER, - TestGroup.OPENSHIFT, - TestGroup.K8S, - TestGroup.FLAKY - }) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S, TestGroup.FLAKY}) public class ShareWorkspaceOwnerTest { private static final String WORKSPACE_NAME = generate("workspace", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/SystemAdminOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/SystemAdminOrganizationTest.java index 4d2f0a5a8ca..0468bc4bd83 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/SystemAdminOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/SystemAdminOrganizationTest.java @@ -41,7 +41,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class SystemAdminOrganizationTest { private int initialRootOrgNumber; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/UserEmptyOrganizationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/UserEmptyOrganizationTest.java index 02a5deea977..0f8bd62231d 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/UserEmptyOrganizationTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/organization/UserEmptyOrganizationTest.java @@ -32,7 +32,7 @@ * * @author Ann Shumilova */ -@Test(groups = {TestGroup.MULTIUSER, TestGroup.DOCKER, TestGroup.OPENSHIFT, TestGroup.K8S}) +@Test(groups = {TestGroup.MULTIUSER, TestGroup.OPENSHIFT, TestGroup.K8S}) public class UserEmptyOrganizationTest { private TestOrganizationServiceClient organizationServiceClient; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/AddOrImportProjectFormTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/AddOrImportProjectFormTest.java deleted file mode 100644 index 69d0c8ca1e0..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/AddOrImportProjectFormTest.java +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard.workspaces; - -import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.RUNNING; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.testng.Assert.assertEquals; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspaceProvider; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.AddOrImportForm; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace.Stack; -import org.eclipse.che.selenium.pageobject.dashboard.ProjectOptions; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Ihor Okhrimenko */ -public class AddOrImportProjectFormTest { - - private static final String NAME_WITH_MAX_AVAILABLE_LENGTH = generate("name", 124); - private static final String WORKSPACE_NAME = generate("test-workspace", 4); - private static final String TEST_BLANK_WORKSPACE_NAME = "test-blank-workspace"; - private static final String TEST_JAVA_WORKSPACE_NAME = "test-java-workspace"; - private static final String TEST_JAVA_WORKSPACE_NAME_EDIT = generate("test-java-workspace", 4); - private static final String NAME_WITH_SPECIAL_CHARACTERS = "@#$%^&*"; - private static final String SPRING_SAMPLE_NAME = "web-java-spring"; - private static final String EXPECTED_SPRING_REPOSITORY_URL = - "https://github.com/che-samples/web-java-spring.git"; - private static final String CONSOLE_SAMPLE_NAME = "console-java-simple"; - private static final String RENAMED_CONSOLE_SAMPLE_NAME = "java-console-test"; - private static final String EXPECTED_CONSOLE_REPOSITORY_URL = - "https://github.com/che-samples/console-java-simple.git"; - private static final String BLANK_FORM_DESCRIPTION = "example of description"; - private static final String SPRING_FUSE_SAMPLE = "fuse-rest-http-booster"; - private static final String CUSTOM_BLANK_PROJECT_NAME = "blank-project"; - private static final String BLANK_PROJECT_NAME = "blank"; - private static final String BLANK_DEFAULT_URL = "https://github.com/che-samples/blank"; - private static final ImmutableMap EXPECTED_SAMPLES_WITH_DESCRIPTIONS = - ImmutableMap.of( - SPRING_SAMPLE_NAME, - "A basic example using Spring servlets. The app returns values entered into a submit form.", - SPRING_FUSE_SAMPLE, - "Fuse booster.", - CONSOLE_SAMPLE_NAME, - "A hello world Java application."); - private static final String EXPECTED_TEXT_IN_EDITOR = - "package org.eclipse.che.examples;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class GreetingController implements Controller\n" - + "{\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception\n" - + " {\n" - + " String userName = request.getParameter(\"user\");\n" - + " String result = \"\";\n" - + " if (userName != null)\n" - + " {\n" - + " result = \"Hello, \" + userName + \"!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"hello_view\");\n" - + " view.addObject(\"greeting\", result);\n" - + " return view;\n" - + " }\n" - + "}\n"; - - private static final String PATH_TO_JAVA_FILE = - "/src/main/java/org/eclipse/che/examples/GreetingController.java"; - - @Inject private Ide ide; - @Inject private Dashboard dashboard; - @Inject private DefaultTestUser defaultTestUser; - @Inject private Workspaces workspaces; - @Inject private NewWorkspace newWorkspace; - @Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private WorkspaceOverview workspaceOverview; - @Inject private WorkspaceDetails workspaceDetails; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private ProjectOptions projectOptions; - @Inject private AddOrImportForm addOrImportForm; - @Inject private TestWorkspaceProvider testWorkspaceProvider; - @Inject private Consoles consoles; - - // it is used to read workspace logs on test failure - private TestWorkspace testWorkspace; - - @BeforeClass - public void setup() { - dashboard.open(); - } - - @AfterClass - public void cleanup() throws Exception { - testWorkspaceServiceClient.delete(WORKSPACE_NAME, defaultTestUser.getName()); - testWorkspaceServiceClient.delete(TEST_BLANK_WORKSPACE_NAME, defaultTestUser.getName()); - testWorkspaceServiceClient.delete(TEST_JAVA_WORKSPACE_NAME, defaultTestUser.getName()); - testWorkspaceServiceClient.delete(TEST_JAVA_WORKSPACE_NAME_EDIT, defaultTestUser.getName()); - } - - @BeforeMethod - public void prepareToTestMethod() { - dashboard.waitDashboardToolbarTitle(); - dashboard.selectWorkspacesItemOnDashboard(); - workspaces.waitToolbarTitleName(); - workspaces.clickOnAddWorkspaceBtn(); - newWorkspace.waitPageLoad(); - } - - @Test - public void checkOfCheckboxes() { - // preparing - newWorkspace.waitPageLoad(); - newWorkspace.selectStack(Stack.JAVA_MAVEN); - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.waitSamplesButtonSelected(); - addOrImportForm.waitSamplesWithDescriptions(EXPECTED_SAMPLES_WITH_DESCRIPTIONS); - waitAllCheckboxesDisabled(); - addOrImportForm.waitCancelButtonDisabled(); - addOrImportForm.waitAddButtonDisabled(); - - // click on single disabled checkbox - addOrImportForm.clickOnSampleCheckbox(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitCancelButtonEnabled(); - addOrImportForm.waitAddButtonEnabled(); - - // unselect checkbox by "Cancel" button - addOrImportForm.clickOnCancelButton(); - addOrImportForm.waitSampleCheckboxDisabled(CONSOLE_SAMPLE_NAME); - - // select and unselect single checkbox by clicking on it - addOrImportForm.clickOnSampleCheckbox(SPRING_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(SPRING_SAMPLE_NAME); - addOrImportForm.waitCancelButtonEnabled(); - addOrImportForm.waitAddButtonEnabled(); - - addOrImportForm.clickOnSampleCheckbox(SPRING_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxDisabled(SPRING_SAMPLE_NAME); - addOrImportForm.waitCancelButtonDisabled(); - addOrImportForm.waitAddButtonDisabled(); - - // unselect multiple checkboxes by "Cancel" button - clickOnEachCheckbox(); - waitAllCheckboxesEnabled(); - addOrImportForm.waitCancelButtonEnabled(); - addOrImportForm.waitAddButtonEnabled(); - - addOrImportForm.clickOnCancelButton(); - waitAllCheckboxesDisabled(); - addOrImportForm.waitCancelButtonDisabled(); - addOrImportForm.waitAddButtonDisabled(); - } - - @Test(priority = 1) - public void checkProjectSamples() { - // preparing - newWorkspace.waitPageLoad(); - newWorkspace.selectStack(Stack.JAVA_MAVEN); - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.waitSamplesButtonSelected(); - - // add single sample to workspace - addOrImportForm.clickOnSampleCheckbox(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitCancelButtonEnabled(); - addOrImportForm.waitAddButtonEnabled(); - - addOrImportForm.clickOnAddButton(); - checkProjectTabAppearanceAndFields( - CONSOLE_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(CONSOLE_SAMPLE_NAME), - EXPECTED_CONSOLE_REPOSITORY_URL); - - // remove added sample by "Remove" button - projectOptions.clickOnRemoveButton(); - addOrImportForm.waitProjectTabDisappearance(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.waitSamplesButtonSelected(); - addOrImportForm.waitSamplesWithDescriptions(EXPECTED_SAMPLES_WITH_DESCRIPTIONS); - waitAllCheckboxesDisabled(); - addOrImportForm.waitCancelButtonDisabled(); - addOrImportForm.waitAddButtonDisabled(); - - // add multiple samples - clickOnEachCheckbox(); - waitAllCheckboxesEnabled(); - addOrImportForm.waitCancelButtonEnabled(); - addOrImportForm.waitAddButtonEnabled(); - - addOrImportForm.clickOnAddButton(); - addOrImportForm.waitProjectTabAppearance(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitProjectTabAppearance(SPRING_SAMPLE_NAME); - - addOrImportForm.clickOnProjectTab(CONSOLE_SAMPLE_NAME); - checkProjectTabAppearanceAndFields( - CONSOLE_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(CONSOLE_SAMPLE_NAME), - EXPECTED_CONSOLE_REPOSITORY_URL); - - addOrImportForm.clickOnProjectTab(SPRING_SAMPLE_NAME); - checkProjectTabAppearanceAndFields( - SPRING_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(SPRING_SAMPLE_NAME), - EXPECTED_SPRING_REPOSITORY_URL); - - // remove sample - projectOptions.clickOnRemoveButton(); - addOrImportForm.waitProjectTabAppearance(CONSOLE_SAMPLE_NAME); - addOrImportForm.waitProjectTabDisappearance(SPRING_SAMPLE_NAME); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.waitSamplesButtonSelected(); - - // check name field of the project tab - addOrImportForm.clickOnProjectTab(CONSOLE_SAMPLE_NAME); - projectOptions.waitProjectOptionsForm(); - - projectOptions.setValueOfNameField(""); - projectOptions.waitProjectNameErrorMessage("A name is required."); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonEnabling(); - - projectOptions.setValueOfNameField(RENAMED_CONSOLE_SAMPLE_NAME); - projectOptions.waitProjectNameErrorDisappearance(); - projectOptions.waitSaveButtonEnabling(); - projectOptions.waitCancelButtonEnabling(); - - projectOptions.setValueOfNameField(""); - projectOptions.waitProjectNameErrorMessage("A name is required."); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonEnabling(); - - projectOptions.setValueOfNameField(NAME_WITH_MAX_AVAILABLE_LENGTH); - projectOptions.waitProjectNameErrorDisappearance(); - projectOptions.waitSaveButtonEnabling(); - projectOptions.waitCancelButtonEnabling(); - - projectOptions.setValueOfNameField(NAME_WITH_MAX_AVAILABLE_LENGTH + "p"); - projectOptions.waitProjectNameErrorMessage("The name has to be less than 128 characters long."); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonEnabling(); - - projectOptions.setValueOfNameField(NAME_WITH_SPECIAL_CHARACTERS); - projectOptions.waitProjectNameErrorMessage( - "The name should not contain special characters like space, dollar, etc."); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonEnabling(); - - // check of restoring the previous values of the tab after click "Cancel" button - projectOptions.typeTextInDescriptionField(""); - projectOptions.clickOnCancelButton(); - checkProjectTabAppearanceAndFields( - CONSOLE_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(CONSOLE_SAMPLE_NAME), - EXPECTED_CONSOLE_REPOSITORY_URL); - - // Check "Url" field - projectOptions.typeTextInRepositoryUrlField(""); - projectOptions.waitRepositoryUrlErrorMessage("Invalid Git URL"); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonEnabling(); - - // check of restoring the previous values of the tab after click "Cancel" button - projectOptions.clickOnCancelButton(); - checkProjectTabAppearanceAndFields( - CONSOLE_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(CONSOLE_SAMPLE_NAME), - EXPECTED_CONSOLE_REPOSITORY_URL); - - // check of restoring the previous values of the tab after click on the another project tab - // without saving - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.clickOnSampleCheckbox(SPRING_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(SPRING_SAMPLE_NAME); - addOrImportForm.clickOnAddButton(); - addOrImportForm.waitProjectTabAppearance(SPRING_SAMPLE_NAME); - addOrImportForm.clickOnProjectTab(CONSOLE_SAMPLE_NAME); - projectOptions.waitProjectNameFieldValue(CONSOLE_SAMPLE_NAME); - - projectOptions.setValueOfNameField(""); - projectOptions.typeTextInDescriptionField(""); - projectOptions.typeTextInRepositoryUrlField(""); - - addOrImportForm.clickOnProjectTab(SPRING_SAMPLE_NAME); - projectOptions.waitProjectNameFieldValue(SPRING_SAMPLE_NAME); - - addOrImportForm.clickOnProjectTab(CONSOLE_SAMPLE_NAME); - checkProjectTabAppearanceAndFields( - CONSOLE_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(CONSOLE_SAMPLE_NAME), - EXPECTED_CONSOLE_REPOSITORY_URL); - - // check ability of creation the sample with specified valid name - projectOptions.setValueOfNameField(RENAMED_CONSOLE_SAMPLE_NAME); - projectOptions.clickOnSaveButton(); - addOrImportForm.waitProjectTabAppearance(RENAMED_CONSOLE_SAMPLE_NAME); - projectOptions.waitSaveButtonDisabling(); - projectOptions.waitCancelButtonDisabling(); - } - - @Test(priority = 2) - public void checkProjectsBlank() throws Exception { - // preparing - newWorkspace.waitPageLoad(); - newWorkspace.selectStack(Stack.JAVA_MAVEN); - newWorkspace.waitStackSelected(Stack.JAVA_MAVEN); - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - addOrImportForm.clickOnBlankButton(); - - // check name field - addOrImportForm.typeToBlankNameField(NAME_WITH_MAX_AVAILABLE_LENGTH); - addOrImportForm.waitErrorMessageDissappearanceInBlankNameField(); - addOrImportForm.waitAddButtonEnabled(); - addOrImportForm.waitCancelButtonEnabled(); - - addOrImportForm.typeToBlankNameField(""); - addOrImportForm.waitAddButtonDisabled(); - addOrImportForm.waitCancelButtonDisabled(); - - addOrImportForm.typeToBlankNameField(NAME_WITH_MAX_AVAILABLE_LENGTH + "p"); - addOrImportForm.waitNameFieldErrorMessageInBlankForm( - "The name has to be less than 128 characters long."); - addOrImportForm.waitAddButtonDisabled(); - addOrImportForm.waitCancelButtonEnabled(); - - addOrImportForm.typeToBlankNameField(NAME_WITH_SPECIAL_CHARACTERS); - addOrImportForm.waitNameFieldErrorMessageInBlankForm( - "The name should not contain special characters like space, dollar, etc."); - addOrImportForm.waitAddButtonDisabled(); - addOrImportForm.waitCancelButtonEnabled(); - - // check description field - addOrImportForm.typeToBlankDescriptionField(BLANK_FORM_DESCRIPTION); - addOrImportForm.waitTextInBlankDescriptionField(BLANK_FORM_DESCRIPTION); - - addOrImportForm.clickOnCancelButton(); - addOrImportForm.waitTextInBlankNameField(""); - addOrImportForm.waitTextInBlankDescriptionField(""); - - // add sample with specified valid name and description - addOrImportForm.typeToBlankNameField(CUSTOM_BLANK_PROJECT_NAME); - addOrImportForm.typeToBlankDescriptionField(BLANK_FORM_DESCRIPTION); - addOrImportForm.clickOnAddButton(); - - addOrImportForm.waitProjectTabAppearance(CUSTOM_BLANK_PROJECT_NAME); - checkProjectTabAppearanceAndFields( - CUSTOM_BLANK_PROJECT_NAME, BLANK_FORM_DESCRIPTION, BLANK_DEFAULT_URL); - - // check that added by "Git" button project has an expected name and description - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - - addOrImportForm.clickOnGitButton(); - addOrImportForm.waitGitTabOpened(); - - addOrImportForm.typeToGitUrlField(BLANK_DEFAULT_URL); - addOrImportForm.clickOnAddButton(); - checkProjectTabAppearanceAndFields(BLANK_PROJECT_NAME, "", BLANK_DEFAULT_URL); - - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - - addOrImportForm.clickOnGitHubButton(); - newWorkspace.typeWorkspaceName(WORKSPACE_NAME); - - newWorkspace.clickOnCreateButtonAndEditWorkspace(); - workspaceDetails.waitToolbarTitleName(WORKSPACE_NAME); - workspaceDetails.checkStateOfWorkspace(StateWorkspace.STOPPED); - // store info about created workspace to make SeleniumTestHandler.captureTestWorkspaceLogs() - // possible to read logs in case of test failure - testWorkspace = testWorkspaceProvider.getWorkspace(WORKSPACE_NAME, defaultTestUser); - } - - @Test(priority = 3) - public void checkCreatingProject() throws Exception { - // check that name field saves it state after choosing another stack - newWorkspace.waitPageLoad(); - newWorkspace.typeWorkspaceName(TEST_BLANK_WORKSPACE_NAME); - newWorkspace.selectStack(Stack.DOT_NET); - newWorkspace.waitStackSelected(Stack.DOT_NET); - assertEquals(newWorkspace.getWorkspaceNameValue(), TEST_BLANK_WORKSPACE_NAME); - - newWorkspace.selectStack(Stack.JAVA_MAVEN); - newWorkspace.waitStackSelected(Stack.JAVA_MAVEN); - assertEquals(newWorkspace.getWorkspaceNameValue(), TEST_BLANK_WORKSPACE_NAME); - - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - - addOrImportForm.clickOnSampleCheckbox(SPRING_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(SPRING_SAMPLE_NAME); - - addOrImportForm.clickOnAddButton(); - addOrImportForm.waitProjectTabAppearance(SPRING_SAMPLE_NAME); - - newWorkspace.clickOnCreateButtonAndEditWorkspace(); - workspaceOverview.checkNameWorkspace(TEST_BLANK_WORKSPACE_NAME); - - seleniumWebDriver.navigate().back(); - - prepareJavaWorkspace(TEST_JAVA_WORKSPACE_NAME); - newWorkspace.clickOnCreateButtonAndEditWorkspace(); - workspaceOverview.checkNameWorkspace(TEST_JAVA_WORKSPACE_NAME); - - seleniumWebDriver.navigate().back(); - - prepareJavaWorkspace(TEST_JAVA_WORKSPACE_NAME_EDIT); - newWorkspace.clickOnTopCreateButton(); - - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - testWorkspaceServiceClient.waitStatus( - TEST_JAVA_WORKSPACE_NAME_EDIT, defaultTestUser.getName(), RUNNING); - - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(SPRING_SAMPLE_NAME); - projectExplorer.waitItem(SPRING_SAMPLE_NAME); - projectExplorer.quickRevealToItemWithJavaScript(SPRING_SAMPLE_NAME + PATH_TO_JAVA_FILE); - projectExplorer.openItemByPath(SPRING_SAMPLE_NAME + PATH_TO_JAVA_FILE); - editor.waitActive(); - editor.waitTextIntoEditor(EXPECTED_TEXT_IN_EDITOR); - } - - private void waitAllCheckboxesDisabled() { - addOrImportForm - .getSamplesNames() - .forEach(sampleName -> addOrImportForm.waitSampleCheckboxDisabled(sampleName)); - } - - private void waitAllCheckboxesEnabled() { - addOrImportForm - .getSamplesNames() - .forEach(sampleName -> addOrImportForm.waitSampleCheckboxEnabled(sampleName)); - } - - private void clickOnEachCheckbox() { - addOrImportForm - .getSamplesNames() - .forEach(sampleName -> addOrImportForm.clickOnSampleCheckbox(sampleName)); - } - - private void checkProjectTabAppearanceAndFields( - String tabName, String expectedDescription, String expectedUrl) { - projectOptions.waitProjectOptionsForm(); - projectOptions.waitProjectNameFieldValue(tabName); - projectOptions.waitDescriptionFieldValue(expectedDescription); - projectOptions.waitRepositoryUrlFieldValue(expectedUrl); - projectOptions.waitRemoveButton(); - projectOptions.waitCancelButtonDisabling(); - projectOptions.waitSaveButtonDisabling(); - } - - private void prepareJavaWorkspace(String workspaceName) { - // prepare workspace - newWorkspace.waitPageLoad(); - newWorkspace.typeWorkspaceName(workspaceName); - - newWorkspace.selectStack(Stack.JAVA_MAVEN); - newWorkspace.waitStackSelected(Stack.JAVA_MAVEN); - - addOrImportForm.clickOnAddOrImportProjectButton(); - addOrImportForm.waitAddOrImportFormOpened(); - - addOrImportForm.clickOnSampleCheckbox(SPRING_SAMPLE_NAME); - addOrImportForm.waitSampleCheckboxEnabled(SPRING_SAMPLE_NAME); - - addOrImportForm.clickOnAddButton(); - checkProjectTabAppearanceAndFields( - SPRING_SAMPLE_NAME, - EXPECTED_SAMPLES_WITH_DESCRIPTIONS.get(SPRING_SAMPLE_NAME), - EXPECTED_SPRING_REPOSITORY_URL); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/WorkspacesListTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/WorkspacesListTest.java index 81307858259..00484cc6b77 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/WorkspacesListTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/WorkspacesListTest.java @@ -48,6 +48,8 @@ * @author Sergey Skorik * @author Ihor Okhrimenko */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class WorkspacesListTest { private static final int BLANK_WS_MB = 2048; private static final int JAVA_WS_MB = 3072; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachineActionsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachineActionsTest.java deleted file mode 100644 index 928a726b212..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachineActionsTest.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard.workspaces.details; - -import static org.eclipse.che.selenium.core.TestGroup.DOCKER; -import static org.eclipse.che.selenium.core.TestGroup.K8S; -import static org.eclipse.che.selenium.core.TestGroup.OPENSHIFT; -import static org.eclipse.che.selenium.core.TestGroup.OSIO; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.APPLY_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.CANCEL_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.SAVE_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.MACHINES; -import static org.openqa.selenium.Keys.ARROW_DOWN; -import static org.openqa.selenium.Keys.ARROW_UP; -import static org.openqa.selenium.Keys.ESCAPE; - -import com.google.inject.Inject; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.EditMachineForm; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetailsMachines; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceInstallers; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceServers; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class WorkspaceDetailsMachineActionsTest { - private static final String MACHINE_NAME = "dev-machine"; - private static final String CHANGED_MACHINE_NAME = "test-machine"; - private static final String IMAGE_NAME = "eclipse/ubuntu_jdk8"; - private static final String EXPECTED_RAM_VALUE = "2"; - private static final String EMPTY_NAME_ERROR_MESSAGE = "Machine's name is required."; - private static final String SPECIAL_CHARACTERS_ERRORS_MESSAGE = - "The name should not contain special characters like space, dollar, etc."; - private static final String NAME_WITH_SPECIAL_CHARACTERS = "@#$^&*(!"; - private static final String MAX_VALID_NAME = NameGenerator.generate("max-name", 120); - private static final String TOO_BIG_NAME = NameGenerator.generate(MAX_VALID_NAME, 1); - private static final String TOO_BIG_RAM_SIZE = "1000"; - private static final String MAX_VALID_RAM_VALUE = "100"; - private static final String NOT_EXISTED_IMAGE = NameGenerator.generate("wrong/image", 5); - private static final String CHANGED_RAM_SIZE = "7"; - private static final String MIN_VALID_RAM_VALUE = "0.1"; - - @Inject private Dashboard dashboard; - @Inject private Workspaces workspaces; - @Inject private WorkspaceDetails workspaceDetails; - @Inject private WorkspaceDetailsMachines workspaceDetailsMachines; - @Inject private TestWorkspace testWorkspace; - @Inject private EditMachineForm editMachineForm; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private WorkspaceInstallers workspaceInstallers; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private WorkspaceServers workspaceServers; - - @BeforeMethod - public void setup() throws Exception { - // open workspace details "Machines" page - dashboard.open(); - dashboard.waitDashboardToolbarTitle(); - dashboard.selectWorkspacesItemOnDashboard(); - workspaces.waitPageLoading(); - workspaces.selectWorkspaceItemName(testWorkspace.getName()); - workspaceDetails.waitToolbarTitleName(testWorkspace.getName()); - workspaceDetails.selectTabInWorkspaceMenu(MACHINES); - } - - @Test - public void checkEditFormClosing() { - workspaceDetailsMachines.waitMachineListItemWithAttributes( - MACHINE_NAME, IMAGE_NAME, EXPECTED_RAM_VALUE); - - // close form by "ESC" button - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - seleniumWebDriverHelper.sendKeys(ESCAPE.toString()); - editMachineForm.waitFormInvisibility(); - - // close form by "x" icon - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.clickOnCloseIcon(); - editMachineForm.waitFormInvisibility(); - - // close form by "Close" button - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.clickOnCloseIcon(); - editMachineForm.waitFormInvisibility(); - } - - @Test(groups = {OPENSHIFT, K8S, OSIO}) - public void checkEditMachineNameOpenshift() { - checkEditOfMachineName(IMAGE_NAME); - } - - @Test(groups = DOCKER) - public void checkEditMachineNameDocker() { - checkEditOfMachineName("FROM " + IMAGE_NAME + "\n"); - } - - @Test(groups = {OPENSHIFT, K8S, OSIO}) - public void checkRamSectionOpenshift() { - checkRamSection(IMAGE_NAME); - } - - @Test(groups = {DOCKER}) - public void checkRamSectionDocker() { - checkRamSection("FROM " + IMAGE_NAME + "\n"); - } - - private void checkEditOfMachineName(String expectedRecipeText) { - // check default values - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.waitName(MACHINE_NAME); - editMachineForm.waitSliderRamValue(EXPECTED_RAM_VALUE + " GB"); - editMachineForm.waitRamFieldText(EXPECTED_RAM_VALUE); - editMachineForm.waitRecipeText(expectedRecipeText); - - // name empty field - editMachineForm.typeName(""); - editMachineForm.waitInvalidNameHighlighting(); - editMachineForm.waitNameErrorMessage(EMPTY_NAME_ERROR_MESSAGE); - editMachineForm.waitSaveButtonDisabling(); - setValidName(); - - // special characters - editMachineForm.typeName(NAME_WITH_SPECIAL_CHARACTERS); - editMachineForm.waitInvalidNameHighlighting(); - editMachineForm.waitNameErrorMessage(SPECIAL_CHARACTERS_ERRORS_MESSAGE); - editMachineForm.waitSaveButtonDisabling(); - setValidName(); - - // max valid name - editMachineForm.typeName(MAX_VALID_NAME); - editMachineForm.waitValidNameHighlighting(); - editMachineForm.waitSaveButtonEnabling(); - - // too long name - editMachineForm.typeName(TOO_BIG_NAME); - editMachineForm.waitInvalidNameHighlighting(); - editMachineForm.waitSaveButtonDisabling(); - } - - public void checkRamSection(String expectedRecipeText) { - // check machine name editing - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.typeName(CHANGED_MACHINE_NAME); - editMachineForm.waitValidNameHighlighting(); - editMachineForm.waitSaveButtonEnabling(); - - // check RAM field behavior with min valid value - editMachineForm.typeRam(MIN_VALID_RAM_VALUE); - editMachineForm.waitSliderRamValue(MIN_VALID_RAM_VALUE + " GB"); - seleniumWebDriverHelper.sendKeys(ARROW_DOWN.toString()); - editMachineForm.waitSliderRamValue(MIN_VALID_RAM_VALUE + " GB"); - editMachineForm.waitRamFieldText(MIN_VALID_RAM_VALUE); - - seleniumWebDriverHelper.sendKeys(ARROW_UP.toString()); - editMachineForm.waitRamFieldText("0.2"); - editMachineForm.waitSliderRamValue("0.2 GB"); - - // check RAM behavior with more than max valid value - editMachineForm.typeRam(TOO_BIG_RAM_SIZE); - editMachineForm.waitSaveButtonDisabling(); - editMachineForm.waitSliderRamValue("GB"); - - // check RAM behavior with max valid value - editMachineForm.typeRam("100"); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.waitSliderRamValue(MAX_VALID_RAM_VALUE + " GB"); - - seleniumWebDriverHelper.sendKeys(ARROW_UP.toString()); - editMachineForm.waitValidNameHighlighting(); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.waitRamFieldText(MAX_VALID_RAM_VALUE); - editMachineForm.waitSliderRamValue(MAX_VALID_RAM_VALUE + " GB"); - - seleniumWebDriverHelper.sendKeys(ARROW_DOWN.toString()); - editMachineForm.waitValidNameHighlighting(); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.waitRamFieldText("99.9"); - editMachineForm.waitSliderRamValue("99.9 GB"); - - // check restoring of default values after clicking on "Cancel" button - editMachineForm.typeRam("4"); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.waitSliderRamValue("4 GB"); - editMachineForm.clickOnCancelButton(); - editMachineForm.waitFormInvisibility(); - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.waitRecipeText(expectedRecipeText); - - // check saving of the changes - editMachineForm.typeRam(CHANGED_RAM_SIZE); - editMachineForm.waitRamFieldText(CHANGED_RAM_SIZE); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.clickOnSaveButton(); - editMachineForm.waitFormInvisibility(); - workspaceDetails.waitAllEnabled(SAVE_BUTTON, APPLY_BUTTON, CANCEL_BUTTON); - workspaceDetailsMachines.waitMachineListItemWithAttributes( - MACHINE_NAME, IMAGE_NAME, CHANGED_RAM_SIZE); - workspaceDetails.waitAllEnabled(SAVE_BUTTON, APPLY_BUTTON, CANCEL_BUTTON); - workspaceDetails.waitAndClickOn(SAVE_BUTTON); - workspaceDetailsMachines.waitMachineListItemWithAttributes( - MACHINE_NAME, IMAGE_NAME, CHANGED_RAM_SIZE); - } - - @Test - public void checkMachineSettings() { - final String installerName = "Exec"; - final String serverName = "tomcat8"; - - // check the "Servers" link - waitMachineListItemAndClickOnSettingsButton(); - workspaceDetailsMachines.clickOnServersLink(); - workspaceServers.checkServerName(serverName); - - seleniumWebDriver.navigate().back(); - - workspaceDetailsMachines.waitMachineListItem(MACHINE_NAME); - closeSettingsPopoverIfOpen(); - } - - private void waitMachineListItemAndClickOnSettingsButton() { - workspaceDetailsMachines.waitMachineListItem(MACHINE_NAME); - closeSettingsPopoverIfOpen(); - workspaceDetailsMachines.clickOnSettingsButton(MACHINE_NAME); - workspaceDetailsMachines.waitSettingsPopover(); - } - - private void closeSettingsPopoverIfOpen() { - if (!workspaceDetailsMachines.isSettingsPopoverOpened()) { - return; - } - - workspaceDetailsMachines.clickOnSettingsButton(MACHINE_NAME); - workspaceDetailsMachines.waitSettingsPopoverInvisibility(); - } - - private void setValidName() { - editMachineForm.typeName(MACHINE_NAME); - editMachineForm.waitValidNameHighlighting(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachinesRamTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachinesRamTest.java deleted file mode 100644 index 763f215dd2c..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsMachinesRamTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard.workspaces.details; - -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.APPLY_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.CANCEL_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.SAVE_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.MACHINES; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetailsMachines; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class WorkspaceDetailsMachinesRamTest { - private static final String MACHINE_NAME = "dev-machine"; - private static final String IMAGE_NAME = "eclipse/ubuntu_jdk8"; - private static final String EXPECTED_RAM_VALUE = "2"; - private static final String MAX_RAM_VALID_VALUE = "100"; - private static final String MIN_RAM_VALID_VALUE = "0.1"; - private static final String SUCCESS_NOTIFICATION_MESSAGE = "Workspace updated."; - - @Inject private Dashboard dashboard; - @Inject private Workspaces workspaces; - @Inject private WorkspaceDetails workspaceDetails; - @Inject private WorkspaceDetailsMachines workspaceDetailsMachines; - @Inject private TestWorkspace testWorkspace; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - - @BeforeClass - public void setup() throws Exception { - // open workspace details "Machines" page - dashboard.open(); - dashboard.waitDashboardToolbarTitle(); - dashboard.selectWorkspacesItemOnDashboard(); - workspaces.waitPageLoading(); - workspaces.selectWorkspaceItemName(testWorkspace.getName()); - workspaceDetails.waitToolbarTitleName(testWorkspace.getName()); - workspaceDetails.selectTabInWorkspaceMenu(MACHINES); - } - - @Test - public void checkRamSection() { - workspaceDetailsMachines.waitMachineListItemWithAttributes( - MACHINE_NAME, IMAGE_NAME, EXPECTED_RAM_VALUE); - - // check behavior with invalid RAM value - workspaceDetailsMachines.typeRamAmount(MACHINE_NAME, ""); - workspaceDetailsMachines.waitInvalidRamHighlighting(MACHINE_NAME); - workspaceDetails.waitAllInvisibility(SAVE_BUTTON, CANCEL_BUTTON, APPLY_BUTTON); - - // check saving behavior - workspaceDetailsMachines.typeRamAmount(MACHINE_NAME, "3"); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetails.waitAllEnabled(SAVE_BUTTON); - workspaceDetails.waitAndClickOn(SAVE_BUTTON); - workspaceDetailsMachines.waitNotificationMessage(SUCCESS_NOTIFICATION_MESSAGE); - - // check increment, decrement RAM buttons - workspaceDetailsMachines.typeRamAmount(MACHINE_NAME, MAX_RAM_VALID_VALUE); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetails.waitAllEnabled(SAVE_BUTTON); - - workspaceDetailsMachines.clickOnIncrementRamButton(MACHINE_NAME); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetailsMachines.waitRamAmount(MACHINE_NAME, MAX_RAM_VALID_VALUE); - - workspaceDetailsMachines.clickOnDecrementRamButton(MACHINE_NAME); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetailsMachines.waitRamAmount(MACHINE_NAME, "99.9"); - - workspaceDetailsMachines.typeRamAmount(MACHINE_NAME, MIN_RAM_VALID_VALUE); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetails.waitAllEnabled(SAVE_BUTTON); - - workspaceDetailsMachines.clickOnDecrementRamButton(MACHINE_NAME); - workspaceDetailsMachines.waitRamAmount(MACHINE_NAME, MIN_RAM_VALID_VALUE); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - - workspaceDetailsMachines.clickOnIncrementRamButton(MACHINE_NAME); - workspaceDetailsMachines.waitRamAmount(MACHINE_NAME, "0.2"); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - - workspaceDetailsMachines.typeRamAmount(MACHINE_NAME, "3"); - workspaceDetailsMachines.waitValidRamHighlighting(MACHINE_NAME); - workspaceDetails.waitAllDisabled(SAVE_BUTTON); - - workspaceDetailsMachines.clickOnIncrementRamButton(MACHINE_NAME); - workspaceDetails.waitAllEnabled(SAVE_BUTTON); - workspaceDetails.waitAllEnabled(CANCEL_BUTTON); - - workspaceDetails.waitAndClickOn(CANCEL_BUTTON); - workspaceDetailsMachines.waitRamAmount(MACHINE_NAME, "3"); - workspaceDetails.waitAllDisabled(SAVE_BUTTON); - workspaceDetails.waitAllDisabled(CANCEL_BUTTON); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsOverviewTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsOverviewTest.java index 26454c8c0d8..103ec7bffae 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsOverviewTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsOverviewTest.java @@ -12,6 +12,7 @@ package org.eclipse.che.selenium.dashboard.workspaces.details; import static java.util.Arrays.asList; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.openqa.selenium.Keys.ESCAPE; import com.google.inject.Inject; @@ -26,6 +27,8 @@ import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; import org.testng.annotations.Test; +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class WorkspaceDetailsOverviewTest { private static final String WORKSPACE_NAME = NameGenerator.generate("test-workspace", 4); private static final String CHANGED_WORKSPACE_NAME = NameGenerator.generate(WORKSPACE_NAME, 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsProjectsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsProjectsTest.java index 33028a221ec..c5239a55910 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsProjectsTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsProjectsTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.dashboard.workspaces.details; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.PROJECTS; import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceProjects.BottomButton.APPLY_BUTTON; @@ -37,6 +38,8 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class WorkspaceDetailsProjectsTest { private static final String PROJECT_NAME = NameGenerator.generate("wsDetails", 4); private static final String PROJECT_FOR_SEARCHING_NAME = NameGenerator.generate("searchWs", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsSingleMachineTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsSingleMachineTest.java deleted file mode 100644 index 8780f656981..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/dashboard/workspaces/details/WorkspaceDetailsSingleMachineTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.dashboard.workspaces.details; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; -import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.CONSOLE_JAVA_SIMPLE; -import static org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage.Template.WEB_JAVA_SPRING; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.RUNNING; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.StateWorkspace.STOPPED; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.OVERVIEW; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.PROJECTS; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.SERVERS; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.SSH; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.VOLUMES; -import static org.testng.Assert.assertTrue; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.ProjectSourcePage; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceInstallers; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceMachines; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceOverview; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceProjects; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceServers; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceSsh; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspacesVolumes; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class WorkspaceDetailsSingleMachineTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final ImmutableMap EXPECTED_INSTALLERS = - ImmutableMap.builder() - .put("C# language server", false) - .put("Exec", true) - .put("File sync", false) - .put("Git credentials", false) - .put("JSON language server", false) - .put("PHP language server", false) - .put("Python language server", false) - .put("SSH", false) - .put("Terminal", true) - .put("TypeScript language server", false) - .put("Workspace API", true) - .put("Yaml language server", false) - .build(); - - private String workspaceName; - - @Inject private DefaultTestUser testUser; - @Inject private Loader loader; - @Inject private Dashboard dashboard; - @Inject private WorkspaceDetails workspaceDetails; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private WorkspaceProjects workspaceProjects; - @Inject private Workspaces workspaces; - @Inject private ProjectSourcePage projectSourcePage; - @Inject private WorkspaceMachines workspaceMachines; - @Inject private WorkspaceServers workspaceServers; - @Inject private WorkspaceInstallers workspaceInstallers; - @Inject private WorkspaceOverview workspaceOverview; - @Inject private TestWorkspace testWorkspace; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private WorkspaceSsh workspaceSsh; - @Inject private WorkspacesVolumes workspacesVolumes; - - @BeforeClass - public void setUp() throws Exception { - workspaceName = testWorkspace.getName(); - URL resource = - WorkspaceDetailsSingleMachineTest.this.getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - - dashboard.open(); - dashboard.selectWorkspacesItemOnDashboard(); - dashboard.waitToolbarTitleName("Workspaces"); - workspaces.selectWorkspaceItemName(workspaceName); - workspaceDetails.waitToolbarTitleName(workspaceName); - workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW); - workspaceDetails.checkStateOfWorkspace(RUNNING); - workspaceDetails.clickOnStopWorkspace(); - workspaceDetails.checkStateOfWorkspace(STOPPED); - } - - @AfterClass - public void tearDown() throws Exception { - workspaceServiceClient.delete(workspaceName, testUser.getName()); - } - - @Test - public void checkOverviewTab() { - workspaceOverview.checkNameWorkspace(workspaceName); - workspaceOverview.isDeleteWorkspaceButtonExists(); - - // check the Export feature - workspaceOverview.clickExportWorkspaceBtn(); - workspaceOverview.waitClipboardWorkspaceJsonFileBtn(); - workspaceOverview.waitDownloadWorkspaceJsonFileBtn(); - workspaceOverview.clickOnHideWorkspaceJsonFileBtn(); - } - - @Test - public void checkWorkingWithServers() { - workspaceDetails.selectTabInWorkspaceMenu(SERVERS); - - // add a new server, save changes and check it exists - createServer("agen", "8083", "https"); - - // edit the server and check it exists - workspaceServers.clickOnEditServerButton("agen"); - workspaceServers.enterReference("agent"); - workspaceServers.enterPort("83"); - workspaceServers.enterProtocol("http"); - workspaceDetails.clickOnUpdateButtonInDialogWindow(); - workspaceServers.checkServerExists("agent", "83"); - - // delete the server and check it is not exist - workspaceServers.clickOnDeleteServerButton("agent"); - workspaceDetails.clickOnDeleteButtonInDialogWindow(); - clickOnSaveButton(); - workspaceServers.checkServerIsNotExists("agent", "83"); - - // add a new server which will be checked after the workspace staring - createServer("agent", "8082", "https"); - } - - @Test - public void checkWorkingWithProjects() { - workspaceDetails.selectTabInWorkspaceMenu(PROJECTS); - - // add new project and cancel adding - addNewProject(WEB_JAVA_SPRING); - workspaceDetails.clickOnCancelChangesBtn(); - workspaceProjects.waitProjectIsNotPresent(WEB_JAVA_SPRING); - - // add two projects and save changes - workspaceProjects.clickOnAddNewProjectButton(); - projectSourcePage.selectSample(WEB_JAVA_SPRING); - projectSourcePage.selectSample(CONSOLE_JAVA_SIMPLE); - projectSourcePage.clickOnAddProjectButton(); - clickOnSaveButton(); - - // check that project exists(workspace will restart) - workspaceProjects.waitProjectIsPresent(WEB_JAVA_SPRING); - workspaceProjects.waitProjectIsPresent(CONSOLE_JAVA_SIMPLE); - } - - @Test - public void checkSshTab() { - workspaceDetails.selectTabInWorkspaceMenu(SSH); - - // check ssh key exist - Assert.assertTrue(workspaceSsh.isPrivateKeyExists()); - Assert.assertTrue(workspaceSsh.isPublicKeyExists()); - - // remove ssh key - workspaceSsh.clickOnRemoveDefaultSshKeyButton(); - workspaceSsh.waitSshKeyNotExists(); - - // generate ssh key - workspaceSsh.clickOnGenerateButton(); - Assert.assertTrue(workspaceSsh.isPrivateKeyExists()); - Assert.assertTrue(workspaceSsh.isPublicKeyExists()); - } - - @Test - public void checkVolumesTab() { - String volumeName = "prj"; - String volumePath = "/" + volumeName; - String renamedVolumeName = "project"; - String renamedVolumePath = "/" + renamedVolumeName; - - workspaceDetails.selectTabInWorkspaceMenu(VOLUMES); - - // create volume - workspacesVolumes.clickOnAddVolumeButton(); - workspacesVolumes.enterVolumeName(volumeName); - workspacesVolumes.enterVolumePath(volumePath); - workspaceDetails.clickOnAddButtonInDialogWindow(); - assertTrue(workspacesVolumes.checkVolumeExists(volumeName, volumePath)); - clickOnSaveButton(); - - // edit volume - workspacesVolumes.clickOnEditVolumeButton(volumeName); - workspacesVolumes.enterVolumeName(renamedVolumeName); - workspacesVolumes.enterVolumePath(renamedVolumePath); - workspaceDetails.clickOnUpdateButtonInDialogWindow(); - assertTrue(workspacesVolumes.checkVolumeExists(renamedVolumeName, renamedVolumePath)); - clickOnSaveButton(); - - // remove volume - workspacesVolumes.clickOnRemoveVolumeButton(renamedVolumeName); - workspaceDetails.clickOnDeleteButtonInDialogWindow(); - workspacesVolumes.waitVolumeNotExists(renamedVolumeName); - clickOnSaveButton(); - } - - private void addNewProject(String projectName) { - workspaceProjects.clickOnAddNewProjectButton(); - projectSourcePage.selectSample(projectName); - projectSourcePage.clickOnAddProjectButton(); - workspaceProjects.waitProjectIsPresent(projectName); - } - - private void clickOnSaveButton() { - workspaceDetails.clickOnSaveChangesBtn(); - dashboard.waitNotificationMessage("Workspace updated"); - dashboard.waitNotificationIsClosed(); - } - - private void createServer(String serverName, String serverPort, String serverProtocol) { - workspaceServers.clickOnAddServerButton(); - workspaceServers.waitAddServerDialogIsOpen(); - workspaceServers.enterReference(serverName); - workspaceServers.enterPort(serverPort); - workspaceServers.enterProtocol(serverProtocol); - workspaceDetails.clickOnAddButtonInDialogWindow(); - clickOnSaveButton(); - workspaceServers.checkServerExists(serverName, serverPort); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/BreakpointReorderingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/BreakpointReorderingTest.java deleted file mode 100644 index a484ed7b278..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/BreakpointReorderingTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.action.ActionsFactory; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class BreakpointReorderingTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 2); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private DebugPanel debugPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private ActionsFactory actionsFactory; - - @BeforeClass - public void setUp() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(getClass().getResource("/projects/debug-spring-project").toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - debugPanel.openDebugPanel(); - - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - - editor.setCursorToLine(27); - editor.setInactiveBreakpoint(27); - editor.setInactiveBreakpoint(30); - editor.setInactiveBreakpoint(32); - editor.setCursorToLine(39); - editor.setInactiveBreakpoint(39); - } - - @Test - public void shouldNotRemoveBreakpointWhenFirstCharacterRemoved() throws Exception { - editor.goToCursorPositionVisible(27, 1); - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.DELETE).build().perform(); - - editor.waitInactiveBreakpoint(27); - } - - @Test(priority = 1) - public void shouldNotRemoveBreakpointWhenLastCharacterRemoved() throws Exception { - editor.goToCursorPositionVisible(27, 65); - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.BACK_SPACE).build().perform(); - - editor.waitInactiveBreakpoint(27); - } - - @Test(priority = 2) - public void shouldReorderBreakpointsWhenLineRemoved() throws Exception { - editor.deleteCurrentLine(); - - editor.waitInactiveBreakpoint(29); - editor.waitInactiveBreakpoint(31); - editor.waitInactiveBreakpoint(38); - - actionsFactory - .createAction(seleniumWebDriver) - .keyDown(Keys.CONTROL) - .sendKeys("z") - .keyUp(Keys.CONTROL) - .perform(); - - editor.waitInactiveBreakpoint(30); - editor.waitInactiveBreakpoint(32); - editor.waitInactiveBreakpoint(39); - } - - @Test(priority = 3) - public void shouldReorderBreakpointsWhenLineAdded() throws Exception { - editor.goToCursorPositionVisible(27, 1); - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ENTER).build().perform(); - - editor.waitInactiveBreakpoint(31); - editor.waitInactiveBreakpoint(33); - editor.waitInactiveBreakpoint(40); - - actionsFactory - .createAction(seleniumWebDriver) - .keyDown(Keys.CONTROL) - .sendKeys("z") - .keyUp(Keys.CONTROL) - .perform(); - - editor.waitInactiveBreakpoint(30); - editor.waitInactiveBreakpoint(32); - editor.waitInactiveBreakpoint(39); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ChangeVariableWithEvaluatingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ChangeVariableWithEvaluatingTest.java deleted file mode 100644 index 77b48fc0652..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ChangeVariableWithEvaluatingTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class ChangeVariableWithEvaluatingTest { - private static final String PROJECT_NAME_CHANGE_VARIABLE = - NameGenerator.generate(ChangeVariableWithEvaluatingTest.class.getSimpleName(), 2); - private static final Logger LOG = LoggerFactory.getLogger(ChangeVariableWithEvaluatingTest.class); - private static final String START_DEBUG_COMMAND_NAME = "startDebug"; - private static final String CLEAN_TOMCAT_COMMAND_NAME = "cleanTomcat"; - private static final String BUILD_COMMAND_NAME = "build"; - - private static final String COMMAND_LAUNCHING_TOMCAT_IN_JPDA = - "cp /projects/" - + PROJECT_NAME_CHANGE_VARIABLE - + "/target/qa-spring-sample-1.0-SNAPSHOT.war /home/user/tomcat8/webapps/ROOT.war" - + " && " - + "/home/user/tomcat8/bin/catalina.sh jpda run"; - - private static final String MAVEN_BUILD_COMMAND = - "mvn clean install -f /projects/" + PROJECT_NAME_CHANGE_VARIABLE; - - private DebuggerUtils debuggerUtils = new DebuggerUtils(); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private JavaDebugConfig debugConfig; - @Inject private DebugPanel debugPanel; - @Inject private ToastLoader toastLoader; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private CheTerminal machineTerminal; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/debug-spring-project"); - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME_CHANGE_VARIABLE, - ProjectTemplates.MAVEN_SPRING); - - testCommandServiceClient.createCommand( - COMMAND_LAUNCHING_TOMCAT_IN_JPDA, - START_DEBUG_COMMAND_NAME, - TestCommandsConstants.CUSTOM, - ws.getId()); - - testCommandServiceClient.createCommand( - MAVEN_BUILD_COMMAND, BUILD_COMMAND_NAME, TestCommandsConstants.CUSTOM, ws.getId()); - - String stopTomcatAndCleanWebAppDir = - "/home/user/tomcat8/bin/shutdown.sh && rm -rf /home/user/tomcat8/webapps/*"; - testCommandServiceClient.createCommand( - stopTomcatAndCleanWebAppDir, - CLEAN_TOMCAT_COMMAND_NAME, - TestCommandsConstants.CUSTOM, - ws.getId()); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME_CHANGE_VARIABLE); - } - - @Test - public void changeVariableTest() throws Exception { - buildProjectAndOpenMainClass(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(START_DEBUG_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole(" Server startup in"); - editor.setCursorToLine(35); - editor.setInactiveBreakpoint(35); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT_NAME_CHANGE_VARIABLE); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - TestMenuCommandsConstants.Run.DEBUG + "/" + PROJECT_NAME_CHANGE_VARIABLE); - String appUrl = - workspaceServiceClient - .getServerFromDevMachineBySymbolicName(ws.getId(), "tomcat8") - .getUrl() - .replace("tcp", "http") - + "/spring/guess"; - String requestMess = "numGuess=11&submit=Ok"; - editor.waitActiveBreakpoint(35); - CompletableFuture requestToApplication = - debuggerUtils.gotoDebugAppAndSendRequest( - appUrl, requestMess, APPLICATION_FORM_URLENCODED, 200); - debugPanel.openDebugPanel(); - debugPanel.waitDebugHighlightedText("result = \"Sorry, you failed. Try again later!\";"); - debugPanel.waitVariablesPanel(); - debugPanel.selectNodeInDebuggerTree("numGuessByUser=\"11\""); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.CHANGE_DEBUG_TREE_NODE); - String secretNum = getValueOfSecretNumFromVarWidget().trim(); - debugPanel.typeAndSaveTextAreaDialog(secretNum); - debugPanel.selectNodeInDebuggerTree(String.format("numGuessByUser=%s", secretNum)); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.EVALUATE_EXPRESSIONS); - debugPanel.typeEvaluateExpression("numGuessByUser.length()"); - debugPanel.clickEvaluateBtn(); - debugPanel.waitExpectedResultInEvaluateExpression("1"); - debugPanel.typeEvaluateExpression("numGuessByUser.isEmpty()"); - debugPanel.clickEvaluateBtn(); - debugPanel.waitExpectedResultInEvaluateExpression("false"); - debugPanel.clickCloseEvaluateBtn(); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - - String applicationResponse = requestToApplication.get(LOADER_TIMEOUT_SEC, TimeUnit.SECONDS); - // remove try-catch block after issue has been resolved - try { - assertTrue( - applicationResponse.contains("Sorry, you failed. Try again later!"), - "Actual application response content was: " + applicationResponse); - } catch (AssertionError ex) { - machineTerminal.logApplicationInfo(PROJECT_NAME_CHANGE_VARIABLE, ws); - if (applicationResponse != null && applicationResponse.contains("504 Gateway Time-out")) { - fail("Known random failure https://github.com/eclipse/che/issues/9251", ex); - } else { - throw ex; - } - } - } - - private void buildProjectAndOpenMainClass() { - projectExplorer.waitItem(PROJECT_NAME_CHANGE_VARIABLE); - toastLoader.waitAppeareanceAndClosing(); - projectExplorer.quickExpandWithJavaScript(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(BUILD_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitActive(); - } - - private String getValueOfSecretNumFromVarWidget() { - Pattern compile = Pattern.compile("secretNum=(.*)(\n)?"); - Matcher matcher = compile.matcher(debugPanel.getVariables()); - return matcher.find() ? matcher.group(1) : null; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CheckBreakPointStateTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CheckBreakPointStateTest.java deleted file mode 100644 index 472aff125dc..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CheckBreakPointStateTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckBreakPointStateTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 3); - private static final String PROJECT_NAME_2 = NameGenerator.generate("project", 3); - private static final String PATH_PREFFIX = "/src/main/java/org/eclipse/qa/examples/"; - private static final String PATH_TO_PROJECT_WITH_ONE_CLASS = PROJECT_NAME + PATH_PREFFIX; - private static final String PATH_TO_PROJECT_WITH_TWO_CLASSES = PROJECT_NAME_2 + PATH_PREFFIX; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private DebugPanel debugPanel; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = - CheckBreakPointStateTest.this.getClass().getResource("/projects/debug-spring-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - - resource = CheckBreakPointStateTest.this.getClass().getResource("/projects/debugStepInto"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME_2, ProjectTemplates.MAVEN_SPRING); - - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME_2); - projectExplorer.quickExpandWithJavaScript(); - } - - @Test - public void checkStateAfterDeletionFileAndFolder() throws Exception { - String expectedBreakpointsForAdditionalClass = - "AdditonalClass.java:7\n" + "AdditonalClass.java:9"; - - String expectedBreakpointsForGreetingClass = - "AppController.java:30\n" + "AppController.java:31\n" + "AppController.java:32"; - - projectExplorer.openItemByPath(PATH_TO_PROJECT_WITH_TWO_CLASSES + "AdditonalClass.java"); - editor.waitActive(); - editor.setInactiveBreakpoint(7); - editor.setInactiveBreakpoint(9); - debugPanel.openDebugPanel(); - debugPanel.waitContentInBreakPointPanel(expectedBreakpointsForAdditionalClass); - projectExplorer.waitAndSelectItem(PATH_TO_PROJECT_WITH_TWO_CLASSES + "AdditonalClass.java"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.confirmAndWaitClosed(); - projectExplorer.waitDisappearItemByPath( - PATH_TO_PROJECT_WITH_TWO_CLASSES + "AdditonalClass.java"); - debugPanel.waitBreakPointsPanelIsEmpty(); - projectExplorer.openItemByPath(PATH_TO_PROJECT_WITH_TWO_CLASSES + "AppController.java"); - editor.setInactiveBreakpoint(30); - editor.setInactiveBreakpoint(31); - editor.setInactiveBreakpoint(32); - debugPanel.openDebugPanel(); - debugPanel.waitContentInBreakPointPanel(expectedBreakpointsForGreetingClass); - projectExplorer.waitAndSelectItem(PROJECT_NAME_2 + "/src/main/java"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.confirmAndWaitClosed(); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME_2 + "/src/main/java"); - debugPanel.waitBreakPointsPanelIsEmpty(); - testProjectServiceClient.deleteResource(ws.getId(), PROJECT_NAME_2); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME_2); - } - - @Test(priority = 1) - public void checkStateAfterDeletionProject() { - String expectedBreakpointsForGreetingClass = - "AppController.java:30\n" + "AppController.java:32\n" + "AppController.java:35"; - projectExplorer.openItemByPath(PATH_TO_PROJECT_WITH_ONE_CLASS + "AppController.java"); - editor.setCursorToLine(35); - editor.setInactiveBreakpoint(30); - editor.setInactiveBreakpoint(32); - editor.setInactiveBreakpoint(35); - debugPanel.openDebugPanel(); - debugPanel.waitContentInBreakPointPanel(expectedBreakpointsForGreetingClass); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.confirmAndWaitClosed(); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME); - debugPanel.waitBreakPointsPanelIsEmpty(); - seleniumWebDriver.navigate().refresh(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ConditionalBreakpointsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ConditionalBreakpointsTest.java deleted file mode 100644 index f8bb9d4961b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ConditionalBreakpointsTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.PLAIN_JAVA; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.BTN_DISCONNECT; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.RESUME_BTN_ID; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.api.debug.shared.model.impl.BreakpointConfigurationImpl; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class ConditionalBreakpointsTest { - private static final String PROJECT = NameGenerator.generate("project", 2); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private DebugPanel debugPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private NotificationsPopupPanel notifications; - @Inject private JavaDebugConfig debugConfig; - - @BeforeClass - public void setUp() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(getClass().getResource("/projects/plugins/DebuggerPlugin/hello-world").toURI()), - PROJECT, - PLAIN_JAVA); - - testCommandServiceClient.createCommand( - "cd ${current.project.path}/src/ && javac -g HelloWorld.java", "build", CUSTOM, ws.getId()); - - testCommandServiceClient.createCommand( - "cd ${current.project.path}/src/ &&" - + " java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y HelloWorld", - "debug", - CUSTOM, - ws.getId()); - - ide.open(ws); - projectExplorer.waitItem(PROJECT); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - projectExplorer.quickExpandWithJavaScript(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick("build"); - } - - @Test - public void shouldNavigateToBreakpoint() throws Exception { - projectExplorer.openItemByPath(PROJECT + "/src/HelloWorld.java"); - editor.setBreakpoint(15); - editor.waitInactiveBreakpoint(15); - - projectExplorer.openItemByVisibleNameInExplorer("rt.jar"); - projectExplorer.openItemByVisibleNameInExplorer("com"); - projectExplorer.openItemByVisibleNameInExplorer("oracle"); - projectExplorer.openItemByVisibleNameInExplorer("net"); - projectExplorer.openItemByVisibleNameInExplorer("Sdp"); - editor.setBreakpoint(7); - editor.waitInactiveBreakpoint(7); - - editor.closeAllTabs(); - debugPanel.openDebugPanel(); - - debugPanel.navigateToBreakpoint("com.oracle.net.Sdp", 7); - editor.waitActiveTabFileName("Sdp"); - - debugPanel.navigateToBreakpoint("HelloWorld.java", 15); - editor.waitActiveTabFileName("HelloWorld"); - - editor.closeAllTabs(); - } - - @Test(priority = 1) - public void shouldAddConditionalBreakpoint() throws Exception { - projectExplorer.openItemByPath(PROJECT + "/src/HelloWorld.java"); - editor.setBreakpoint(16); - editor.waitInactiveBreakpoint(16); - - debugPanel.configureBreakpoint( - "HelloWorld.java", 16, new BreakpointConfigurationImpl("i == 3")); - editor.waitConditionalBreakpoint(16, false); - - projectExplorer.waitAndSelectItem(PROJECT); - - startDebug(); - - editor.waitConditionalBreakpoint(16, true); - - String filePath = "/" + PROJECT + "/src/HelloWorld.java"; - debugPanel.waitBreakpointState(filePath, 16, DebugPanel.BreakpointState.ACTIVE, true); - debugPanel.clickOnButton(RESUME_BTN_ID); - debugPanel.waitTextInVariablesPanel("i=3"); - } - - @Test(priority = 2) - public void shouldDisableBreakpoint() throws Exception { - editor.setBreakpoint(19); - editor.waitActiveBreakpoint(19); - debugPanel.disableBreakpoint("HelloWorld.java", 19); - editor.waitDisabledBreakpoint(19); - - editor.setBreakpoint(20); - editor.waitActiveBreakpoint(20); - - debugPanel.clickOnButton(RESUME_BTN_ID); - debugPanel.waitDebugHighlightedText("System.out.println(j);"); - - String filePath = "/" + PROJECT + "/src/HelloWorld.java"; - debugPanel.waitBreakpointState(filePath, 15, DebugPanel.BreakpointState.ACTIVE, false); - debugPanel.waitBreakpointState(filePath, 16, DebugPanel.BreakpointState.ACTIVE, true); - debugPanel.waitBreakpointState(filePath, 19, DebugPanel.BreakpointState.DISABLED, false); - debugPanel.waitBreakpointState(filePath, 20, DebugPanel.BreakpointState.ACTIVE, false); - debugPanel.waitBreakpointState( - "com.oracle.net.Sdp", 7, DebugPanel.BreakpointState.INACTIVE, false); - } - - @Test(priority = 3) - public void shouldDeleteBreakpoint() throws Exception { - List breakpoints = debugPanel.getAllBreakpoints(); - - debugPanel.deleteBreakpoint("HelloWorld.java", 20); - - assertEquals(debugPanel.getAllBreakpoints().size(), breakpoints.size() - 1); - } - - @Test(priority = 4) - public void shouldCheckBreakpointWhenDebuggerDisconnected() throws Exception { - debugPanel.clickOnButton(BTN_DISCONNECT); - - editor.waitInactiveBreakpoint(15); - editor.waitConditionalBreakpoint(16, false); - editor.waitDisabledBreakpoint(19); - - String filePath = "/" + PROJECT + "/src/HelloWorld.java"; - debugPanel.waitBreakpointState(filePath, 15, DebugPanel.BreakpointState.INACTIVE, false); - debugPanel.waitBreakpointState(filePath, 16, DebugPanel.BreakpointState.INACTIVE, true); - debugPanel.waitBreakpointState(filePath, 19, DebugPanel.BreakpointState.DISABLED, false); - } - - private void startDebug() { - menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick("debug"); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - debugConfig.getXpathToІRunDebugCommand(PROJECT)); - notifications.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CppProjectDebuggingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CppProjectDebuggingTest.java deleted file mode 100644 index 067d4a68fdc..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/CppProjectDebuggingTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.CppDebugConfig; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -public class CppProjectDebuggingTest { - - private static final String PROJECT = "cpp-tests"; - private static final String PATH_TO_PROGRAM = PROJECT + "/hello.cc"; - private static final int DEBUG_PORT = 8001; - private static final String MAKE_AND_DEBUG_COMMAND_NAME = "make and debug"; - - @InjectTestWorkspace(template = WorkspaceTemplate.ECLIPSE_CPP_GCC) - private TestWorkspace ws; - - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject protected DebugPanel debugPanel; - @Inject private CppDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setup() throws Exception { - URL resource = - CppProjectDebuggingTest.this - .getClass() - .getResource("/projects/plugins/DebuggerPlugin/cpp-tests"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.CPP); - - // open IDE - ide.open(ws); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notifications.waitProgressPopupPanelClose(); - - // open project tree - projectExplorer.quickExpandWithJavaScript(); - - // add debug config - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT, DEBUG_PORT); - } - - @AfterMethod - public void stopDebug() { - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.END_DEBUG_SESSION); - debugPanel.removeAllBreakpoints(); - } - - @AfterClass - public void removeConfig() { - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.removeConfig(PROJECT); - } - - @Test - public void shouldDebugCppProject() { - // when - projectExplorer.openItemByPath(PATH_TO_PROGRAM); - editor.setInactiveBreakpoint(22); - editor.closeAllTabs(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(MAKE_AND_DEBUG_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole("Listening on port 8001"); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - - notifications.waitExpectedMessageOnProgressPanelAndClose( - String.format("Remote debugger connected\nConnected to: localhost:%s.", DEBUG_PORT)); - - // then - editor.waitTabFileWithSavedStatus("hello.cc"); - debugPanel.waitDebugHighlightedText(" return \"Hello World, \" + name + \"!\";"); - waitTextInVariablesPanel(); - debugPanel.waitTextInVariablesPanel("\"man\""); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - - // then - debugPanel.waitDebugHighlightedText(" std::cout << hello.sayHello(\"man\") << std::endl;"); - debugPanel.waitTextInVariablesPanel("hello={}"); - } - - private String getXpathForDebugConfigurationMenuItem() { - return String.format( - "//*[@id=\"%1$s/%2$s\" or @id=\"topmenu/Run/Debug/Debug '%2$s'\"]", - TestMenuCommandsConstants.Run.DEBUG, PROJECT); - } - - protected void waitTextInVariablesPanel() { - debugPanel.waitTextInVariablesPanel("name ="); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebugExternalClassTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebugExternalClassTest.java deleted file mode 100644 index 255c436c258..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebugExternalClassTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -public class DebugExternalClassTest { - private static final String PROJECT = "java-with-external-libs"; - private static final String PATH_TO_CLASS = - PROJECT + "/src/main/java/org/eclipse/che/examples/SimpleLogger.java"; - - private static final String BUILD_AND_DEBUG_COMMAND_NAME = "build-and-debug"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setup() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass() - .getResource("/projects/plugins/DebuggerPlugin/java-with-external-libs") - .toURI()), - PROJECT, - ProjectTemplates.CONSOLE_JAVA_SIMPLE); - - testCommandServiceClient.createCommand( - "mvn -f ${current.project.path} clean install && java -jar " - + "-Xdebug -Xnoagent -Djava.compiler=NONE " - + "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 " - + "${current.project.path}/target/java-with-external-libs-1.0-SNAPSHOT-jar-with-dependencies.jar", - BUILD_AND_DEBUG_COMMAND_NAME, - TestCommandsConstants.CUSTOM, - ws.getId()); - - // open IDE - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notifications.waitProgressPopupPanelClose(); - - // add java debug configuration - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_CLASS); - } - - @BeforeMethod - public void startDebug() { - projectExplorer.openItemByPath(PATH_TO_CLASS); - - // start application in debug mode - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(BUILD_AND_DEBUG_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - - editor.waitActive(); - } - - @AfterMethod - public void stopDebug() { - debugPanel.removeAllBreakpoints(); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.END_DEBUG_SESSION); - editor.closeAllTabs(); - } - - @Test - public void shouldDebugMavenArtifactClassWithSources() { - // when - editor.setInactiveBreakpoint(24); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - debugConfig.getXpathToІRunDebugCommand(PROJECT)); - - notifications.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(24); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - - // then - editor.waitActiveTabFileName("Logger"); // there should be class "Logger" opened - debugPanel.waitDebugHighlightedText( - "filterAndLog_1(FQCN, null, Level.INFO, format, arg, null);"); - debugPanel.waitTextInVariablesPanel( - "=\"Info from {}\""); // there should be at least parameter with value "Info from {}" - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - - // then - editor.waitActiveTabFileName("Logger"); // there should be class "Logger" opened - debugPanel.waitDebugHighlightedText(" }"); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - - // then - editor.waitActiveTabFileName("SimpleLogger"); - debugPanel.waitDebugHighlightedText( - " org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(SimpleLogger.class);"); - } - - @Test(priority = 1) - public void shouldHandleDebugOfMavenArtifactWithoutSources() { - // when - editor.setInactiveBreakpoint(28); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - debugConfig.getXpathToІRunDebugCommand(PROJECT)); - - notifications.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(28); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - - // then - editor.waitActiveTabFileName("Category"); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - - // then - editor.waitActiveTabFileName("SimpleLogger"); - debugPanel.waitDebugHighlightedText(" }"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerUtils.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerUtils.java deleted file mode 100644 index b490101d801..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerUtils.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import org.eclipse.che.commons.lang.IoUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** @author Musienko Maxim */ -public class DebuggerUtils { - private static final Logger LOG = LoggerFactory.getLogger(DebuggerUtils.class); - - /** - * We need use other thread for send request in flow application. Because request will be stopped - * in breakpoint. And test cannot be continued. - * - * @param appUrl the application url of launched application in the Che - * @param data request message for application - * @param contentType content type - * @param successCode success code - */ - public CompletableFuture gotoDebugAppAndSendRequest( - final String appUrl, final String data, String contentType, int successCode) - throws ExecutionException { - return CompletableFuture.supplyAsync( - () -> { - HttpURLConnection connection = null; - String response; - BufferedReader br; - StringBuilder responseData = new StringBuilder(); - try { - URL url = new URL(appUrl); - connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", contentType); - connection.setDoOutput(true); - connection.setDoInput(true); - OutputStream output = connection.getOutputStream(); - output.write(data.getBytes("UTF-8")); - if (connection.getResponseCode() != successCode) { - throw new RuntimeException( - new Exception( - "Cannot do request for application: " + connection.getResponseCode()) - + IoUtil.readStream(connection.getErrorStream())); - } - output.close(); - br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); - while ((response = br.readLine()) != null) { - responseData.append(response); - } - LOG.debug(responseData.toString()); - br.close(); - } catch (Exception e) { - LOG.error(e.getMessage(), e); - return e.getMessage(); - } finally { - if (connection != null) { - connection.disconnect(); - } - } - return responseData.toString(); - }); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerWatchExpressionTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerWatchExpressionTest.java deleted file mode 100644 index 9b0700844ae..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/DebuggerWatchExpressionTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static java.nio.file.Paths.get; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.PLAIN_JAVA; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.ADD_WATCH_EXPRESSION; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.BTN_DISCONNECT; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.CHANGE_DEBUG_TREE_NODE; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.REMOVE_WATCH_EXPRESSION; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.STEP_OVER; - -import com.google.inject.Inject; -import java.net.URL; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * Test to cover debugger watch expression functionality - * - * @author Oleksandr Andriienko - */ -public class DebuggerWatchExpressionTest { - private static final String PROJECT = - generate(DebuggerWatchExpressionTest.class.getSimpleName(), 2); - private static final String PROJECT_PATH = "/projects/plugins/DebuggerPlugin/watch-expression"; - private static final String PATH_TO_CLASS = "/src/Application.java"; - - private static final String START_DEBUG = "startDebug"; - private static final String DEBUG_APP = - "cd ${current.project.path}/src/ && javac -g Application.java &&" - + " java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y Application"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private TestProjectServiceClient prjServiceClient; - @Inject private TestCommandServiceClient cmdClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private DebugPanel debugPanel; - @Inject private CodenvyEditor editor; - @Inject private CommandsPalette cmdPalette; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private JavaDebugConfig debugConfig; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource(PROJECT_PATH); - prjServiceClient.importProject(ws.getId(), get(resource.toURI()), PROJECT, PLAIN_JAVA); - - cmdClient.createCommand(DEBUG_APP, START_DEBUG, CUSTOM, ws.getId()); - - ide.open(ws); - - projectExplorer.waitItem(PROJECT); - projectExplorer.quickExpandWithJavaScript(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - debugPanel.openDebugPanel(); - - projectExplorer.openItemByPath(PROJECT + PATH_TO_CLASS); - - editor.waitActive(); - editor.setCursorToLine(19); - editor.setBreakpoint(19); - - menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - cmdPalette.openCommandPalette(); - cmdPalette.startCommandByDoubleClick(START_DEBUG); - - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - debugConfig.getXpathToІRunDebugCommand(PROJECT)); - } - - @Test(priority = 1) - public void addWatchExpression() { - editor.waitActiveBreakpoint(19); - debugPanel.waitDebugHighlightedText("message.setLevel(\"WARN\");"); - - debugPanel.clickOnButton(ADD_WATCH_EXPRESSION); - debugPanel.waitAppearTextAreaForm(); - debugPanel.typeAndSaveTextAreaDialog("message.getContent()"); - debugPanel.waitDisappearTextAreaForm(); - - debugPanel.waitTextInVariablesPanel("message.getContent()=\"Simple test message\""); - } - - @Test(priority = 2) - public void editWatchExpression() { - debugPanel.selectNodeInDebuggerTree("message.getContent()=\"Simple test message\""); - - debugPanel.clickOnButton(CHANGE_DEBUG_TREE_NODE); - debugPanel.waitAppearTextAreaForm(); - debugPanel.typeAndSaveTextAreaDialog("message.level"); - debugPanel.waitDisappearTextAreaForm(); - - debugPanel.waitTextInVariablesPanel("message.level=\"INFO\""); - } - - @Test(priority = 3) - public void watchExpressionShouldBeReEvaluatedOnNextDebugStep() { - debugPanel.waitTextInVariablesPanel("message.level=\"INFO\""); - - debugPanel.clickOnButton(STEP_OVER); - - debugPanel.waitTextInVariablesPanel("message.level=\"WARN\""); - } - - @Test(priority = 4) - public void debuggerSupportComplexArithmeticExpression() { - debugPanel.clickOnButton(ADD_WATCH_EXPRESSION); - debugPanel.waitAppearTextAreaForm(); - debugPanel.typeAndSaveTextAreaDialog("100.0 + 1.0/2.0"); - debugPanel.waitDisappearTextAreaForm(); - - debugPanel.waitTextInVariablesPanel("100.0 + 1.0/2.0=100.5"); - } - - @Test(priority = 5) - public void watchExpressionShouldStayAfterStopDebug() { - debugPanel.clickOnButton(BTN_DISCONNECT); - - debugPanel.waitTextInVariablesPanel("message.level="); - debugPanel.waitTextInVariablesPanel("100.0 + 1.0/2.0="); - } - - @Test(priority = 6) - public void removeWatchExpression() { - debugPanel.selectNodeInDebuggerTree("message.level="); - debugPanel.clickOnButton(REMOVE_WATCH_EXPRESSION); - - debugPanel.waitTextIsNotPresentInVariablesPanel("message.level="); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/InnerClassAndLambdaDebuggingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/InnerClassAndLambdaDebuggingTest.java deleted file mode 100644 index 38b75f0122d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/InnerClassAndLambdaDebuggingTest.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.BTN_DISCONNECT; -import static org.eclipse.che.selenium.pageobject.debug.DebugPanel.DebuggerActionButtons.RESUME_BTN_ID; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -@Test(groups = FLAKY) -public class InnerClassAndLambdaDebuggingTest { - private static final String PROJECT = "java-inner-lambda"; - private static final String PATH_TO_CLASS = PROJECT + "/src/main/java/test/App.java"; - - private static final String BUILD_AND_DEBUG_COMMAND_NAME = "build-and-debug"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setup() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass().getResource("/projects/plugins/DebuggerPlugin/java-inner-lambda").toURI()), - PROJECT, - ProjectTemplates.CONSOLE_JAVA_SIMPLE); - - testCommandServiceClient.createCommand( - "mvn -f ${current.project.path} clean install && " - + "java -jar -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y " - + "${current.project.path}/target/*.jar", - BUILD_AND_DEBUG_COMMAND_NAME, - TestCommandsConstants.MAVEN, - ws.getId()); - - // open IDE - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notificationPopup.waitProgressPopupPanelClose(); - - // add java debug configuration - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - // open test class - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_CLASS); - projectExplorer.openItemByPath(PATH_TO_CLASS); - } - - @BeforeMethod - public void startDebug() { - // start application in debug mode - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(BUILD_AND_DEBUG_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - // set breakpoints - editor.waitActive(); - editor.setCursorToLine(42); - editor.setInactiveBreakpoint(42); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - String.format( - "//*[@id=\"%1$s/%2$s\" or @id=\"topmenu/Run/Debug/Debug '%2$s'\"]", - TestMenuCommandsConstants.Run.DEBUG, PROJECT)); - - try { - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - editor.waitActiveBreakpoint(42); - } - - @AfterMethod - public void stopDebug() { - debugPanel.removeAllBreakpoints(); - debugPanel.clickOnButton(BTN_DISCONNECT); - } - - @Test - public void shouldDebugAnonymousClass() { - // when - editor.setCursorToLine(38); - editor.setBreakpoint(38); - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(38); - debugPanel.waitTextInVariablesPanel("anonym=\"App anonym\""); - } - - @Test(priority = 1) - public void shouldDebugMethodLocalInnerClass() { - // when - editor.setCursorToLine(54); - editor.setBreakpoint(54); - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(54); - } - - @Test(priority = 2) - public void shouldDebugInnerClass() { - // when - editor.setCursorToLine(65); - editor.setBreakpoint(65); - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(65); - debugPanel.waitTextInVariablesPanel("innerValue=\"App inner value\""); - } - - @Test(priority = 3) - public void shouldDebugStaticInnerClass() { - // when - editor.setCursorToLine(73); - editor.setBreakpoint(73); - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(73); - debugPanel.waitTextInVariablesPanel("staticInnerValue=\"App static inner value\""); - } - - @Test(priority = 4) - public void shouldDebugLambdaExpressions() { - // when - editor.setCursorToLine(80); - editor.setBreakPointAndWaitActiveState(80); - editor.setBreakPointAndWaitActiveState(88); - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(80); - debugPanel.waitTextInVariablesPanel("j=1"); - - // when - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(80); - debugPanel.waitTextInVariablesPanel("j=2"); - - // when - debugPanel.clickOnButton(RESUME_BTN_ID); - - // then - editor.waitActiveBreakpoint(88); - debugPanel.waitTextInVariablesPanel("j=2"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/MultimoduleProjectDebuggingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/MultimoduleProjectDebuggingTest.java deleted file mode 100644 index de7f99d4718..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/MultimoduleProjectDebuggingTest.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -public class MultimoduleProjectDebuggingTest { - - private static final String PROJECT = "java-multimodule"; - private static final String PATH_TO_APP_CLASS = - PROJECT + "/app/src/main/java/multimodule/App.java"; - private static final String PATH_TO_BOOK_IMPL_CLASS = - PROJECT + "/model/src/main/java/multimodule/model/BookImpl.java"; - private static final String PATH_TO_BOOK_INTERFACE = - PROJECT + "/model/src/main/java/multimodule/model/Book.java"; - - private static final String BUILD_AND_DEBUG_CONSOLE_APPLICATION_COMMAND = - "mvn -f ${current.project.path} clean install && java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -classpath ${current.project.path}/app/target/classes/:${current.project.path}/model/target/classes multimodule.App"; - - private static final String BUILD_AND_DEBUG_COMMAND_NAME = "build-and-debug"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/plugins/DebuggerPlugin/java-multimodule"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.MAVEN_JAVA_MULTIMODULE); - - testCommandServiceClient.createCommand( - BUILD_AND_DEBUG_CONSOLE_APPLICATION_COMMAND, - BUILD_AND_DEBUG_COMMAND_NAME, - TestCommandsConstants.MAVEN, - ws.getId()); - - // open IDE - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notificationPopup.waitProgressPopupPanelClose(); - - // add java debug configuration - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - // open project tree - projectExplorer.quickExpandWithJavaScript(); - } - - @BeforeMethod - public void startDebug() { - // goto root item in the Project Explorer to have proper value of ${current.project.path} when - // executing maven command. - projectExplorer.waitVisibleItem(PROJECT); - projectExplorer.waitAndSelectItem(PROJECT); - - // start application in debug mode - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(BUILD_AND_DEBUG_COMMAND_NAME); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - } - - @AfterMethod - public void stopDebug() { - debugPanel.removeAllBreakpoints(); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.END_DEBUG_SESSION); - } - - @Test - public void shouldGoIntoConstructor() { - // when - projectExplorer.openItemByPath(PATH_TO_APP_CLASS); - editor.setInactiveBreakpoint(20); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(20); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - - // then - try { - editor.waitTabFileWithSavedStatus("ClassLoader"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - } catch (Exception e) { - } - - editor.waitTabFileWithSavedStatus("BookImpl"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - debugPanel.waitDebugHighlightedText("this.title = title;"); - debugPanel.waitTextInVariablesPanel("title=\"java\""); - debugPanel.waitTextInVariablesPanel("author=\"oracle\""); - } - - @Test - public void shouldStopInsideConstructor() { - // when - projectExplorer.openItemByPath(PATH_TO_BOOK_IMPL_CLASS); - editor.setInactiveBreakpoint(19); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - // then - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(19); - debugPanel.waitTextInVariablesPanel("title=\"java\""); - debugPanel.waitTextInVariablesPanel("author=\"oracle\""); - } - - @Test - public void shouldDebugInstanceMethod() { - // when - projectExplorer.openItemByPath(PATH_TO_BOOK_IMPL_CLASS); - editor.setInactiveBreakpoint(24); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - // then - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(24); - debugPanel.waitTextInVariablesPanel("author=\"google\""); - debugPanel.waitTextInVariablesPanel("title=\"go\""); - } - - @Test - public void shouldDebugStaticMethod() { - // when - projectExplorer.openItemByPath(PATH_TO_BOOK_IMPL_CLASS); - editor.setCursorToLine(42); - editor.setInactiveBreakpoint(42); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - // then - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(42); - debugPanel.waitTextInVariablesPanel("author=\"google\""); - debugPanel.waitTextInVariablesPanel("title=\"go\""); - } - - @Test - public void shouldDebugDefaultMethod() { - // when - projectExplorer.openItemByPath(PATH_TO_BOOK_INTERFACE); - editor.setInactiveBreakpoint(31); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - // then - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(31); - debugPanel.waitTextInVariablesPanel("o=instance of multimodule.model.BookImpl"); - } - - @Test - public void shouldDebugStaticDefaultMethod() { - // when - projectExplorer.openItemByPath(PATH_TO_BOOK_INTERFACE); - editor.setCursorToLine(44); - editor.setInactiveBreakpoint(44); - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - // then - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(44); - debugPanel.waitTextInVariablesPanel("book=instance of multimodule.model.BookImpl"); - } - - private String getXpathForDebugConfigurationMenuItem() { - return String.format( - "//*[@id=\"%1$s/%2$s\" or @id=\"topmenu/Run/Debug/Debug '%2$s'\"]", - TestMenuCommandsConstants.Run.DEBUG, PROJECT); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java deleted file mode 100644 index 256d9e60577..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/NodeJsDebugTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.concurrent.ExecutionException; -import org.eclipse.che.commons.json.JsonParseException; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.NodeJsDebugConfig; -import org.openqa.selenium.By; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** Created by mmusienko on 12.02.17. */ -@Test(groups = FLAKY) -public class NodeJsDebugTest { - - private static final String PROJECT_NAME = - NameGenerator.generate(NodeJsDebugTest.class.getSimpleName(), 4); - private static final String APP_FILE = "app.js"; - - @InjectTestWorkspace(template = WorkspaceTemplate.ECLIPSE_NODEJS) - private TestWorkspace ws; - - @Inject private Ide ide; - - @Inject private DebugPanel debugPanel; - @Inject private NodeJsDebugConfig debugConfig; - @Inject private Menu menuPageObj; - @Inject private CodenvyEditor editorPageObj; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/node-js-simple"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.NODE_JS); - ide.open(ws); - - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void debugNodeJsTest() - throws ExecutionException, JsonParseException, InterruptedException { - String nameOfDebugCommand = "check_node_js_debug"; - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(nameOfDebugCommand); - menuPageObj.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - TestMenuCommandsConstants.Run.DEBUG + "/" + nameOfDebugCommand); - - try { - notifications.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - editorPageObj.waitTabFileWithSavedStatus(APP_FILE); - editorPageObj.waitActive(); - debugPanel.waitDebugHighlightedText("/*"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - debugPanel.waitDebugHighlightedText("var greetings = require(\"./greetings.js\");"); - checkDebugStepsFeatures(); - checkEvaluationFeatures(); - - // disconnect session, check highlighter is disappear - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until( - ExpectedConditions.invisibilityOfElementLocated( - By.xpath("//div[text()='{/app.js:13} ']"))); - debugPanel.waitBreakPointsPanelIsEmpty(); - } - - @Test(priority = 1) - public void checkCleanStoragedAfterEndDebugSession() { - String checkedData = - "\"connectionProperties\":{\"SCRIPT\":\"/projects/" + PROJECT_NAME + "/app/app.js\"}"; - Assert.assertFalse(getDataAboutDebugSessionFromStorage().contains(checkedData)); - } - - /** @return 'Che-debug-configurations' values from browser storage */ - private String getDataAboutDebugSessionFromStorage() { - String injectedJsScript = "return window.localStorage.getItem('che-debug-configurations');"; - return seleniumWebDriver.executeScript(injectedJsScript).toString(); - } - - /** Check step into, step over and step out feature */ - private void checkDebugStepsFeatures() { - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - debugPanel.waitDebugHighlightedText("var b = greetings.sayHelloInEnglish();"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - editorPageObj.waitActive(); - editorPageObj.waitTabIsPresent("greetings.js"); - debugPanel.waitDebugHighlightedText("return \"HELLO\";"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - debugPanel.waitDebugHighlightedText("var c=\"some add value\" + b;"); - assertEquals(debugPanel.getExecutionPoint(), "app.js:14"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - } - - private void checkEvaluationFeatures() { - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.EVALUATE_EXPRESSIONS); - debugPanel.typeEvaluateExpression("c.length"); - debugPanel.clickEvaluateBtn(); - try { - debugPanel.waitExpectedResultInEvaluateExpression("19"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/4720", ex); - } - debugPanel.clickCloseEvaluateBtn(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/PhpProjectDebuggingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/PhpProjectDebuggingTest.java deleted file mode 100644 index e5cd6524986..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/PhpProjectDebuggingTest.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; - -import com.google.inject.Inject; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.PhpDebugConfig; -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; - -/** @author Dmytro Nochevnov */ -public class PhpProjectDebuggingTest { - - private static final Logger LOG = LoggerFactory.getLogger(PhpProjectDebuggingTest.class); - protected static final String PROJECT = "php-tests"; - private static final String PATH_TO_INDEX_PHP = PROJECT + "/index.php"; - private static final String PATH_TO_LIB_PHP = PROJECT + "/lib.php"; - - private static final String DEBUG_PHP_SCRIPT_COMMAND_NAME = "debug php script"; - private static final int NON_DEFAULT_DEBUG_PORT = 10140; - private static final String START_DEBUG_PARAMETERS = - "?start_debug=1&debug_host=localhost&debug_port=" + NON_DEFAULT_DEBUG_PORT; - - @InjectTestWorkspace(template = WorkspaceTemplate.ECLIPSE_PHP) - private TestWorkspace ws; - - @Inject private Ide ide; - - @Inject protected ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private DebugPanel debugPanel; - @Inject private PhpDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/plugins/DebuggerPlugin/php-tests"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.PHP); - - // open IDE - ide.open(ws); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notificationPopup.waitProgressPopupPanelClose(); - - // open project tree - projectExplorer.quickExpandWithJavaScript(); - } - - @BeforeMethod - public void startDebug() { - // goto root item in the Project Explorer to have proper value of ${current.project.path} when - // executing maven command. - projectExplorer.waitAndSelectItem(PROJECT); - } - - @AfterMethod - public void stopDebug() { - debugPanel.removeAllBreakpoints(); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, TestMenuCommandsConstants.Run.END_DEBUG_SESSION); - invokeStopCommandWithContextMenu(); - - // remove debug configuration - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.removeConfig(PROJECT); - } - - @Test - public void shouldDebugCliPhpScriptFromFirstLine() { - // when - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - - projectExplorer.openItemByPath(PATH_TO_LIB_PHP); - editor.setBreakpoint(14); - editor.closeAllTabs(); - - projectExplorer.openItemByPath(PATH_TO_INDEX_PHP); - projectExplorer.invokeCommandWithContextMenu( - COMMON_GOAL, PROJECT, DEBUG_PHP_SCRIPT_COMMAND_NAME); - - debugPanel.openDebugPanel(); - - // then - debugPanel.waitDebugHighlightedText(""); - debugPanel.waitTextInVariablesPanel("$_GET=array [0]"); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - - // then - editor.waitTabFileWithSavedStatus("lib.php"); - editor.waitActiveBreakpoint(14); - debugPanel.waitDebugHighlightedText("return \"Hello, $name\""); - debugPanel.waitTextInVariablesPanel("$name=\"man\""); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - - // then - editor.waitTabFileWithSavedStatus("index.php"); - debugPanel.waitDebugHighlightedText("echo sayHello(\"man\");"); - debugPanel.waitTextInVariablesPanel("$_GET=array [0]"); - } - - @Test(priority = 1) - public void shouldDebugWebPhpScriptFromNonDefaultPortAndNotFromFirstLine() { - // when - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT, false, NON_DEFAULT_DEBUG_PORT); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - getXpathForDebugConfigurationMenuItem()); - - notificationPopup.waitExpectedMessageOnProgressPanelAndClose( - String.format( - "Remote debugger connected\nConnected to: Zend Debugger, port: %s.", - NON_DEFAULT_DEBUG_PORT)); - - projectExplorer.openItemByPath(PATH_TO_LIB_PHP); - editor.setBreakpoint(14); - editor.closeAllTabs(); - - projectExplorer.openItemByPath(PATH_TO_INDEX_PHP); - invokeStartCommandWithContextMenu(); - - startWebPhpScriptInDebugMode(); - - debugPanel.openDebugPanel(); - - // then - editor.waitTabFileWithSavedStatus("lib.php"); - - editor.waitActiveBreakpoint(14); - debugPanel.waitDebugHighlightedText("return \"Hello, $name\""); - debugPanel.waitTextInVariablesPanel("$name=\"man\""); - - // when - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - - // then - editor.waitTabFileWithSavedStatus("index.php"); - debugPanel.waitDebugHighlightedText("echo sayHello(\"man\");"); - debugPanel.waitTextInVariablesPanel("$_GET=array [3]"); - } - - /** - * Start Web PHP Application in debug mode by making HTTP GET request to this application - * asynchronously on preview url displayed in console + start debug parameters - */ - private void startWebPhpScriptInDebugMode() { - final String previewUrl = consoles.getPreviewUrl() + START_DEBUG_PARAMETERS; - - // it needs when the test is running on the che6-ocp platform - if (previewUrl.contains("route")) { - WaitUtils.sleepQuietly(10); - } - - new Thread( - () -> { - try { - URL connectionUrl = new URL(previewUrl); - HttpURLConnection connection = (HttpURLConnection) connectionUrl.openConnection(); - connection.setRequestMethod("GET"); - connection.getResponseCode(); - } catch (IOException e) { - LOG.error( - String.format( - "There was a problem with connecting to PHP-application for debug on URL '%s'", - previewUrl), - e); - } - }) - .start(); - } - - private String getXpathForDebugConfigurationMenuItem() { - return String.format( - "//*[@id=\"%1$s/%2$s\" or @id=\"topmenu/Run/Debug/Debug '%2$s'\"]", - TestMenuCommandsConstants.Run.DEBUG, PROJECT); - } - - protected void invokeStartCommandWithContextMenu() { - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT, "start apache"); - } - - protected void invokeStopCommandWithContextMenu() { - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT, "stop apache"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/RunToCursorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/RunToCursorTest.java deleted file mode 100644 index 2119d119c56..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/RunToCursorTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.PLAIN_JAVA; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.*; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.*; - -/** @author Igor Vinokur */ -public class RunToCursorTest { - private static final String PROJECT = NameGenerator.generate("project", 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private NotificationsPopupPanel notifications; - - @BeforeClass - public void setup() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass().getResource("/projects/plugins/DebuggerPlugin/java-run-to-cursor").toURI()), - PROJECT, - PLAIN_JAVA); - - testCommandServiceClient.createCommand( - "cd ${current.project.path}/src/ && javac -g App.java", "build", CUSTOM, ws.getId()); - - testCommandServiceClient.createCommand( - "cd ${current.project.path}/src/ &&" - + " java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y App", - "debug", - CUSTOM, - ws.getId()); - - ide.open(ws); - projectExplorer.waitItem(PROJECT); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick("build"); - projectExplorer.quickExpandWithJavaScript(); - - projectExplorer.waitItem(PROJECT + "/src/App.class"); - projectExplorer.openItemByPath(PROJECT + "/src/App.java"); - editor.waitActive(); - editor.setBreakpoint(15); - debugPanel.openDebugPanel(); - - startDebug(); - } - - @Test - public void shouldRunToLocationInsideMainClass() { - // when - editor.setCursorToLine(22); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RUN_TO_CURSOR); - - // then - debugPanel.waitTextInVariablesPanel("string=\"method\""); - } - - @Test(priority = 1) - public void shouldRunToLocationInsideMethod() { - // when - editor.setCursorToLine(28); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RUN_TO_CURSOR); - - // then - debugPanel.waitTextInVariablesPanel("string=\"inner class\""); - } - - @Test(priority = 2) - public void shouldNotRunToNonExistedLocation() { - // when - editor.setCursorToLine(29); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RUN_TO_CURSOR); - - // then - debugPanel.waitTextInVariablesPanel("string=\"inner class\""); - } - - @Test(priority = 3) - public void shouldRunToLocationInsideInnerClass() { - // when - editor.setCursorToLine(32); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RUN_TO_CURSOR); - - // then - debugPanel.waitTextInVariablesPanel("string=\"inner class method\""); - } - - private void startDebug() { - menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick("debug"); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - - menu.runCommandByXpath( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - debugConfig.getXpathToІRunDebugCommand(PROJECT)); - notifications.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/StepIntoStepOverStepReturnWithChangeVariableTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/StepIntoStepOverStepReturnWithChangeVariableTest.java deleted file mode 100644 index 813cc3b9ef2..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/StepIntoStepOverStepReturnWithChangeVariableTest.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.Keys; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class StepIntoStepOverStepReturnWithChangeVariableTest { - protected static final String PROJECT = NameGenerator.generate("project", 4); - protected static final String START_DEBUG = "startDebug"; - private static final String CLEAN_TOMCAT = "cleanTomcat"; - protected static final String BUILD = "build"; - - private DebuggerUtils debugUtils = new DebuggerUtils(); - - @Inject protected TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject protected Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject protected DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject protected TestCommandServiceClient testCommandServiceClient; - @Inject protected TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Loader loader; - @Inject private CommandsPalette commandsPalette; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private CheTerminal machineTerminal; - - @BeforeClass - public void prepare() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(getClass().getResource("/projects/debugStepInto").toURI()), - PROJECT, - ProjectTemplates.MAVEN_SPRING); - - createStartDebugCommmand(); - createBuildCommand(); - - testCommandServiceClient.createCommand( - "/home/user/tomcat8/bin/shutdown.sh && rm -rf /home/user/tomcat8/webapps/*", - CLEAN_TOMCAT, - TestCommandsConstants.CUSTOM, - ws.getId()); - - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - } - - @AfterMethod - public void shutDownAndCleanWebApp() { - editor.closeAllTabs(); - stopDebuggerAndCleanUp(); - projectExplorer.clickOnProjectExplorerTab(); - } - - @Test - public void changeVariableTest() throws Exception { - buildProjectAndOpenMainClass(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(START_DEBUG); - waitExpectedTextIntoConsole(); - editor.setCursorToLine(35); - editor.setInactiveBreakpoint(35); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.DEBUG, - TestMenuCommandsConstants.Run.DEBUG + "/" + PROJECT); - editor.waitActiveBreakpoint(35); - String appUrl = getApplicationUrl(); - String requestMess = "numGuess=6&submit=Ok"; - CompletableFuture requestToApplication = - debugUtils.gotoDebugAppAndSendRequest( - appUrl, requestMess, APPLICATION_FORM_URLENCODED, 200); - - editor.waitActiveBreakpoint(35); - debugPanel.waitDebugHighlightedText("result = \"Sorry, you failed. Try again later!\";"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - debugPanel.waitDebugHighlightedText("AdditonalClass.check();"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_INTO); - editor.waitTabFileWithSavedStatus("AdditonalClass"); - debugPanel.waitDebugHighlightedText(" someStr.toLowerCase();"); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OVER); - debugPanel.waitDebugHighlightedText("Operation.valueOf(\"SUBTRACT\").toString();"); - debugPanel.waitTextInVariablesPanel("someStr=\"hello Cdenvy\""); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.STEP_OUT); - debugPanel.waitTextInVariablesPanel("secretNum="); - debugPanel.selectNodeInDebuggerTree("numGuessByUser=\"6\""); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.CHANGE_DEBUG_TREE_NODE); - debugPanel.typeAndSaveTextAreaDialog("\"7\""); - debugPanel.waitTextInVariablesPanel("numGuessByUser=\"7\""); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - - String applicationResponse = requestToApplication.get(LOADER_TIMEOUT_SEC, TimeUnit.SECONDS); - // remove try-catch block after issue has been resolved - try { - assertTrue( - applicationResponse.contains("Sorry, you failed. Try again later!"), - "Actual application response content was: " + applicationResponse); - } catch (AssertionError ex) { - machineTerminal.logApplicationInfo(PROJECT, ws); - if (applicationResponse != null && applicationResponse.contains("504 Gateway Time-out")) { - fail("Known random failure https://github.com/eclipse/che/issues/9251", ex); - } else { - throw ex; - } - } - } - - @Test(priority = 1) - public void shouldOpenDebuggingFile() { - buildProjectAndOpenMainClass(); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(START_DEBUG); - waitExpectedTextIntoConsole(); - editor.setInactiveBreakpoint(27); - seleniumWebDriver - .switchTo() - .activeElement() - .sendKeys(Keys.SHIFT.toString() + Keys.F9.toString()); - editor.waitActiveBreakpoint(27); - } - - private void buildProjectAndOpenMainClass() { - String absPathToClass = PROJECT + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - projectExplorer.waitItem(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT); - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT, BUILD); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - projectExplorer.quickRevealToItemWithJavaScript(absPathToClass); - projectExplorer.openItemByPath(absPathToClass); - editor.waitActive(); - } - - protected void createStartDebugCommmand() throws Exception { - testCommandServiceClient.createCommand( - "cp /projects/" - + PROJECT - + "/target/qa-spring-sample-1.0-SNAPSHOT.war /home/user/tomcat8/webapps/ROOT.war" - + " && " - + "/home/user/tomcat8/bin/catalina.sh jpda run", - START_DEBUG, - TestCommandsConstants.CUSTOM, - ws.getId()); - } - - protected void createBuildCommand() throws Exception { - testCommandServiceClient.createCommand( - "mvn clean install -f /projects/" + PROJECT, - BUILD, - TestCommandsConstants.CUSTOM, - ws.getId()); - } - - protected void stopDebuggerAndCleanUp() { - debugPanel.stopDebuggerWithUiAndCleanUpTomcat(CLEAN_TOMCAT); - } - - protected void waitExpectedTextIntoConsole() { - consoles.waitExpectedTextIntoConsole(" Server startup in"); - } - - protected String getApplicationUrl() throws Exception { - return workspaceServiceClient - .getServerFromDevMachineBySymbolicName(ws.getId(), "tomcat8") - .getUrl() - .replace("tcp", "http") - + "/spring/guess"; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ThreadDumpTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ThreadDumpTest.java deleted file mode 100644 index 374c0eae531..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/debugger/ThreadDumpTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.debugger; - -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.MAVEN; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.DEBUG; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.EDIT_DEBUG_CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.CONSOLE_JAVA_SIMPLE; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.api.debug.shared.model.SuspendPolicy; -import org.eclipse.che.api.debug.shared.model.impl.BreakpointConfigurationImpl; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.debug.DebugPanel; -import org.eclipse.che.selenium.pageobject.debug.JavaDebugConfig; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Anatolii Bazko */ -public class ThreadDumpTest { - private static final String PROJECT = NameGenerator.generate("project", 2); - private static final String DEBUG_COMMAND = "debug"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private DebugPanel debugPanel; - @Inject private JavaDebugConfig debugConfig; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setUp() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass().getResource("/projects/plugins/DebuggerPlugin/java-multimodule").toURI()), - PROJECT, - CONSOLE_JAVA_SIMPLE); - - testCommandServiceClient.createCommand( - "mvn -f ${current.project.path} clean install &&" - + " java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y" - + " -classpath ${current.project.path}/app/target/classes/:${current.project.path}/model/target/classes multimodule.App", - DEBUG_COMMAND, - MAVEN, - ws.getId()); - - // open IDE - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notificationPopup.waitProgressPopupPanelClose(); - - // open project tree - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitVisibleItem(PROJECT); - projectExplorer.waitAndSelectItem(PROJECT); - - startDebuggingApp(); - } - - @Test - public void shouldShowAndNavigateByAllThread() { - assertTrue(debugPanel.getSelectedThread().contains("\"main\"@")); - - String[] frames = debugPanel.getFrames(); - assertEquals(frames.length, 1); - assertEquals("main(String[]):20, App", frames[0]); - - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - debugPanel.waitDebugHighlightedText("this.title = title;"); - - frames = debugPanel.getFrames(); - assertEquals(frames.length, 2); - assertEquals("(String, String):19, BookImpl", frames[0]); - assertEquals("main(String[]):20, App", frames[1]); - - editor.closeAllTabs(); - - debugPanel.selectFrame(0); - editor.waitActiveTabFileName("BookImpl"); - assertTrue(debugPanel.getVariables().contains("title=\"java\"")); - - debugPanel.selectFrame(1); - editor.waitActiveTabFileName("App"); - assertTrue(debugPanel.getVariables().contains("args=instance of java.lang.String[0]")); - - debugPanel.selectThread("Finalizer"); - assertTrue(debugPanel.getVariables().isEmpty()); - - debugPanel.selectThread("main"); - assertTrue(debugPanel.getVariables().contains("title=\"java\"")); - } - - @Test(priority = 1) - public void shouldShowAndNavigateBySuspendedThread() { - editor.setBreakpoint(21); - debugPanel.configureBreakpoint( - "App.java", 21, new BreakpointConfigurationImpl(SuspendPolicy.THREAD)); - debugPanel.clickOnButton(DebugPanel.DebuggerActionButtons.RESUME_BTN_ID); - - debugPanel.selectThread("Finalizer"); - - debugPanel.waitThreadNotSuspendedHolderVisible(); - assertTrue(debugPanel.getVariables().isEmpty()); - - debugPanel.selectThread("main"); - assertTrue(debugPanel.getVariables().contains("args=instance of java.lang.String[0]")); - debugPanel.waitThreadNotSuspendedHolderHidden(); - } - - private void startDebuggingApp() { - menu.runCommand(RUN_MENU, EDIT_DEBUG_CONFIGURATION); - debugConfig.createConfig(PROJECT); - - // starts application in debug mode - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(DEBUG_COMMAND); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.LISTENING_AT_ADDRESS_8000); - - // stops at breakpoint - projectExplorer.openItemByPath(PROJECT + "/app/src/main/java/multimodule/App.java"); - editor.setInactiveBreakpoint(20); - - projectExplorer.openItemByPath( - PROJECT + "/model/src/main/java/multimodule/model/BookImpl.java"); - editor.setInactiveBreakpoint(19); - - menu.runCommand(RUN_MENU, DEBUG, DEBUG + "/" + PROJECT); - notificationPopup.waitExpectedMessageOnProgressPanelAndClose("Remote debugger connected"); - editor.waitActiveBreakpoint(20); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckReplaceFeatureInEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckReplaceFeatureInEditorTest.java deleted file mode 100644 index 9ec43dd5185..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckReplaceFeatureInEditorTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import com.google.common.base.Joiner; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.SearchReplacePanel; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckReplaceFeatureInEditorTest { - private static final String PROJECT_NAME = - NameGenerator.generate(CheckReplaceFeatureInEditorTest.class.getSimpleName(), 4); - private static final String FIND_TEXT = "codenvy"; - private static final String REPLACE_TEXT = "che"; - - private String expectedReplace = ""; - private String expectedReplaceAll = ""; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private SearchReplacePanel searchReplacePanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resources = CheckReplaceFeatureInEditorTest.class.getResource("replace"); - List expectedReplaseTextList = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - expectedReplace = Joiner.on("\n").join(expectedReplaseTextList); - - resources = CheckReplaceFeatureInEditorTest.class.getResource("replace-all"); - List expectedReplaseAllTextList = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - expectedReplaceAll = Joiner.on("\n").join(expectedReplaseAllTextList); - - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - } - - @Test(priority = 0) - public void checkReplace() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByVisibleNameInExplorer("README.md"); - loader.waitOnClosed(); - searchReplacePanel.openSearchReplacePanel(); - searchReplacePanel.enterTextInFindInput(FIND_TEXT); - searchReplacePanel.enterTextInReplaceInput(REPLACE_TEXT); - searchReplacePanel.clickOnReplaceBtn(); - searchReplacePanel.closeSearchReplacePanel(); - editor.closeAllTabs(); - projectExplorer.openItemByVisibleNameInExplorer("README.md"); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTextIntoEditor(expectedReplace); - } - - @Test(priority = 1) - public void checkReplaceAll() { - searchReplacePanel.openSearchReplacePanel(); - searchReplacePanel.enterTextInFindInput(FIND_TEXT); - searchReplacePanel.enterTextInReplaceInput(REPLACE_TEXT); - searchReplacePanel.clickOnReplaceAllBtn(); - searchReplacePanel.closeSearchReplacePanel(); - editor.closeAllTabs(); - projectExplorer.openItemByVisibleNameInExplorer("README.md"); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTextIntoEditor(expectedReplaceAll); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckRestoringSplitEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckRestoringSplitEditorTest.java deleted file mode 100644 index e402e239671..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckRestoringSplitEditorTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_JAVA_MULTIMODULE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.TabActionLocator.SPLIT_HORIZONTALLY; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.TabActionLocator.SPLIT_VERTICALLY; -import static org.testng.Assert.fail; - -import com.google.common.base.Joiner; -import com.google.inject.Inject; -import java.io.IOException; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.commons.lang.Pair; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.PopupDialogsBrowser; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class CheckRestoringSplitEditorTest { - private String javaClassName = "AppController.java"; - private String readmeFileName = "README.md"; - private String pomFileTab = "qa-spring-sample"; - private String javaClassTab = "AppController"; - private final String PROJECT_NAME = NameGenerator.generate("project", 4);; - private final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/" + javaClassName; - private Pair cursorPositionForJavaFile = new Pair<>(13, 1); - private Pair cursorPositionForReadMeFile = new Pair<>(1, 10); - private Pair cursorPositionForPomFile = new Pair<>(32, 1); - private List expectedTextFromEditor; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private PopupDialogsBrowser popupDialogsBrowser; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - - @BeforeClass - public void prepare() throws Exception { - String splitter = "----split_line---"; - URL resources = - CheckRestoringSplitEditorTest.class.getResource("split-editor-restore-exp-text.txt"); - expectedTextFromEditor = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF8")); - String expectedTextFromFile = Joiner.on("\n").join(expectedTextFromEditor); - expectedTextFromEditor = Arrays.asList(expectedTextFromFile.split(splitter)); - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_JAVA_MULTIMODULE); - ide.open(workspace); - } - - @Test - public void checkRestoringStateSplitEditor() throws IOException, Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - splitEditorAndOpenFiles(); - setPositionsForSplitEditor(); - editor.waitActive(); - if (popupDialogsBrowser.isAlertPresent()) { - popupDialogsBrowser.acceptAlert(); - } - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.waitItemIsSelected(PROJECT_NAME); - - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(javaClassName, WIDGET_TIMEOUT_SEC); - - notificationsPopupPanel.waitPopupPanelsAreClosed(); - checkSplitEditorAfterRefreshing( - 1, javaClassTab, expectedTextFromEditor.get(0), cursorPositionForJavaFile); - checkSplitEditorAfterRefreshing( - 2, readmeFileName, expectedTextFromEditor.get(1).trim(), cursorPositionForReadMeFile); - checkSplitEditorAfterRefreshing( - 3, pomFileTab, expectedTextFromEditor.get(2).trim(), cursorPositionForPomFile); - } - - private void checkSplitEditorAfterRefreshing( - int numOfEditor, - String nameOfEditorTab, - String expectedTextAfterRefresh, - Pair pair) - throws IOException { - - editor.waitActive(); - editor.selectTabByName(nameOfEditorTab); - editor.waitCursorPosition(numOfEditor - 1, pair.first, pair.second); - - try { - editor.waitTextInDefinedSplitEditor( - numOfEditor, LOAD_PAGE_TIMEOUT_SEC, expectedTextAfterRefresh); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/9456", ex); - } - } - - private void splitEditorAndOpenFiles() { - String namePomFile = "pom.xml"; - - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - loader.waitOnClosed(); - editor.waitActive(); - editor.openAndWaitContextMenuForTabByName(javaClassTab); - editor.runActionForTabFromContextMenu(SPLIT_HORIZONTALLY); - editor.selectTabByIndexEditorWindowAndOpenMenu(0, javaClassTab); - editor.runActionForTabFromContextMenu(SPLIT_VERTICALLY); - loader.waitOnClosed(); - editor.selectTabByIndexEditorWindow(1, javaClassTab); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + readmeFileName); - editor.selectTabByIndexEditorWindow(2, javaClassTab); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + namePomFile); - } - - private void setPositionsForSplitEditor() { - editor.selectTabByIndexEditorWindow(0, javaClassTab); - editor.goToPosition(0, cursorPositionForJavaFile.first, cursorPositionForJavaFile.second); - editor.selectTabByName(readmeFileName); - editor.goToPosition(1, cursorPositionForReadMeFile.first, cursorPositionForReadMeFile.second); - editor.selectTabByName(pomFileTab); - editor.goToPosition(2, cursorPositionForPomFile.first, cursorPositionForPomFile.second); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckSearchFeatureInEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckSearchFeatureInEditorTest.java deleted file mode 100644 index 46d7fa4553a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckSearchFeatureInEditorTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.SearchReplacePanel; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckSearchFeatureInEditorTest { - private static final String PROJECT_NAME = - NameGenerator.generate(CheckSearchFeatureInEditorTest.class.getSimpleName(), 4); - private static final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String FIND_TEXT = "Num"; - private static final String FIND_TEXT_REGULAR_EXP = "Num.*"; - private static final String FIRST_CURSOR_POSITION = "23:42"; - private static final String SECOND_CURSOR_POSITION = "27:19"; - private static final String THIRD_CURSOR_POSITION = "39:28"; - private static final String FOURTH_CURSOR_POSITION = "31:60"; - private static final String FIFTH_CURSOR_POSITION = "31:61"; - private static final String SIXTH_CURSOR_POSITION = "23:88"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private SearchReplacePanel searchReplacePanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test(priority = 0) - public void checkNextPrevious() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JAVA_FILE); - loader.waitOnClosed(); - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - editor.waitActive(); - searchReplacePanel.openSearchReplacePanel(); - searchReplacePanel.enterTextInFindInput(FIND_TEXT); - WaitUtils.sleepQuietly(2); - editor.waitSpecifiedValueForLineAndChar(FIRST_CURSOR_POSITION); - searchReplacePanel.clickOnNextBtn(); - editor.waitSpecifiedValueForLineAndChar(SECOND_CURSOR_POSITION); - searchReplacePanel.clickOnPreviousBtn(); - editor.waitSpecifiedValueForLineAndChar(FIRST_CURSOR_POSITION); - } - - @Test(priority = 1) - public void checkToggleWholeWord() { - searchReplacePanel.clickOnToggleWholeBtn(); - searchReplacePanel.clickOnNextBtn(); - editor.waitSpecifiedValueForLineAndChar(THIRD_CURSOR_POSITION); - searchReplacePanel.clickOnPreviousBtn(); - editor.waitSpecifiedValueForLineAndChar(THIRD_CURSOR_POSITION); - } - - @Test(priority = 2) - public void checkToggleCaseInsensitive() { - searchReplacePanel.clickOnToggleWholeBtn(); - searchReplacePanel.clickOnToggleCaseBtn(); - searchReplacePanel.clickOnPreviousBtn(); - editor.waitSpecifiedValueForLineAndChar(FOURTH_CURSOR_POSITION); - searchReplacePanel.clickOnNextBtn(); - editor.waitSpecifiedValueForLineAndChar(FIRST_CURSOR_POSITION); - } - - @Test(priority = 3) - public void checkToggleRegularExpression() { - searchReplacePanel.enterTextInFindInput(FIND_TEXT_REGULAR_EXP); - searchReplacePanel.clickOnToggleRegularExpressionBtn(); - searchReplacePanel.clickOnPreviousBtn(); - editor.waitSpecifiedValueForLineAndChar(FIFTH_CURSOR_POSITION); - searchReplacePanel.clickOnNextBtn(); - editor.waitSpecifiedValueForLineAndChar(SIXTH_CURSOR_POSITION); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabByUsingTabListTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabByUsingTabListTest.java deleted file mode 100644 index 0a84f6db535..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabByUsingTabListTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.CodenvyEditor.TabActionLocator; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckWorkingWithTabByUsingTabListTest { - - private static final String PROJECT_NAME = - NameGenerator.generate(CheckWorkingWithTabByUsingTabListTest.class.getSimpleName(), 4); - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JAVA_CLASS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String NAME_TO_CSS = "cssFile.css"; - private static final String NAME_TO_XML = "web.xml"; - private static final String NAME_TO_HTML = "htmlFile.html"; - private static final String NAME_TO_JAVA_CLASS = "AppController"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles consoles; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkWorkingWithTabByUsingTabList() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - openTabsInEditor(); - - editor.openTabList(); - editor.waitTabIsPresentInTabList(NAME_TO_JAVA_CLASS); - editor.waitTabIsPresentInTabList(NAME_TO_CSS); - editor.waitTabIsPresentInTabList(NAME_TO_HTML); - editor.waitTabIsPresentInTabList(NAME_TO_XML); - editor.waitTabIsPresent(NAME_TO_HTML); - editor.clickOnTabInTabList(NAME_TO_HTML); - editor.openAndWaitContextMenuForTabByName(NAME_TO_HTML); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE); - editor.openTabList(); - editor.waitTabIsNotPresentInTabList(NAME_TO_HTML); - } - - private void openTabsInEditor() { - projectExplorer.waitItem(PATH_TO_JAVA_CLASS); - projectExplorer.openItemByPath(PATH_TO_JAVA_CLASS); - projectExplorer.waitItem(PATH_TO_CSS); - projectExplorer.openItemByPath(PATH_TO_CSS); - projectExplorer.waitItem(PATH_TO_XML); - projectExplorer.openItemByPath(PATH_TO_XML); - projectExplorer.waitItem(PATH_TO_HTML); - projectExplorer.openItemByPath(PATH_TO_HTML); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabsByUsingContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabsByUsingContextMenuTest.java deleted file mode 100644 index 4685e67c2d5..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/CheckWorkingWithTabsByUsingContextMenuTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.CodenvyEditor.TabActionLocator; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckWorkingWithTabsByUsingContextMenuTest { - - private static final String PROJECT_NAME = - NameGenerator.generate(CheckWorkingWithTabsByUsingContextMenuTest.class.getSimpleName(), 4); - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JAVA_CLASS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String NAME_TO_CSS = "cssFile.css"; - private static final String NAME_TO_XML = "web.xml"; - private static final String NAME_TO_HTML = "htmlFile.html"; - private static final String NAME_TO_JAVA_CLASS = "AppController"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void checkWorkingWithTabsByUsingContextMenu() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - - // close all tab by using context menu - openTabsInEditor(); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE_ALL); - editor.waitTabIsNotPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsNotPresent(NAME_TO_CSS); - editor.waitTabIsNotPresent(NAME_TO_XML); - editor.waitTabIsNotPresent(NAME_TO_HTML); - - // close one tab by using context menu - openTabsInEditor(); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE); - editor.waitTabIsNotPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsPresent(NAME_TO_CSS); - editor.waitTabIsPresent(NAME_TO_XML); - editor.waitTabIsPresent(NAME_TO_HTML); - editor.closeAllTabs(); - - // close other tabs by using context menu - openTabsInEditor(); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE_OTHER); - editor.waitTabIsPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsNotPresent(NAME_TO_CSS); - editor.waitTabIsNotPresent(NAME_TO_XML); - editor.waitTabIsNotPresent(NAME_TO_HTML); - editor.closeAllTabs(); - - // pin and close all tabs without pinned by using context menu - openTabsInEditor(); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.PIN_UNPIN_TAB); - editor.openAndWaitContextMenuForTabByName(NAME_TO_CSS); - editor.runActionForTabFromContextMenu(TabActionLocator.PIN_UNPIN_TAB); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE_ALL_BUT_PINNED); - editor.waitTabIsPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsPresent(NAME_TO_CSS); - editor.waitTabIsNotPresent(NAME_TO_XML); - editor.waitTabIsNotPresent(NAME_TO_HTML); - editor.closeAllTabs(); - - // reopen closed tab by using context menu - openTabsInEditor(); - editor.openAndWaitContextMenuForTabByName(NAME_TO_JAVA_CLASS); - editor.runActionForTabFromContextMenu(TabActionLocator.CLOSE); - editor.waitTabIsNotPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsPresent(NAME_TO_CSS); - editor.waitTabIsPresent(NAME_TO_XML); - editor.waitTabIsPresent(NAME_TO_HTML); - editor.selectTabByName(NAME_TO_CSS); - editor.openAndWaitContextMenuForTabByName(NAME_TO_CSS); - editor.runActionForTabFromContextMenu(TabActionLocator.REOPEN_CLOSED_TAB); - editor.waitTabIsPresent(NAME_TO_JAVA_CLASS); - editor.waitTabIsPresent(NAME_TO_CSS); - editor.waitTabIsPresent(NAME_TO_XML); - editor.waitTabIsPresent(NAME_TO_HTML); - editor.closeAllTabs(); - } - - private void openTabsInEditor() { - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JAVA_CLASS); - projectExplorer.openItemByPath(PATH_TO_JAVA_CLASS); - editor.waitTabIsPresent(NAME_TO_JAVA_CLASS); - - projectExplorer.waitItem(PATH_TO_CSS); - projectExplorer.openItemByPath(PATH_TO_CSS); - editor.waitTabIsPresent(NAME_TO_CSS); - - projectExplorer.waitItem(PATH_TO_XML); - projectExplorer.openItemByPath(PATH_TO_XML); - editor.waitTabIsPresent(NAME_TO_XML); - - projectExplorer.waitItem(PATH_TO_HTML); - projectExplorer.openItemByPath(PATH_TO_HTML); - editor.waitTabIsPresent(NAME_TO_HTML); - - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/ContextMenuEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/ContextMenuEditorTest.java deleted file mode 100644 index 12e62cfbf0d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/ContextMenuEditorTest.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.CLOSE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FIND; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FIND_DEFINITION; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FORMAT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.NAVIGATE_FILE_STRUCTURE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.QUICK_DOC; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.QUICK_FIX; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.REDO; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.REFACTORING; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.REFACTORING_MOVE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.REFACTORING_RENAME; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.UNDO; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FileStructure; -import org.eclipse.che.selenium.pageobject.FindText; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -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.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class ContextMenuEditorTest { - - private static final String PROJECT_NAME = - NameGenerator.generate(ContextMenuEditorTest.class.getSimpleName(), 4); - private static final String FORMATTED_TEXT = - "/*\n" - + " * Copyright (c) 2012-2018 Red Hat, Inc.\n" - + " * This program and the accompanying materials are made\n" - + " * available under the terms of the Eclipse Public License 2.0\n" - + " * which is available at https://www.eclipse.org/legal/epl-2.0/\n" - + " *\n" - + " * SPDX-License-Identifier: EPL-2.0\n" - + " *\n" - + " * Contributors:\n" - + " * Red Hat, Inc. - initial API and implementation\n" - + " */\n" - + "package org.eclipse.qa.examples;\n" - + "\n" - + "import java.util.Random;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\";\n" - + "\n" - + " if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " }\n" - + "\n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view;\n" - + " }\n" - + "}\n"; - - private static final String CHECK_TEXT = "// ** check **"; - - private static final String QUICK_DOC_TEXT = - "java.lang.Exception\n" - + "The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch.\n" - + "The class Exception and any subclasses that are not also subclasses of RuntimeException are checked exceptions. Checked exceptions need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.\n" - + "Since:\n" - + "JDK1.0\n" - + "Author:\n" - + "Frank Yellin\n" - + "See Also:\n" - + "java.lang.Error\n" - + "@jls\n" - + "11.2 Compile-Time Checking of Exceptions"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private Refactor refactor; - @Inject private FileStructure fileStructure; - @Inject private FindText findText; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - consoles.closeProcessesArea(); - } - - @AfterMethod - public void closeContextMenuAndFileTabs() { - // insure context menu is closed - if (editor.isContextMenuPresent()) { - editor.clickOnItemInContextMenu(ContextMenuLocator.CLOSE); - } - - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void checkFormatContextMenu() { - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.scrollToItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - loader.waitOnClosed(); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FORMAT); - editor.waitTextIntoEditor(FORMATTED_TEXT); - editor.waitContextMenuIsNotPresent(); - } - - @Test(priority = 1, alwaysRun = true) - public void checkUndoRedo() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.scrollToItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - editor.setCursorToLine(2); - editor.waitActive(); - editor.typeTextIntoEditor(CHECK_TEXT); - editor.waitTextIntoEditor(CHECK_TEXT); - loader.waitOnClosed(); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(UNDO); - editor.setCursorToLine(2); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(CHECK_TEXT); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(REDO); - editor.setCursorToLine(2); - editor.waitActive(); - editor.waitTextIntoEditor(CHECK_TEXT); - editor.waitContextMenuIsNotPresent(); - } - - @Test(priority = 2, alwaysRun = true) - public void checkClose() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.scrollToItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - loader.waitOnClosed(); - editor.waitActive(); - editor.openContextMenuInEditor(); - loader.waitOnClosed(); - editor.clickOnItemInContextMenu(CLOSE); - editor.waitContextMenuIsNotPresent(); - editor.waitTabIsNotPresent("AppController"); - } - - @Test(priority = 3, alwaysRun = true, groups = UNDER_REPAIR) - public void checkQuickDocumentation() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(26, 105); - loader.waitOnClosed(); - editor.openContextMenuOnElementInEditor("Exception"); - editor.clickOnItemInContextMenu(QUICK_DOC); - editor.waitContextMenuIsNotPresent(); - try { - editor.waitJavaDocPopUpOpened(); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/11735", ex); - } - - editor.checkTextToBePresentInJavaDocPopUp(QUICK_DOC_TEXT); - editor.selectTabByName("AppController"); - editor.waitJavaDocPopUpClosed(); - } - - @Test(priority = 4, alwaysRun = true) - public void checkQuickFix() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - editor.setCursorToLine(29); - editor.typeTextIntoEditor("String s = 5;"); - editor.waitTextIntoEditor("String s = 5;"); - editor.waitMarkerInPosition(ERROR, 29); - editor.openContextMenuOnElementInEditor("5"); - editor.clickOnItemInContextMenu(QUICK_FIX); - editor.waitContextMenuIsNotPresent(); - editor.waitTextIntoFixErrorProposition("Change type of 's' to 'int'"); - editor.selectFirstItemIntoFixErrorPropByEnter(); - editor.setCursorToLine(29); - editor.waitTextIntoEditor("int s = 5;"); - editor.waitMarkerInvisibility(ERROR, 29); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - } - - @Test(priority = 5, alwaysRun = true) - public void checkOpenDeclaration() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.goToCursorPositionVisible(26, 13); - editor.openContextMenuOnElementInEditor(" ModelAndView"); - editor.clickOnItemInContextMenu(FIND_DEFINITION); - editor.waitContextMenuIsNotPresent(); - editor.waitTabIsPresent("ModelAndView.class"); - editor.closeFileByNameWithSaving("ModelAndView.class"); - } - - @Test(priority = 6, alwaysRun = true, groups = FLAKY) - public void checkRefactoring() { - final String editorTabName = "Test1"; - final String renamedEditorTabName = "Zclass"; - - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/com/example/Test1.java"); - - editor.goToCursorPositionVisible(14, 15); - editor.openContextMenuOnElementInEditor(editorTabName); - editor.clickOnItemInContextMenu(REFACTORING); - editor.clickOnItemInContextMenu(REFACTORING_MOVE); - editor.waitContextMenuIsNotPresent(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - loader.waitOnClosed(); - refactor.clickOnExpandIconTree("/src/main/java"); - loader.waitOnClosed(); - refactor.chooseDestinationForItem("org.eclipse.qa.examples"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - - try { - editor.waitTabIsPresent(editorTabName); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/11697"); - } - - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Test1.java"); - editor.goToCursorPositionVisible(14, 15); - editor.openContextMenuOnElementInEditor(editorTabName); - editor.clickOnItemInContextMenu(REFACTORING); - editor.clickOnItemInContextMenu(REFACTORING_RENAME); - editor.waitContextMenuIsNotPresent(); - editor.typeTextIntoEditor(renamedEditorTabName); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - - try { - editor.waitTabIsPresent(renamedEditorTabName); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/11697"); - } - - editor.waitTextIntoEditor("public class Zclass"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/Zclass.java"); - } - - @Test(priority = 7, alwaysRun = true) - public void checkNaviFileStructure() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(NAVIGATE_FILE_STRUCTURE); - editor.waitContextMenuIsNotPresent(); - fileStructure.waitFileStructureFormIsOpen("AppController"); - loader.waitOnClosed(); - fileStructure.waitExpectedTextInFileStructure( - "handleRequest(HttpServletRequest, HttpServletResponse):ModelAndView"); - loader.waitOnClosed(); - fileStructure.selectItemInFileStructure( - "handleRequest(HttpServletRequest, HttpServletResponse):ModelAndView"); - fileStructure.selectItemInFileStructureByDoubleClick( - "handleRequest(HttpServletRequest, HttpServletResponse):ModelAndView"); - fileStructure.waitFileStructureFormIsClosed(); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.waitTextElementsActiveLine("handleRequest"); - editor.waitSpecifiedValueForLineAndChar(26, 25); - } - - @Test(priority = 8, alwaysRun = true) - public void checkFind() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FIND); - editor.waitContextMenuIsNotPresent(); - findText.waitFindTextMainFormIsOpen(); - findText.typeTextIntoFindField("class"); - findText.waitTextIntoFindField("class"); - loader.waitOnClosed(); - findText.waitPathIntoRootField("/" + PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - findText.clickOnSearchButtonMainForm(); - findText.waitFindInfoPanelIsOpen(); - findText.waitExpectedTextInFindInfoPanel("AppController.java"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/SplitEditorFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/SplitEditorFeatureTest.java deleted file mode 100644 index 48fa78dca6a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/SplitEditorFeatureTest.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.TabActionLocator.*; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class SplitEditorFeatureTest { - - protected static final String PROJECT_NAME = - NameGenerator.generate(SplitEditorFeatureTest.class.getSimpleName(), 4); - private static final String TEXT_FILE = "README.md"; - private static final String PATH_TEXT_FILE = PROJECT_NAME + "/" + TEXT_FILE; - private static final String NEW_NAME = "NewName"; - private static final String NEW_NAME_JAVA = "NewName.java"; - private static final String NEW_NAME_TXT_FILE = "NewREADME"; - private static final String TEXT = "some text"; - - private final String javaFileName = getJavaFileNameFromTabTitle(); - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject protected ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject protected CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Menu menu; - @Inject private Refactor refactor; - @Inject protected Wizard wizard; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - createProject(PROJECT_NAME); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - expandProjectExplorerAndOpenFile(); - } - - @Test - public void checkSplitEditorWindow() { - editor.waitActive(); - editor.openAndWaitContextMenuForTabByName(javaFileName); - editor.runActionForTabFromContextMenu(SPLIT_HORIZONTALLY); - - editor.waitCountTabsWithProvidedName(2, javaFileName); - - editor.selectTabByIndexEditorWindowAndOpenMenu(0, javaFileName); - editor.runActionForTabFromContextMenu(SPLIT_VERTICALLY); - editor.waitCountTabsWithProvidedName(3, javaFileName); - editor.selectTabByIndexEditorWindow(1, javaFileName); - editor.waitTabSelection(1, javaFileName); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.UP.toString()); - editor.typeTextIntoEditor(TEXT); - - selectSplittedTabAndWaitExpectedText(0, javaFileName, TEXT); - - selectSplittedTabAndWaitExpectedText(1, javaFileName, TEXT); - - selectSplittedTabAndWaitExpectedText(2, javaFileName, TEXT); - } - - @Test(priority = 1) - public void checkFocusInCurrentWindow() { - editor.selectTabByIndexEditorWindow(1, javaFileName); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TEXT_FILE); - editor.waitTabIsPresent(TEXT_FILE); - editor.waitTabFocusing(0, TEXT_FILE); - editor.waitActive(); - assertTrue(editor.tabIsPresentOnce(TEXT_FILE)); - } - - @Test(priority = 2) - public void checkRefactoring() { - editor.selectTabByIndexEditorWindow(2, javaFileName); - editor.waitActive(); - waitAndSelectItem(); - - projectExplorer.launchRefactorByKeyboard(); - refactor.typeAndWaitNewName(NEW_NAME_JAVA); - refactor.clickOkButtonRefactorForm(); - editor.waitActive(); - - editor.selectTabByIndexEditorWindow(1, NEW_NAME); - editor.waitActive(); - - editor.selectTabByIndexEditorWindow(0, NEW_NAME); - editor.waitActive(); - editor.setCursorToLine(2); - editor.typeTextIntoEditor("//" + TEXT); - editor.waitTextIntoEditor("//" + TEXT); - - selectSplittedTabAndWaitExpectedText(1, NEW_NAME, "//" + TEXT); - - selectSplittedTabAndWaitExpectedText(2, NEW_NAME, "//" + TEXT); - } - - @Test(priority = 3) - public void checkContentAfterRenameFile() { - editor.selectTabByIndexEditorWindow(0, NEW_NAME); - projectExplorer.openItemByPath(PATH_TEXT_FILE); - editor.waitActive(); - editor.selectTabByIndexEditorWindow(2, NEW_NAME); - projectExplorer.openItemByPath(PATH_TEXT_FILE); - editor.waitActive(); - renameFile(PATH_TEXT_FILE); - editor.selectTabByIndexEditorWindow(0, NEW_NAME_TXT_FILE); - editor.waitActive(); - editor.setCursorToLine(3); - editor.typeTextIntoEditor("***" + TEXT); - editor.waitTextIntoEditor("***" + TEXT); - - selectSplittedTabAndWaitExpectedText(1, NEW_NAME_TXT_FILE, "***" + TEXT); - - selectSplittedTabAndWaitExpectedText(2, NEW_NAME_TXT_FILE, "***" + TEXT); - } - - private void createProject(String projectName) { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - wizard.waitCreateProjectWizardForm(); - wizard.typeProjectNameOnWizard(projectName); - selectSample(); - wizard.clickCreateButton(); - loader.waitOnClosed(); - wizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - loader.waitOnClosed(); - } - - private void renameFile(String pathToFile) { - projectExplorer.waitAndSelectItem(pathToFile); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clearInput(); - askForValueDialog.typeAndWaitText(NEW_NAME_TXT_FILE); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - } - - private void selectSplittedTabAndWaitExpectedText( - int tabIndex, String tabName, String expectedText) { - editor.selectTabByIndexEditorWindow(tabIndex, tabName); - editor.waitTabSelection(tabIndex, tabName); - editor.waitActive(); - editor.waitTextInDefinedSplitEditor(tabIndex + 1, LOAD_PAGE_TIMEOUT_SEC, expectedText); - } - - protected String getJavaFileNameFromTabTitle() { - return "GreetingController"; - } - - protected void expandProjectExplorerAndOpenFile() { - String pathToFile = PROJECT_NAME + "/src/main/java/org.eclipse.che.examples"; - String javaFileName = this.javaFileName + ".java"; - projectExplorer.expandPathInProjectExplorerAndOpenFile(pathToFile, javaFileName); - loader.waitOnClosed(); - } - - protected void waitAndSelectItem() { - String pathToJavaFile = - PROJECT_NAME + "/src/main/java/org/eclipse/che/examples/GreetingController.java"; - projectExplorer.waitAndSelectItem(pathToJavaFile); - } - - protected void selectSample() { - wizard.selectSample(WEB_JAVA_SPRING); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteFeaturesInEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteFeaturesInEditorTest.java deleted file mode 100644 index 8f0a3f46ea9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteFeaturesInEditorTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class AutocompleteFeaturesInEditorTest { - private static final String PROJECT_NAME = NameGenerator.generate("TestProject", 4); - private static final String[] autocompleteContentAfterFirst = { - "request : HttpServletRequest", - "response : HttpServletResponse", - "numGuessByUser : String", - "result : String", - "view : ModelAndView", - "secretNum : String AppController", - "handleRequest(HttpServletRequest request, HttpServletResponse response) : ModelAndView AppController", - "wait(long timeout, int nanos) : void Object", - "wait(long timeout) : void Object", - "wait() : void Object", - "toString() : String Object", - "notifyAll() : void Object", - "notify() : void Object", - "hashCode() : int Object", - "getClass() : Class Object", - "finalize() : void Object", - "equals(Object obj) : boolean Object", - "clone() : Object Object", - "AppController - org.eclipse.qa.examples" - }; - - private static final String[] autocompleteContentAfterSecondBeforeScroll = { - "CASE_INSENSITIVE_ORDER : Comparator String", - "valueOf(char[] data, int offset, int count) : String String", - "valueOf(double d) : String String", - "valueOf(float f) : String String", - "valueOf(long l) : String String", - "valueOf(int i) : String String", - "valueOf(char c) : String String", - "valueOf(boolean b) : String String", - "valueOf(char[] data) : String String", - "valueOf(Object obj) : String String", - "trim() : String String", - "toUpperCase(Locale locale) : String String", - "toUpperCase() : String String", - "toString() : String String", - "toLowerCase(Locale locale) : String String", - "toLowerCase() : String String", - "toCharArray() : char[] String", - "substring(int beginIndex, int endIndex) : String String", - "substring(int beginIndex) : String String", - "subSequence(int beginIndex, int endIndex) : CharSequence String", - "startsWith(String prefix, int toffset) : boolean String", - "startsWith(String prefix) : boolean String", - "split(String regex, int limit) : String[] String", - "split(String regex) : String[] String", - "replaceFirst(String regex, String replacement) : String String", - "replaceAll(String regex, String replacement) : String String", - "replace(CharSequence target, CharSequence replacement) : String String", - "replace(char oldChar, char newChar) : String String", - "regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len) : boolean String", - "regionMatches(int toffset, String other, int ooffset, int len) : boolean String", - "offsetByCodePoints(int index, int codePointOffset) : int String", - "matches(String regex) : boolean String", - "length() : int String", - "lastIndexOf(String str, int fromIndex) : int String", - "lastIndexOf(int ch, int fromIndex) : int String", - "lastIndexOf(String str) : int String", - "lastIndexOf(int ch) : int String", - "join(CharSequence delimiter, Iterable elements) : String String", - "join(CharSequence delimiter, CharSequence... elements) : String String", - "isEmpty() : boolean String", - "intern() : String String", - "indexOf(String str, int fromIndex) : int String", - "indexOf(int ch, int fromIndex) : int String", - "indexOf(String str) : int String", - "indexOf(int ch) : int String", - "hashCode() : int String", - "getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) : void String", - "getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) : void String", - "getBytes(Charset charset) : byte[] String", - "getBytes(String charsetName) : byte[] String" - }; - - private static final String[] autocompleteContentAfterSecondAfterScroll = { - "replace(CharSequence target, CharSequence replacement) : String String", - "replace(char oldChar, char newChar) : String String", - "regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len) : boolean String", - "regionMatches(int toffset, String other, int ooffset, int len) : boolean String", - "offsetByCodePoints(int index, int codePointOffset) : int String", - "matches(String regex) : boolean String", - "length() : int String", - "lastIndexOf(String str, int fromIndex) : int String", - "lastIndexOf(int ch, int fromIndex) : int String", - "lastIndexOf(String str) : int String", - "lastIndexOf(int ch) : int String", - "join(CharSequence delimiter, Iterable elements) : String String", - "join(CharSequence delimiter, CharSequence... elements) : String String", - "isEmpty() : boolean String", - "intern() : String String", - "indexOf(String str, int fromIndex) : int String", - "indexOf(int ch, int fromIndex) : int String", - "indexOf(String str) : int String", - "indexOf(int ch) : int String", - "hashCode() : int String", - "getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) : void String", - "getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) : void String", - "getBytes(Charset charset) : byte[] String", - "getBytes(String charsetName) : byte[] String", - "getBytes() : byte[] String", - "format(Locale l, String format, Object... args) : String String", - "format(String format, Object... args) : String String", - "equalsIgnoreCase(String anotherString) : boolean String", - "equals(Object anObject) : boolean String", - "endsWith(String suffix) : boolean String", - "copyValueOf(char[] data, int offset, int count) : String String", - "copyValueOf(char[] data) : String String", - "contentEquals(CharSequence cs) : boolean String", - "contentEquals(StringBuffer sb) : boolean String", - "contains(CharSequence s) : boolean String", - "concat(String str) : String String", - "compareToIgnoreCase(String str) : int String", - "compareTo(String anotherString) : int String", - "codePointCount(int beginIndex, int endIndex) : int String", - "codePointBefore(int index) : int String", - "codePointAt(int index) : int String", - "charAt(int index) : char String", - "wait(long timeout, int nanos) : void Object", - "wait(long timeout) : void Object", - "wait() : void Object", - "notifyAll() : void Object", - "notify() : void Object", - "getClass() : Class Object" - }; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createJavaSpringProjectAndTestEditor() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitActive(); - loader.waitOnClosed(); - reparseEditorCode(); - editor.setCursorToLine(38); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.launchAutocompleteAndWaitContainer(); - String textFromEditorAfterFirstCall = editor.getAllVisibleTextFromAutocomplete(); - for (String content : autocompleteContentAfterFirst) { - assertTrue(textFromEditorAfterFirstCall.contains(content)); - } - - editor.enterAutocompleteProposal("result : String"); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitTextIntoEditor("result"); - editor.typeTextIntoEditor("."); - editor.launchAutocompleteAndWaitContainer(); - String textFromEditorAfterSecondCall = editor.getAllVisibleTextFromAutocomplete(); - for (String content : autocompleteContentAfterSecondBeforeScroll) { - assertTrue(textFromEditorAfterSecondCall.contains(content)); - } - - editor.scrollAutocompleteFormToBottom(); - - textFromEditorAfterSecondCall = editor.getAllVisibleTextFromAutocomplete(); - for (String content : autocompleteContentAfterSecondAfterScroll) { - assertTrue(textFromEditorAfterSecondCall.contains(content)); - } - - editor.enterAutocompleteProposal("getBytes() : byte[] "); - editor.waitTextIntoEditor("result.getBytes()"); - editor.typeTextIntoEditor("."); - editor.launchAutocompleteAndWaitContainer(); - editor.enterAutocompleteProposal("toString() : String "); - editor.typeTextIntoEditor(";"); - editor.waitTextIntoEditor("result.getBytes().toString();"); - editor.waitTabFileWithSavedStatus("AppController"); - } - - // need for check ready - state the ide editor - private void reparseEditorCode() { - editor.setCursorToLine(37); - editor.typeTextIntoEditor("a;"); - editor.waitMarkerInPosition(ERROR, 37); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - editor.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - editor.waitMarkerInvisibility(ERROR, 37); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteJSFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteJSFilesTest.java deleted file mode 100644 index 5126fc51bea..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteJSFilesTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.INFO; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class AutocompleteJSFilesTest { - private static final String PROJECT_NAME = - NameGenerator.generate(AutocompleteJSFilesTest.class.getSimpleName(), 4); - private static final String EXPECTED_TEXT = - "function a (){\n" - + " var b = 5;\n" - + " var c = b;\n" - + " return c;\n" - + "}\n" - + "a();\n" - + "/**\n" - + " * \n" - + " */"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - } - - @Test - public void checkAutocompleteJSFilesTest() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.waitProjectExplorer(); - projectExplorer.quickExpandWithJavaScript(); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("newJsFile"); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName("newJsFile.js"); - - editor.waitActive(); - loader.waitOnClosed(); - editor.setCursorToLine(1); - - editor.typeTextIntoEditorWithoutDelayForSaving("function a ("); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("{"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("var b = 5;"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("var c = "); - - editor.launchPropositionAssistPanelForJSFiles(); - editor.enterTextIntoFixErrorPropByEnterForJsFiles("b", " : number"); - - editor.typeTextIntoEditorWithoutDelayForSaving(";"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("return c;"); - editor.setCursorToLine(5); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - - editor.launchPropositionAssistPanelForJSFiles(); - editor.enterTextIntoFixErrorPropByEnterForJsFiles("a()", " : number"); - - editor.typeTextIntoEditorWithoutDelayForSaving(";"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("/**"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - - Assert.assertEquals(editor.getVisibleTextFromEditor(), EXPECTED_TEXT); - - editor.setCursorToLine(9); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("function f ("); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("{"); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving("return 'test text';"); - editor.setCursorToLine(12); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - - editor.launchPropositionAssistPanelForJSFiles(); - editor.enterTextIntoFixErrorPropByEnterForJsFiles("f()", " : string"); - editor.typeTextIntoEditorWithoutDelayForSaving(";"); - - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - - editor.setCursorToLine(11); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.END.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.BACK_SPACE.toString()); - - editor.clickOnMarker(INFO, 11); - editor.clickOnElementByXpath("//button[text()='Add missing semicolon']"); - - editor.waitAllMarkersInvisibility(INFO); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteProposalJavaDocTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteProposalJavaDocTest.java deleted file mode 100644 index da416650a06..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteProposalJavaDocTest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -@Test(groups = UNDER_REPAIR) -public class AutocompleteProposalJavaDocTest { - private static final String PROJECT = "multi-module-java-with-ext-libs"; - - private static final String APP_CLASS_NAME = "App"; - private static final String PATH_FOR_EXPAND_APP_CLASS = - PROJECT + "/app/src/main/java/multimodule"; - private static final String BOOK_IMPL_CLASS_NAME = "BookImpl"; - private static final String PATH_TO_SLF4J_ARTIFACTS = "/home/user/.m2/repository/org/slf4j"; - private static final String COMMAND_TO_REMOVE_SLF4J_ARTIFACTS = "removeSLF4J"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - - // no links are present in completion item javadoc due to - // https://github.com/eclipse/eclipse.jdt.ls/issues/731 - // also, links would be displayed, but not handled currently. - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/multi-module-java-with-ext-libs"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT, - ProjectTemplates.CONSOLE_JAVA_SIMPLE); - testCommandServiceClient.createCommand( - format("rm -r %s", PATH_TO_SLF4J_ARTIFACTS), - COMMAND_TO_REMOVE_SLF4J_ARTIFACTS, - CUSTOM, - workspace.getId()); - // open IDE - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - projectExplorer.waitAndSelectItem(PROJECT); - notificationsPopupPanel.waitProgressPopupPanelClose(); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PATH_FOR_EXPAND_APP_CLASS, APP_CLASS_NAME + ".java"); - - // close project tree - projectExplorer.openItemByPath(PROJECT); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT + "/model/src/main/java/multimodule.model", BOOK_IMPL_CLASS_NAME + ".java"); - } - - @BeforeMethod - public void openMainClass() { - editor.selectTabByName(APP_CLASS_NAME); - } - - @Test - public void shouldDisplayJavaDocOfClassMethod() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(31, 30); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal( - "concat(String part1, String part2, char divider) : String App"); - - // then - checkProposalDocumentationHTML(getExpectedJavadocHtmlText()); - } - - @Test - public void shouldWorkAroundAbsentJavaDocOfConstructor() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(32, 14); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal("App() multimodule.App"); - - // then - checkProposalDocumentationHTML("

No documentation found.

\n"); - } - - @Test - public void shouldDisplayAnotherModuleClassJavaDoc() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(25, 20); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal("isEquals(Object o) : boolean Book"); - - // then - checkProposalDocumentationHTML(getProposalDocumentationHTML()); - } - - @Test - public void shouldReflectChangesInJavaDoc() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.selectTabByName(BOOK_IMPL_CLASS_NAME); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - editor.goToCursorPositionVisible(15, 4); - editor.typeTextIntoEditor("UPDATE. "); - - editor.selectTabByName(APP_CLASS_NAME); - editor.waitActive(); - editor.goToCursorPositionVisible(22, 12); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal("BookImpl - multimodule.model"); - - // then - editor.waitProposalDocumentationHTML("UPDATE. Implementation of Book interface."); - } - - @Test - public void shouldDisplayJavaDocOfJreClass() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(25, 20); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal("hashCode() : int Object"); - - // then - checkProposalDocumentationHTML( - "Returns a hash code value for the object. " - + "This method is supported for the benefit of hash tables such as those provided by"); - } - - @Test - public void shouldNotShowJavaDocIfExternalLibDoesNotExist() { - // when - editor.waitActive(); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(31, 23); - editor.launchAutocompleteAndWaitContainer(); - editor.selectCompositeAutocompleteProposal("info(String msg) : void Logger"); - - // then - checkProposalDocumentationHTML( - "
    \n" - + "
  • Parameters:

    \n" - + "
      \n" - + "
    • msg the message string to be logged
    • \n" - + "
    \n" - + "
  • \n" - + "
"); - - // when - editor.closeAutocomplete(); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitActiveTabFileName("Logger.class"); - editor.selectTabByName(APP_CLASS_NAME); - - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(COMMAND_TO_REMOVE_SLF4J_ARTIFACTS); - - loader.waitOnClosed(); - editor.waitActive(); - editor.goToCursorPositionVisible(30, 20); - editor.openJavaDocPopUp(); - - // then - assertFalse(editor.isTooltipPopupVisible()); - } - - private void checkProposalDocumentationHTML(String expectedText) { - try { - editor.waitProposalDocumentationHTML(expectedText); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/11743"); - } - } - - protected String getExpectedJavadocHtmlText() { - return "

Deprecated As of version 1.0, use org.apache.commons.lang.StringUtils.join(Object [], char)

\n" - + "

Returns concatination of two strings into one divided by special symbol.

\n" - + "
    \n" - + "
  • Parameters:

    \n" - + "
      \n" - + "
    • part1 part 1 to concat.

      \n" - + "
    • \n" - + "
    • part2 part 2 to concat.

      \n" - + "
    • \n" - + "
    • divider divider of part1 and part2.

      \n" - + "
    • \n" - + "
    \n" - + "
  • \n" - + "
  • Returns:

    \n" - + "
      \n" - + "
    • concatination of two strings into one.
    • \n" - + "
    \n" - + "
  • \n" - + "
  • Throws:

    \n" - + "\n" - + "
  • \n" - + "
\n"; - } - - protected String getProposalDocumentationHTML() { - return "

Returns true if the argument is equal to instance. otherwise false

\n" - + "
    \n" - + "
  • Parameters:

    \n" - + "
      \n" - + "
    • o an object.
    • \n" - + "
    \n" - + "
  • \n" - + "
  • Returns:

    \n" - + "
      \n" - + "
    • Returns true if the argument is equal to instance. otherwise false
    • \n" - + "
    \n" - + "
  • \n" - + "
  • Since:

    \n" - + "
      \n" - + "
    • 1.0
    • \n" - + "
    \n" - + "
  • \n" - + "
  • See Also:

    \n" - + "\n" - + "
  • \n" - + "
\n"; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteWithInheritTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteWithInheritTest.java deleted file mode 100644 index 8a5f66b6f07..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/AutocompleteWithInheritTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.TASK_OVERVIEW; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = UNDER_REPAIR) -public class AutocompleteWithInheritTest { - private static final String PROJECT_NAME = - NameGenerator.generate(AutocompleteWithInheritTest.class.getSimpleName(), 4); - private static final String BASE_CLASS = "AppController"; - private static final String EXTENDED_CLASS = "InheritClass"; - private static final Logger LOG = LoggerFactory.getLogger(AutocompleteWithInheritTest.class); - - private static final String contentAfterFix = - "public class InheritClass extends AppController {\n" - + "\n" - + " public InheritClass(int testInt, String testString) {\n" - + " super(testInt, testString);\n" - + " // TODO Auto-generated constructor stub\n" - + " }\n" - + "\n" - + "}\n"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-dependency-test"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void updateDependencyWithInheritTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - mavenPluginStatusBar.waitClosingInfoPanel(); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/src/main/java/example", BASE_CLASS + ".java"); - editor.waitAllMarkersInvisibility(ERROR); - projectExplorer.openItemByVisibleNameInExplorer(EXTENDED_CLASS + ".java"); - editor.waitMarkerInPosition(MarkerLocator.ERROR, 14); - editor.setCursorToLine(14); - editor.launchPropositionAssistPanel(); - try { - editor.waitTextIntoFixErrorProposition("Add constructor 'InheritClass(int,String)'"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/eclipse.jdt.ls/issues/767"); - } - editor.selectFirstItemIntoFixErrorPropByEnter(); - editor.waitTextIntoEditor(contentAfterFix); - editor.waitMarkerInvisibility(ERROR, 14); - editor.waitMarkerInPosition(TASK_OVERVIEW, 19); - editor.waitTabFileWithSavedStatus(EXTENDED_CLASS); - editor.selectTabByName(BASE_CLASS); - loader.waitOnClosed(); - editor.selectLineAndDelete(25); - editor.typeTextIntoEditor("int testString;"); - editor.typeTextIntoEditor(Keys.ARROW_DOWN.toString()); - editor.typeTextIntoEditor(Keys.ARROW_DOWN.toString()); - editor.selectLineAndDelete(); - editor.typeTextIntoEditor("public AppController(int testInt, int testString) {"); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.waitTabFileWithSavedStatus(BASE_CLASS); - editor.selectTabByName(EXTENDED_CLASS); - loader.waitOnClosed(); - editor.setCursorToLine(17); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.HOME.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.typeTextIntoEditor("s"); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Change type of 'testString' to 'int'"); - editor.selectFirstItemIntoFixErrorPropByDoubleClick(); - editor.waitAllMarkersInvisibility(ERROR); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/CheckAutocompleteFeaturesInTheTestFolderTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/CheckAutocompleteFeaturesInTheTestFolderTest.java deleted file mode 100644 index 861278f2e18..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/CheckAutocompleteFeaturesInTheTestFolderTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * // - * - * @author Musienko Maxim - * @author Aleksandr Shmaraev - */ -@Test(groups = UNDER_REPAIR) -public class CheckAutocompleteFeaturesInTheTestFolderTest { - private static final String PROJECT_NAME = - NameGenerator.generate("CheckAuthoCompleteInTheTestFolder_", 4); - private static final String TEST_CLASS = "AppTest.java"; - private static final String TAB_TITLE = "AppTest"; - private static final String PATH_TO_TEST_FOLDER = - PROJECT_NAME + "/src/test/java/com/codenvy/example/java/"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/console-java-with-html-file"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkAutocompleteFeaturesInTheTestFolderTest() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - - projectExplorer.clickOnProjectExplorerTab(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByPath(PATH_TO_TEST_FOLDER + TEST_CLASS); - editor.waitTabIsPresent(TAB_TITLE); - - checkOpenDeclaration(); - checkAutocompletion(); - checkJavadoc(); - } - - private void checkOpenDeclaration() { - final String expectedTabTitle = "Test.class"; - final String expectedContent = - "package junit.framework;\n" - + "\n" - + "/**\n" - + " * A Test can be run and collect its results.\n" - + " *\n" - + " * @see TestResult\n" - + " */\n" - + "public interface Test {\n" - + " /**\n" - + " * Counts the number of test cases that will be run by this test.\n" - + " */\n" - + " public abstract int countTestCases();\n" - + " /**\n" - + " * Runs a test and collects its result in a TestResult instance.\n" - + " */\n" - + " public abstract void run(TestResult result);\n" - + "}"; - - // prepare file - editor.waitActive(); - editor.goToCursorPositionVisible(36, 21); - editor.waitActive(); - editor.waitSpecifiedValueForLineAndChar(36, 21); - - // check open declaration - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent(expectedTabTitle); - editor.waitTextIntoEditor(expectedContent); - editor.closeFileByNameWithSaving(expectedTabTitle); - } - - private void checkAutocompletion() { - final String[] autocompleteItems = { - "Test", "TestSuite", "TestCollector", "TestListener", "TestFailure" - }; - - final String textBeforeAutocomplete = - " public AppTest(String testName) {\n" - + " super(testName);\n" - + " Test\n" - + " }"; - - final String textAfterAutocomplete = - " public AppTest(String testName) {\n" - + " super(testName);\n" - + " TestCase\n" - + " }"; - - final String codeWithoutErrors = - " public AppTest(String testName) {\n" - + " super(testName);\n" - + " TestCase testCase;\n" - + " }"; - - // prepare text and launch autocomplete - editor.waitActive(); - editor.goToCursorPositionVisible(30, 25); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitSpecifiedValueForLineAndChar(31, 9); - editor.typeTextIntoEditor("Test"); - editor.waitTextIntoEditor(textBeforeAutocomplete); - editor.launchAutocomplete(); - - // check autocomplete proposals - for (String autocompleteItem : autocompleteItems) { - editor.waitProposalIntoAutocompleteContainer(autocompleteItem); - } - - // check applying of the autocomplete suggestion - editor.enterAutocompleteProposal("Case - junit.framework"); - editor.waitTextIntoEditor(textAfterAutocomplete); - editor.typeTextIntoEditor(" testCase;"); - editor.waitTextIntoEditor(codeWithoutErrors); - } - - private void checkJavadoc() { - final String tabTitle = "AppTest"; - final String expectedTextInJavaDoc = - "The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase."; - - editor.waitTabIsPresent(tabTitle); - editor.selectTabByName(tabTitle); - editor.waitTabFocusing(0, tabTitle); - editor.waitActive(); - editor.goToCursorPositionVisible(29, 21); - editor.openJavaDocPopUp(); - try { - editor.waitJavaDocPopUpOpened(); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/11735", ex); - } - - editor.checkTextToBePresentInJavaDocPopUp(expectedTextInJavaDoc); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorMemberActiveLineForOpenedTabTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorMemberActiveLineForOpenedTabTest.java deleted file mode 100644 index 2a289caaeca..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorMemberActiveLineForOpenedTabTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrienko Alexander on 11.01.15. */ -public class EditorMemberActiveLineForOpenedTabTest { - private static final String PROJECT_NAME = - NameGenerator.generate(EditorMemberActiveLineForOpenedTabTest.class.getSimpleName(), 4); - private static final String DELETE_TEXT_FOR_SQL = "Delete file \"sqlFile.sql\"?"; - private static final String DELETE_TEXT_FOR_LESS = "Delete file \"LessFile.less\"?"; - private static final String DELETE_TEXT_FOR_TEXT_FILE = "Delete file \"another\"?"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createJavaSpringProjectAndTestEditor() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitTabIsPresent("AppController"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(1); - projectExplorer.openItemByVisibleNameInExplorer("sqlFile.sql"); - editor.waitTabIsPresent("sqlFile.sql"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(1); - projectExplorer.openItemByVisibleNameInExplorer("another"); - editor.waitTabIsPresent("another"); - editor.expectedNumberOfActiveLine(1); - editor.waitActive(); - editor.setCursorToLine(5); - editor.selectTabByName("AppController"); - editor.waitActive(); - editor.setCursorToLine(8); - editor.selectTabByName("another"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(5); - editor.selectTabByName("AppController"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(8); - editor.selectTabByName("sqlFile.sql"); - editor.waitActive(); - editor.setCursorToLine(3); - editor.selectTabByName("another"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(5); - editor.selectTabByName("AppController"); - WaitUtils.sleepQuietly(2); - editor.setCursorToLine(42); - editor.selectTabByName("sqlFile.sql"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(3); - editor.selectTabByName("another"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(5); - editor.selectTabByName("sqlFile.sql"); - editor.waitActive(); - editor.expectedNumberOfActiveLine(3); - projectExplorer.waitAndSelectItem( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText(DELETE_TEXT_FOR_SQL); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"); - editor.selectTabByName("another"); - editor.expectedNumberOfActiveLine(5); - projectExplorer.waitAndSelectItem( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText(DELETE_TEXT_FOR_LESS); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"); - editor.selectTabByName("another"); - loader.waitOnClosed(); - editor.expectedNumberOfActiveLine(5); - projectExplorer.waitAndSelectItem( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText(DELETE_TEXT_FOR_TEXT_FILE); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"); - editor.selectTabByName("AppController"); - editor.expectedNumberOfActiveLine(42); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorValidationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorValidationTest.java deleted file mode 100644 index ddf3c30b630..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/EditorValidationTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrienko Alexander on 12.01.15. */ -public class EditorValidationTest { - - private static final String PROJECT_NAME = - NameGenerator.generate(EditorValidationTest.class.getSimpleName(), 4); - private static final String TEXT_FOR_WARNING = "String l, n;"; - private static final String TEXT_FOR_ERROR = "Integer f = 7.8; String key = Keys.ALT;"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskDialog askDialog; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void autoCompleteClassInTheSamePackage() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - mavenPluginStatusBar.waitClosingInfoPanel(); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - // validation warnings - editor.waitAllMarkersInvisibility(ERROR); - editor.setCursorToLine(28); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor("\n"); - editor.waitAllMarkersInvisibility(ERROR); - editor.typeTextIntoEditor(TEXT_FOR_WARNING); - editor.waitMarkerInPosition(WARNING, 29); - editor.waitAnnotationCodeAssistIsClosed(); - editor.moveToMarkerAndWaitAssistContent(WARNING); - loader.waitOnClosed(); - editor.waitTextIntoAnnotationAssist("The value of the local variable l is not used"); - editor.waitTextIntoAnnotationAssist("The value of the local variable n is not used"); - - // TODO the proposition code assist does not still work by click - // ide.getEditor().clickOnWarningMarkerInPosition(21); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Remove 'l', keep assignments with side effects"); - editor.waitTextIntoFixErrorProposition("Remove 'l' and all assignments"); - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitErrorPropositionPanelClosed(); - - // validation errors - editor.setCursorToLine(30); - editor.waitActive(); - editor.typeTextIntoEditor(TEXT_FOR_ERROR); - editor.waitMarkerInPosition(ERROR, 30); - editor.waitActive(); - editor.waitAnnotationCodeAssistIsClosed(); - editor.moveToMarkerAndWaitAssistContent(ERROR); - editor.waitTextIntoAnnotationAssist("Type mismatch: cannot convert from double to Integer"); - editor.waitTextIntoAnnotationAssist("Keys cannot be resolved to a variable"); - loader.waitOnClosed(); - - // TODO the proposition code assist does not still work by click - // ide.getEditor().clickOnErrorMarkerInPosition(22); - editor.typeTextIntoEditor(Keys.HOME.toString()); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Add cast to 'int'"); - editor.waitTextIntoFixErrorProposition("Change type of 'f' to 'double'"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/FormatterTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/FormatterTest.java deleted file mode 100644 index f5a7d58e539..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/FormatterTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Zaryana Dombrovskaya */ -public class FormatterTest { - private static final String PROJECT_NAME = - NameGenerator.generate(FormatterTest.class.getSimpleName(), 4); - private static final String FORMATTED_TEXT = - "/*\n" - + " * Copyright (c) 2012-2018 Red Hat, Inc.\n" - + " * This program and the accompanying materials are made\n" - + " * available under the terms of the Eclipse Public License 2.0\n" - + " * which is available at https://www.eclipse.org/legal/epl-2.0/\n" - + " *\n" - + " * SPDX-License-Identifier: EPL-2.0\n" - + " *\n" - + " * Contributors:\n" - + " * Red Hat, Inc. - initial API and implementation\n" - + " */\n" - + "package org.eclipse.qa.examples;\n" - + "\n" - + "import java.util.Random;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\";\n" - + "\n" - + " if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " }\n" - + "\n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view;\n" - + " }\n" - + "}"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/not-formated-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void formatterTest() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItemByName("AppController.java"); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.FORMAT); - - editor.waitActive(); - editor.waitTextIntoEditor(FORMATTED_TEXT); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/InheritClassTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/InheritClassTest.java deleted file mode 100644 index 8f29b30b474..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/InheritClassTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrienko Alexander on 12.01.15. */ -public class InheritClassTest { - private static final String PROJECT_NAME = - NameGenerator.generate(InheritClassTest.class.getSimpleName(), 4); - private static final String COMMON_PACKAGE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskDialog askDialog; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void autoCompleteClassInTheSamePackage() { - // create java class in the same package with GreetingController.java - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByPath(COMMON_PACKAGE + "/AppController.java"); - - // create java class in the different package with GreetingController.java - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(COMMON_PACKAGE); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - askForValueDialog.createJavaFileByNameAndType("CodenvyTest", AskForValueDialog.JavaFiles.CLASS); - editor.waitTabIsPresent("CodenvyTest"); - loader.waitOnClosed(); - - projectExplorer.waitAndSelectItem(COMMON_PACKAGE); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - askForValueDialog.createJavaFileByNameAndType( - "CodenvyTestInherite", AskForValueDialog.JavaFiles.CLASS); - editor.waitTabIsPresent("CodenvyTestInherite"); - loader.waitOnClosed(); - - editor.waitActive(); - editor.setCursorToLine(3); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.typeTextIntoEditor("ex"); - loader.waitOnClosed(); - editor.launchAutocomplete(); - editor.waitAutocompleteContainerIsClosed(); - editor.waitTextIntoEditor("extends"); - editor.typeTextIntoEditor(" Code"); - loader.waitOnClosed(); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); - editor.enterAutocompleteProposal("nvyTest - org.eclipse.qa.examples"); - editor.waitAutocompleteContainerIsClosed(); - editor.waitTextIntoEditor("CodenvyTestInherite extends CodenvyTest"); - loader.waitOnClosed(); - editor.waitActive(); - - editor.selectTabByName("AppController"); - editor.waitActive(); - editor.setCursorToLine(33); - editor.typeTextIntoEditor("Code"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); - editor.waitProposalIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples"); - editor.enterAutocompleteProposal("nvyTest - org.eclipse.qa.examples"); - editor.waitAutocompleteContainerIsClosed(); - - editor.waitTextIntoEditor("CodenvyTest"); - editor.typeTextIntoEditor(" codenvyTest = n"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitAutocompleteContainer(); - editor.waitProposalIntoAutocompleteContainer("numGuessByUser : String"); - editor.enterAutocompleteProposal("umGuessByUser : String"); - - editor.typeTextIntoEditor(" Code"); - editor.waitTextIntoEditor("CodenvyTest codenvyTest = numGuessByUser Code"); - editor.waitCodeAssistMarkers(ERROR); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("CodenvyTest - org.eclipse.qa.examples"); - editor.waitProposalIntoAutocompleteContainer("CodenvyTestInherite - org.eclipse.qa.examples"); - editor.enterAutocompleteProposal("nvyTestInherite - org.eclipse.qa.examples"); - editor.waitAutocompleteContainerIsClosed(); - editor.typeTextIntoEditor(";"); - editor.waitTextIntoEditor( - "CodenvyTest codenvyTest = numGuessByUser CodenvyTestInherite; \n"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupLinkTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupLinkTest.java deleted file mode 100644 index 00306ed89f2..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupLinkTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Josh Pinkney */ -public class JavaDocPopupLinkTest { - private static final String PROJECT_NAME = - NameGenerator.generate(JavaDocPopupTest.class.getSimpleName(), 4); - - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void javaDocPopupLinkTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - - // Reference to external class file - projectExplorer.waitItem(PATH_TO_FILES + "/AppController.java"); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - editor.goToCursorPositionVisible(26, 105); - - editor.openJavaDocPopUp(); - editor.waitJavaDocPopUpOpened(); - editor.clickOnElementByXpath("//div[contains(@class, 'textviewTooltip')]//a"); - editor.tabIsPresentOnce("RuntimeException.class"); - editor.closeAllTabsByContextMenu(); - loader.waitOnClosed(); - - // Reference to link in same class - projectExplorer.openItemByVisibleNameInExplorer("Aclass.java"); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - editor.goToCursorPositionVisible(14, 22); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - - editor.setCursorToLine(15); - editor.typeTextIntoEditor("/**"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("This {@link Aclass link} tests that the user is sent to line 13"); - editor.setCursorToLine(18); - editor.typeTextIntoEditor("public void testLinkInClass() {}"); - editor.goToCursorPositionVisible(18, 24); - editor.openJavaDocPopUp(); - editor.waitJavaDocPopUpOpened(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - editor.clickOnElementByXpath("//div[contains(@class, 'textviewTooltip')]"); - editor.clickOnElementByXpath("//div[contains(@class, 'textviewTooltip')]//a"); - editor.expectedNumberOfActiveLine(14); - - // Reference to class in a different package but held locally - editor.waitActive(); - editor.setCursorToLine(19); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("/**"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("{@link org.eclipse.qa.examples.AppController#handleRequest}"); - editor.setCursorToLine(23); - editor.typeTextIntoEditor("public void testLinkInDifferentPackage() {}"); - editor.goToCursorPositionVisible(23, 18); - editor.openJavaDocPopUp(); - editor.waitJavaDocPopUpOpened(); - editor.clickOnElementByXpath("//div[contains(@class, 'textviewTooltip')]//a"); - editor.tabIsPresentOnce("AppController.class"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupTest.java deleted file mode 100644 index 944bab1acbd..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/JavaDocPopupTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Igor Vinokur - * @author Andrey Chizhikov - */ -@Test(groups = UNDER_REPAIR) -public class JavaDocPopupTest { - private static final String PROJECT_NAME = - NameGenerator.generate(JavaDocPopupTest.class.getSimpleName(), 4); - private static final String CLASS_NAME_TEXT = "org.eclipse.qa.examples.AppController"; - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - private static final String JAVA_DOC_FOR_TEST_CLASS = - "org.eclipse.qa.examples.TestClass\n" + "Hello"; - private static final String JAVA_DOC_FOR_OBJECT = - "java.lang.Object\n" - + "Class Object is the root of the class hierarchy. Every class has Object as a superclass. " - + "All objects, including arrays, implement the methods of this class.\n" - + "Since:\n" - + "JDK1.0\n" - + "Author:\n" - + "unascribed\n" - + "See Also:\n" - + "java.lang.Class"; - private static final String ANNOTATION_TEXT = - "java.lang.Override\n" - + "Indicates that a method declaration is intended to override a method declaration " - + "in a supertype. If a method is annotated with this annotation type compilers are" - + " required to generate an error message unless at least one of the following " - + "conditions hold:\n" - + "The method does override or implement a method declared in a supertype.\n" - + "The method has a signature that is override-equivalent to that of any public" - + " method declared in Object.\n" - + "Since:\n" - + "1.5\n" - + "Author:\n" - + "Peter von der Ahé\n" - + "Joshua Bloch\n" - + "@jls\n" - + "9.6.1.4 @Override"; - private static final String CONSTRUCTOR_TEXT = - "org.eclipse.qa.examples.AppController.AppController()"; - private static final String CLASS_TEXT = - "java.lang.Exception\n" - + "The class Exception and its subclasses are a form of Throwable that" - + " indicates conditions that a reasonable application might want to catch.\n" - + "The class Exception and any subclasses that are not also subclasses " - + "of RuntimeException are checked exceptions. Checked exceptions need " - + "to be declared in a method or constructor's throws clause if they can" - + " be thrown by the execution of the method or constructor and propagate" - + " outside the method or constructor boundary.\n" - + "Since:\n" - + "JDK1.0\n" - + "Author:\n" - + "Frank Yellin\n" - + "See Also:\n" - + "java.lang.Error\n" - + "@jls\n" - + "11.2 Compile-Time Checking of Exceptions"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void javaDocPopupTest() throws Exception { - final String tabTitle = "AppController"; - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitItem(PATH_TO_FILES + "/AppController.java"); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitTabIsPresent(tabTitle); - editor.waitActive(); - loader.waitOnClosed(); - // Class javadoc popup - editor.goToCursorPositionVisible(26, 105); - - editor.openJavaDocPopUp(); - checkJavaDocPopUpOpened(); - editor.checkTextToBePresentInJavaDocPopUp(CLASS_TEXT); - - editor.selectTabByName(tabTitle); - editor.waitJavaDocPopUpClosed(); - - // Annotation javadoc popup - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - editor.waitActive(); - editor.goToCursorPositionVisible(25, 6); - - editor.openJavaDocPopUp(); - checkJavaDocPopUpOpened(); - // editor.checkTextToBePresentInJavaDocPopUp(ANNOTATION_TEXT); - - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitJavaDocPopUpClosed(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - - // Class name javadoc popup - editor.goToCursorPositionVisible(22, 17); - editor.openJavaDocPopUp(); - checkJavaDocPopUpOpened(); - editor.checkTextToBePresentInJavaDocPopUp(CLASS_NAME_TEXT); - - editor.selectTabByName("AppController"); - editor.waitJavaDocPopUpClosed(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - - // Class constructor name javadoc popup - editor.waitActive(); - editor.setCursorToLine(24); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("public AppController() {}"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - - editor.goToCursorPositionVisible(25, 15); - editor.openJavaDocPopUp(); - editor.checkTextToBePresentInJavaDocPopUp(CONSTRUCTOR_TEXT); - - editor.selectTabByName("AppController"); - editor.waitJavaDocPopUpClosed(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - - createClass("TestClass", PATH_TO_FILES); - editor.waitActive(); - editor.setCursorToLine(2); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("/**"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.UP.toString()); - editor.typeTextIntoEditor("Hello"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(""); - editor.closeAllTabsByContextMenu(); - projectExplorer.openItemByPath(PATH_TO_FILES + "/AppController.java"); - editor.waitActive(); - editor.setCursorToLine(24); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("TestClass abc = new TestClass(); Object testObject = new Object();"); - editor.typeTextIntoEditor(Keys.HOME.toString()); - - editor.goToCursorPositionVisible(25, 5); - editor.openJavaDocPopUp(); - editor.checkTextToBePresentInJavaDocPopUp(JAVA_DOC_FOR_TEST_CLASS); - - editor.selectTabByName("AppController"); - editor.waitJavaDocPopUpClosed(); - editor.typeTextIntoEditor(Keys.CONTROL.toString()); - - editor.goToCursorPositionVisible(25, 35); - editor.openJavaDocPopUp(); - checkJavaDocPopUpOpened(); - editor.checkTextToBePresentInJavaDocPopUp(JAVA_DOC_FOR_OBJECT); - } - - private void createClass(String className, String pathParent) { - projectExplorer.waitAndSelectItem(pathParent); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - loader.waitOnClosed(); - askForValueDialog.createJavaFileByNameAndType(className, AskForValueDialog.JavaFiles.CLASS); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(className + ".java"); - } - - private void checkJavaDocPopUpOpened() { - try { - editor.waitJavaDocPopUpOpened(); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/11735", ex); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/OpenDeclarationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/OpenDeclarationTest.java deleted file mode 100644 index 7a9e530fdf1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/OpenDeclarationTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Igor Vinokur - * @author Aleksandr Shmaraev - */ -public class OpenDeclarationTest { - private static final String PROJECT_NAME = - NameGenerator.generate(OpenDeclarationTest.class.getSimpleName(), 4); - - private String expectedTextBeforeDownloadSources = ""; - private String expectedTextAfterDownloadSources = ""; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Events events; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resources = OpenDeclarationTest.class.getResource("expected-test-before-download-sources"); - List expectedBeforeTextList = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - for (String bufer : expectedBeforeTextList) { - expectedTextBeforeDownloadSources += bufer + '\n'; - } - - resources = OpenDeclarationTest.class.getResource("expected-test-after-download-sources"); - List expectedAfterTextList = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - for (String bufer : expectedAfterTextList) { - expectedTextAfterDownloadSources += bufer + '\n'; - } - - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void navigateToSourceTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - events.clickEventLogBtn(); - mavenPluginStatusBar.waitClosingInfoPanel(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - editor.selectTabByName("AppController"); - editor.setCursorToLine(21); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("import sun.net.spi.nameservice.dns.DNSNameServiceDescriptor;"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.setCursorToLine(26); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor( - "DNSNameServiceDescriptor descriptor = new DNSNameServiceDescriptor();"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("String sdf = descriptor.getProviderName();"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - - editor.goToCursorPositionVisible(27, 10); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("DNSNameServiceDescriptor.class"); - editor.waitActive(); - editor.setCursorToLine(4); - editor.waitTextElementsActiveLine("DNSNameServiceDescriptor"); - editor.closeFileByNameWithSaving("DNSNameServiceDescriptor.class"); - editor.waitTabIsNotPresent("DNSNameServiceDescriptor"); - editor.selectTabByName("AppController"); - editor.goToCursorPositionVisible(28, 39); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("DNSNameServiceDescriptor.class"); - editor.setCursorToLine(13); - editor.waitTextElementsActiveLine("getProviderName"); - editor.closeFileByNameWithSaving("DNSNameServiceDescriptor.class"); - - // check an ability to download source - editor.selectTabByName("AppController"); - editor.goToCursorPositionVisible(31, 12); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("ModelAndView.class"); - // editor.waitTextIntoEditor(expectedTextBeforeDownloadSources); - loader.waitOnClosed(); - // editor.waitTextIntoEditor(expectedTextAfterDownloadSources); - - editor.closeFileByNameWithSaving("ModelAndView.class"); - - // check go to class - editor.selectTabByName("AppController"); - editor.goToCursorPositionVisible(31, 12); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("ModelAndView.class"); - editor.waitSpecifiedValueForLineAndChar(44, 26); - editor.closeFileByNameWithSaving("ModelAndView.class"); - - // Check go to method - editor.selectTabByName("AppController"); - editor.goToCursorPositionVisible(44, 16); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("ModelAndView.class"); - editor.waitSpecifiedValueForLineAndChar(226, 31); - - // Check go to inner method - editor.goToCursorPositionVisible(227, 9); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("ModelAndView.class"); - editor.waitSpecifiedValueForLineAndChar(203, 29); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/QuickFixAndCodeAssistantFeaturesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/QuickFixAndCodeAssistantFeaturesTest.java deleted file mode 100644 index 46e7ea36c2b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/QuickFixAndCodeAssistantFeaturesTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -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; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrienko Alexander on 08.01.15. */ -@Test(groups = UNDER_REPAIR) -public class QuickFixAndCodeAssistantFeaturesTest { - private static final String PROJECT_NAME = - NameGenerator.generate(QuickFixAndCodeAssistantFeaturesTest.class.getSimpleName(), 4); - private static final String TEXT_FOR_WARNING = "String l = \"test\";"; - private static final String TEXT_FOR_ERROR = "Class1 test = n"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void quickFixAndCodeAssistantTest() { - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.waitActive(); - - editor.setCursorToLine(28); - editor.typeTextIntoEditor(TEXT_FOR_WARNING); - editor.waitMarkerInPosition(WARNING, 28); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Remove 'l', keep assignments with side effects"); - editor.waitTextIntoFixErrorProposition("Remove 'l' and all assignments"); - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitErrorPropositionPanelClosed(); - - editor.launchPropositionAssistPanel(); - try { - editor.waitTextIntoFixErrorProposition("Convert local variable to field"); - editor.waitTextIntoFixErrorProposition("Inline local variable"); - } catch (TimeoutException e) { - fail( - "Known permanent failure https://github.com/eclipse/eclipse.jdt.ls/issues/772, " - + "https://github.com/eclipse/eclipse.jdt.ls/issues/771"); - } - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitErrorPropositionPanelClosed(); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor("\n"); - - editor.typeTextIntoEditor(TEXT_FOR_ERROR); - editor.launchAutocompleteAndWaitContainer(); - editor.enterAutocompleteProposal("null"); - projectExplorer.waitAndSelectItemByName( - "AppController.java"); // TODO because the cursor disappears after click in the autocomplete - // panel - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.typeTextIntoEditor(";"); - editor.waitMarkerInPosition(ERROR, 29); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Change to 'ClassDesc' (javax.rmi.CORBA)"); - editor.waitTextIntoFixErrorProposition("Change to 'ClassUtils' (org.springframework.util)"); - editor.waitTextIntoFixErrorProposition("Change to 'ClassValue' (java.lang)"); - editor.waitTextIntoFixErrorProposition("Change to 'Class' (java.lang)"); - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitErrorPropositionPanelClosed(); - editor.launchPropositionAssistPanel(); - editor.waitTextIntoFixErrorProposition("Change to 'ClassDesc' (javax.rmi.CORBA)"); - editor.waitTextIntoFixErrorProposition("Change to 'ClassUtils' (org.springframework.util)"); - editor.waitTextIntoFixErrorProposition("Change to 'ClassValue' (java.lang)"); - editor.waitTextIntoFixErrorProposition("Change to 'Class' (java.lang)"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/ShowHintsCommandTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/ShowHintsCommandTest.java deleted file mode 100644 index d995554fd94..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/editor/autocomplete/ShowHintsCommandTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.editor.autocomplete; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = UNDER_REPAIR) -public class ShowHintsCommandTest { - private final Logger LOG = LoggerFactory.getLogger(ShowHintsCommandTest.class); - private static final String PROJECT_NAME = - NameGenerator.generate(ShowHintsCommandTest.class.getSimpleName(), 4); - - private static final String TEXT_IN_POP_UP_1 = - "runCommand() : void\n" - + "runCommand(String arg) : void\n" - + "runCommand(boolean arg) : String\n" - + "runCommand(int arg) : void\n" - + "runCommand(int arg, String arg2) : void\n" - + "runCommand(int arg, String arg2, boolean arg3) : void"; - - private static final String CONSTRUCTOR = "HintTestClass hintTestClass = new HintTestClass(11);"; - - private static final String TEXT_IN_POP_UP_2 = - "HintTestClass()\n" - + "HintTestClass(int arg)\n" - + "HintTestClass(int arg, String arg2)\n" - + "HintTestClass(int arg, String arg2, boolean arg3)"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles console; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/spring-for-hint-test"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - console.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkShowHintsCommand() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - console.closeProcessesArea(); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples", "AppController.java"); - loader.waitOnClosed(); - projectExplorer.openItemByVisibleNameInExplorer("HintTestClass.java"); - loader.waitOnClosed(); - - // check the 'show hints' to all parameters on the overloaded method - editor.selectTabByName("AppController"); - editor.waitActive(); - editor.setCursorToLine(33); - editor.typeTextIntoEditor(Keys.TAB.toString()); - editor.typeTextIntoEditor("runCommand();"); - editor.waitTextIntoEditor("runCommand();"); - editor.waitMarkerInPosition(MarkerLocator.ERROR, 34); - editor.goToCursorPositionVisible(33, 16); - editor.callShowHintsPopUp(); - - try { - editor.waitShowHintsPopUpOpened(); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/11747", ex); - } - - editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_1); - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitShowHintsPopUpClosed(); - - // check the 'show hints' to all parameters on the overloaded constructor - editor.waitActive(); - editor.setCursorToLine(28); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.TAB.toString()); - editor.typeTextIntoEditor(CONSTRUCTOR); - editor.waitTextIntoEditor(CONSTRUCTOR); - editor.goToCursorPositionVisible(29, 53); - editor.callShowHintsPopUp(); - editor.waitShowHintsPopUpOpened(); - editor.waitExpTextIntoShowHintsPopUp(TEXT_IN_POP_UP_2); - editor.typeTextIntoEditor(Keys.ESCAPE.toString()); - editor.waitShowHintsPopUpClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithMultiModuleTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithMultiModuleTest.java deleted file mode 100644 index a8f6308d3a5..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithMultiModuleTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER; -import static org.testng.Assert.fail; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class CheckFactoryWithMultiModuleTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 6); - - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private ProjectExplorer projectExplorer; - @Inject private NotificationsPopupPanel notifications; - @Inject private Dashboard dashboard; - @Inject private PullRequestPanel pullRequestPanel; - - @Inject private Consoles consoles; - @Inject private TestGitHubRepository testRepo; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - private TestFactory testFactory; - - @BeforeClass - public void setUp() throws Exception { - // preconditions - add the project to the test repository - Path entryPath = Paths.get(getClass().getResource("/projects/java-multimodule").getPath()); - testRepo.addContent(entryPath); - String repositoryUrl = testRepo.getHttpsTransportUrl(); - - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - ProjectConfigDto projectConfigDto = factoryBuilder.getWorkspace().getProjects().get(0); - projectConfigDto.setName(PROJECT_NAME); - projectConfigDto.setPath("/" + PROJECT_NAME); - projectConfigDto.getSource().setParameters(ImmutableMap.of("branch", "master")); - projectConfigDto.getSource().setLocation(repositoryUrl); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void deleteTestFactory() throws Exception { - testFactory.delete(); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void checkFactoryProcessing() { - dashboard.open(); - testFactory.open(seleniumWebDriver); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitProjectExplorer(); - - try { - notifications.waitExpectedMessageOnProgressPanelAndClose( - "Project " + PROJECT_NAME + " imported"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/my-lib", PROJECT_FOLDER); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/my-webapp", PROJECT_FOLDER); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerClickCreatePolicyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerClickCreatePolicyTest.java deleted file mode 100644 index 4bedac0a940..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerClickCreatePolicyTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.api.factory.shared.dto.PoliciesDto; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mihail Kuznyetsov */ -@Test(groups = FLAKY) -public class CheckFactoryWithPerClickCreatePolicyTest { - @Inject private ProjectExplorer projectExplorer; - @Inject private Dashboard dashboard; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - - private TestFactory testFactory; - - @BeforeClass - public void setUp() throws Exception { - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - factoryBuilder.setPolicies(newDto(PoliciesDto.class).withCreate("perClick")); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void checkFactoryAcceptingWithPerClickPolicy() { - // accept factory - dashboard.open(); - testFactory.open(seleniumWebDriver); - - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitProjectExplorer(); - - try { - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose("Project Spring imported"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - String workspaceUrl = seleniumWebDriver.getCurrentUrl(); - - // accept factory - testFactory.open(seleniumWebDriver); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitProjectExplorer(); - - try { - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose("Project Spring imported"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - // factory has been accepted in another workspace - assertEquals(workspaceUrl + "_1", seleniumWebDriver.getCurrentUrl()); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerUserCreatePolicyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerUserCreatePolicyTest.java deleted file mode 100644 index 71d5d466f0e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithPerUserCreatePolicyTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.api.factory.shared.dto.PoliciesDto; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.openqa.selenium.TimeoutException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mihail Kuznyetsov */ -@Test(groups = {FLAKY, UNDER_REPAIR}) -public class CheckFactoryWithPerUserCreatePolicyTest { - @Inject private ProjectExplorer projectExplorer; - @Inject private Dashboard dashboard; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - private TestFactory testFactory; - private final Logger LOG = LoggerFactory.getLogger(CheckFactoryWithPerUserCreatePolicyTest.class); - - @BeforeClass - public void setUp() throws Exception { - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - factoryBuilder.setPolicies(newDto(PoliciesDto.class).withCreate("perUser")); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void checkFactoryAcceptingWithPerUserPolicy() throws Exception { - dashboard.open(); - - // accept factory - testFactory.open(seleniumWebDriver); - - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitProjectExplorer(); - - try { - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose("Project Spring imported"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - String workspaceUrl = seleniumWebDriver.getCurrentUrl(); - // accept factory - testFactory.open(seleniumWebDriver); - - try { - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - } catch (TimeoutException ex) { - LOG.info( - String.format( - CheckFactoryWithPerUserCreatePolicyTest.class.getSimpleName(), - testFactory.getWorkspaceStatusAssociatedWithFactory(), - "Current workspace status for %s is: %s")); - fail("Known permanent failure https://github.com/eclipse/che/issues/8798"); - } - projectExplorer.waitProjectExplorer(); - - // factory has been accepted in the same workspace - assertEquals(workspaceUrl, seleniumWebDriver.getCurrentUrl()); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSincePolicyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSincePolicyTest.java deleted file mode 100644 index d3dc8c345cb..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSincePolicyTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.api.factory.shared.dto.PoliciesDto; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.pageobject.PopupDialogsBrowser; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mihail Kuznyetsov */ -public class CheckFactoryWithSincePolicyTest { - private static final String FACTORY_NAME = NameGenerator.generate("sincePolicy", 3); - private static final String EXPIRE_MESSAGE = - "Unable to load Factory: This Factory is not yet valid due to time restrictions applied" - + " by its owner. Please, contact owner for more information."; - private static final int FACTORY_INACTIVITY_TIME = 120000; - private static final int ADDITIONAL_TIME = 10000; - private static long initTime; - - @Inject private ProjectExplorer projectExplorer; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private PopupDialogsBrowser popupDialogsBrowser; - @Inject private Dashboard dashboard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private WarningDialog warningDialog; - private TestFactory testFactory; - - @BeforeClass - public void setUp() throws Exception { - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - initTime = System.currentTimeMillis(); - factoryBuilder.setPolicies( - newDto(PoliciesDto.class).withSince(initTime + FACTORY_INACTIVITY_TIME)); - factoryBuilder.setName(FACTORY_NAME); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void checkFactoryAcceptingWithSincePolicy() { - // check factory now, make sure its restricted - dashboard.open(); - testFactory.open(seleniumWebDriver); - seleniumWebDriver.switchFromDashboardIframeToIde(); - - if (System.currentTimeMillis() > initTime + FACTORY_INACTIVITY_TIME) { - fail("Factory started longer then additional time and next test steps does not make sense"); - } - - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(EXPIRE_MESSAGE); - - // wait until factory becomes avaialble - while (System.currentTimeMillis() <= initTime + FACTORY_INACTIVITY_TIME + ADDITIONAL_TIME) { - WaitUtils.sleepQuietly(1); - } - - // check again - testFactory.open(seleniumWebDriver); - seleniumWebDriver.switchFromDashboardIframeToIde(); - projectExplorer.waitProjectExplorer(); - warningDialog.waitWaitClosingWarnDialogWindow(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSparseCheckoutTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSparseCheckoutTest.java deleted file mode 100644 index 0bc22759112..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithSparseCheckoutTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mihail Kuznyetsov */ -@Test(groups = TestGroup.GITHUB) -public class CheckFactoryWithSparseCheckoutTest { - private String projectName; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Events events; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private TestGitHubRepository testRepo; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - private TestFactory testFactory; - - @BeforeClass - public void setUp() throws Exception { - // preconditions - add the project to the test repository - Path entryPath = Paths.get(getClass().getResource("/projects/java-multimodule").getPath()); - testRepo.addContent(entryPath); - String repositoryUrl = testRepo.getHtmlUrl(); - projectName = testRepo.getName(); - - TestFactoryInitializer.TestFactoryBuilder testFactoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - ProjectConfigDto projectConfig = testFactoryBuilder.getWorkspace().getProjects().get(0); - projectConfig.getSource().setParameters(ImmutableMap.of("keepDir", "my-lib")); - projectConfig.getSource().setLocation(repositoryUrl); - projectConfig.setName(projectName); - projectConfig.setPath("/" + projectName); - testFactory = testFactoryBuilder.build(); - } - - @AfterClass - public void deleteTestFactory() throws Exception { - testFactory.delete(); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void acceptFactoryWithSparseCheckout() { - testFactory.authenticateAndOpen(); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - - events.clickEventLogBtn(); - events.waitOpened(); - events.waitExpectedMessage("Project " + projectName + " imported"); - projectExplorer.waitAndSelectItem(projectName); - pullRequestPanel.waitOpenPanel(); - projectExplorer.openItemByPath(projectName); - projectExplorer.waitItem(projectName + "/my-lib"); - projectExplorer.waitItemIsNotPresentVisibleArea(projectName + "/my-webapp"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithUntilPolicyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithUntilPolicyTest.java deleted file mode 100644 index 9261c5daf74..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckFactoryWithUntilPolicyTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.api.factory.shared.dto.PoliciesDto; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.PopupDialogsBrowser; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mihail Kuznyetsov */ -public class CheckFactoryWithUntilPolicyTest { - private static final String FACTORY_NAME = NameGenerator.generate("untilPolicy", 3); - private static final String EXPIRE_MESSAGE = - "Unable to load Factory: This Factory has expired due to time restrictions applied by its owner. Please, contact owner for more information."; - private static final int FACTORY_INACTIVITY_TIME = 120000; - private static final int ADDITIONAL_TIME = 10000; - private static long initTime; - - @Inject private ProjectExplorer projectExplorer; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private PopupDialogsBrowser popupDialogsBrowser; - @Inject private Dashboard dashboard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private WarningDialog warningDialog; - private TestFactory testFactory; - - @BeforeClass - public void setUp() throws Exception { - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - initTime = System.currentTimeMillis(); - factoryBuilder.setPolicies( - newDto(PoliciesDto.class).withUntil(initTime + FACTORY_INACTIVITY_TIME)); - factoryBuilder.setName(FACTORY_NAME); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void checkFactoryAcceptingWithUntilPolicy() { - dashboard.open(); - testFactory.open(seleniumWebDriver); - seleniumWebDriver.switchFromDashboardIframeToIde(); - - if (System.currentTimeMillis() > initTime + FACTORY_INACTIVITY_TIME) { - fail("Factory started longer then additional time and next test steps does not make sense"); - } - - // first - while (System.currentTimeMillis() <= initTime + FACTORY_INACTIVITY_TIME + ADDITIONAL_TIME) { - if (warningDialog.isPresent()) { - warningDialog.clickOkBtn(); - fail("Factory expired before the until period"); - } - projectExplorer.waitProjectExplorer(); - WaitUtils.sleepQuietly(1); - } - - // second - testFactory.open(seleniumWebDriver); - seleniumWebDriver.switchFromDashboardIframeToIde(); - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(EXPIRE_MESSAGE); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckOpenFileFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckOpenFileFeatureTest.java deleted file mode 100644 index f31e8b80a79..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckOpenFileFeatureTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; -import static org.eclipse.che.selenium.pageobject.dashboard.DashboardFactories.AddAction.OPEN_FILE; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestFactoryServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.LoadingBehaviorPage; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.DashboardFactories; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -@Test(groups = FLAKY) -public class CheckOpenFileFeatureTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String OPEN_FILE_URL = "/" + PROJECT_NAME + "/pom.xml"; - private static final String FACTORY_NAME = generate("factory", 4); - - @Inject private ProjectExplorer projectExplorer; - @Inject private Dashboard dashboard; - @Inject private DashboardFactories dashboardFactories; - @Inject private Ide ide; - @Inject private LoadingBehaviorPage loadingBehaviorPage; - @Inject protected CodenvyEditor editor; - @Inject private Loader loader; - @Inject protected Wizard wizard; - @Inject private Menu menu; - @Inject private TestWorkspace testWorkspace; - @Inject private DefaultTestUser user; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestFactoryServiceClient factoryServiceClient; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @AfterClass - public void tearDown() throws Exception { - workspaceServiceClient.deleteFactoryWorkspaces(testWorkspace.getName(), user.getName()); - factoryServiceClient.deleteFactory(FACTORY_NAME); - } - - @Test - public void checkOpenFileFeatureTest() throws Exception { - createProject(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - dashboard.open(); - dashboard.selectFactoriesOnDashbord(); - dashboardFactories.clickOnAddFactoryBtn(); - dashboardFactories.selectWorkspaceForCreation(testWorkspace.getName()); - dashboardFactories.setFactoryName(FACTORY_NAME); - dashboardFactories.clickOnCreateFactoryBtn(); - dashboardFactories.selectAction(OPEN_FILE); - dashboardFactories.enterParamValue(OPEN_FILE_URL); - dashboardFactories.clickAddOnAddAction(); - dashboardFactories.clickOnOpenFactory(); - String currentWin = seleniumWebDriver.getWindowHandle(); - seleniumWebDriverHelper.switchToNextWindow(currentWin); - loadingBehaviorPage.waitWhileLoadPageIsClosed(); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitItem(PROJECT_NAME); - - try { - waitTabIsPresent(); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/11001"); - } - } - - private void createProject(String projectName) { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.waitCreateProjectWizardForm(); - wizard.typeProjectNameOnWizard(projectName); - selectSample(); - wizard.clickCreateButton(); - loader.waitOnClosed(); - wizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - loader.waitOnClosed(); - } - - protected void waitTabIsPresent() { - editor.waitTabIsPresent("web-java-spring", WIDGET_TIMEOUT_SEC); - } - - protected void selectSample() { - wizard.selectSample(WEB_JAVA_SPRING); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckRunCommandFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckRunCommandFeatureTest.java deleted file mode 100644 index ab4e9bb98f0..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckRunCommandFeatureTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestBuildConstants.BUILD_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; -import static org.eclipse.che.selenium.pageobject.dashboard.DashboardFactories.AddAction.RUN_COMMAND; - -import com.google.inject.Inject; -import java.util.concurrent.ExecutionException; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestFactoryServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.LoadingBehaviorPage; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.DashboardFactories; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckRunCommandFeatureTest { - protected static final String PROJECT_NAME = generate("project", 4); - private static final String FACTORY_NAME = generate("factory", 4); - - @Inject private ProjectExplorer projectExplorer; - @Inject private Dashboard dashboard; - @Inject protected DashboardFactories dashboardFactories; - @Inject private Ide ide; - @Inject private LoadingBehaviorPage loadingBehaviorPage; - @Inject private Loader loader; - @Inject protected Wizard wizard; - @Inject private Menu menu; - @Inject private TestWorkspace testWorkspace; - @Inject private DefaultTestUser user; - @Inject private Consoles consoles; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestFactoryServiceClient factoryServiceClient; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @AfterClass - public void tearDown() throws Exception { - workspaceServiceClient.deleteFactoryWorkspaces(testWorkspace.getName(), user.getName()); - factoryServiceClient.deleteFactory(FACTORY_NAME); - } - - @Test - public void checkRunCommandFeatureTest() throws ExecutionException, InterruptedException { - // wait the jdt.ls server is started - consoles.waitExpectedTextIntoConsole("Initialized language server"); - createProject(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - - dashboard.open(); - dashboard.selectFactoriesOnDashbord(); - dashboardFactories.clickOnAddFactoryBtn(); - dashboardFactories.selectWorkspaceForCreation(testWorkspace.getName()); - dashboardFactories.setFactoryName(FACTORY_NAME); - dashboardFactories.clickOnCreateFactoryBtn(); - dashboardFactories.selectAction(RUN_COMMAND); - enterParamValueOnDashboardFactories(); - dashboardFactories.clickAddOnAddAction(); - dashboardFactories.clickOnOpenFactory(); - - String currentWin = seleniumWebDriver.getWindowHandle(); - seleniumWebDriverHelper.switchToNextWindow(currentWin); - - loadingBehaviorPage.waitWhileLoadPageIsClosed(); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS); - } - - private void createProject(String projectName) { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.waitCreateProjectWizardForm(); - wizard.typeProjectNameOnWizard(projectName); - selectSample(); - wizard.clickCreateButton(); - loader.waitOnClosed(); - wizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - loader.waitOnClosed(); - } - - protected void selectSample() { - wizard.selectSample(WEB_JAVA_SPRING); - } - - protected void enterParamValueOnDashboardFactories() { - String nameBuildCommand = PROJECT_NAME + ": build and run"; - dashboardFactories.enterParamValue(nameBuildCommand); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckSkipRootFolderTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckSkipRootFolderTest.java deleted file mode 100644 index a7da48aeec9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckSkipRootFolderTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckSkipRootFolderTest { - - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestGitHubRepository testRepo; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private DefaultTestUser productUser; - @Inject private Dashboard dashboard; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private Ide ide; - - private TestFactory testFactory; - private String projectName; - - @BeforeClass - public void setUp() throws Exception { - // add test repository - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - - // create download URL for current repo (this will be used in the factory as resource URL) - projectName = testRepo.getName(); - String urlToDownloadZippedRepoFromGitHub = - String.format("%s%s", testRepo.getHtmlUrl(), "/archive/master.zip"); - - // create test factory based on minimal template, set necessary path and name to imported - // project, type, skipFirstLevel value - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - ProjectConfigDto projectConfigDto = factoryBuilder.getWorkspace().getProjects().get(0); - projectConfigDto.setName(projectName); - projectConfigDto.setPath("/" + projectName); - projectConfigDto.getSource().setParameters(ImmutableMap.of("skipFirstLevel", "true")); - projectConfigDto.getSource().setType("zip"); - projectConfigDto.getSource().setLocation(urlToDownloadZippedRepoFromGitHub); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void checkSkipRootDirectory() { - dashboard.open(); - testFactory.open(seleniumWebDriver); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - checkProjectStructure(); - } - - private void checkProjectStructure() { - projectExplorer.openItemByPath(projectName); - projectExplorer.waitItem(projectName + "/pom.xml"); - projectExplorer.waitItem(projectName + "/README.md"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckWelcomePanelOnCodenvyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckWelcomePanelOnCodenvyTest.java deleted file mode 100644 index d4914795eda..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CheckWelcomePanelOnCodenvyTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.util.Collections; -import org.eclipse.che.api.factory.shared.dto.IdeActionDto; -import org.eclipse.che.api.factory.shared.dto.IdeDto; -import org.eclipse.che.api.factory.shared.dto.OnAppLoadedDto; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants; -import org.eclipse.che.selenium.core.factory.FactoryTemplate; -import org.eclipse.che.selenium.core.factory.TestFactory; -import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckWelcomePanelOnCodenvyTest { - @Inject private Ide ide; - @Inject private TestFactoryInitializer testFactoryInitializer; - @Inject private ProjectExplorer projectExplorer; - @Inject private Dashboard dashboard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - - private TestFactory testFactory; - private WebDriverWait webDriverWait; - - @BeforeClass - public void setUp() throws Exception { - String urlToContentWelcomePanel = "https://codenvy.io/docs/admin-guide/runbook/index.html"; - webDriverWait = - new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC); - TestFactoryInitializer.TestFactoryBuilder factoryBuilder = - testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); - factoryBuilder.withIde( - newDto(IdeDto.class) - .withOnAppLoaded( - newDto(OnAppLoadedDto.class) - .withActions( - Collections.singletonList( - newDto(IdeActionDto.class) - .withId("openWelcomePage") - .withProperties( - ImmutableMap.of( - "greetingTitle", - "greetingTitle", - "greetingContentUrl", - urlToContentWelcomePanel)))))); - testFactory = factoryBuilder.build(); - } - - @AfterClass - public void tearDown() throws Exception { - testFactory.delete(); - } - - @Test - public void shouldAppearsWelcomePanelAfterUsingFactory() throws Exception { - dashboard.open(); - testFactory.open(seleniumWebDriver); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - projectExplorer.waitItem("Spring"); - checkWelcomePanel(); - } - - private void checkWelcomePanel() { - String expectedTextFragment = - "Runbook\n" - + "This article provides specific performance and security guidance for Codenvy on-premises installations based on our experience running"; - webDriverWait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("greetingFrame"))); - webDriverWait.until( - ExpectedConditions.textToBePresentInElementLocated( - By.tagName("body"), expectedTextFragment)); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateFactoryFromUiWithKeepDirTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateFactoryFromUiWithKeepDirTest.java deleted file mode 100644 index f4a003d802f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateFactoryFromUiWithKeepDirTest.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestGitConstants.CONFIGURING_PROJECT_AND_CLONING_SOURCE_CODE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_FACTORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.IMPORT_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CONVERT_TO_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.UPDATING_PROJECT_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; -import static org.openqa.selenium.Keys.F4; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestFactoryServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.provider.TestIdeUrlProvider; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.CreateFactoryWidget; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.LoadingBehaviorPage; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class CreateFactoryFromUiWithKeepDirTest { - private static final String PROJECT_NAME = generate("project", 5); - private static final String PROJECT_URL = "https://github.com/spring-guides/gs-rest-service"; - private static final String KEEPED_DIR = "complete"; - private static final String FACTORY_NAME = generate("keepFactory", 2); - private static final String[] autocompleteContentAfterFirst = { - "GreetingController", "GreetingControllerTest", "Greeting" - }; - - @Inject private DefaultTestUser user; - @Inject private CodenvyEditor editor; - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Wizard wizard; - @Inject private Events events; - @Inject private CreateFactoryWidget factoryWidget; - @Inject private LoadingBehaviorPage loadingBehaviorPage; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private ImportProjectFromLocation importProjectFromLocation; - @Inject private Loader loader; - @Inject private TestIdeUrlProvider ideUrlProvider; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestFactoryServiceClient factoryServiceClient; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @AfterClass - public void deleteFactoryRelatedStaff() throws Exception { - workspaceServiceClient.deleteFactoryWorkspaces(testWorkspace.getName(), user.getName()); - factoryServiceClient.deleteFactory(FACTORY_NAME); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void createFactoryFromUiWithKeepDirTest() { - projectExplorer.waitProjectExplorer(); - - consoles.waitJDTLSStartedMessage(); - makeKeepDirectoryFromGitUrl(PROJECT_URL, PROJECT_NAME, KEEPED_DIR); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - setUpModuleForFactory(); - - consoles.clickOnProcessesButton(); - checkAutocompletion(); - checkOpenDeclaration(); - } - - private void setUpModuleForFactory() { - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME + "/" + KEEPED_DIR); - - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + KEEPED_DIR); - projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); - wizard.selectSample(MAVEN); - wizard.clickSaveButton(); - - projectExplorer.openItemByPath(PROJECT_NAME + "/" + KEEPED_DIR); - - events.clickEventLogBtn(); - createFactoryAndSwitchToWs(); - } - - private void createFactoryAndSwitchToWs() { - String currentWin = seleniumWebDriver.getWindowHandle(); - - menu.runCommand(WORKSPACE, CREATE_FACTORY); - factoryWidget.waitOpen(); - factoryWidget.typeNameFactory(FACTORY_NAME); - factoryWidget.clickOnCreateBtn(); - factoryWidget.waitTextIntoFactoryField(ideUrlProvider.get().toString()); - factoryWidget.clickOnInvokeBtn(); - seleniumWebDriverHelper.switchToNextWindow(currentWin); - loadingBehaviorPage.waitWhileLoadPageIsClosed(); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - - try { - projectExplorer.waitProjectExplorer(LOADER_TIMEOUT_SEC); - } catch (org.openqa.selenium.TimeoutException ex) { - seleniumWebDriver.switchTo().defaultContent(); - projectExplorer.waitProjectExplorer(LOADER_TIMEOUT_SEC); - } - - events.clickEventLogBtn(); - - try { - events.waitExpectedMessage(CONFIGURING_PROJECT_AND_CLONING_SOURCE_CODE); - events.waitExpectedMessage("Project " + PROJECT_NAME + " imported"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/7253"); - } - - consoles.clickOnProcessesButton(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/" + KEEPED_DIR + "/src/main/java/hello", "GreetingController.java"); - - mavenPluginStatusBar.waitClosingInfoPanel(UPDATING_PROJECT_TIMEOUT_SEC); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void makeKeepDirectoryFromGitUrl(String url, String projectName, String folderName) { - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - importProjectFromLocation.waitMainForm(); - loader.waitOnClosed(); - importProjectFromLocation.selectGitHubSourceItem(); - loader.waitOnClosed(); - importProjectFromLocation.typeURi(url); - importProjectFromLocation.typeProjectName(projectName); - importProjectFromLocation.waitKeepDirectoryIsNotSelected(); - importProjectFromLocation.clickOnKeepDirectoryCheckbox(); - importProjectFromLocation.waitKeepDirectoryIsSelected(); - importProjectFromLocation.typeDirectoryName(folderName); - importProjectFromLocation.clickImportBtn(); - importProjectFromLocation.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - } - - private void checkAutocompletion() { - editor.goToCursorPositionVisible(18, 6); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("Greeting"); - editor.launchAutocompleteAndWaitContainer(); - - String textFromEditorAfterFirstCall = editor.getAllVisibleTextFromAutocomplete(); - - for (String content : autocompleteContentAfterFirst) { - assertTrue(textFromEditorAfterFirstCall.contains(content)); - } - - editor.closeAutocomplete(); - editor.typeTextIntoEditor(" greeting =null;"); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void checkOpenDeclaration() { - String expectedTextBeforeDownloadSources = - "package hello;\n" - + "\n" - + "public class Greeting {\n" - + "\n" - + " private final long id;\n" - + " private final String content;\n" - + "\n" - + " public Greeting(long id, String content) {\n" - + " this.id = id;\n" - + " this.content = content;\n" - + " }\n" - + "\n" - + " public long getId() {\n" - + " return id;\n" - + " }\n" - + "\n" - + " public String getContent() {\n" - + " return content;\n" - + " }\n" - + "}"; - - editor.goToCursorPositionVisible(15, 12); - editor.typeTextIntoEditor(F4.toString()); - editor.waitTabIsPresent("Greeting"); - editor.waitTextIntoEditor(expectedTextBeforeDownloadSources); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashboardTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashboardTest.java deleted file mode 100644 index a0e99b0e1f4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/CreateNamedFactoryFromDashboardTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.factory; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestGitConstants.CONFIGURING_PROJECT_AND_CLONING_SOURCE_CODE; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; - -import com.google.inject.Inject; -import java.util.concurrent.ExecutionException; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestFactoryServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.LoadingBehaviorPage; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.DashboardFactories; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CreateNamedFactoryFromDashboardTest { - protected static final String PROJECT_NAME = generate("project", 4);; - private static final String FACTORY_NAME = generate("factory", 4); - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private DefaultTestUser user; - @Inject private DashboardFactories dashboardFactories; - @Inject private Dashboard dashboard; - @Inject private LoadingBehaviorPage loadingBehaviorPage; - @Inject private ProjectExplorer projectExplorer; - @Inject private Events events; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject protected Wizard wizard; - @Inject private Menu menu; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestFactoryServiceClient factoryServiceClient; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitExpectedTextIntoConsole("Initialized language server"); - - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - selectSampleProject(); - } - - @AfterClass - public void deleteFactoryRelatedStaff() throws Exception { - workspaceServiceClient.deleteFactoryWorkspaces(testWorkspace.getName(), user.getName()); - factoryServiceClient.deleteFactory(FACTORY_NAME); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void createFactoryFromDashBoard() throws ExecutionException, InterruptedException { - String currentWin = seleniumWebDriver.getWindowHandle(); - - dashboard.open(); - dashboardFactories.selectFactoriesOnNavBar(); - dashboardFactories.waitAllFactoriesPage(); - dashboardFactories.clickOnAddFactoryBtn(); - dashboardFactories.selectWorkspaceForCreation(testWorkspace.getName()); - dashboardFactories.setFactoryName(FACTORY_NAME); - dashboardFactories.clickOnCreateFactoryBtn(); - dashboardFactories.waitJsonFactoryIsNotEmpty(); - dashboard.waitNotificationIsClosed(); - dashboardFactories.clickFactoryIDUrl(); - - seleniumWebDriverHelper.switchToNextWindow(currentWin); - loadingBehaviorPage.waitWhileLoadPageIsClosed(); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - - projectExplorer.waitItem(PROJECT_NAME); - events.clickEventLogBtn(); - events.waitExpectedMessage(CONFIGURING_PROJECT_AND_CLONING_SOURCE_CODE); - events.waitExpectedMessage("Project " + PROJECT_NAME + " imported"); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - projectExplorer.openItemByPath(PROJECT_NAME); - mavenPluginStatusBar.waitClosingInfoPanel(); - } - - protected void selectSampleProject() { - wizard.selectProjectAndCreate(WEB_JAVA_SPRING, PROJECT_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithKeepDirectoryTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithKeepDirectoryTest.java index 7bb778f8d0f..139da544fa9 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithKeepDirectoryTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithKeepDirectoryTest.java @@ -25,6 +25,8 @@ import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; import org.eclipse.che.selenium.pageobject.theia.TheiaIde; import org.eclipse.che.selenium.pageobject.theia.TheiaProjectTree; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -32,6 +34,8 @@ @Test(groups = {GITHUB, OPENSHIFT, UNDER_REPAIR}) public class DirectUrlFactoryWithKeepDirectoryTest { + private static final Logger LOG = + LoggerFactory.getLogger(DirectUrlFactoryWithKeepDirectoryTest.class); @Inject private TestFactoryInitializer testFactoryInitializer; @Inject private TestGitHubRepository testRepo; @@ -52,7 +56,11 @@ public void setUp() throws Exception { @AfterClass public void tearDown() throws Exception { - testFactoryWithKeepDir.delete(); + try { + testFactoryWithKeepDir.delete(); + } catch (Exception e) { + LOG.warn("It was impossible to remove factory.", e); + } } @Test diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolderTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolderTest.java index 4dc0f6f3d8b..b36316cf323 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolderTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithRootFolderTest.java @@ -25,6 +25,8 @@ import org.eclipse.che.selenium.core.factory.TestFactoryInitializer; import org.eclipse.che.selenium.pageobject.theia.TheiaIde; import org.eclipse.che.selenium.pageobject.theia.TheiaProjectTree; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -32,6 +34,8 @@ /** @author Musienko Maxim */ @Test(groups = {GITHUB, OPENSHIFT}) public class DirectUrlFactoryWithRootFolderTest { + private static final Logger LOG = + LoggerFactory.getLogger(DirectUrlFactoryWithRootFolderTest.class); @Inject private TestFactoryInitializer testFactoryInitializer; @Inject private TestGitHubRepository testRepo; @@ -52,7 +56,11 @@ public void setUp() throws Exception { @AfterClass public void tearDown() throws Exception { - testFactoryWithRootFolder.delete(); + try { + testFactoryWithRootFolder.delete(); + } catch (Exception e) { + LOG.warn("It was impossible to remove factory.", e); + } } @Test diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranchTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranchTest.java index 9bd96ca40c2..6c40b79639c 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranchTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/factory/DirectUrlFactoryWithSpecificBranchTest.java @@ -30,12 +30,17 @@ import org.eclipse.che.selenium.pageobject.theia.TheiaProposalForm; import org.eclipse.che.selenium.pageobject.theia.TheiaTerminal; import org.openqa.selenium.Keys; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @Test(groups = {GITHUB, OPENSHIFT}) public class DirectUrlFactoryWithSpecificBranchTest { + private static final Logger LOG = + LoggerFactory.getLogger(DirectUrlFactoryWithSpecificBranchTest.class); + private static final String SECOND_BRANCH_NAME = "contrib"; @Inject @@ -66,7 +71,11 @@ public void setUp() throws Exception { @AfterClass public void deleteTestBranch() throws Exception { - testFactoryWithSpecificBranch.delete(); + try { + testFactoryWithSpecificBranch.delete(); + } catch (Exception e) { + LOG.warn("It was impossible to remove factory.", e); + } } @Test diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckDeletingProjectByApiTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckDeletingProjectByApiTest.java deleted file mode 100644 index 9f553603749..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckDeletingProjectByApiTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckDeletingProjectByApiTest { - - private String projectName = NameGenerator.generate("project1", 6); - private String projectName2 = NameGenerator.generate("project2", 6); - - @Inject private TestWorkspace testWorkspace; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Events events; - - @BeforeClass - public void setUp() throws Exception { - createProject(projectName); - createProject(projectName2); - ide.open(testWorkspace); - } - - @Test - public void shouldDeleteProjectsAndCheckDeleting() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - projectExplorer.waitItem(projectName2); - events.clickEventLogBtn(); - deleteAndWaitProjectNotExistByApi(projectName); - deleteAndWaitProjectNotExistByApi(projectName2); - } - - private void createProject(String projectName) throws Exception { - projectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(getClass().getResource("/projects/default-spring-project").toURI()), - projectName, - ProjectTemplates.MAVEN_SPRING); - } - - private void deleteAndWaitProjectNotExistByApi(String projectName) throws Exception { - projectServiceClient.deleteResource(testWorkspace.getId(), projectName); - projectExplorer.waitItemIsNotPresentVisibleArea(projectName); - events.waitExpectedMessage(String.format("Project %s removed", projectName)); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckFileWatcherExcludeFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckFileWatcherExcludeFeatureTest.java deleted file mode 100644 index e46f160302c..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/CheckFileWatcherExcludeFeatureTest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.ADD_TO_FILE_WATCHER_EXCLUDES; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.REMOVE_FROM_FILE_WATCHER_EXCLUDES; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuItems; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckFileWatcherExcludeFeatureTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 4); - private static final String FOLDER_NAME_FOR_EXCLUDE = "src"; - private static final String FILE_WATCHER_IGNORE_FILE_NAME = "fileWatcherIgnore"; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestWorkspace testWorkspace; - @Inject private CheTerminal terminal; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private Loader loader; - @Inject private Events events; - @Inject private Menu menu; - @Inject private Ide ide; - - @BeforeClass - public void setUp() throws Exception { - projectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(getClass().getResource("/projects/guess-project").toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - // We enable hidden files because in the test we use file Watcher Ignore, which is hidden. - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.SHOW_HIDE_HIDDEN_FILES); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - doFileWatcherExcludeOperation(PROJECT_NAME + "/" + "pom.xml", ADD_TO_FILE_WATCHER_EXCLUDES); - projectExplorer.clickOnRefreshTreeButton(); - } - - @AfterMethod - public void closeOpenedTabs() { - editor.closeAllTabs(); - } - - @Test - public void checkFileWatcherIgnoreFileAfterIncludingAndExcludingFileWatching() throws Exception { - String fileNameForExcluding = "pom.xml"; - String pathToExcludedFile = PROJECT_NAME + "/" + fileNameForExcluding; - projectExplorer.waitItem(PROJECT_NAME + "/.che"); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer(FILE_WATCHER_IGNORE_FILE_NAME); - editor.waitActive(); - editor.waitTextIntoEditor(fileNameForExcluding); - - // Remove the file from the File Watcher Excludes feature and check that the file name is not - // exists in the 'fileWatcherIgnore' file - doFileWatcherExcludeOperation(pathToExcludedFile, REMOVE_FROM_FILE_WATCHER_EXCLUDES); - editor.clickOnCloseFileIcon(FILE_WATCHER_IGNORE_FILE_NAME); - projectExplorer.openItemByVisibleNameInExplorer(FILE_WATCHER_IGNORE_FILE_NAME); - editor.selectTabByName(FILE_WATCHER_IGNORE_FILE_NAME); - editor.waitTextNotPresentIntoEditor(fileNameForExcluding); - } - - @Test - public void testFeatureAfterExcludingFile() throws Exception { - String fileNameForExluding = "README.md"; - String pathToExcludedFile = PROJECT_NAME + "/" + fileNameForExluding; - String currentTimeInMillis = Long.toString(System.currentTimeMillis()); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByVisibleNameInExplorer(fileNameForExluding); - editor.waitActive(); - - // Add the file to exclude and check that the file content in the Editor is not changed - doFileWatcherExcludeOperation(pathToExcludedFile, ADD_TO_FILE_WATCHER_EXCLUDES); - testProjectServiceClient.updateFile( - testWorkspace.getId(), pathToExcludedFile, currentTimeInMillis); - editor.waitTextNotPresentIntoEditor(currentTimeInMillis); - - // Close file and open again and check that the file content is changed - editor.clickOnCloseFileIcon(fileNameForExluding); - projectExplorer.openItemByVisibleNameInExplorer(fileNameForExluding); - editor.waitActive(); - editor.waitTextIntoEditor(currentTimeInMillis); - } - - @Test - public void testFeatureAfterExcludingFolder() throws Exception { - String fileNameForExcluding = "AppController.java"; - String pathToJavaFile = - format("%s/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME); - String currentTimeInMillis = Long.toString(System.currentTimeMillis()); - // Exclude 'src' folder - doFileWatcherExcludeOperation( - PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE, ADD_TO_FILE_WATCHER_EXCLUDES); - - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); - editor.waitActive(); - - testProjectServiceClient.updateFile(testWorkspace.getId(), pathToJavaFile, currentTimeInMillis); - editor.selectTabByName("AppController"); - editor.waitTextNotPresentIntoEditor(currentTimeInMillis); - - // Reopen the file and check that its content changed - editor.clickOnCloseFileIcon("AppController"); - projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); - editor.waitActive(); - editor.waitTextIntoEditor(currentTimeInMillis); - } - - @Test - public void testIsNotExcludeOperationEventAboutIgnoreFile() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + "README.md"); - // Clear event log - events.clickEventLogBtn(); - events.clearAllMessages(); - consoles.clickOnProcessesButton(); - - doFileWatcherExcludeOperation(PROJECT_NAME, ADD_TO_FILE_WATCHER_EXCLUDES); - doFileWatcherExcludeOperation(PROJECT_NAME, REMOVE_FROM_FILE_WATCHER_EXCLUDES); - - // Check in the Events that there are not "File 'fileWatcherIgnore' is updated" messages - events.clickEventLogBtn(); - events.waitMessageIsNotPresent("File 'fileWatcherIgnore' is updated"); - consoles.clickOnProcessesButton(); - } - - private void doFileWatcherExcludeOperation(String itemName, ContextMenuItems typeOfOperation) { - projectExplorer.waitAndSelectItem(itemName); - projectExplorer.openContextMenuByPathSelectedItem(itemName); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(typeOfOperation); - loader.waitOnClosed(); - projectExplorer.waitContextMenuPopUpClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/EditFilesWithTabsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/EditFilesWithTabsTest.java deleted file mode 100644 index 6b3d88d77b5..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/EditFilesWithTabsTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.concurrent.TimeUnit; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.pageobject.InjectPageObject; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class EditFilesWithTabsTest { - @Inject private TestWorkspace testWorkspace; - - @InjectPageObject(driverId = 1) - private Ide ide1; - - @InjectPageObject(driverId = 1) - private CodenvyEditor editor1; - - @InjectPageObject(driverId = 1) - private ProjectExplorer projectExplorer1; - - @InjectPageObject(driverId = 2) - private Ide ide2; - - @InjectPageObject(driverId = 2) - private CodenvyEditor editor2; - - @InjectPageObject(driverId = 2) - private ProjectExplorer projectExplorer2; - - @Inject private TestProjectServiceClient testProjectServiceClient; - - @InjectPageObject(driverId = 1) - private Events eventsTab1; - - @InjectPageObject(driverId = 2) - private Events eventsTab2; - - private String projectName = NameGenerator.generate("project", 6); - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/spring-project-for-file-watcher-tabs"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - projectName, - ProjectTemplates.MAVEN_SPRING); - - ide1.open(testWorkspace); - ide1.waitOpenedWorkspaceIsReadyToUse(); - ide2.open(testWorkspace); - ide2.waitOpenedWorkspaceIsReadyToUse(); - - prepareFiles(); - } - - @Test - public void checkEditingFilesFromIde() throws Exception { - String textForValidation = "//check test message for java file"; - String textForValidationTxt1 = "//check test message for file1.txt file"; - String expectedNotificationMess1 = "File 'AppController.java' is updated"; - String expectedNotificationMess2 = "File 'file1.txt' is updated"; - String nameReadmeFile = "README.md"; - String nameFiletxt1 = "file1.txt"; - - editor1.setCursorToLine(1); - editor1.typeTextIntoEditor(textForValidation); - editor1.typeTextIntoEditor(Keys.ENTER.toString()); - - eventsTab2.waitExpectedMessage(expectedNotificationMess1); - editor2.waitTextIntoEditor(textForValidation); - projectExplorer1.openItemByPath(projectName + "/" + nameReadmeFile); - projectExplorer1.openItemByPath(projectName + "/" + nameFiletxt1); - projectExplorer2.openItemByPath(projectName + "/" + nameReadmeFile); - projectExplorer2.openItemByPath(projectName + "/" + nameFiletxt1); - editor2.typeTextIntoEditor(textForValidationTxt1); - - eventsTab1.waitExpectedMessage(expectedNotificationMess2); - eventsTab1.clearAllMessages(); - - editor1.closeFileByNameWithSaving(nameFiletxt1); - editor2.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - editor2.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - - checkThatNotificationIsNotAppear(8, 500, expectedNotificationMess1); - } - - /** Opens same file in two browsers */ - private void prepareFiles() { - expandFoldersToClass(projectExplorer1, editor1); - expandFoldersToClass(projectExplorer2, editor2); - eventsTab1.clickEventLogBtn(); - eventsTab2.clickEventLogBtn(); - } - - /** Expands project for a defined browser instance ('user') */ - private void expandFoldersToClass(ProjectExplorer projectExplorer, CodenvyEditor editor) { - String path_for_expand = - projectName + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - - projectExplorer.waitItem(projectName); - projectExplorer.quickRevealToItemWithJavaScript(path_for_expand); - projectExplorer.openItemByPath(path_for_expand); - editor.waitActive(); - } - - /** Performs checking that notifications do not appear for inactive tabs */ - private void checkThatNotificationIsNotAppear( - int amountOfRequests, int delayBetweenRequsts, String expMess) { - for (int i = 0; i < amountOfRequests; i++) { - sleepQuietly(delayBetweenRequsts, TimeUnit.MILLISECONDS); - editor1.waitTextNotPresentIntoEditor(expMess); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RefactoringFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RefactoringFeatureTest.java deleted file mode 100644 index da7b97a1f73..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RefactoringFeatureTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.pageobject.InjectPageObject; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -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.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class RefactoringFeatureTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 6); - private final String PATH_TO_GREETING_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private final String originClassName = "AppController.java"; - private final String renamedClassName = "AppController2.java"; - - @Inject private TestWorkspace ws; - - @InjectPageObject(driverId = 1) - private Ide ide1; - - @InjectPageObject(driverId = 1) - private ProjectExplorer projectExplorer1; - - @InjectPageObject(driverId = 1) - private CodenvyEditor editor1; - - @InjectPageObject(driverId = 1) - private Events events1; - - @InjectPageObject(driverId = 1) - private Menu menu1; - - @InjectPageObject(driverId = 1) - private Consoles consoles; - - @InjectPageObject(driverId = 2) - private Ide ide2; - - @InjectPageObject(driverId = 2) - private CodenvyEditor editor2; - - @InjectPageObject(driverId = 2) - private Events events2; - - @InjectPageObject(driverId = 2) - private ProjectExplorer projectExplorer2; - - @InjectPageObject(driverId = 2) - private Refactor refactorPanel2; - - @InjectPageObject(driverId = 2) - private Menu menu2; - - @InjectPageObject(driverId = 2) - private Consoles consoles2; - - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/spring-project-for-file-watcher-tabs"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide1.open(ws); - ide2.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - consoles2.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - events1.clickEventLogBtn(); - events2.clickEventLogBtn(); - } - - @Test - public void checkRefactorFilesFromIde() throws Exception { - String expectedMessAfterRename = "File '" + originClassName + "' is removed"; - String expectedMessAfterMove = "File '" + renamedClassName + "' is removed"; - projectExplorer1.waitItem(PROJECT_NAME); - prepareFiles(editor1, projectExplorer1); - prepareFiles(editor2, projectExplorer2); - editor1.goToCursorPositionVisible(22, 14); - doRenameRefactor(); - checkWatching(expectedMessAfterRename); - editor2.waitTabIsNotPresent(renamedClassName); - doMoveRefactor(); - projectExplorer1.openItemByVisibleNameInExplorer(renamedClassName); - events1.waitExpectedMessage(expectedMessAfterMove); - } - - private void checkWatching(String expectedMessAfterRename) { - events2.waitExpectedMessage(expectedMessAfterRename); - projectExplorer2.waitItemIsNotPresentVisibleArea(originClassName); - editor2.waitTabIsNotPresent(originClassName); - } - - private void prepareFiles(CodenvyEditor editor, ProjectExplorer projectExplorer) { - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_GREETING_FILE); - editor.waitTabIsPresent(originClassName.replace(".java", "")); - editor.waitActive(); - } - - private void doRenameRefactor() { - menu1.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - editor1.typeTextIntoEditor(renamedClassName.replace(".java", "")); - sleepQuietly(1); - editor1.typeTextIntoEditor(Keys.ENTER.toString()); - projectExplorer1.waitItem(PATH_TO_GREETING_FILE.replace(originClassName, renamedClassName), 10); - } - - private void doMoveRefactor() { - String pathToRenamedItem = - String.format( - PROJECT_NAME + "%s%s", "/src/main/java/org/eclipse/qa/examples/", renamedClassName); - projectExplorer2.waitAndSelectItem(pathToRenamedItem); - menu2.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.MOVE); - refactorPanel2.waitMoveItemFormIsOpen(); - refactorPanel2.clickOnExpandIconTree(PROJECT_NAME); - refactorPanel2.clickOnExpandIconTree("/src/main/java"); - refactorPanel2.chooseDestinationForItem("com.move"); - refactorPanel2.clickOkButtonRefactorForm(); - refactorPanel2.waitMoveItemFormIsClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RemoveFilesWithActiveTabs.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RemoveFilesWithActiveTabs.java deleted file mode 100644 index 8f4b8fd20f9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/RemoveFilesWithActiveTabs.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.DELETE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.EDIT; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.pageobject.InjectPageObject; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.IdeMainDockPanel; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class RemoveFilesWithActiveTabs { - private static final String PROJECT_NAME = NameGenerator.generate("project", 6); - @Inject private TestWorkspace ws; - - @InjectPageObject(driverId = 1) - private Ide ide1; - - @InjectPageObject(driverId = 1) - private ProjectExplorer projectExplorer1; - - @InjectPageObject(driverId = 1) - private Events events1; - - @InjectPageObject(driverId = 1) - private NotificationsPopupPanel notifications1; - - @InjectPageObject(driverId = 1) - private Menu menu1; - - @InjectPageObject(driverId = 1) - private Loader loader1; - - @InjectPageObject(driverId = 1) - private CodenvyEditor editor1; - - @InjectPageObject(driverId = 1) - private IdeMainDockPanel ideMainDockPanel1; - - @InjectPageObject(driverId = 1) - private AskDialog askDialog1; - - @InjectPageObject(driverId = 2) - private Ide ide2; - - @InjectPageObject(driverId = 2) - private CodenvyEditor editor2; - - @InjectPageObject(driverId = 2) - private Events events2; - - @InjectPageObject(driverId = 2) - private ProjectExplorer projectExplorer2; - - @InjectPageObject(driverId = 2) - private Refactor refactorPanel2; - - @InjectPageObject(driverId = 2) - private Menu menu2; - - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/spring-project-for-file-watcher-tabs"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - - ide1.open(ws); - ide2.open(ws); - - prepareFiles(); - } - - @Test - public void checkDeletionWithSingleOpenedTabFromIde() throws Exception { - String deletedClass = "AppController.java"; - String expectedMessage = "File '" + deletedClass + "' is removed"; - projectExplorer1.waitAndSelectItemByName(deletedClass); - menu1.runCommand(EDIT, DELETE); - projectExplorer2.openItemByVisibleNameInExplorer(deletedClass); - editor2.waitActive(); - - confirmDeletion(); - - waitExpectedMessageInEventPanel(events2, expectedMessage); - editor2.waitTabIsNotPresent(deletedClass.replace(".java", "")); - projectExplorer2.waitItemIsNotPresentVisibleArea(deletedClass); - } - - @Test(priority = 1) - public void checkDeletionWithMultiOpenedTabFromIde() throws Exception { - String nameReadmeFile = "README.md"; - String nameFiletxt1 = "file1.txt"; - String expectedMessage1 = "File '" + nameReadmeFile + "' is removed"; - String expectedMessage2 = "File '" + nameFiletxt1 + "' is removed"; - projectExplorer1.openItemByPath(PROJECT_NAME + "/" + nameReadmeFile); - projectExplorer1.openItemByPath(PROJECT_NAME + "/" + nameFiletxt1); - projectExplorer2.openItemByPath(PROJECT_NAME + "/" + nameReadmeFile); - projectExplorer2.openItemByPath(PROJECT_NAME + "/" + nameFiletxt1); - projectExplorer1.waitAndSelectItem(PROJECT_NAME + "/" + nameReadmeFile); - projectExplorer1.selectMultiFilesByCtrlKeys(PROJECT_NAME + "/" + nameFiletxt1); - menu1.runCommand(EDIT, DELETE); - - confirmDeletion(); - - waitExpectedMessageInEventPanel(events2, expectedMessage1); - waitExpectedMessageInEventPanel(events2, expectedMessage2); - projectExplorer1.waitItemIsNotPresentVisibleArea(nameReadmeFile); - projectExplorer1.waitItemIsNotPresentVisibleArea(nameFiletxt1); - projectExplorer2.waitItemIsNotPresentVisibleArea(nameReadmeFile); - projectExplorer2.waitItemIsNotPresentVisibleArea(nameFiletxt1); - } - - @Test(priority = 2) - public void checkRemovingWithoutIde() throws Exception { - String nameFiletxt2 = "file2.txt"; - String nameFiletxt3 = "file3.txt"; - String expectedMessage1 = "File '" + nameFiletxt2 + "' is removed"; - String expectedMessage2 = "File '" + nameFiletxt3 + "' is removed"; - projectExplorer1.openItemByPath(PROJECT_NAME + "/" + nameFiletxt2); - editor1.waitTabIsPresent(nameFiletxt2); - - testProjectServiceClient.deleteResource(ws.getId(), PROJECT_NAME + "/" + nameFiletxt2); - - waitExpectedMessageInEventPanel(events1, expectedMessage1); - editor1.waitTabIsNotPresent(nameFiletxt2); - projectExplorer2.openItemByPath(PROJECT_NAME + "/" + nameFiletxt3); - editor2.waitTabIsPresent(nameFiletxt3); - - testProjectServiceClient.deleteResource(ws.getId(), PROJECT_NAME + "/" + nameFiletxt3); - - editor2.waitTabIsNotPresent(nameFiletxt2); - waitExpectedMessageInEventPanel(events2, expectedMessage2); - } - - /** Handles the IDE deletion dialog */ - private void confirmDeletion() { - askDialog1.waitFormToOpen(); - askDialog1.clickOkBtn(); - loader1.waitOnClosed(); - askDialog1.waitFormToClose(); - } - - /** Expands tree of project explorer in two browsers */ - private void prepareFiles() { - projectExplorer1.waitItem(PROJECT_NAME); - projectExplorer1.quickExpandWithJavaScript(); - - projectExplorer2.waitItem(PROJECT_NAME); - projectExplorer2.quickExpandWithJavaScript(); - - events1.clickEventLogBtn(); - events2.clickEventLogBtn(); - } - - private void waitExpectedMessageInEventPanel(Events event, String expectedMessage) { - try { - event.waitExpectedMessage(expectedMessage, LOAD_PAGE_TIMEOUT_SEC); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/7339"); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/UpdateFilesWithoutIDETest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/UpdateFilesWithoutIDETest.java deleted file mode 100644 index 56385794d3d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/filewatcher/UpdateFilesWithoutIDETest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.filewatcher; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.pageobject.InjectPageObject; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class UpdateFilesWithoutIDETest { - - private static final String PROJECT_NAME = NameGenerator.generate("project", 6); - - @Inject private TestWorkspace ws; - @Inject private DefaultTestUser user; - - @InjectPageObject(driverId = 1) - private Ide ide1; - - @InjectPageObject(driverId = 1) - private ProjectExplorer projectExplorer1; - - @InjectPageObject(driverId = 1) - private CodenvyEditor editor1; - - @InjectPageObject(driverId = 1) - private Events events1; - - @InjectPageObject(driverId = 2) - private Ide ide2; - - @InjectPageObject(driverId = 2) - private CodenvyEditor editor2; - - @InjectPageObject(driverId = 2) - private NotificationsPopupPanel notifications2; - - @InjectPageObject(driverId = 2) - private ProjectExplorer projectExplorer2; - - @InjectPageObject(driverId = 2) - private Events events2; - - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/spring-project-for-file-watcher-tabs"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - - ide1.open(ws); - ide1.waitOpenedWorkspaceIsReadyToUse(); - ide2.open(ws); - ide2.waitOpenedWorkspaceIsReadyToUse(); - - events1.clickEventLogBtn(); - events2.clickEventLogBtn(); - } - - @Test - public void checkEditingFileWithoutIDE() throws Exception { - String nameFiletxt2 = "file2.txt"; - String nameFiletxt3 = "file3.txt"; - String expectedMessage2 = "File '" + nameFiletxt2 + "' is updated"; - String expectedMessage3 = "File '" + nameFiletxt3 + "' is updated"; - - projectExplorer1.openItemByPath(PROJECT_NAME); - projectExplorer2.openItemByPath(PROJECT_NAME); - projectExplorer1.openItemByPath(PROJECT_NAME + "/" + nameFiletxt2); - editor1.waitActive(); - projectExplorer2.openItemByPath(PROJECT_NAME + "/" + nameFiletxt2); - editor1.waitActive(); - - testProjectServiceClient.updateFile( - ws.getId(), PROJECT_NAME + "/" + nameFiletxt2, Long.toString(System.currentTimeMillis())); - - events1.waitExpectedMessage(expectedMessage2, LOAD_PAGE_TIMEOUT_SEC); - projectExplorer1.openItemByPath(PROJECT_NAME + "/" + nameFiletxt3); - editor1.waitActive(); - projectExplorer2.openItemByPath(PROJECT_NAME + "/" + nameFiletxt3); - editor2.waitActive(); - - String currentTimeInMs = Long.toString(System.currentTimeMillis()); - testProjectServiceClient.updateFile( - ws.getId(), PROJECT_NAME + "/" + nameFiletxt3, currentTimeInMs); - - editor1.waitTextIntoEditor(currentTimeInMs, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - editor2.waitTextIntoEditor(currentTimeInMs, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); - events1.waitExpectedMessage(expectedMessage3, LOAD_PAGE_TIMEOUT_SEC); - events2.waitExpectedMessage(expectedMessage3, LOAD_PAGE_TIMEOUT_SEC); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AddFilesToIndexTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AddFilesToIndexTest.java deleted file mode 100644 index 68356c9caa2..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AddFilesToIndexTest.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maksim */ -@Test(groups = TestGroup.GITHUB) -public class AddFilesToIndexTest { - private static final String PROJECT_NAME = NameGenerator.generate("AddFilesToIndex_", 4); - private static final String PATH_TO_JSP_FILE = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String JAVA_TAB_FILE_NAME = "AppController"; - - private static final String STATUS_MESSAGE_ONE_FILE = - " On branch master\n" - + " Changes to be committed:\n" - + " modified: src/main/webapp/index.jsp"; - - private static final String STATUS_MESSAGE_ALL_FILES = - " On branch master\n" - + " Changes to be committed:\n" - + " new file: src/main/webapp/new.css\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java"; - - private static final String STATUS_MESSAGE_AFTER_EDIT = - " On branch master\n" - + " Changes to be committed:\n" - + " new file: src/main/webapp/new.css\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java\n" - + " Changes not staged for commit:\n" - + " modified: src/main/webapp/new.css\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java"; - - private static final String STATUS_AFTER_DELETE_FILE = - " On branch master\n" - + " Changes to be committed:\n" - + " new file: src/main/webapp/new.css\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java\n" - + " deleted: README.md"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private DefaultTestUser productUser; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void addFilesTest() { - // preparation - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.waitItemIsSelected(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS); - - // perform init commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // check state of the index - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_NOTHING_TO_ADD); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_NOTHING_TO_ADD); - - // expand the tree and open files - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JSP_FILE); - projectExplorer.openItemByPath(PATH_TO_JSP_FILE); - editor.waitActive(); - - // Edit index.jsp - editor.setCursorToLine(17); - editor.typeTextIntoEditor(""); - loader.waitOnClosed(); - - // Add this file to index - projectExplorer.waitAndSelectItem(PATH_TO_JSP_FILE); - projectExplorer.waitItemIsSelected(PATH_TO_JSP_FILE); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - - // Check status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - loader.waitOnClosed(); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_ONE_FILE); - - // Edit AppController.java - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JAVA_FILE); - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - editor.waitActive(); - editor.setCursorToLine(15); - editor.typeTextIntoEditor("//Testing add to index"); - loader.waitOnClosed(); - - // Create new.css file - projectExplorer.waitAndSelectItem(PATH_TO_JSP_FILE); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.CSS_FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("new"); - askForValueDialog.clickOkBtn(); - - // Add all files to index - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.waitAddToIndexFileName("Add content of folder " + PROJECT_NAME + " to index?"); - git.confirmAddToIndexForm(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - - // Check status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_ALL_FILES); - - // Edit AppController.java - editor.selectTabByName(JAVA_TAB_FILE_NAME); - editor.waitActive(); - editor.setCursorToLine(18); - editor.typeTextIntoEditor("//Testing add to index"); - loader.waitOnClosed(); - - // Edit index.jsp - editor.selectTabByName("index.jsp"); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.PAGE_DOWN.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(""); - loader.waitOnClosed(); - - // Edit new.css - editor.selectTabByName("new.css"); - editor.waitActive(); - editor.typeTextIntoEditor("/* Testing add to index */"); - loader.waitOnClosed(); - - // Check status and add to index all files - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_EDIT); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - - // delete README file and add to index - deleteFromMenuFile(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_AFTER_DELETE_FILE); - } - - private void deleteFromMenuFile() { - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/README.md"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText("Delete file \"README.md\"?"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AmendCommitTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AmendCommitTest.java deleted file mode 100644 index 7605f556032..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AmendCommitTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestGitConstants.GIT_INITIALIZED_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.COMMIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.SHOW_HISTORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.STATUS; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class AmendCommitTest { - private static final String PROJECT_NAME = NameGenerator.generate("AmendCommit_", 4); - private static final String JAVA_FILE_TAB_NAME = "AppController"; - private static final String CHANGE_CONTENT = ""; - private static final String COMMIT_MESSAGE = "first commit"; - private static final String NOTHING_TO_COMMIT = - " On branch master\n" + " nothing to commit, working directory clean"; - private static final String AMEND_COMMIT_MESS = "changed commit"; - private static final String AMEND_CONTENT = "amend previous content"; - private static final String AMEND_COMMIT = "amend previous commit"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void checkAmendPreviousCommit() { - String pathToFileItem = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - - projectExplorer.quickRevealToItemWithJavaScript(pathToFileItem); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.waitItemIsSelected(PROJECT_NAME); - menu.runCommand(GIT, INITIALIZE_REPOSITORY); - askDialog.confirmAndWaitClosed(); - git.waitGitStatusBarWithMess(GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(GIT_INITIALIZED_SUCCESS); - projectExplorer.quickRevealToItemWithJavaScript(pathToFileItem); - loader.waitOnClosed(); - - // perform init commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // edit java file and commit the change - projectExplorer.openItemByPath(pathToFileItem); - editor.waitActive(); - editor.setCursorToLine(15); - editor.typeTextIntoEditor("//" + CHANGE_CONTENT); - editor.waitTextIntoEditor("//" + CHANGE_CONTENT); - menu.runCommand(GIT, COMMIT); - git.waitAndRunCommit(COMMIT_MESSAGE); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - - // need to repeat selection of the project (https://github.com/eclipse/che/issues/10520) - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess(NOTHING_TO_COMMIT); - - // view git history - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, SHOW_HISTORY); - loader.waitOnClosed(); - git.waitTextInHistoryForm(COMMIT_MESSAGE); - git.closeGitHistoryForm(); - - // only amend commit message - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMMIT); - git.waitAndRunAmendCommitMessage(AMEND_COMMIT_MESS); - menu.runCommand(GIT, SHOW_HISTORY); - git.waitHistoryFormToOpen(); - git.waitCommitInHistoryFormNotPresent(COMMIT_MESSAGE); - git.waitCommitInHistoryForm(AMEND_COMMIT_MESS); - git.closeGitHistoryForm(); - - // perform amend previous commit - editor.selectTabByName(JAVA_FILE_TAB_NAME); - editor.waitActive(); - editor.setCursorToLine(12); - editor.selectLineAndDelete(); - editor.typeTextIntoEditor("//" + AMEND_CONTENT); - editor.waitTextIntoEditor("//" + AMEND_CONTENT); - menu.runCommand(GIT, COMMIT); - git.waitAndRunAmendPreviousCommit(AMEND_COMMIT); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - - // need to repeat selection of the project (https://github.com/eclipse/che/issues/10520) - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess(NOTHING_TO_COMMIT); - - // view git history - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, SHOW_HISTORY); - loader.waitOnClosed(); - git.waitTextInHistoryForm(AMEND_COMMIT); - git.waitCommitInHistoryFormNotPresent(AMEND_COMMIT_MESS); - loader.waitOnClosed(); - git.clickOnHistoryRowInСommitsList(0); - git.waitContentInHistoryEditor(AMEND_COMMIT); - git.clickCompareBtnGitHistory(); - loader.waitOnClosed(); - checkChangesIntoCompareForm(AMEND_CONTENT); - } - - private void checkChangesIntoCompareForm(String expText) { - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor(expText); - git.waitTextNotPresentIntoCompareRightEditor(expText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromPreferencesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromPreferencesTest.java deleted file mode 100644 index 7b2cb62d0a9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/AuthorizeOnGithubFromPreferencesTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.GitHub; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.account.KeycloakFederatedIdentitiesPage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class AuthorizeOnGithubFromPreferencesTest { - private static final String GITHUB_COM = "github.com"; - private static final Logger LOG = - LoggerFactory.getLogger(AuthorizeOnGithubFromPreferencesTest.class); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject - @Named("che.multiuser") - private boolean isMultiuser; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CheTerminal terminal; - @Inject private Menu menu; - @Inject private ImportProjectFromLocation importProject; - @Inject private Preferences preferences; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private AskDialog askDialog; - @Inject private GitHub gitHub; - @Inject private TestGitHubServiceClient gitHubClientService; - @Inject private Loader loader; - @Inject private Events events; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private Dashboard dashboard; - @Inject private KeycloakFederatedIdentitiesPage keycloakFederatedIdentitiesPage; - - @BeforeClass(groups = TestGroup.MULTIUSER) - @AfterClass(groups = TestGroup.MULTIUSER) - private void removeGitHubIdentity() { - dashboard.open(); // to login - keycloakFederatedIdentitiesPage.open(); - keycloakFederatedIdentitiesPage.ensureGithubIdentityIsAbsent(); - assertEquals(keycloakFederatedIdentitiesPage.getGitHubIdentityFieldValue(), ""); - } - - @BeforeClass - private void revokeGithubOauthToken() { - try { - gitHubClientService.deleteAllGrants(gitHubUsername, gitHubPassword); - } catch (Exception e) { - LOG.warn("There was an error of revoking the github oauth token.", e); - } - } - - @BeforeClass - private void deletePrivateSshKey() throws Exception { - ide.open(ws); - projectExplorer.waitProjectExplorer(); - terminal.waitFirstTerminalTab(); - - // open Preferences Vcs Form - openPreferencesVcsForm(); - if (preferences.isSshKeyIsPresent(GITHUB_COM)) { - preferences.deleteSshKeyByHost(GITHUB_COM); - } - - preferences.close(); - } - - @Test - public void checkAuthorizationOnGithubWhenUploadSshKey() throws Exception { - String ideWin = seleniumWebDriver.getWindowHandle(); - - // generate and upload github ssh key - ide.open(ws); - openPreferencesVcsForm(); - preferences.clickOnGenerateAndUploadToGitHub(); - - // login to github - askDialog.waitFormToOpen(25); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - seleniumWebDriverHelper.switchToNextWindow(ideWin); - - gitHub.waitAuthorizationPageOpened(); - gitHub.typeLogin(gitHubUsername); - gitHub.typePass(gitHubPassword); - gitHub.clickOnSignInButton(); - - // authorize on github.com - gitHub.waitAuthorizeBtn(); - gitHub.clickOnAuthorizeBtn(); - seleniumWebDriver.switchTo().window(ideWin); - loader.waitOnClosed(); - preferences.waitSshKeyIsPresent(GITHUB_COM); - - // check that repeat of upload of ssh-key doesn't require authorization - preferences.deleteSshKeyByHost(GITHUB_COM); - preferences.clickOnGenerateAndUploadToGitHub(); - loader.waitOnClosed(); - preferences.waitSshKeyIsPresent(GITHUB_COM); - - // check GitHub identity is present in Keycloak account management page - if (isMultiuser) { - keycloakFederatedIdentitiesPage.open(); - - // set to lower case because it's a normal behaviour (issue: - // https://github.com/eclipse/che/issues/10138) - assertEquals( - keycloakFederatedIdentitiesPage.getGitHubIdentityFieldValue(), - gitHubUsername.toLowerCase()); - } - } - - private void openPreferencesVcsForm() { - menu.runCommand( - TestMenuCommandsConstants.Profile.PROFILE_MENU, - TestMenuCommandsConstants.Profile.PREFERENCES); - preferences.waitPreferencesForm(); - preferences.waitMenuInCollapsedDropdown(Preferences.DropDownSshKeysMenu.VCS); - preferences.selectDroppedMenuByName(Preferences.DropDownSshKeysMenu.VCS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/BranchTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/BranchTest.java deleted file mode 100644 index e45aa0b1eb6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/BranchTest.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class BranchTest { - private static final String PROJECT_NAME = NameGenerator.generate("Branch_", 4); - private static final String APP_JAVA_TAB_NAME = "AppController"; - private static final String HELLO_JAVA_TAB_NAME = "Hello"; - private static final String JSP_TAB_NAME = "index.jsp"; - private static final String APP_JAVA_PATH = - "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String HELLO_JAVA_PATH = "/src/main/java/org/eclipse/qa/examples/Hello.java"; - private static final String JSP_FILE_PATH = "/src/main/webapp/index.jsp"; - private static final String SCRIPT_FILE_PATH = "/src/main/webapp/script.js"; - private final String MASTER_BRANCH = "master"; - private final String TEST_BRANCH = "newbranch"; - private static final String CHANGE_CONTENT_1 = ""; - private static final String CHANGE_CONTENT_2 = ""; - - private static final String STATUS_MESSAGE_BEFORE_ADD = - " On branch newbranch\n" - + " Changes not staged for commit:\n" - + " new file: src/main/webapp/script.js\n" - + " new file: src/main/java/org/eclipse/qa/examples/Hello.java\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java"; - - private static final String STATUS_MESSAGE_AFTER_ADD = - " On branch newbranch\n" - + " Changes to be committed:\n" - + " new file: src/main/webapp/script.js\n" - + " new file: src/main/java/org/eclipse/qa/examples/Hello.java\n" - + " modified: src/main/webapp/index.jsp\n" - + " modified: src/main/java/org/eclipse/qa/examples/AppController.java"; - - private static final String STATUS_MESSAGE_AFTER_COMMIT = - " On branch newbranch\n" + " nothing to commit, working directory clean"; - - private static final String STATUS_MASTER_BRANCH = - " On branch master\n" + " nothing to commit, working directory clean"; - - private static final String CONFLICT_MESSAGE = - " Checkout conflict with files: \n" - + "src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "src/main/webapp/index.jsp"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser user; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/checkoutSpringSimple"); - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, user.getEmail()); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - } - - @Test - public void checkoutBranchTest() { - // perform init commit - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - loader.waitOnClosed(); - askDialog.confirmAndWaitClosed(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - loader.waitOnClosed(); - git.waitAndRunCommit("init"); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - createBranch(); - switchOnTestBranch(); - - // create change in AppController.java - projectExplorer.openItemByPath(PROJECT_NAME + APP_JAVA_PATH); - editor.setCursorToLine(15); - editor.typeTextIntoEditor("//some change"); - editor.waitTextIntoEditor("//some change"); - loader.waitOnClosed(); - - // Create change in index.jsp - projectExplorer.openItemByPath(PROJECT_NAME + JSP_FILE_PATH); - editor.waitActive(); - editor.typeTextIntoEditor(CHANGE_CONTENT_1); - editor.waitTextIntoEditor(CHANGE_CONTENT_1); - loader.waitOnClosed(); - - // Create Hello.java class - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName("Hello"); - askForValueDialog.clickOkBtnNewJavaClass(); - askForValueDialog.waitNewJavaClassClose(); - projectExplorer.openItemByPath(PROJECT_NAME + HELLO_JAVA_PATH); - loader.waitOnClosed(); - - // Create script.js file - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/webapp"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("script"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - - // Check status - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - loader.waitOnClosed(); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_BEFORE_ADD); - - // add all files to index and check status - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.confirmAddToIndexForm(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_ADD); - - // commit to repository and check status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("first commit"); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_COMMIT); - - // checkout in main branch and check changed files - switchOnMasterBranch(); - loader.waitOnClosed(); - editor.selectTabByName(APP_JAVA_TAB_NAME); - editor.waitTextNotPresentIntoEditor("//some change"); - editor.selectTabByName(JSP_TAB_NAME); - editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_1); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MASTER_BRANCH); - loader.waitOnClosed(); - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + HELLO_JAVA_PATH); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + SCRIPT_FILE_PATH); - - // switch to test branch again and check earlier changes - switchOnTestBranch(); - editor.selectTabByName(APP_JAVA_TAB_NAME); - loader.waitOnClosed(); - editor.waitTextIntoEditor("//some change"); - editor.selectTabByName(JSP_TAB_NAME); - editor.waitTextIntoEditor(CHANGE_CONTENT_1); - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + HELLO_JAVA_PATH); - loader.waitOnClosed(); - projectExplorer.openItemByPath(PROJECT_NAME + HELLO_JAVA_PATH); - projectExplorer.openItemByPath(PROJECT_NAME + SCRIPT_FILE_PATH); - loader.waitOnClosed(); - editor.closeFileByNameWithSaving("script.js"); - - // Checkout in main branch, change files in master branch (this creates conflict) and check - // message with conflict - switchOnMasterBranch(); - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - - // create change in GreetingController.java - editor.selectTabByName(APP_JAVA_TAB_NAME); - editor.setCursorToLine(21); - editor.typeTextIntoEditor("//change in master branch"); - editor.waitTextIntoEditor("//change in master branch"); - editor.waitTabFileWithSavedStatus(APP_JAVA_TAB_NAME); - loader.waitOnClosed(); - - // create change in index.jsp - editor.selectTabByName(JSP_TAB_NAME); - editor.waitTextNotPresentIntoEditor(CHANGE_CONTENT_2); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.PAGE_UP.toString()); - editor.typeTextIntoEditor(CHANGE_CONTENT_2); - editor.waitTextIntoEditor(CHANGE_CONTENT_2); - editor.waitTabFileWithSavedStatus("index.jsp"); - loader.waitOnClosed(); - - // Add all files to index and check status - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - checkShwithConflict(); - } - - @Test(priority = 1) - public void filterBranchesTest() { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - String defaultFilter = "Type from keyboard to filter branches"; - git.waitBranchSearchFilerWithText(defaultFilter); - git.typeToBranchSearchFilter("newbranch"); - git.waitBranchSearchFilerWithText("newbranch"); - git.waitBranchInTheList("newbranch"); - git.waitDisappearBranchName("master"); - git.typeToBranchSearchFilter(Keys.ESCAPE.toString()); - git.waitBranchSearchFilerWithText(defaultFilter); - git.waitBranchInTheList("master"); - git.waitBranchInTheList("newbranch"); - } - - private void createBranch() { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitDisappearBranchName(TEST_BRANCH); - git.waitEnabledAndClickCreateBtn(); - git.typeAndWaitNewBranchName(TEST_BRANCH); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.closeBranchesForm(); - } - - private void switchOnTestBranch() { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.selectBranchAndClickCheckoutBtn(TEST_BRANCH); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheListWithCoState(TEST_BRANCH); - git.closeBranchesForm(); - loader.waitOnClosed(); - } - - private void checkShwithConflict() { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - loader.waitOnClosed(); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.selectBranchAndClickCheckoutBtn(TEST_BRANCH); - git.closeBranchesForm(); - git.waitGitStatusBarWithMess(CONFLICT_MESSAGE); - } - - private void switchOnMasterBranch() { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - loader.waitOnClosed(); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.selectBranchAndClickCheckoutBtn(MASTER_BRANCH); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheListWithCoState(MASTER_BRANCH); - git.closeBranchesForm(); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutReferenceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutReferenceTest.java deleted file mode 100644 index bcc1c00768c..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutReferenceTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.*; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.*; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.git.GitHistory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class CheckoutReferenceTest { - private static final String PROJECT_NAME = NameGenerator.generate("CheckoutReference_", 4); - private static final String DEFAULT_BRANCH = "develop"; - private static final String JS_FILE = "app.js"; - private static final String CHANGE_FILE = "// change"; - private static final String CHANGE_FILE_1 = "// change content to version_1"; - private static final String CHANGE_FILE_2 = "// change content to version_2"; - private static final String UPDATE_FILE = "// update"; - private static final String TAG_NAME_1 = "version_1"; - private static final String TAG_NAME_2 = "version_2"; - private static final String COMMIT_MESSAGE = "Change file app.js"; - private static final String COMMIT_MESSAGE_TAG_1 = "Change the app.js file, tag version_1"; - private static final String COMMIT_MESSAGE_TAG_2 = "Change the app.js file, tag version_2"; - private static final String MESSAGE_TAG_WRONG = "Ref version1 can not be resolved"; - private static final String BRANCH_DETACHED_TAG_1 = "(detached from version_1)"; - private static final String BRANCH_DETACHED_TAG_2 = "(detached from version_2)"; - - private String sha1; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject(optional = true) - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private CodenvyEditor editor; - @Inject private GitHistory gitHistory; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = Paths.get(getClass().getResource("/projects/git-pull-test").getPath()); - testRepo.addContent(entryPath); - - testRepo.createBranch(DEFAULT_BRANCH); - testRepo.setDefaultBranch(DEFAULT_BRANCH); - - // create tags in the test repo - testRepo.changeFileContent(JS_FILE, CHANGE_FILE, COMMIT_MESSAGE); - - sha1 = testRepo.getSha1(DEFAULT_BRANCH); - - testRepo.changeFileContent(JS_FILE, CHANGE_FILE_1, COMMIT_MESSAGE_TAG_1); - testRepo.createTag(TAG_NAME_1); - - testRepo.changeFileContent(JS_FILE, CHANGE_FILE_2, COMMIT_MESSAGE_TAG_2); - testRepo.createTag(TAG_NAME_2); - - testRepo.changeFileContent(JS_FILE, UPDATE_FILE, "Update the app.js file"); - - ide.open(ws); - } - - @Test(priority = 1) - public void checkoutReferenceByHashCommit() { - // preconditions - String branchDetachedMess = String.format("(detached from %s)", sha1); - String hashCommit = sha1.substring(0, 8); - String wrongHashCommit = String.format("%s ##", hashCommit); - String failMessage = String.format("Branch name %s is not allowed", wrongHashCommit); - - // import the test repo - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, BLANK); - - // open test file - projectExplorer.expandPathInProjectExplorerAndOpenFile(PROJECT_NAME, JS_FILE); - editor.waitActive(); - editor.waitTextIntoEditor(UPDATE_FILE); - - // check current reference - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess("On branch " + DEFAULT_BRANCH); - projectExplorer.waitReferenceName(DEFAULT_BRANCH); - - // check the name of the default branch - openBranchPanelAndWaitRefHeadName(DEFAULT_BRANCH); - - // check the 'Cancel' button of the 'Checkout Reference' form - menu.runCommand(GIT, CHECKOUT_REFERENCE); - git.waitReferenceFormIsOpened(); - git.clickCheckoutReferenceCancelButton(); - - // perform checkout reference to wrong hash commit - performCheckoutReference(wrongHashCommit); - git.waitGitStatusBarWithMess(failMessage); - - // perform git checkout by not fully hash of specific commit - performCheckoutReference(hashCommit); - editor.selectTabByName(JS_FILE); - editor.waitTextIntoEditor(CHANGE_FILE); - editor.waitTextNotPresentIntoEditor(UPDATE_FILE); - - // check current reference - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess("HEAD detached at " + hashCommit); - projectExplorer.waitReferenceName(sha1); - - // switch to default branch - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheListWithCoState(branchDetachedMess); - git.selectBranchAndClickCheckoutBtn(DEFAULT_BRANCH); - openBranchPanelAndWaitRefHeadName(DEFAULT_BRANCH); - editor.selectTabByName(JS_FILE); - editor.waitTextIntoEditor(UPDATE_FILE); - - // perform git checkout by hash of specific commit - performCheckoutReference(sha1); - openBranchPanelAndWaitRefHeadName(branchDetachedMess); - - // check the git history - openGitHistoryForm(); - assertTrue(gitHistory.getTopCommitRevision().contains(hashCommit)); - git.clickOnHistoryRowInСommitsList(0); - git.waitContentInHistoryEditor(COMMIT_MESSAGE); - git.closeGitHistoryForm(); - } - - @Test(priority = 2) - public void checkoutReferenceByTagName() { - // git checkout to wrong tag name - performCheckoutReference("version1"); - git.waitGitStatusBarWithMess(MESSAGE_TAG_WRONG); - - // git checkout to tag 'version_1' - performCheckoutReference(TAG_NAME_1); - openBranchPanelAndWaitRefHeadName(BRANCH_DETACHED_TAG_1); - editor.selectTabByName(JS_FILE); - editor.waitTextIntoEditor(CHANGE_FILE_1); - - // check current reference - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess("HEAD detached at " + TAG_NAME_1); - projectExplorer.waitReferenceName(TAG_NAME_1); - - // check the git history - openGitHistoryForm(); - git.clickOnHistoryRowInСommitsList(0); - git.waitContentInHistoryEditor(COMMIT_MESSAGE_TAG_1); - git.closeGitHistoryForm(); - - // switch to default branch - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheListWithCoState(BRANCH_DETACHED_TAG_1); - git.selectBranchAndClickCheckoutBtn(DEFAULT_BRANCH); - - openBranchPanelAndWaitRefHeadName(DEFAULT_BRANCH); - - // switch to another tag - performCheckoutReference(TAG_NAME_2); - openBranchPanelAndWaitRefHeadName(BRANCH_DETACHED_TAG_2); - editor.selectTabByName(JS_FILE); - editor.waitTextIntoEditor(CHANGE_FILE_2); - } - - private void openGitHistoryForm() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, SHOW_HISTORY); - git.waitHistoryFormToOpen(); - } - - private void performCheckoutReference(String refName) { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, CHECKOUT_REFERENCE); - git.typeReferenceAndConfirm(refName); - } - - private void openBranchPanelAndWaitRefHeadName(String refHeadName) { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheListWithCoState(refHeadName); - git.closeBranchesForm(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchTest.java deleted file mode 100644 index f1818f839fb..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchTest.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.BRANCHES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.COMMIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.PULL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.PUSH; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.REMOTES_TOP; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.SHOW_HISTORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.STATUS; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestGitHubKeyUploader; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class CheckoutToRemoteBranchTest { - private static final String PROJECT_NAME = NameGenerator.generate("CheckoutToRemoteBranch-", 4); - private static final String PROJECT_NAME2 = NameGenerator.generate("CheckoutToRemoteBranch2-", 4); - - private static final String MASTER_BRANCH = "master"; - private static final String ORIGIN_MASTER_BRANCH = "origin/master"; - private static final String ORIGIN_SECOND_BRANCH = "origin/second_branch"; - private static final String SECOND_BRANCH = "second_branch"; - private static final String NAME_REMOTE_REPO = "origin"; - private static final String PULL_MSG = "Already up-to-date"; - private static final String MASTER_CHECKED_POPUP_MSG = "Branch 'master' is checked out"; - private static final String SECOND_BRANCH_CHECKED_POPUP_MSG = - "Branch 'second_branch' is checked out"; - private static String COMMIT_MESS = "commitchk_remote"; - private static final String GIT_STATUS_MESS = - " On branch second_branch\n" + " nothing to commit, working directory clean"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private Git git; - @Inject private Menu menu; - @Inject private Events events; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestGitHubKeyUploader testGitHubKeyUploader; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - testGitHubKeyUploader.updateGithubKey(); - - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - - // create another branch in the test repo - testRepo.createBranch(SECOND_BRANCH); - } - - @Test - public void checkoutToRemoteBranch() throws Exception { - // preconditions and import the test repo - String pathJavaFile = "/src/main/java/che/eclipse/sample/Aclass.java"; - String pathJspFile = "/src/main/webapp/index.jsp"; - String changeContent = - String.format("// change_content-%s", String.valueOf(System.currentTimeMillis())); - - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getSshUrl(), PROJECT_NAME, MAVEN); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - events.clickEventLogBtn(); - events.waitExpectedMessage(MASTER_CHECKED_POPUP_MSG); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // git checkout to the 'second_branch' - checkoutToSecondRemoteBranch(); - - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess(GIT_STATUS_MESS); - - performGitPull(); - - // change content of the files, commit and push - testProjectServiceClient.updateFile(ws.getId(), PROJECT_NAME + pathJavaFile, changeContent); - testProjectServiceClient.updateFile(ws.getId(), PROJECT_NAME + pathJspFile, changeContent); - - commitFiles(); - - performGitPush(); - - // import from github the second project - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME2, MAVEN); - projectExplorer.waitAndSelectItem(PROJECT_NAME2); - - checkoutToSecondRemoteBranch(); - - // check the changes are present in the files - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/java/che/eclipse/sample/Aclass.java"); - editor.waitTextIntoEditor(changeContent); - projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/webapp/index.jsp"); - editor.waitTextIntoEditor(changeContent); - - // Call and checking show history - projectExplorer.waitAndSelectItem(PROJECT_NAME2 + "/src"); - menu.runCommand(GIT, SHOW_HISTORY); - git.waitHistoryFormToOpen(); - git.waitCommitInHistoryForm(COMMIT_MESS); - } - - private void checkoutToSecondRemoteBranch() { - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(ORIGIN_MASTER_BRANCH); - git.waitBranchInTheList(ORIGIN_SECOND_BRANCH); - git.selectBranchAndClickCheckoutBtn(ORIGIN_SECOND_BRANCH); - git.waitGitCompareBranchFormIsClosed(); - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose( - SECOND_BRANCH_CHECKED_POPUP_MSG); - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheListWithCoState(SECOND_BRANCH); - git.closeBranchesForm(); - } - - private void performGitPull() { - menu.runCommand(GIT, REMOTES_TOP, PULL); - git.waitPullFormToOpen(); - git.waitPullRemoteRepository(NAME_REMOTE_REPO); - git.waitPullRemoteBranchName(SECOND_BRANCH); - git.waitPullLocalBranchName(SECOND_BRANCH); - git.clickPull(); - git.waitPullFormToClose(); - git.waitGitStatusBarWithMess(PULL_MSG); - } - - private void commitFiles() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMMIT); - - git.waitAndRunCommit(COMMIT_MESS); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - } - - private void performGitPush() { - menu.runCommand(GIT, REMOTES_TOP, PUSH); - git.waitPushFormToOpen(); - git.selectPushRemoteBranchName(SECOND_BRANCH); - git.clickPush(); - git.waitPushFormToClose(); - git.waitGitStatusBarWithMess("Successfully pushed to " + testRepo.getSshUrl()); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchWhichAlreadyHasLinkedLocalBranchTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchWhichAlreadyHasLinkedLocalBranchTest.java deleted file mode 100644 index 87ae558725e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CheckoutToRemoteBranchWhichAlreadyHasLinkedLocalBranchTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.BRANCHES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; - -import com.google.inject.Inject; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class CheckoutToRemoteBranchWhichAlreadyHasLinkedLocalBranchTest { - - private static final String PROJECT_NAME = "testRepo"; - private static final String LOCAL_BRANCH = "master"; - private static final String REMOTE_BRANCH = "origin/master"; - private static final String GIT_MESSAGE = "Ref master already exists"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private TestGitHubRepository testRepo; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private Events eventsPanel; - - @BeforeClass - public void prepare() throws Exception { - Path entryPath = Paths.get(getClass().getResource("/projects/git-pull-test").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - } - - @Test - public void checkoutRemoteBranchToExistingLocalBranchTest() throws Exception { - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, BLANK); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Open branches form - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheList(LOCAL_BRANCH); - git.waitBranchInTheList(REMOTE_BRANCH); - git.waitBranchInTheListWithCoState(LOCAL_BRANCH); - - // Checkout to the master remote branch. - git.selectBranchAndClickCheckoutBtn(REMOTE_BRANCH); - git.closeBranchesForm(); - git.waitGitStatusBarWithMess(GIT_MESSAGE); - - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(GIT_MESSAGE); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesByMultiSelectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesByMultiSelectTest.java deleted file mode 100644 index 8739d25bddd..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesByMultiSelectTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author aleksandr shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class CommitFilesByMultiSelectTest { - private static final String PROJECT_NAME = NameGenerator.generate("CommitByMultiSelect_", 4); - private static final String PATH_FOR_EXPAND_FIRST_MODULE = - PROJECT_NAME + "/my-lib/src/test/java/hello/SayHelloTest.java"; - private static final String PATH_FOR_EXPAND_SECOND_MODULE = - PROJECT_NAME + "/my-webapp/src/main/java/helloworld/AppController.java"; - private static final String CHANGE_CONTENT = "***change content***"; - private static final String COMMIT_MESSAGE_1 = "first commit"; - private static final String COMMIT_MESSAGE_2 = "second commit"; - private static final String STATUS_MESSAGE_BEFORE_COMMIT = - " On branch master\n" - + " Changes not staged for commit:\n" - + " modified: my-lib/src/test/java/hello/file.html\n" - + " modified: my-lib/src/test/java/hello/file.css\n" - + " modified: my-webapp/src/main/java/helloworld/AppController.java\n" - + " modified: my-lib/src/test/java/hello/SayHelloTest.java"; - private static final String STATUS_MESSAGE_AFTER_COMMIT = - " On branch master\n" - + " Changes not staged for commit:\n" - + " modified: my-lib/src/test/java/hello/file.html\n" - + " modified: my-lib/src/test/java/hello/file.css"; - private static final String STATUS_MESS_AFTER_ADD_TO_INDEX = - " On branch master\n" - + " Changes to be committed:\n" - + " modified: my-lib/src/test/java/hello/file.html\n" - + " modified: my-lib/src/test/java/hello/file.css\n" - + " Changes not staged for commit:\n" - + " modified: my-webapp/src/file.xml\n" - + " modified: my-webapp/src/file.js"; - private static final String CHANGE_TO_COMMIT_MESSAGE = - " On branch master\n" + " nothing to commit, working directory clean"; - private static final String TEXT_GROUP_1 = - "my-lib/src/test/java/hello\n" - + "SayHelloTest.java\n" - + "my-webapp/src/main/java/helloworld\n" - + "AppController.java"; - private static final String TEXT_GROUP_2 = - "my-lib/src/test/java/hello\n" - + "file.css\n" - + "file.html\n" - + "my-webapp/src\n" - + "file.js\n" - + "file.xml"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - URL resource = getClass().getResource("/projects/java-project-for-multiselect"); - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_JAVA_MULTIMODULE); - ide.open(ws); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void commitFilesByMultiSelect() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.confirmAndWaitClosed(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS); - loader.waitOnClosed(); - - // Check the 'Cancel' button - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitCommitMainFormIsOpened(); - git.clickOnCancelBtnCommitForm(); - - // perform init commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // Edit SayHelloTest.java - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND_FIRST_MODULE); - projectExplorer.openItemByPath(PATH_FOR_EXPAND_FIRST_MODULE); - editor.waitActive(); - editor.setCursorToLine(16); - editor.typeTextIntoEditor("//" + CHANGE_CONTENT); - editor.waitTextIntoEditor("//" + CHANGE_CONTENT); - - // Edit AppController.java - git.closeGitInfoPanel(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND_SECOND_MODULE); - projectExplorer.openItemByPath(PATH_FOR_EXPAND_SECOND_MODULE); - editor.waitActive(); - editor.setCursorToLine(16); - editor.typeTextIntoEditor("//" + CHANGE_CONTENT); - editor.waitTextIntoEditor("//" + CHANGE_CONTENT); - - // Edit several files in the first module - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/my-lib/src/test/java/hello/file.css"); - projectExplorer.openItemByPath(PROJECT_NAME + "/my-lib/src/test/java/hello/file.css"); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.PAGE_UP.toString()); - editor.typeTextIntoEditor(CHANGE_CONTENT); - editor.waitTextIntoEditor(CHANGE_CONTENT); - projectExplorer.openItemByPath(PROJECT_NAME + "/my-lib/src/test/java/hello/file.html"); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.PAGE_UP.toString()); - editor.typeTextIntoEditor(""); - editor.waitTextIntoEditor(""); - - // Check git status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_BEFORE_COMMIT); - - // Perform the commit selected files - projectExplorer.waitAndSelectItem(PATH_FOR_EXPAND_FIRST_MODULE); - projectExplorer.waitItemIsSelected(PATH_FOR_EXPAND_FIRST_MODULE); - git.closeGitInfoPanel(); - selectItemByCtrlKeys(PATH_FOR_EXPAND_SECOND_MODULE); - projectExplorer.waitItemIsSelected(PATH_FOR_EXPAND_SECOND_MODULE); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit(COMMIT_MESSAGE_1); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESSAGE_AFTER_COMMIT); - git.closeGitInfoPanel(); - - // Check the git history - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - git.waitHistoryFormToOpen(); - git.waitCommitInHistoryForm(COMMIT_MESSAGE_1); - git.clickOnHistoryRowInСommitsList(0); - loader.waitOnClosed(); - git.waitContentInHistoryEditor(COMMIT_MESSAGE_1); - - // check changes in git compare form - git.clickCompareBtnGitHistory(); - checkChangesIntoCompareForm(CHANGE_CONTENT); - git.closeGitCompareForm(); - git.waitHistoryFormToOpen(); - git.closeGitHistoryForm(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - git.waitHistoryFormToOpen(); - git.clickOnHistoryRowInСommitsList(0); - loader.waitOnClosed(); - git.clickCompareBtnGitHistory(); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP_1); - git.selectFileInChangedFilesTreePanel("AppController.java"); - git.clickOnGroupCompareButton(); - checkChangesIntoCompareForm(CHANGE_CONTENT); - git.closeGitCompareForm(); - git.closeGroupGitCompareForm(); - git.closeGitHistoryForm(); - - // Add the 'file.css' and 'file.html' to index - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - loader.waitOnClosed(); - git.closeGitInfoPanel(); - - // Edit several files in the second module - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/my-webapp/src/file.xml"); - editor.waitActive(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.PAGE_UP.toString()); - editor.typeTextIntoEditor(""); - editor.waitTextIntoEditor(""); - projectExplorer.openItemByPath(PROJECT_NAME + "/my-webapp/src/file.js"); - editor.waitActive(); - editor.typeTextIntoEditor(CHANGE_CONTENT); - editor.waitTextIntoEditor(CHANGE_CONTENT); - - // Check git status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(STATUS_MESS_AFTER_ADD_TO_INDEX); - loader.waitOnClosed(); - git.closeGitInfoPanel(); - - // Perform the commit and add selected files - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/my-webapp/src/file.xml"); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/my-webapp/src/file.xml"); - selectItemByCtrlKeys(PROJECT_NAME + "/my-webapp/src/file.js"); - selectItemByCtrlKeys(PROJECT_NAME + "/my-lib/src/test/java/hello/file.css"); - selectItemByCtrlKeys(PROJECT_NAME + "/my-lib/src/test/java/hello/file.html"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit(COMMIT_MESSAGE_2); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(CHANGE_TO_COMMIT_MESSAGE); - git.closeGitInfoPanel(); - - // Check the git history - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - git.waitHistoryFormToOpen(); - git.waitCommitInHistoryForm(COMMIT_MESSAGE_2); - git.clickOnHistoryRowInСommitsList(0); - loader.waitOnClosed(); - git.waitContentInHistoryEditor(COMMIT_MESSAGE_2); - - // check changes in git compare form - git.clickCompareBtnGitHistory(); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP_2); - git.selectFileInChangedFilesTreePanel("file.css"); - git.clickOnGroupCompareButton(); - checkChangesIntoCompareForm(CHANGE_CONTENT); - git.closeGitCompareForm(); - git.waitGroupGitCompareIsOpen(); - git.selectFileInChangedFilesTreePanel("file.js"); - git.clickOnGroupCompareButton(); - checkChangesIntoCompareForm(CHANGE_CONTENT); - } - - private void checkChangesIntoCompareForm(String expText) { - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor(expText); - git.waitTextNotPresentIntoCompareRightEditor(expText); - } - - private void selectItemByCtrlKeys(String pathToItem) { - projectExplorer.selectMultiFilesByCtrlKeys(pathToItem); - projectExplorer.waitItemIsSelected(pathToItem); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesTest.java deleted file mode 100644 index f68e4e51015..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CommitFilesTest.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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.Keys; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author aleksandr shmaraev - * @author igor vinokur - */ -@Test(groups = TestGroup.GITHUB) -public class CommitFilesTest { - private static final String PROJECT_NAME = CommitFilesTest.class.getSimpleName(); - private static final String NEW_NAME_PACKAGE = "org.eclipse.dev.examples"; - private static final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/dev/examples/AppController.java"; - private static final String PATH_TO_JSP_FILE = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String MESSAGE_FOR_CHANGE_CONTENT = ""; - private static final String COMMIT_MESSAGE = "first commit"; - private static final String NOTHING_TO_COMMIT_MESSAGE = - " On branch master\n" + " nothing to commit, working directory clean"; - private static final String TEXT_GROUP = - "src/main\n" - + "java/org/eclipse/dev/examples\n" - + "AppController.java\n" - + "Hello.java\n" - + "webapp\n" - + "index.jsp\n" - + "script.js"; - private static final String EXP_TEXT = "public class Hello"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - URL resource = getClass().getResource("/projects/checkoutSpringSimple"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @AfterMethod - public void closeForm() { - if (git.isCommitWidgetOpened()) { - git.clickOnCancelBtnCommitForm(); - } - } - - @Test - public void testCheckBoxSelections() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - - // unselect folder and check that all child nodes are also unselected - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.clickItemCheckBoxInCommitWindow("webapp"); - git.waitItemCheckBoxToBeIndeterminateInCommitWindow("src/main"); - git.waitItemCheckBoxToBeUnSelectedInCommitWindow( - "webapp", "WEB-INF", "jsp", "guess_num.jsp", "web.xml", "spring-servlet.xml", "index.jsp"); - - // select folder and check that all child nodes are also selected - git.clickItemCheckBoxInCommitWindow("webapp"); - git.waitItemCheckBoxToBeSelectedInCommitWindow( - "src/main", - "webapp", - "WEB-INF", - "jsp", - "guess_num.jsp", - "web.xml", - "spring-servlet.xml", - "index.jsp"); - - // unselect folder, select nested file, check that all parent folders of the file are also - // selected - git.clickItemCheckBoxInCommitWindow("webapp"); - git.clickItemCheckBoxInCommitWindow("guess_num.jsp"); - git.waitItemCheckBoxToBeIndeterminateInCommitWindow("src/main", "webapp", "WEB-INF"); - git.waitItemCheckBoxToBeSelectedInCommitWindow("jsp", "guess_num.jsp"); - git.waitItemCheckBoxToBeUnSelectedInCommitWindow("web.xml", "spring-servlet.xml", "index.jsp"); - - // unselect nested file, check that all parent folders of the file are also unselected - git.clickItemCheckBoxInCommitWindow("guess_num.jsp"); - git.waitItemCheckBoxToBeUnSelectedInCommitWindow( - "webapp", "WEB-INF", "jsp", "guess_num.jsp", "web.xml", "spring-servlet.xml", "index.jsp"); - - // select parent folder, unselect nested file, check that all nodes are selected except - // unselected file and his folder - git.clickItemCheckBoxInCommitWindow("webapp"); - git.clickItemCheckBoxInCommitWindow("guess_num.jsp"); - git.waitItemCheckBoxToBeIndeterminateInCommitWindow("webapp", "WEB-INF"); - git.waitItemCheckBoxToBeUnSelectedInCommitWindow("jsp", "guess_num.jsp"); - git.waitItemCheckBoxToBeSelectedInCommitWindow("web.xml", "spring-servlet.xml", "index.jsp"); - - git.clickOnCancelBtnCommitForm(); - git.waitCommitFormClosed(); - } - - @Test(priority = 1) - public void testFoldersStructureAfterRename() { - projectExplorer.expandPathInProjectExplorer(PROJECT_NAME + "/src/main/java/"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - refactor.waitRenamePackageFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.typeAndWaitNewName(NEW_NAME_PACKAGE); - refactor.clickOkButtonRefactorForm(); - - seleniumWebDriverHelper.performAndVerify( - aVoid -> { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitCommitMainFormIsOpened(); - return null; - }, - aVoid -> { - projectExplorer.waitItemIsSelected(PROJECT_NAME); - return null; - }, - aVoid -> { - git.clickOnCancelBtnCommitForm(); - git.waitCommitFormClosed(); - return null; - }); - - git.waitItemCheckBoxToBeSelectedInCommitWindow( - "src/main", - "java/org/eclipse/dev/examples", - "AppController.java", - "webapp", - "WEB-INF", - "jsp", - "guess_num.jsp", - "web.xml", - "spring-servlet.xml", - "index.jsp", - "pom.xml"); - - git.clickOnCancelBtnCommitForm(); - git.waitCommitFormClosed(); - } - - @Test(priority = 2) - public void commitFilesTest() { - // perform init commit without one folder - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.clickItemCheckBoxInCommitWindow("java/org/eclipse/dev/examples"); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // check git status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess( - "new file: src/main/java/org/eclipse/dev/examples/AppController.java"); - git.closeGitInfoPanel(); - loader.waitOnClosed(); - - // perform commit of the folder - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // check git status - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(NOTHING_TO_COMMIT_MESSAGE); - git.closeGitInfoPanel(); - loader.waitOnClosed(); - - // change content in AppController.java - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/org/eclipse/dev/examples"); - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - editor.waitActive(); - editor.setCursorToLine(12); - editor.typeTextIntoEditor("//" + MESSAGE_FOR_CHANGE_CONTENT); - editor.waitTextIntoEditor("//" + MESSAGE_FOR_CHANGE_CONTENT); - editor.waitTabFileWithSavedStatus("AppController"); - editor.closeFileByNameWithSaving("AppController"); - editor.waitWhileFileIsClosed("AppController"); - - // change content in index.jsp - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_JSP_FILE); - editor.waitActive(); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.PAGE_UP.toString()); - editor.typeTextIntoEditor(MESSAGE_FOR_CHANGE_CONTENT); - editor.waitTextIntoEditor(MESSAGE_FOR_CHANGE_CONTENT); - editor.waitTabFileWithSavedStatus("index.jsp"); - loader.waitOnClosed(); - editor.closeFileByNameWithSaving("index.jsp"); - editor.waitWhileFileIsClosed("index.jsp"); - - // Create Hello.java class - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/dev/examples"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName("Hello"); - askForValueDialog.clickOkBtnNewJavaClass(); - askForValueDialog.waitNewJavaClassClose(); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName("Hello.java"); - editor.waitTabIsPresent("Hello"); - loader.waitOnClosed(); - editor.closeFileByNameWithSaving("Hello"); - editor.waitWhileFileIsClosed("Hello"); - - // Create script.js file - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/webapp"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("script"); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - askForValueDialog.waitFormToClose(); - - // Commit to repository and check status - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit(COMMIT_MESSAGE); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess(NOTHING_TO_COMMIT_MESSAGE); - - // View git history - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - loader.waitOnClosed(); - git.waitTextInHistoryForm(COMMIT_MESSAGE); - loader.waitOnClosed(); - git.clickOnHistoryRowInСommitsList(0); - git.waitContentInHistoryEditor(COMMIT_MESSAGE); - - // Check diff in the git compare - git.clickCompareBtnGitHistory(); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP); - git.selectFileInChangedFilesTreePanel("AppController.java"); - checkChangesIntoCompareForm(MESSAGE_FOR_CHANGE_CONTENT); - git.waitGroupGitCompareIsOpen(); - git.selectFileInChangedFilesTreePanel("Hello.java"); - checkChangesIntoCompareForm(EXP_TEXT); - } - - private void checkChangesIntoCompareForm(String expText) { - git.clickOnGroupCompareButton(); - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor(expText); - git.waitTextNotPresentIntoCompareRightEditor(expText); - git.closeGitCompareForm(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CreateAndDeleteLocalBranchTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CreateAndDeleteLocalBranchTest.java deleted file mode 100644 index 45f08d6f8ba..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/CreateAndDeleteLocalBranchTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** Created by aleksandr shmaraev on 25.11.15 */ -@Test(groups = TestGroup.GITHUB) -public class CreateAndDeleteLocalBranchTest { - private static final String PROJECT_NAME = NameGenerator.generate("CreateLocalBranch", 4); - private static final String MASTER_BRANCH = "master"; - private static final String TEST_BRANCH = "newbranch"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser user; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private AskDialog askDialog; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, user.getEmail()); - URL resource = - CreateAndDeleteLocalBranchTest.class.getResource("/projects/create-local-branch-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - } - - @Test(priority = 1) - public void createNewLocalBranchTest() { - initRepo(); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitDisappearBranchName(TEST_BRANCH); - git.waitEnabledAndClickCreateBtn(); - git.typeAndWaitNewBranchName(TEST_BRANCH); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.closeBranchesForm(); - } - - @Test(priority = 2) - public void deleteLocalBranch() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheList(MASTER_BRANCH); - git.waitBranchInTheList(TEST_BRANCH); - git.selectBranchAndClickDelBranch(TEST_BRANCH); - git.waitOpenedAskDelBranch(); - git.confirmeAndCloseAskDelBranch(); - git.waitDisappearBranchName(TEST_BRANCH); - git.closeBranchesForm(); - } - - private void initRepo() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/FetchAndMergeRemoteBranchIntoLocalTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/FetchAndMergeRemoteBranchIntoLocalTest.java deleted file mode 100644 index 520748914ac..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/FetchAndMergeRemoteBranchIntoLocalTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author aleksandr shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class FetchAndMergeRemoteBranchIntoLocalTest { - private static final String PROJECT_NAME = NameGenerator.generate("FetchAndMergeTest-", 4); - private static final String NEW_CONTENT = - String.format("//change_content-%s", String.valueOf(System.currentTimeMillis())); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private Events eventsPanel; - @Inject private CodenvyEditor editor; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = Paths.get(getClass().getResource("/projects/guess-project").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - } - - @Test - public void fetchUpdatesAndMergeRemoteBranchTolocal() throws IOException { - // preconditions and import the test repo - String textFile = "README.md"; - String javaFile = "AppController"; - String jspFile = "index.jsp"; - String pathToJavaFile = "src/main/java/org/eclipse/qa/examples"; - String pathToJspFile = "src/main/webapp"; - String originMaster = "origin/master"; - String fetchMess = String.format("Fetched from %s", testRepo.getHtmlUrl()); - String mergeMess1 = "Fast-forward Merged commits:"; - String mergeMess2 = "New HEAD commit: "; - String mergeMess3 = "Already up-to-date"; - - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, MAVEN); - - // change content in the test repo on GitHub - testRepo.deleteFile(String.format("%s/%s", pathToJspFile, jspFile)); - testRepo.changeFileContent( - String.format("%s/%s.java", pathToJavaFile, javaFile), NEW_CONTENT, "file-" + NEW_CONTENT); - testRepo.changeFileContent(textFile, NEW_CONTENT, "file-" + NEW_CONTENT); - - performFetch(); - git.waitGitStatusBarWithMess(fetchMess); - - // open project and check that content is not changed - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath( - String.format("%s/%s/%s.java", PROJECT_NAME, pathToJavaFile, javaFile)); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(NEW_CONTENT); - projectExplorer.openItemByPath(String.format("%s/%s", PROJECT_NAME, textFile)); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(NEW_CONTENT); - projectExplorer.waitVisibilityByName(jspFile); - - mergeRemoteBranch(originMaster); - - git.waitGitStatusBarWithMess(mergeMess1); - git.waitGitStatusBarWithMess(mergeMess2); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(mergeMess1); - - // check the content is changed - editor.selectTabByName(javaFile); - editor.waitActive(); - editor.waitTextIntoEditor(NEW_CONTENT); - editor.selectTabByName(textFile); - editor.waitActive(); - editor.waitTextIntoEditor(NEW_CONTENT); - projectExplorer.waitItemInvisibility( - String.format("%s/%s/%s", PROJECT_NAME, "src/main/webapp", jspFile)); - - // merge again - mergeRemoteBranch(originMaster); - git.waitGitStatusBarWithMess(mergeMess3); - - // wait commit in git history - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - git.waitTextInHistoryForm(NEW_CONTENT); - git.clickOnHistoryRowInСommitsList(0); - git.waitContentInHistoryEditor(NEW_CONTENT); - } - - private void performFetch() { - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, - TestMenuCommandsConstants.Git.Remotes.REMOTES_TOP, - TestMenuCommandsConstants.Git.Remotes.FETCH); - - git.waitFetchFormOpened(); - git.clickOnFetchButton(); - git.waitFetchFormClosed(); - } - - private void mergeRemoteBranch(String nameRemoteBranch) { - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.MERGE); - - git.waitMergeView(); - git.waitMergeReferencePanel(); - git.waitMergeExpandRemoteBranchIcon(); - git.clickMergeExpandRemoteBranchIcon(); - git.waitItemInMergeList(nameRemoteBranch); - git.clickItemInMergeList(nameRemoteBranch); - git.clickMergeBtn(); - git.waitMergeViewClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitChangeMarkersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitChangeMarkersTest.java deleted file mode 100644 index ef5e12050e4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitChangeMarkersTest.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestGitConstants.GIT_INITIALIZED_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.*; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.FILE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.*; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Igor Vnokur */ -@Test(groups = TestGroup.GITHUB) -public class GitChangeMarkersTest { - private static final String PROJECT_NAME = NameGenerator.generate("GitColors_", 4); - private static final String PATH_TO_JAVA_FILE = "/src/com/company/Main.java"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private DefaultTestUser productUser; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private AskForValueDialog askForValueDialog; - @Inject private CheTerminal terminal; - @Inject private Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - URL resource = getClass().getResource("/projects/simple-java-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void testModificationMarker() { - projectExplorer.waitProjectExplorer(); - projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + PATH_TO_JAVA_FILE); - menu.runCommand(GIT, INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(GIT_INITIALIZED_SUCCESS); - - // perform init commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - - projectExplorer.clickOnRefreshTreeButton(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + PATH_TO_JAVA_FILE); - projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_JAVA_FILE); - editor.waitActive(); - editor.waitNoGitChangeMarkers(); - editor.typeTextIntoEditor("//", 12); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - - editor.waitGitModificationMarkerInPosition(12, 14); - } - - @Test(priority = 1) - public void testInsertionMarker() { - editor.setCursorToLine(17); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitGitInsertionMarkerInPosition(18, 19); - } - - @Test(priority = 2) - public void testDeletionMarker() { - editor.setCursorToLine(21); - editor.deleteCurrentLine(); - - editor.waitGitDeletionMarkerInPosition(20); - } - - @Test(priority = 3) - public void testMarkersAfterCommit() { - // perform commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("commit"); - loader.waitOnClosed(); - - editor.waitNoGitChangeMarkers(); - } - - @Test(priority = 4) - public void testChangeMarkersAfterCommitFromTerminal() { - // Make a change - editor.selectTabByName("Main"); - editor.typeTextIntoEditor("//", 13); - editor.waitGitModificationMarkerInPosition(13, 13); - - terminal.selectFirstTerminalTab(); - terminal.typeIntoActiveTerminal("cd " + PROJECT_NAME + Keys.ENTER); - terminal.typeIntoActiveTerminal( - "git config --global user.email \"git@email.com\"" + Keys.ENTER); - terminal.typeIntoActiveTerminal("git config --global user.name \"name\"" + Keys.ENTER); - terminal.typeIntoActiveTerminal("git commit -a -m 'Terminal commit'" + Keys.ENTER); - terminal.waitTextInFirstTerminal("1 file changed, 1 insertion(+), 1 deletion(-)"); - - editor.waitNoGitChangeMarkers(); - } - - @Test(priority = 5) - public void testChangeMarkersOnUntrackedFile() { - // Make a change - editor.selectTabByName("Main"); - editor.typeTextIntoEditor("//", 14); - editor.waitGitModificationMarkerInPosition(14, 14); - - // Remove file from index - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/com/company/Main.java"); - menu.runCommand(GIT, REMOVE_FROM_INDEX); - git.waitRemoveFromIndexFileName("Main"); - git.selectRemoveOnlyFromIndexCheckBox(); - git.confirmRemoveFromIndexForm(); - - editor.waitNoGitChangeMarkers(); - } - - @Test(priority = 6) - public void testChangeMarkersOnAddedToIndexAndUntrackedFileFromTerminal() { - // Add file to index - terminal.selectFirstTerminalTab(); - terminal.typeIntoActiveTerminal("git add src/com/company/Main.java" + Keys.ENTER); - editor.waitGitModificationMarkerInPosition(14, 14); - - // Remove file from index - terminal.typeIntoActiveTerminal("git rm --cached src/com/company/Main.java" + Keys.ENTER); - - editor.waitNoGitChangeMarkers(); - } - - @Test(priority = 7) - public void testChangeMarkersOnAddedFile() { - // Create new file - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(PROJECT, NEW, FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("newFile"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - editor.closeFileByNameWithSaving("Main"); - - // Add file to index - menu.runCommand(GIT, ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.confirmAddToIndexForm(); - - // Make a change - editor.selectTabByName("newFile"); - editor.typeTextIntoEditor("change", 1); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitNoGitChangeMarkers(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitColorsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitColorsTest.java deleted file mode 100644 index c546c8818e6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitColorsTest.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestGitConstants.GIT_INITIALIZED_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.ADD_TO_INDEX; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.DELETE_REPOSITORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.REMOVE_FROM_INDEX; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.RESET; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.FILE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.*; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Igor Vnokur */ -@Test(groups = TestGroup.GITHUB) -public class GitColorsTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private CheTerminal terminal; - @Inject private Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(getClass().getResource("/projects/default-spring-project").toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - } - - @Test - public void testUntrackedFileColor() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME); - menu.runCommand(GIT, INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(GIT_INITIALIZED_SUCCESS); - - // Check file colors are yellow - projectExplorer.waitYellowNode(PROJECT_NAME + "/README.md"); - projectExplorer.waitYellowNode(PROJECT_NAME + "/pom.xml"); - - // perform init commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - - // Check file to be in default color - projectExplorer.openItemByPath(PROJECT_NAME + "/README.md"); - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("README.md"); - - // Remove file from index - menu.runCommand(GIT, REMOVE_FROM_INDEX); - git.waitRemoveFromIndexFileName("README.md"); - git.selectRemoveOnlyFromIndexCheckBox(); - git.confirmRemoveFromIndexForm(); - - // Check file colors are yellow - projectExplorer.waitYellowNode(PROJECT_NAME + "/README.md"); - editor.waitYellowTab("README.md"); - - // Add to index - menu.runCommand(GIT, ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.confirmAddToIndexForm(); - - // Check files are in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("README.md"); - } - - @Test(priority = 1) - public void testUntrackedFileColorFromTerminal() { - // Remove file from index - terminal.selectFirstTerminalTab(); - terminal.typeIntoActiveTerminal("cd " + PROJECT_NAME + Keys.ENTER); - terminal.typeIntoActiveTerminal("git rm --cached README.md" + Keys.ENTER); - - // Check file colors are yellow - projectExplorer.waitYellowNode(PROJECT_NAME + "/README.md"); - editor.waitYellowTab("README.md"); - - // Add to index - terminal.typeIntoActiveTerminal("git add README.md" + Keys.ENTER); - - // Check files are in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("README.md"); - } - - @Test(priority = 2) - public void testNewFileColor() { - // Create new file - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(PROJECT, NEW, FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("newFile"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - editor.waitYellowTab("newFile"); - - // check that the file color is yellow - projectExplorer.waitYellowNode(PROJECT_NAME + "/newFile"); - - // add file to index - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/newFile"); - menu.runCommand(GIT, ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.confirmAddToIndexForm(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_ADD_TO_INDEX_SUCCESS); - - // check that file color is green - projectExplorer.waitGreenNode(PROJECT_NAME + "/newFile"); - editor.waitGreenTab("newFile"); - } - - @Test(priority = 3) - public void testModifiedFilesColor() { - // Check file is colored in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("README.md"); - - // Make a change - editor.selectTabByName("README.md"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTabFileWithSavedStatus("README.md"); - projectExplorer.waitBlueNode(PROJECT_NAME + "/README.md"); - editor.waitBlueTab("README.md"); - - // check that the file color is blue - editor.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - editor.waitTabFileWithSavedStatus("README.md"); - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("README.md"); - } - - @Test(priority = 4) - public void testFileColorsAfterCommitFromMenu() { - // Make a change - editor.selectTabByName("README.md"); - editor.typeTextIntoEditor("//change" + Keys.SPACE); - editor.waitTabFileWithSavedStatus("README.md"); - - // check that the file color is blue - projectExplorer.waitBlueNode(PROJECT_NAME + "/README.md"); - editor.waitBlueTab("README.md"); - - // Perform commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("commit"); - git.waitCommitFormClosed(); - - // Check files are colored in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/newFile"); - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("newFile"); - editor.waitDefaultColorTab("README.md"); - } - - @Test(priority = 5) - public void testFileColorsAfterCommitFromTerminal() { - // Soft reset to previous commit - menu.runCommand(GIT, RESET); - git.waitResetWindowOpen(); - git.selectCommitResetWindow(2); - git.selectSoftReset(); - git.clickResetBtn(); - git.waitResetWindowClose(); - - loader.waitOnClosed(); - terminal.selectFirstTerminalTab(); - terminal.typeIntoActiveTerminal("cd " + PROJECT_NAME + Keys.ENTER); - terminal.typeIntoActiveTerminal( - "git config --global user.email \"git@email.com\"" + Keys.ENTER); - terminal.typeIntoActiveTerminal("git config --global user.name \"name\"" + Keys.ENTER); - terminal.typeIntoActiveTerminal("git commit -a -m 'Terminal commit'" + Keys.ENTER); - terminal.waitTextInFirstTerminal("2 files changed, 1 insertion(+), 1 deletion(-)"); - - // Check files are colored in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/newFile"); - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("newFile"); - editor.waitDefaultColorTab("README.md"); - } - - @Test(priority = 6) - public void testFileColorsAfterDeleteRepository() { - menu.runCommand(GIT, DELETE_REPOSITORY); - askDialog.acceptDialogWithText("Are you sure you want to delete "); - - // Check files are colored in default color - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/newFile"); - projectExplorer.waitDefaultColorNode(PROJECT_NAME + "/README.md"); - editor.waitDefaultColorTab("newFile"); - editor.waitDefaultColorTab("README.md"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitCompareTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitCompareTest.java deleted file mode 100644 index d84bd619fee..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitCompareTest.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.DELETE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.EDIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.ADD_TO_INDEX; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.COMMIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Compare.COMPARE_LATEST_VER; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Compare.COMPARE_TOP; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Compare.COMPARE_WITH_BRANCH; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Compare.COMPARE_WITH_REVISION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.JAVA_CLASS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.git.GitCompare; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class GitCompareTest { - private static final String PROJECT_NAME = NameGenerator.generate("GitCompare_", 4); - private static final String PATH_TO_APP_CONTROLLER = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_TO_ACLASS = - PROJECT_NAME + "/src/main/java/che/eclipse/sample/Aclass.java"; - private static final String PATH_TO_NEW_CLASS = - PROJECT_NAME + "/src/main/java/che/eclipse/sample/NewClass.java"; - private static final String LEFT_COMPARE_ST = "Line 2 : Column 1"; - private static final String TEXT_GROUP = - "src/main/java\n" - + "che/eclipse/sample\n" - + "Aclass.java\n" - + "NewClass.java\n" - + "org/eclipse/qa/examples\n" - + "AppController.java"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private GitCompare gitCompare; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private AskDialog askDialog; - @Inject private WarningDialog warningDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - projectExplorer.waitProjectExplorer(); - - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, Wizard.TypeProject.MAVEN); - createBranch(); - } - - @Test(priority = 1) - public void checkCompareWithLatestRepoVersion() throws Exception { - // expand the project and do changes in the java files - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_APP_CONTROLLER); - - // check compare after update file - testProjectServiceClient.updateFile( - ws.getId(), PATH_TO_APP_CONTROLLER, "// <<< checking compare content >>>\n"); - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMPARE_TOP, COMPARE_LATEST_VER); - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor("// <<< checking compare content >>>"); - git.waitTextNotPresentIntoCompareRightEditor("// <<< checking compare content >>>"); - git.closeGitCompareForm(); - - createNewJavaFile(); - deleteJavaFile(); - addToIndex(); - - // check compare to deleting the file - menu.runCommand(GIT, COMPARE_TOP, COMPARE_LATEST_VER); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP); - git.selectFileInChangedFilesTreePanel("Aclass.java"); - git.clickOnGroupCompareButton(); - git.waitGitCompareFormIsOpen(); - gitCompare.waitTextNotPresentIntoLeftEditor("public class Aclass"); - gitCompare.waitExpectedTextIntoRightEditor("public class Aclass"); - git.closeGitCompareForm(); - - // check compare to adding the file - git.waitGroupGitCompareIsOpen(); - git.selectFileInChangedFilesTreePanel("NewClass.java"); - git.clickOnGroupCompareButton(); - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor("public class NewClass"); - git.waitTextNotPresentIntoCompareRightEditor("public class NewClass"); - git.closeGitCompareForm(); - git.closeGroupGitCompareForm(); - - // check the compare warning dialog after commit - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMMIT); - git.waitAndRunCommit("Change files"); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - menu.runCommand(GIT, COMPARE_TOP, COMPARE_LATEST_VER); - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess( - "There are no changes in the selected item."); - warningDialog.clickOkBtn(); - } - - @Test(priority = 2) - public void checkCompareWithBranch() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // check the 'Close' button - menu.runCommand(GIT, COMPARE_TOP, COMPARE_WITH_BRANCH); - git.waitGitCompareBranchFormIsOpen(); - gitCompare.clickOnCloseBranchCompareButton(); - - // check the 'git compare' for another local branch - menu.runCommand(GIT, COMPARE_TOP, COMPARE_WITH_BRANCH); - git.waitGitCompareBranchFormIsOpen(); - git.selectBranchIntoGitCompareBranchForm("newbranch"); - git.clickOnCompareBranchFormButton(); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP); - - // check the 'Next' diff button - git.selectFileInChangedFilesTreePanel("Aclass.java"); - git.clickOnGroupCompareButton(); - git.waitGitCompareFormIsOpen(); - gitCompare.clickOnNextDiffButton(); - git.setFocusOnLeftGitCompareEditor(); - git.waitExpTextIntoCompareLeftEditor("public class NewClass"); - gitCompare.clickOnNextDiffButton(); - git.waitExpTextIntoCompareLeftEditor("// <<< checking compare content >>>"); - - // check the 'Previous' diff button - gitCompare.clickOnPreviousDiffButton(); - git.waitExpTextIntoCompareLeftEditor("public class NewClass"); - git.closeGitCompareForm(); - git.closeGroupGitCompareForm(); - - // check the 'git compare' for remote branch - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMPARE_TOP, COMPARE_WITH_BRANCH); - git.waitGitCompareBranchFormIsOpen(); - git.selectBranchIntoGitCompareBranchForm("origin/master"); - git.clickOnCompareBranchFormButton(); - git.waitGroupGitCompareIsOpen(); - git.waitExpTextInGroupGitCompare(TEXT_GROUP); - git.closeGroupGitCompareForm(); - } - - @Test(priority = 3) - public void checkCompareWithRevision() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PATH_TO_APP_CONTROLLER); - - // check the 'Close' button - menu.runCommand(GIT, COMPARE_TOP, COMPARE_WITH_REVISION); - git.waitGitCompareRevisionFormIsOpen(); - git.clickOnCloseRevisionButton(); - - // check the compare with revision - menu.runCommand(GIT, COMPARE_TOP, COMPARE_WITH_REVISION); - git.waitGitCompareRevisionFormIsOpen(); - git.selectRevisionIntoCompareRevisionForm(1); - git.clickOnRevisionCompareButton(); - git.waitGitCompareFormIsOpen(); - git.waitExpTextIntoCompareLeftEditor("// <<< checking compare content >>>"); - git.waitTextNotPresentIntoCompareRightEditor("// <<< checking compare content >>>"); - - // add change to file in the compare editor - git.setFocusOnLeftGitCompareEditor(); - git.setCursorToLine(2, LEFT_COMPARE_ST); - git.typeTextIntoGitCompareEditor("//change content from compare editor"); - git.waitExpTextIntoCompareLeftEditor("//change content from compare editor"); - git.clickOnGitCompareCloseButton(); - askDialog.confirmAndWaitClosed(); - git.waitGitCompareFormIsClosed(); - git.waitGitCompareRevisionFormIsOpen(); - git.clickOnCloseRevisionButton(); - - // check the change in the editor - projectExplorer.openItemByPath(PATH_TO_APP_CONTROLLER); - editor.waitActive(); - editor.waitTextIntoEditor("//change content from compare editor"); - } - - private void createBranch() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, TestMenuCommandsConstants.Git.BRANCHES); - git.waitBranchInTheList("master"); - git.waitDisappearBranchName("newbranch"); - git.waitEnabledAndClickCreateBtn(); - git.typeAndWaitNewBranchName("newbranch"); - git.waitBranchInTheList("master"); - git.waitBranchInTheList("newbranch"); - git.closeBranchesForm(); - } - - private void deleteJavaFile() { - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.waitAndSelectItem(PATH_TO_ACLASS); - projectExplorer.waitItemIsSelected(PATH_TO_ACLASS); - menu.runCommand(EDIT, DELETE); - askDialog.waitFormToOpen(); - askDialog.containsText("Delete file \"Aclass.java\"?"); - askDialog.clickOkBtn(); - loader.waitOnClosed(); - } - - private void createNewJavaFile() { - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/che/eclipse/sample"); - menu.runCommand(PROJECT, NEW, JAVA_CLASS); - loader.waitOnClosed(); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName("NewClass"); - askForValueDialog.clickOkBtnNewJavaClass(); - askForValueDialog.waitNewJavaClassClose(); - projectExplorer.waitItem(PATH_TO_NEW_CLASS); - } - - private void addToIndex() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, ADD_TO_INDEX); - git.confirmAddToIndexForm(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPanelTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPanelTest.java deleted file mode 100644 index a8e6ee568b6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPanelTest.java +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.git.GitCompare; -import org.eclipse.che.selenium.pageobject.git.GitPanel; -import org.openqa.selenium.By; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Mykola Morhun */ -// This test is disabled because git panel isn't ready for production and hidden -// Git panel epic: https://github.com/eclipse/che/issues/5128 -// Issue: https://github.com/eclipse/che/issues/7022 -@Test(groups = TestGroup.GITHUB) -public class GitPanelTest { - - private static final String JAVA_PLAIN_NON_GIT_PROJECT_NAME = "non-git-java-project"; - private static final String NODE_JS_GIT_PROJECT_NAME = "node-js"; - private static final String JAVA_SPRING_GIT_PROJECT_NAME = "web-java-spring"; - private static final String NEW_PROJECT_NAME = "new-project"; - private static final String RENAMED_JAVA_SPRING_GIT_PROJECT_NAME = "java-spring"; - - private static final String NODE_JS_EDITED_FILE_NAME = "app.js"; - private static final String JAVA_SPRING_EDITED_FILE1_NAME = "AppController.java"; - private static final String JAVA_SPRING_EDITED_FILE2_NAME = "web.xml"; - private static final String JAVA_SPRING_DELETED_FILE_NAME = "spring-servlet.xml"; - private static final String JAVA_SPRING_ADDED_FILE_NAME = "test.java"; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private DefaultTestUser productUser; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private Loader loader; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private Wizard wizard; - @Inject private Menu menu; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private CheTerminal terminal; - @Inject private AskDialog askDialog; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private Git git; - @Inject private GitCompare gitCompare; - @Inject private GitPanel gitPanel; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - URL resource; - resource = getClass().getResource("/projects/node-js-simple"); - projectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - NODE_JS_GIT_PROJECT_NAME, - ProjectTemplates.NODE_JS); - - resource = getClass().getResource("/projects/ProjectWithDifferentTypeOfFiles"); - projectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - JAVA_SPRING_GIT_PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - resource = getClass().getResource("/projects/plain-java-project"); - projectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - JAVA_PLAIN_NON_GIT_PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - - // make two projects to be under git - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(JAVA_PLAIN_NON_GIT_PROJECT_NAME); - projectExplorer.waitItem(NODE_JS_GIT_PROJECT_NAME); - projectExplorer.waitItem(JAVA_SPRING_GIT_PROJECT_NAME); - - createGitRepositoryInProject(NODE_JS_GIT_PROJECT_NAME); - commitAllChangesInProject(NODE_JS_GIT_PROJECT_NAME, "initial commit"); - - createGitRepositoryInProject(JAVA_SPRING_GIT_PROJECT_NAME); - commitAllChangesInProject(JAVA_SPRING_GIT_PROJECT_NAME, "initial commit"); - } - - @Test(priority = 1, enabled = false) - public void checkProjectsInGitPanel() { - gitPanel.openPanel(); - // check that only projects under git is shown - gitPanel.waitRepositories(2); - assertTrue(gitPanel.isRepositoryPresent(NODE_JS_GIT_PROJECT_NAME)); - assertTrue(gitPanel.isRepositoryPresent(JAVA_SPRING_GIT_PROJECT_NAME)); - assertFalse(gitPanel.isRepositoryPresent(JAVA_PLAIN_NON_GIT_PROJECT_NAME)); - } - - @Test(priority = 2, enabled = false) - public void checkChangesNumber() { - projectExplorer.openAndWait(); - - projectExplorer.quickExpandWithJavaScript(); - editFile(NODE_JS_EDITED_FILE_NAME); - editFile(JAVA_SPRING_EDITED_FILE1_NAME); - editFile(JAVA_SPRING_EDITED_FILE2_NAME); - deleteFile(JAVA_SPRING_DELETED_FILE_NAME); - createFileAndAddToIndex(JAVA_SPRING_GIT_PROJECT_NAME, JAVA_SPRING_ADDED_FILE_NAME); - - gitPanel.openPanel(); - - gitPanel.waitRepositoryToHaveChanges(NODE_JS_GIT_PROJECT_NAME, 1); - gitPanel.waitRepositoryToHaveChanges(JAVA_SPRING_GIT_PROJECT_NAME, 4); - } - - @Test(priority = 3, enabled = false) - public void shouldUpdateLabelsDynamically() { - // check label update - final String JAVA_SPRING_EDITED_FILE1_NAME_FILENAME = - toEditorTabName(JAVA_SPRING_EDITED_FILE1_NAME); - editor.selectTabByName(JAVA_SPRING_EDITED_FILE1_NAME_FILENAME); - editor.waitActiveTabFileName(JAVA_SPRING_EDITED_FILE1_NAME_FILENAME); - - assertEquals(gitPanel.getRepositoryChanges(JAVA_SPRING_GIT_PROJECT_NAME), 4); - editor.typeTextIntoEditor("\b"); - gitPanel.waitRepositoryToHaveChanges(JAVA_SPRING_GIT_PROJECT_NAME, 3); - editor.typeTextIntoEditor(" "); - gitPanel.waitRepositoryToHaveChanges(JAVA_SPRING_GIT_PROJECT_NAME, 4); - - // check label disappearance and appearance - editor.selectTabByName(NODE_JS_EDITED_FILE_NAME); - editor.waitActiveTabFileName(NODE_JS_EDITED_FILE_NAME); - - assertEquals(gitPanel.getRepositoryChanges(NODE_JS_GIT_PROJECT_NAME), 1); - editor.typeTextIntoEditor("\b"); - gitPanel.waitRepositoryToBeClean(NODE_JS_GIT_PROJECT_NAME); - editor.typeTextIntoEditor(" "); - gitPanel.waitRepositoryToHaveChanges(NODE_JS_GIT_PROJECT_NAME, 1); - } - - @Test(priority = 4, enabled = false) - public void checkChangedFilesList() { - gitPanel.selectRepository(NODE_JS_GIT_PROJECT_NAME); - assertEquals(gitPanel.getRepositoryChanges(NODE_JS_GIT_PROJECT_NAME), 1); - gitPanel.waitFileInChangesList(NODE_JS_EDITED_FILE_NAME); - - gitPanel.selectRepository(JAVA_SPRING_GIT_PROJECT_NAME); - assertEquals(gitPanel.getRepositoryChanges(JAVA_SPRING_GIT_PROJECT_NAME), 4); - gitPanel.waitFileInChangesList(JAVA_SPRING_EDITED_FILE1_NAME); - gitPanel.waitFileInChangesList(JAVA_SPRING_EDITED_FILE2_NAME); - gitPanel.waitFileInChangesList(JAVA_SPRING_DELETED_FILE_NAME); - gitPanel.waitFileInChangesList(JAVA_SPRING_ADDED_FILE_NAME); - } - - @Test(priority = 5, enabled = false) - public void shouldShowDiffOfChangedItem() { - gitPanel.selectRepository(JAVA_SPRING_GIT_PROJECT_NAME); - - gitPanel.openDiffForChangedFileWithDoubleClick(JAVA_SPRING_EDITED_FILE1_NAME); - gitCompare.waitGitCompareFormIsOpen(); - gitCompare.clickOnCompareCloseButton(); - gitCompare.waitGitCompareFormIsClosed(); - - gitPanel.openDiffForChangedFileWithEnterKey(JAVA_SPRING_EDITED_FILE2_NAME); - gitCompare.waitGitCompareFormIsOpen(); - gitCompare.clickOnCompareCloseButton(); - gitCompare.waitGitCompareFormIsClosed(); - } - - @Test(priority = 6, enabled = false) - public void shouldAddNewRepositoryIntoPanelWhenNewProjectUnderGitCreated() { - assertEquals(gitPanel.countRepositories(), 2); - projectExplorer.openAndWait(); - - createProject(NEW_PROJECT_NAME, Wizard.SamplesName.CONSOLE_JAVA_SIMPLE); - projectExplorer.waitAndSelectItem(NEW_PROJECT_NAME); - - gitPanel.openPanel(); - gitPanel.waitRepositories(3); - assertTrue(gitPanel.isRepositoryPresent(NEW_PROJECT_NAME)); - } - - @Test(priority = 7, enabled = false) - public void shouldRemoveRepositoryFromPanelWhenProjectUnderGitDeleted() { - projectExplorer.openAndWait(); - - projectExplorer.waitAndSelectItem(NEW_PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - projectExplorer.waitDisappearItemByPath(NEW_PROJECT_NAME); - - gitPanel.openPanel(); - gitPanel.waitRepositories(2); - assertFalse(gitPanel.isRepositoryPresent(NEW_PROJECT_NAME)); - } - - @Test(priority = 8, enabled = false) - public void shouldRemoveRepositoryFromPanelWhenGitRepositoryDeletedFromProject() { - projectExplorer.openAndWait(); - - projectExplorer.waitAndSelectItem(NODE_JS_GIT_PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.DELETE_REPOSITORY); - askDialog.acceptDialogWithText( - "Are you sure you want to delete " + NODE_JS_GIT_PROJECT_NAME + '?'); - - gitPanel.openPanel(); - gitPanel.waitRepositories(1); - assertFalse(gitPanel.isRepositoryPresent(NODE_JS_GIT_PROJECT_NAME)); - assertTrue(gitPanel.isRepositoryPresent(JAVA_SPRING_GIT_PROJECT_NAME)); - } - - @Test(priority = 9, enabled = false) - public void shouldAddNewRepositoryIntoPanelWhenProjectAddedUnderGit() { - assertEquals(gitPanel.countRepositories(), 1); - projectExplorer.openAndWait(); - - projectExplorer.waitAndSelectItem(NODE_JS_GIT_PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.acceptDialogWithText( - "Do you want to initialize the local repository " + NODE_JS_GIT_PROJECT_NAME + '?'); - - gitPanel.openPanel(); - gitPanel.waitRepositories(2); - assertTrue(gitPanel.isRepositoryPresent(NODE_JS_GIT_PROJECT_NAME)); - assertTrue(gitPanel.isRepositoryPresent(JAVA_SPRING_GIT_PROJECT_NAME)); - } - - @Test(priority = 10, enabled = false) - public void shouldRenameRepositoryWhenProjectUnderGitRenamed() { - projectExplorer.openAndWait(); - - projectExplorer.waitAndSelectItem(JAVA_SPRING_GIT_PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clearInput(); - askForValueDialog.typeAndWaitText(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME); - askForValueDialog.clickOkBtn(); - projectExplorer.quickExpandWithJavaScript(); - - gitPanel.openPanel(); - gitPanel.waitRepositories(2); - gitPanel.waitRepositoryPresent(NODE_JS_GIT_PROJECT_NAME); - gitPanel.waitRepositoryPresent(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME); - assertFalse(gitPanel.isRepositoryClean(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME)); - assertEquals(gitPanel.getRepositoryChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME), 4); - } - - @Test(priority = 11, enabled = false) - public void shouldDisplayCleanRepositoryAfterCommit() { - assertFalse(gitPanel.isRepositoryClean(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME)); - projectExplorer.openAndWait(); - - commitAllChangesInProject(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, "Some changes"); - - gitPanel.openPanel(); - gitPanel.waitRepositoryToBeClean(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME); - } - - @Test(priority = 12, enabled = false) - public void shouldUpdatePanelIfFilesChangedFromExternalSource() { - projectExplorer.openAndWait(); - - // change two files from editor and checkout with force from terminal - editFile(JAVA_SPRING_EDITED_FILE1_NAME); - editFile(JAVA_SPRING_EDITED_FILE2_NAME); - - gitPanel.openPanel(); - assertEquals(gitPanel.countRepositories(), 2); - gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 2); - - terminal.selectFirstTerminalTab(); - terminal.sendCommandIntoTerminal("cd /projects/" + RENAMED_JAVA_SPRING_GIT_PROJECT_NAME); - terminal.sendCommandIntoTerminal("git checkout -f HEAD"); - - assertEquals(gitPanel.countRepositories(), 2); - gitPanel.waitRepositoryToBeClean(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME); - gitPanel.waitFileGoneInChangesList(JAVA_SPRING_EDITED_FILE1_NAME); - gitPanel.waitFileGoneInChangesList(JAVA_SPRING_EDITED_FILE2_NAME); - - // change a file from terminal - terminal.sendCommandIntoTerminal("echo \"New content\" > " + JAVA_SPRING_ADDED_FILE_NAME); - - assertEquals(gitPanel.countRepositories(), 2); - gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 1); - gitPanel.waitFileInChangesList(JAVA_SPRING_ADDED_FILE_NAME); - } - - @Test(priority = 13, enabled = false) - public void shouldOpenGitPanelWithHotKey() { - assertEquals(gitPanel.countRepositories(), 2); - - projectExplorer.openAndWait(); - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitProjectExplorer(); - seleniumWebDriver.findElement(By.id("gwt-debug-projectTree")).sendKeys(Keys.ALT + "g"); - gitPanel.waitRepositories(2); - gitPanel.waitRepositoryToBeClean(NODE_JS_GIT_PROJECT_NAME); - gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 1); - - projectExplorer.openAndWait(); - projectExplorer.waitProjectExplorer(); - seleniumWebDriver.findElement(By.id("gwt-debug-projectTree")).sendKeys(Keys.ALT + "g"); - gitPanel.waitRepositories(2); - gitPanel.waitRepositoryToBeClean(NODE_JS_GIT_PROJECT_NAME); - gitPanel.waitRepositoryToHaveChanges(RENAMED_JAVA_SPRING_GIT_PROJECT_NAME, 1); - } - - /** Creates git repository for non-under-git project */ - private void createGitRepositoryInProject(String projectName) { - projectExplorer.waitAndSelectItemByName(projectName); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - } - - /** Commits all changes with given message for specified project. */ - private void commitAllChangesInProject(String projectName, String message) { - projectExplorer.waitAndSelectItemByName(projectName); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit(message); - } - - /** Opens given file by name and inserts a space into beginning of the file. */ - private void editFile(String visibleFileName) { - projectExplorer.openItemByVisibleNameInExplorer(visibleFileName); - editor.waitActiveTabFileName(toEditorTabName(visibleFileName)); - editor.typeTextIntoEditor(" "); - } - - private void deleteFile(String visibleFileName) { - projectExplorer.waitAndSelectItemByName(visibleFileName); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - askDialog.acceptDialogWithText("Delete file \"" + visibleFileName + "\"?"); - } - - private void createFileAndAddToIndex(String projectName, String fileName) { - // create file - projectExplorer.waitAndSelectItem(projectName); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(fileName); - askForValueDialog.clickOkBtn(); - - // add the file into index - projectExplorer.waitAndSelectItemByName(fileName); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.waitAddToIndexFormToOpen(); - git.waitAddToIndexFileName("Add file " + fileName + " to index?"); - git.confirmAddToIndexForm(); - } - - private void createProject(String projectName, String sampleName) { - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.waitCreateProjectWizardForm(); - wizard.typeProjectNameOnWizard(projectName); - wizard.selectSample(sampleName); - wizard.clickCreateButton(); - loader.waitOnClosed(); - wizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - } - - /** - * Converts file name to editor tab title for java projects. - * - * @param filename name of file - * @return tab title - */ - private String toEditorTabName(String filename) { - if (filename.endsWith(".java")) { - return filename.substring(0, filename.length() - 5); - } - return filename; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullConflictTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullConflictTest.java deleted file mode 100644 index 0250ac0c4f4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullConflictTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.PULL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.REMOTES_TOP; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author aleksandr shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class GitPullConflictTest { - private static final String PROJECT_NAME = NameGenerator.generate("PullConflictProject-", 4); - private static final String PATH_TO_JAVA_FILE = "src/main/java/org/eclipse/qa/examples"; - private static final String COMMIT_MSG = "commit_changes"; - - private static final String FIRST_MERGE_CONFLICT_MESSAGE = - "Checkout operation failed, the following files would be overwritten by merge:\n" - + "README.md\n" - + "src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "Could not pull. Commit your changes before merging."; - - private static final String SECOND_MERGE_CONFLICT_MESSAGE = - "Could not pull because a merge conflict is detected in the files:\n" - + "src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "README.md\n" - + "Automatic merge failed; fix conflicts and then commit the result."; - - private static final String CHANGE_STRING_1 = - String.format("//first_change_%s", System.currentTimeMillis()); - - private static final String HEAD_CONF_PREFIX_CONF_MESS = - String.format("<<<<<<< HEAD\n//second_change\n=======\n%s\n>>>>>>>", CHANGE_STRING_1); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Git git; - @Inject private Events eventsPanel; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - } - - @Test - public void pullConflictsTest() throws Exception { - // preconditions and import the test repo - String javaFileChange = "AppController"; - String textFileChange = "README.md"; - String changeContent2 = "//second_change"; - String pathJavaFile = - String.format("%s/%s/%s.java", PROJECT_NAME, PATH_TO_JAVA_FILE, javaFileChange); - String pathTextFile = String.format("%s/%s", PROJECT_NAME, textFileChange); - - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, MAVEN); - - // change files in the test repo on GitHub - testRepo.changeFileContent( - String.format("%s/%s.java", PATH_TO_JAVA_FILE, javaFileChange), CHANGE_STRING_1); - testRepo.changeFileContent(textFileChange, CHANGE_STRING_1); - - // change the java and text files in the editor - testProjectServiceClient.updateFile(ws.getId(), pathJavaFile, changeContent2); - testProjectServiceClient.updateFile(ws.getId(), pathTextFile, changeContent2); - - // make pull and wait the first expected conflict message - performPull(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(FIRST_MERGE_CONFLICT_MESSAGE); - - commitFiles(); - - // make pull again and wait the second expected conflict message - performPull(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(SECOND_MERGE_CONFLICT_MESSAGE); - - // wait the expected text in the editor - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(pathJavaFile); - editor.waitActive(); - editor.waitTextIntoEditor(HEAD_CONF_PREFIX_CONF_MESS); - projectExplorer.openItemByPath(pathTextFile); - editor.waitActive(); - editor.waitTextIntoEditor(HEAD_CONF_PREFIX_CONF_MESS); - } - - private void performPull() { - menu.runCommand(GIT, REMOTES_TOP, PULL); - - git.waitPullFormToOpen(); - git.clickPull(); - git.waitPullFormToClose(); - consoles.waitProcessInProcessConsoleTree("Git pull", LOADER_TIMEOUT_SEC); - } - - private void commitFiles() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - - git.waitAndRunCommit(COMMIT_MSG); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullTest.java deleted file mode 100644 index b90ce37d578..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitPullTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.TestGroup.GITHUB; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.PULL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.Remotes.REMOTES_TOP; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -@Test(groups = GITHUB) -public class GitPullTest { - private static final String PROJECT_NAME = NameGenerator.generate("FirstProject-", 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private CodenvyEditor editor; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = Paths.get(getClass().getResource("/projects/git-pull-test").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - } - - @Test - public void pullTest() throws Exception { - String jsFileName = "app.js"; - String htmlFileName = "file.html"; - String readmeTxtFileName = "readme-txt"; - String readmeMdFileName = "README.md"; - String folderWithPlainFilesPath = "plain-files"; - - String currentTimeInMillis = Long.toString(System.currentTimeMillis()); - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, BLANK); - - prepareFilesForTest(jsFileName); - prepareFilesForTest(htmlFileName); - prepareFilesForTest(folderWithPlainFilesPath + "/" + readmeTxtFileName); - prepareFilesForTest(folderWithPlainFilesPath + "/" + readmeMdFileName); - - testRepo.changeFileContent(jsFileName, currentTimeInMillis); - testRepo.changeFileContent(htmlFileName, currentTimeInMillis); - testRepo.changeFileContent( - String.format("%s/%s", folderWithPlainFilesPath, readmeTxtFileName), currentTimeInMillis); - - performPull(); - - git.waitGitStatusBarWithMess( - String.format("Successfully pulled from %s", testRepo.getHtmlUrl())); - - checkPullAfterUpdatingContent(jsFileName, currentTimeInMillis); - checkPullAfterUpdatingContent(htmlFileName, currentTimeInMillis); - checkPullAfterUpdatingContent(readmeTxtFileName, currentTimeInMillis); - - testRepo.deleteFolder(Paths.get(folderWithPlainFilesPath), "remove file"); - - performPull(); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - - checkPullAfterRemovingContent( - readmeTxtFileName, - String.format("/%s/%s/%s", PROJECT_NAME, folderWithPlainFilesPath, readmeTxtFileName)); - checkPullAfterRemovingContent( - readmeMdFileName, - String.format("/%s/%s/%s", PROJECT_NAME, folderWithPlainFilesPath, readmeMdFileName)); - } - - private void performPull() { - menu.runCommand(GIT, REMOTES_TOP, PULL); - git.waitPullFormToOpen(); - git.clickPull(); - git.waitPullFormToClose(); - } - - private void prepareFilesForTest(String fileName) { - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(String.format(PROJECT_NAME + "/%s", fileName)); - editor.waitActive(); - } - - private void checkPullAfterUpdatingContent(String tabNameOpenedFile, String expectedMessage) { - editor.selectTabByName(tabNameOpenedFile); - editor.waitTextIntoEditor(expectedMessage); - } - - private void checkPullAfterRemovingContent( - String tabNameOpenedFile, String pathToItemInProjectExplorer) { - editor.waitTabIsNotPresent(tabNameOpenedFile); - projectExplorer.waitLibrariesAreNotPresent(pathToItemInProjectExplorer); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitResetTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitResetTest.java deleted file mode 100644 index aa8325e713a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/GitResetTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.STATUS; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.DEFAULT_WITH_GITHUB_PROJECTS; -import static org.eclipse.che.selenium.pageobject.git.Git.ResetModes.HARD; -import static org.eclipse.che.selenium.pageobject.git.Git.ResetModes.MIXED; -import static org.eclipse.che.selenium.pageobject.git.Git.ResetModes.SOFT; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.utils.WorkspaceDtoDeserializer; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.git.GitRevertCommit; -import org.eclipse.che.selenium.pageobject.git.GitStatusBar; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class GitResetTest { - @Inject private Ide ide; - @Inject private DefaultTestUser testUser; - @Inject private WorkspaceDtoDeserializer workspaceDtoDeserializer; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskDialog askDialog; - @Inject private Menu menu; - @Inject private Git git; - @Inject private CodenvyEditor editor; - @Inject private GitRevertCommit gitRevertCommit; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private GitStatusBar gitStatusBar; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - - @InjectTestWorkspace(template = DEFAULT_WITH_GITHUB_PROJECTS) - private TestWorkspace ws; - - private final String NAME_OF_PROJECT_FOR_CHECKING_GIT_SOFT_RESET = "checkGitSoftReset"; - private final String NAME_OF_PROJECT_FOR_CHECKING_GIT_HARD_RESET = "checkGitHardReset"; - private final String NAME_OF_PROJECT_FOR_CHECKING_GIT_MIX_RESET = "checkGitMixedReset"; - private final String COMMIT_MESSAGE = "added php samples"; - - @BeforeClass - public void prepare() throws Exception { - List projects = - Arrays.asList( - NAME_OF_PROJECT_FOR_CHECKING_GIT_SOFT_RESET, - NAME_OF_PROJECT_FOR_CHECKING_GIT_HARD_RESET, - NAME_OF_PROJECT_FOR_CHECKING_GIT_MIX_RESET); - - ide.open(ws); - projects.forEach(item -> projectExplorer.waitItem(item)); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - projectExplorer.quickExpandWithJavaScript(); - } - - @AfterClass - public void tearDown() { - ws.delete(); - } - - @Test - public void checkSoftReset() { - String expectedTextInGitStatusConsole = - "On branch master\n Changes to be committed:\n new file: .codenvy.json\n modified: README.md"; - projectExplorer.waitAndSelectItem(NAME_OF_PROJECT_FOR_CHECKING_GIT_SOFT_RESET); - git.doResetToCommitMessage(SOFT, COMMIT_MESSAGE); - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess(expectedTextInGitStatusConsole); - } - - @Test - public void checkMixReset() { - String expectedTextInGitStatusConsole = - "On branch master\n Changes not staged for commit:\n new file: .codenvy.json\n modified: README.md"; - projectExplorer.waitAndSelectItem(NAME_OF_PROJECT_FOR_CHECKING_GIT_MIX_RESET); - git.doResetToCommitMessage(MIXED, COMMIT_MESSAGE); - menu.runCommand(GIT, STATUS); - git.waitGitStatusBarWithMess(expectedTextInGitStatusConsole); - } - - @Test - public void checkHardReset() { - String textInEditorBeforeReset = - "To access database, run `env | grep MYSQL` in the terminal. You will get MySQL user, password and database. `root` user is passwordless."; - String commitMessage = "Initial commit"; - String expectedTextInEditorAfterHardResetting = - "# web-php-apache2-simple\nA hello world PHP script"; - String expectedTextInGitStatusConsole = "On branch master\n nothing to commit"; - - projectExplorer.openItemByPath(NAME_OF_PROJECT_FOR_CHECKING_GIT_HARD_RESET + "/README.md"); - editor.waitTextIntoEditor(textInEditorBeforeReset); - git.doResetToCommitMessage(HARD, commitMessage); - menu.runCommand(GIT, STATUS); - projectExplorer.waitDisappearItemByPath( - NAME_OF_PROJECT_FOR_CHECKING_GIT_HARD_RESET + "/index.php"); - git.waitGitStatusBarWithMess(expectedTextInGitStatusConsole); - editor.waitTextIntoEditor(expectedTextInEditorAfterHardResetting); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/ImportWizardFormTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/ImportWizardFormTest.java deleted file mode 100644 index ea9339d8036..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/ImportWizardFormTest.java +++ /dev/null @@ -1,717 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.BRANCHES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.IMPORT_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.GO_BACK; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.GO_INTO; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.io.IOException; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestGitHubServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.GitHub; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.account.KeycloakFederatedIdentitiesPage; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.openqa.selenium.WebDriverException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Ihor Okhrimenko - */ -public class ImportWizardFormTest { - private static final Logger LOG = LoggerFactory.getLogger(ImportWizardFormTest.class); - private static final String GITHUB_COM = "github.com"; - private static final String TEST_BRANCH = "test-branch"; - private static final String ANOTHER_TEST_BRANCH = "another-test-branch"; - private static final String BRANCH_WITH_CHANGES = "branch-with-changes"; - private static final String SPRING_SUBMODULE = "Repo_For_Test"; - private static final String REGULAR_SUBMODULE = "testRepo"; - public static final String MY_LIB_DIRECTORY = "my-lib"; - public static final String TEST_DIRECTORY = "my-lib/src/test"; - private String currentProjectName; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject - @Named("che.multiuser") - private boolean isMultiuser; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CheTerminal terminal; - @Inject private Menu menu; - @Inject private ImportProjectFromLocation importProject; - @Inject private Preferences preferences; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private AskDialog askDialog; - @Inject private GitHub gitHub; - @Inject private TestGitHubServiceClient gitHubClientService; - @Inject private Loader loader; - @Inject private Dashboard dashboard; - @Inject private KeycloakFederatedIdentitiesPage keycloakFederatedIdentitiesPage; - @Inject private TestGitHubRepository testRepo; - @Inject private TestGitHubRepository keepDirectoryRepo; - @Inject private TestGitHubRepository importBranchRepo; - @Inject private TestGitHubRepository multimoduleRepo; - @Inject private Git git; - @Inject private Wizard projectWizard; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass(groups = TestGroup.MULTIUSER) - @AfterClass(groups = TestGroup.MULTIUSER) - private void removeGitHubIdentity() { - dashboard.open(); // to login - keycloakFederatedIdentitiesPage.open(); - keycloakFederatedIdentitiesPage.ensureGithubIdentityIsAbsent(); - assertEquals(keycloakFederatedIdentitiesPage.getGitHubIdentityFieldValue(), ""); - } - - @BeforeClass - private void revokeGithubOauthToken() { - try { - gitHubClientService.deleteAllGrants(gitHubUsername, gitHubPassword); - } catch (Exception e) { - LOG.warn("There was an error of revoking the github oauth token.", e); - } - } - - @BeforeClass - private void deletePrivateSshKey() throws Exception { - ide.open(ws); - projectExplorer.waitProjectExplorer(); - terminal.waitFirstTerminalTab(); - - openPreferencesVcsForm(); - - if (preferences.isSshKeyIsPresent(GITHUB_COM)) { - preferences.deleteSshKeyByHost(GITHUB_COM); - } - - preferences.close(); - } - - @AfterMethod - private void deleteProject() { - try { - testProjectServiceClient.deleteResource(ws.getId(), currentProjectName); - } catch (Exception e) { - LOG.warn(e.getMessage(), e); - } - } - - @Test - public void shouldLoginToGitHubAndImportProject() throws Exception { - initRepoForLoginToGithubAndImportProject(); - - currentProjectName = testRepo.getName(); - - // init repos for tests - initRepoForKeepDirectoryTest(); - initRepoForImportBranchTest(); - initRepoForMultiModuleTest(); - - // open github authorization window - ide.open(ws); - String ideWin = seleniumWebDriver.getWindowHandle(); - - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - importProject.waitMainForm(); - importProject.selectGitHubSourceItem(); - importProject.clickLoadRepoBtn(); - askDialog.waitFormToOpen(25); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - seleniumWebDriverHelper.switchToNextWindow(ideWin); - - gitHub.waitAuthorizationPageOpened(); - gitHub.typeLogin(gitHubUsername); - gitHub.typePass(gitHubPassword); - gitHub.clickOnSignInButton(); - - // authorize on github.com - gitHub.waitAuthorizeBtn(); - gitHub.clickOnAuthorizeBtn(); - seleniumWebDriver.switchTo().window(ideWin); - loader.waitOnClosed(); - importProject.selectItemInAccountList( - gitHubClientService.getName(gitHubUsername, gitHubPassword)); - importProject.closeWithIcon(); - - // import project - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - importProject.waitMainForm(); - importProject.selectGitHubSourceItem(); - importProject.clickLoadRepoBtn(); - importProject.selectItemInAccountList( - gitHubClientService.getName(gitHubUsername, gitHubPassword)); - importProject.selectProjectByName(currentProjectName); - - importProject.clickImportBtn(); - projectWizard.waitCreateProjectWizardForm(); - projectWizard.clickSaveButton(); - projectWizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitItem(currentProjectName); - - // check GitHub identity is present in Keycloak account management page - if (isMultiuser) { - keycloakFederatedIdentitiesPage.open(); - - // set to lower case because it's a normal behaviour (issue: - // https://github.com/eclipse/che/issues/10138) - assertEquals( - keycloakFederatedIdentitiesPage.getGitHubIdentityFieldValue(), - gitHubUsername.toLowerCase()); - ide.open(ws); - } - } - - @Test(priority = 1) - public void keepDirectoryImportBySshUrlTest() { - projectExplorer.waitProjectExplorer(); - currentProjectName = keepDirectoryRepo.getName() + "Ssh"; - - makeKeepDirectoryFromGitUrl( - keepDirectoryRepo.getSshUrl(), currentProjectName, MY_LIB_DIRECTORY); - - projectExplorer.waitItem(currentProjectName); - projectExplorer.waitAndSelectItemByName(currentProjectName); - projectExplorer.openItemByPath(currentProjectName); - - loader.waitOnClosed(); - projectExplorer.waitItemInvisibility(currentProjectName + "/my-webapp"); - projectExplorer.waitItem(currentProjectName + "/my-lib"); - - expandDirectoryMyLib(currentProjectName); - } - - @Test(priority = 1) - public void keepDirectoryImportByHttpsUrlTest() { - projectExplorer.waitProjectExplorer(); - currentProjectName = keepDirectoryRepo.getName() + "Https"; - - makeKeepDirectoryFromGitUrl(keepDirectoryRepo.getHtmlUrl(), currentProjectName, TEST_DIRECTORY); - - projectExplorer.waitItem(currentProjectName); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - currentProjectName + "/my-lib/src/test/java/hello", "SayHelloTest.java"); - - editor.waitActive(); - projectExplorer.waitItemInvisibility(currentProjectName + "/my-lib/src/main"); - projectExplorer.waitItemInvisibility(currentProjectName + "/my-webapp"); - - projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); - projectExplorer.clickOnItemInContextMenu(GO_INTO); - - projectExplorer.waitDisappearItemByPath(currentProjectName + "/src/my-lib"); - projectExplorer.waitVisibilityByName("test"); - projectExplorer.waitVisibilityByName("java"); - projectExplorer.waitVisibilityByName("hello"); - projectExplorer.waitVisibilityByName("SayHelloTest.java"); - - projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-lib/src/test"); - projectExplorer.clickOnItemInContextMenu(GO_BACK); - - projectExplorer.waitItem(currentProjectName + "/my-lib/src"); - } - - @Test(priority = 1) - public void keepDirectoryImportFromGitHub() throws Exception { - projectExplorer.waitProjectExplorer(); - currentProjectName = keepDirectoryRepo.getName(); - - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitHubSourceItem(); - - loader.waitOnClosed(); - importProject.waitLoadRepoBtn(); - - importProject.clickLoadRepoBtn(); - loader.waitOnClosed(); - - importProject.selectItemInAccountList( - gitHubClientService.getName(gitHubUsername, gitHubPassword)); - - importProject.selectProjectByName(currentProjectName); - importProject.typeProjectName(currentProjectName); - - importProject.waitKeepDirectoryIsNotSelected(); - - importProject.clickOnKeepDirectoryCheckbox(); - - importProject.waitKeepDirectoryIsSelected(); - - importProject.typeDirectoryName("my-webapp"); - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(currentProjectName); - projectExplorer.waitAndSelectItemByName(currentProjectName); - - projectExplorer.openItemByPath(currentProjectName); - - loader.waitOnClosed(); - projectExplorer.waitItemInvisibility(currentProjectName + "/my-lib"); - - projectExplorer.expandPathInProjectExplorer(currentProjectName + "/my-webapp/src/main/webapp"); - - projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-webapp"); - projectExplorer.clickOnItemInContextMenu(GO_INTO); - - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName("my-webapp"); - projectExplorer.waitItemInvisibility(currentProjectName); - - projectExplorer.openContextMenuByPathSelectedItem(currentProjectName + "/my-webapp"); - projectExplorer.clickOnItemInContextMenu(GO_BACK); - - projectExplorer.waitItem(currentProjectName); - } - - @Test(priority = 1) - public void checkImportProjectInBranchBySshUrl() { - projectExplorer.waitProjectExplorer(); - currentProjectName = importBranchRepo.getName() + "Ssh"; - - performImportIntoBranch(importBranchRepo.getSshUrl(), currentProjectName, TEST_BRANCH); - projectExplorer.waitItem(currentProjectName); - projectExplorer.waitAndSelectItemByName(currentProjectName); - loader.waitOnClosed(); - - menu.runCommand(GIT, BRANCHES); - - git.waitBranchInTheListWithCoState(TEST_BRANCH); - - git.closeBranchesForm(); - - projectExplorer.waitItem(currentProjectName); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - currentProjectName + "/src/main/java/org.eclipse.qa.examples", "AppController.java"); - - editor.waitActive(); - } - - @Test(priority = 1) - public void checkImportProjectInBranchByHttpsUrl() { - projectExplorer.waitProjectExplorer(); - currentProjectName = importBranchRepo.getName() + "Https"; - - performImportIntoBranch(importBranchRepo.getHtmlUrl(), currentProjectName, ANOTHER_TEST_BRANCH); - - projectExplorer.waitItem(currentProjectName); - - projectExplorer.waitAndSelectItemByName(currentProjectName); - loader.waitOnClosed(); - - menu.runCommand(GIT, BRANCHES); - - git.waitBranchInTheListWithCoState(ANOTHER_TEST_BRANCH); - - git.closeBranchesForm(); - - projectExplorer.waitItem(currentProjectName); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - currentProjectName + "/src/main/java/org.eclipse.qa.examples", "AppController.java"); - - editor.waitActive(); - } - - @Test(priority = 1) - public void checkImportProjectInBranchFromGitHub() throws Exception { - projectExplorer.waitProjectExplorer(); - currentProjectName = importBranchRepo.getName(); - - importIntoBranchFromGitHub(); - - projectWizard.waitCreateProjectWizardForm(); - - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - loader.waitOnClosed(); - - projectWizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(currentProjectName); - projectExplorer.waitAndSelectItemByName(currentProjectName); - loader.waitOnClosed(); - - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.BRANCHES); - - git.waitBranchInTheListWithCoState(BRANCH_WITH_CHANGES); - - git.closeBranchesForm(); - projectExplorer.openItemByPath(currentProjectName); - loader.waitOnClosed(); - projectExplorer.openItemByPath(currentProjectName + "/AppController.java"); - - editor.waitActive(); - } - - @Test(priority = 1, groups = FLAKY) - public void checkImportProjectSubmoduleByHttpsUrl() { - projectExplorer.waitProjectExplorer(); - currentProjectName = multimoduleRepo.getName() + "Https"; - - importRecursivelyFromGitUrl(multimoduleRepo.getHtmlUrl(), currentProjectName); - openAndCheckSpringSubmodule(currentProjectName); - openAndCheckRegularSubmodule(currentProjectName); - } - - @Test(priority = 1, groups = FLAKY) - public void checkImportProjectSubmoduleBySshUrl() { - projectExplorer.waitProjectExplorer(); - currentProjectName = multimoduleRepo.getName() + "Ssh"; - - importRecursivelyFromGitUrl(multimoduleRepo.getSshUrl(), currentProjectName); - openAndCheckSpringSubmodule(currentProjectName); - openAndCheckRegularSubmodule(currentProjectName); - } - - @Test(priority = 1, groups = FLAKY) - public void checkImportProjectSubmoduleFromGithub() throws Exception { - projectExplorer.waitProjectExplorer(); - currentProjectName = multimoduleRepo.getName(); - - importRecursivelyFromGitHub(currentProjectName); - openAndCheckSpringSubmodule(currentProjectName); - openAndCheckRegularSubmodule(currentProjectName); - } - - private void importRecursivelyFromGitUrl(String url, String projectName) { - loader.waitOnClosed(); - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitSourceItem(); - loader.waitOnClosed(); - importProject.typeURi(url); - importProject.typeProjectName(projectName); - - importProject.waitImportRecursivelyIsNotSelected(); - - importProject.clickOnImportRecursivelyCheckbox(); - - importProject.waitImportRecursivelyIsSelected(); - - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectWizard.waitCreateProjectWizardForm(); - - projectWizard.selectTypeProject(MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - loader.waitOnClosed(); - - projectWizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - } - - private void makeKeepDirectoryFromGitUrl(String url, String projectName, String folderName) { - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitSourceItem(); - loader.waitOnClosed(); - importProject.typeURi(url); - importProject.typeProjectName(projectName); - - importProject.waitKeepDirectoryIsNotSelected(); - - importProject.clickOnKeepDirectoryCheckbox(); - importProject.waitKeepDirectoryIsSelected(); - importProject.typeDirectoryName(folderName); - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - } - - private void performImportIntoBranch(String url, String projectName, String branchName) { - projectExplorer.waitProjectExplorer(); - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitSourceItem(); - loader.waitOnClosed(); - - importProject.typeURi(url); - importProject.typeProjectName(projectName); - - importProject.waitBranchIsNotSelected(); - - importProject.clickBranchCheckbox(); - - importProject.waitBranchIsSelected(); - - importProject.typeBranchName(branchName); - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectWizard.waitCreateProjectWizardForm(); - - projectWizard.selectTypeProject(MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - - loader.waitOnClosed(); - projectWizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitProjectExplorer(); - } - - private void expandDirectoryMyLib(String projectName) { - projectExplorer.expandPathInProjectExplorerAndOpenFile( - projectName + "/my-lib/src/main/java/hello", "SayHello.java"); - - editor.waitActive(); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - projectName + "/my-lib/src/test/java/hello", "SayHelloTest.java"); - - editor.waitActive(); - } - - private void initRepoForLoginToGithubAndImportProject() throws IOException { - testRepo.addContent(Paths.get(getClass().getResource("/projects/testRepo").getPath())); - } - - private void initRepoForKeepDirectoryTest() throws IOException { - keepDirectoryRepo.addContent( - Paths.get(getClass().getResource("/projects/java-multimodule").getPath())); - } - - private void initRepoForImportBranchTest() throws IOException { - importBranchRepo.addContent( - Paths.get(getClass().getResource("/projects/default-spring-project").getPath())); - - importBranchRepo.createBranch(TEST_BRANCH); - importBranchRepo.createBranch(ANOTHER_TEST_BRANCH); - importBranchRepo.createBranch(BRANCH_WITH_CHANGES); - - importBranchRepo.addContent( - Paths.get(getClass().getResource("/projects/Repo_For_Test_branch1").getPath()), - BRANCH_WITH_CHANGES); - } - - private void initRepoForMultiModuleTest() throws Exception { - multimoduleRepo.addContent( - Paths.get(getClass().getResource("/projects/java-multimodule").getPath())); - multimoduleRepo.addSubmodule( - Paths.get(getClass().getResource("/projects/Repo_For_Test").getPath()), SPRING_SUBMODULE); - multimoduleRepo.addSubmodule( - Paths.get(getClass().getResource("/projects/testRepo").getPath()), REGULAR_SUBMODULE); - } - - private void importRecursivelyFromGitHub(String projectName) throws Exception { - loader.waitOnClosed(); - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitHubSourceItem(); - - loader.waitOnClosed(); - importProject.waitLoadRepoBtn(); - - importProject.clickLoadRepoBtn(); - loader.waitOnClosed(); - importProject.selectItemInAccountList( - gitHubClientService.getName(gitHubUsername, gitHubPassword)); - importProject.selectProjectByName(projectName); - importProject.typeProjectName(projectName); - - importProject.waitImportRecursivelyIsNotSelected(); - - importProject.clickOnImportRecursivelyCheckbox(); - - importProject.waitImportRecursivelyIsSelected(); - - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - projectWizard.waitCreateProjectWizardForm(); - - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - - loader.waitOnClosed(); - projectWizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - } - - private void openAndCheckSpringSubmodule(String projectName) { - projectExplorer.openItemByPath(projectName); - projectExplorer.waitAndSelectItem(projectName + "/" + SPRING_SUBMODULE); - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.CONVERT_TO_PROJECT); - - projectWizard.waitOpenProjectConfigForm(); - projectWizard.waitTextParentDirectoryName("/" + projectName); - projectWizard.waitTextProjectNameInput(SPRING_SUBMODULE); - - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - - projectWizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitItem(projectName); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - projectName + "/" + SPRING_SUBMODULE + "/src/main/java/com.codenvy.example.spring", - "GreetingController.java"); - - projectExplorer.waitVisibilityByName("HelloWorld.java"); - - editor.closeFileByNameWithSaving("GreetingController"); - } - - private void openAndCheckRegularSubmodule(String projectName) { - projectExplorer.waitAndSelectItem(projectName + "/" + REGULAR_SUBMODULE); - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.CONVERT_TO_PROJECT); - - projectWizard.waitOpenProjectConfigForm(); - projectWizard.waitTextParentDirectoryName("/" + projectName); - projectWizard.waitTextProjectNameInput(REGULAR_SUBMODULE); - - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - loader.waitOnClosed(); - projectWizard.clickSaveButton(); - - projectWizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitItem(projectName); - - try { - projectExplorer.expandPathInProjectExplorerAndOpenFile( - projectName + "/" + REGULAR_SUBMODULE + "/src/main/java/com.company.example", "A.java"); - } catch (WebDriverException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10012", ex); - } - editor.closeFileByNameWithSaving("A"); - } - - private void importIntoBranchFromGitHub() throws Exception { - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - - importProject.waitMainForm(); - loader.waitOnClosed(); - - importProject.selectGitHubSourceItem(); - - loader.waitOnClosed(); - importProject.waitLoadRepoBtn(); - - importProject.clickLoadRepoBtn(); - loader.waitOnClosed(); - - importProject.selectItemInAccountList( - gitHubClientService.getName(gitHubUsername, gitHubPassword)); - importProject.selectProjectByName(importBranchRepo.getName()); - importProject.typeProjectName(importBranchRepo.getName()); - - importProject.waitBranchIsNotSelected(); - - importProject.clickBranchCheckbox(); - - importProject.waitBranchIsSelected(); - - importProject.typeBranchName(BRANCH_WITH_CHANGES); - importProject.clickImportBtn(); - - importProject.waitMainFormIsClosed(); - loader.waitOnClosed(); - } - - private void openPreferencesVcsForm() { - menu.runCommand( - TestMenuCommandsConstants.Profile.PROFILE_MENU, - TestMenuCommandsConstants.Profile.PREFERENCES); - - preferences.waitPreferencesForm(); - preferences.waitMenuInCollapsedDropdown(Preferences.DropDownSshKeysMenu.VCS); - - preferences.selectDroppedMenuByName(Preferences.DropDownSshKeysMenu.VCS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/InitializeAndDeleteLocalRepositoryTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/InitializeAndDeleteLocalRepositoryTest.java deleted file mode 100644 index d678698610e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/InitializeAndDeleteLocalRepositoryTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author aleksandr shmaraev */ -@Test(groups = TestGroup.GITHUB) -public class InitializeAndDeleteLocalRepositoryTest { - private static final String PROJECT_NAME = NameGenerator.generate("InitAndDelLocalRepo-", 4); - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String ASK_DIALOG_TEXT = - "Do you want to initialize the local repository " + PROJECT_NAME + "?"; - private static final String DELETE_REPO_TEXT = - "Are you sure you want to delete " + PROJECT_NAME + "?"; - private static final String WARNING_TEXT = - "Initial commit is required to perform this operation."; - private static final String COMMIT_MESSAGE = "init"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private AskDialog askDialog; - @Inject private WarningDialog warningDialog; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - } - - @Test(priority = 1) - public void initializeLocalRepository() { - // Initialize git repository - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.acceptDialogWithText(ASK_DIALOG_TEXT); - loader.waitOnClosed(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_INITIALIZED_SUCCESS); - menu.runCommand(TestMenuCommandsConstants.Git.GIT); - menu.waitCommandIsDisabledInMenu(TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - menu.runCommandByXpath(TestMenuCommandsConstants.Git.STATUS); - git.waitGitStatusBarWithMess("On branch master"); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND); - projectExplorer.waitItem(PATH_FOR_EXPAND); - loader.waitOnClosed(); - - // Check git log - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(WARNING_TEXT); - warningDialog.clickOkBtn(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); - git.waitAndRunCommit("init"); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.SHOW_HISTORY); - git.waitTextInHistoryForm(COMMIT_MESSAGE); - git.closeGitHistoryForm(); - git.waitHistoryFormToClose(); - } - - @Test(priority = 2) - public void deleteLocalRepository() { - - // Delete git repo - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.DELETE_REPOSITORY); - askDialog.acceptDialogWithText(DELETE_REPO_TEXT); - loader.waitOnClosed(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_REPO_DELETE); - events.clickEventLogBtn(); - events.waitExpectedMessage(TestGitConstants.GIT_REPO_DELETE); - menu.runCommand(TestMenuCommandsConstants.Git.GIT); - menu.waitCommandIsDisabledInMenu(TestMenuCommandsConstants.Git.DELETE_REPOSITORY); - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND); - projectExplorer.waitItem(PATH_FOR_EXPAND); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/OpenOnGitHubTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/OpenOnGitHubTest.java deleted file mode 100644 index 1601eb474a4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/OpenOnGitHubTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.OPEN_ON_GITHUB; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; -import static org.openqa.selenium.support.ui.ExpectedConditions.*; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * Test "Open on Github" action. Will check action calling from context menu on selected project, - * folder and file - * - * @author Vitalii Parfonov - */ -public class OpenOnGitHubTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PROJECT_WITHOUT_GIT_FOLDER = "projectWithoutGitCVS"; - private static final String PATH_TO_EXPAND = "src/main/java/che/eclipse/sample"; - private String mainBrowserTabHandle; - - @Inject private TestWorkspace workspace; - - @SuppressWarnings("unused") - @Inject - private Ide ide; - - @SuppressWarnings("unused") - @Inject - private ProjectExplorer projectExplorer; - - @SuppressWarnings("unused") - @Inject - private TestProjectServiceClient testProjectServiceClient; - - @SuppressWarnings("unused") - @Inject - private CheTerminal terminal; - - @SuppressWarnings("unused") - @Inject - private SeleniumWebDriverHelper seleniumWebDriverHelper; - - @SuppressWarnings("unused") - @Inject - private SeleniumWebDriver seleniumWebDriver; - - @Inject private CodenvyEditor editor; - - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @Inject private DefaultTestUser productUser; - - @Inject private TestGitHubRepository testRepo; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject private Git git; - - @BeforeClass - public void setUp() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testProjectServiceClient.importProject( - workspace.getId(), entryPath, PROJECT_WITHOUT_GIT_FOLDER, ProjectTemplates.MAVEN_SPRING); - - testRepo.addContent(entryPath); - ide.open(workspace); - mainBrowserTabHandle = seleniumWebDriver.getWindowHandle(); - git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, BLANK); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - } - - @AfterMethod - public void returnToMainWindow() { - if (seleniumWebDriver.getWindowHandles().size() > 1) { - seleniumWebDriverHelper.closeCurrentWindowAndSwitchToAnother(mainBrowserTabHandle); - } - } - - @Test - public void checkProjectWithoutGitFolder() { - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_WITHOUT_GIT_FOLDER); - projectExplorer.waitContexMenuItemIsNotVisible( - TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_ON_GITHUB); - // for closing context menu - projectExplorer.clickOnItemInContextMenu( - TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.COPY); - } - - @Test(priority = 1) - public void openProjectOnGitHubTest() { - projectExplorer.waitAndSelectItem(PROJECT_NAME, 5); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu( - TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_ON_GITHUB); - seleniumWebDriverHelper.switchToNextWindow(seleniumWebDriver.getWindowHandle()); - seleniumWebDriverHelper.waitSuccessCondition(urlToBe(testRepo.getHtmlUrl() + "/tree/master/")); - } - - @Test(priority = 2) - public void openFolderOnGitHubTest() { - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + PATH_TO_EXPAND, 5); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + PATH_TO_EXPAND, 5); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + PATH_TO_EXPAND); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu( - TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_ON_GITHUB); - seleniumWebDriverHelper.switchToNextWindow(seleniumWebDriver.getWindowHandle()); - seleniumWebDriverHelper.waitSuccessCondition( - urlToBe(testRepo.getHtmlUrl() + "/tree/master/" + PATH_TO_EXPAND)); - } - - @Test(priority = 3) - public void openFileOnGitHubTest() { - projectExplorer.openItemByPath(PROJECT_NAME + "/" + PATH_TO_EXPAND + "/Aclass.java"); - editor.selectLines(14, 1); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(OPEN_ON_GITHUB); - seleniumWebDriverHelper.switchToNextWindow(seleniumWebDriver.getWindowHandle()); - seleniumWebDriverHelper.waitSuccessCondition( - urlToBe(testRepo.getHtmlUrl() + "/blob/master/" + PATH_TO_EXPAND + "/Aclass.java#L15-L15")); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginTest.java deleted file mode 100644 index 273e07ae845..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginTest.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static java.lang.String.format; -import static java.util.regex.Pattern.compile; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.BRANCHES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PREFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PROFILE_MENU; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.IMPORT_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.pageobject.PanelSelector.PanelTypes.LEFT_RIGHT_BOTTOM_ID; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.BRANCH_PUSHED_ON_YOUR_ORIGIN; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.NEW_COMMITS_PUSHED; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.PULL_REQUEST_ISSUED; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.PULL_REQUEST_UPDATED; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.provider.TestIdeUrlProvider; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.PanelSelector; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrey Chizhikov - * @author Aleksandr Shmaraiev - */ -@Test(groups = TestGroup.GITHUB) -public class PullRequestPluginTest { - - private static final String FIRST_PROJECT_NAME = "pull-request-plugin-test"; - private static final String SECOND_PROJECT_NAME = "second-project-for-switching"; - private static final String CREATE_BRANCH = "Create new branch..."; - private static final String MAIN_BRANCH = "master"; - private static final String PULL_REQUEST_CREATED = "Your pull request has been created."; - private static final String PUll_REQUEST_UPDATED = "Your pull request has been updated."; - private static final String DEV_BRANCH_NAME = generate("dev-", 4); - private static final String BASE_BRANCH_NAME = generate("base-", 4); - private static final String NEW_BRANCH_NAME = generate("new-", 8); - private static final String TITLE = generate("Title: ", 8); - private static final String COMMENT = generate("Comment: ", 8); - private static final String PATH_TO_README_FILE_1ST_PROJECT = FIRST_PROJECT_NAME + "/README.md"; - private static final String PATH_TO_README_FILE_2ND_PROJECT = SECOND_PROJECT_NAME + "/README.md"; - private static final String READ_FACTORY_URL_FROM_PR_DESCRIPTION_TEMPLATE = - "\\[!\\[Review\\]\\(.*%1$sfactory/resources/factory-review.svg\\)\\]\\((.*%1$sf\\?id=factory.*)\\).*" - + COMMENT; - - private String mainBrowserTabHandle; - private String firstProjectUrl; - private String secondProjectUrl; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private TestIdeUrlProvider testIdeUrlProvider; - - @Inject private Ide ide; - @Inject private Git git; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private Wizard wizard; - @Inject private DefaultTestUser user; - @Inject private CodenvyEditor editor; - @Inject private AskDialog askDialog; - @Inject private Preferences preferences; - @Inject private PanelSelector panelSelector; - @Inject private TestWorkspace testWorkspace; - @Inject private AskForValueDialog valueDialog; - @Inject private TestGitHubRepository testRepo; - @Inject private TestGitHubRepository testRepo2; - @Inject private ProjectExplorer projectExplorer; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private ImportProjectFromLocation importWidget; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - // preconditions - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - testRepo2.addContent(entryPath); - testRepo.createBranch(NEW_BRANCH_NAME); - testRepo2.createBranch(BASE_BRANCH_NAME); - - ide.open(testWorkspace); - mainBrowserTabHandle = seleniumWebDriver.getWindowHandle(); - - // wait until jdt.ls initialized this need to avoid problem in next steps of test - consoles.waitJDTLSStartedMessage(); - // add committer info - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, user.getEmail()); - - // authorize application on GitHub - menu.runCommand(PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - preferences.generateAndUploadSshKeyOnGithub(gitHubUsername, gitHubPassword); - - // import the test projects - firstProjectUrl = testRepo.getHttpsTransportUrl(); - secondProjectUrl = testRepo2.getHttpsTransportUrl(); - - importProject(firstProjectUrl, FIRST_PROJECT_NAME); - importProject(secondProjectUrl, SECOND_PROJECT_NAME); - } - - @AfterMethod - public void returnToMainWindow() { - if (seleniumWebDriver.getWindowHandles().size() > 1) { - seleniumWebDriverHelper.closeCurrentWindowAndSwitchToAnother(mainBrowserTabHandle); - } - } - - @AfterClass - public void deleteFactoryWorkspace() throws Exception { - testWorkspaceServiceClient.deleteFactoryWorkspaces(testWorkspace.getName(), user.getName()); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void switchingBetweenProjects() { - projectExplorer.waitItem(FIRST_PROJECT_NAME); - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - loader.waitOnClosed(); - - // check the data of the first repository - pullRequestPanel.clickPullRequestBtn(); - pullRequestPanel.waitRepoUrl(firstProjectUrl); - pullRequestPanel.waitBranchName(MAIN_BRANCH); - pullRequestPanel.waitProjectName(FIRST_PROJECT_NAME); - - // checkout to another branch when the PR panel is closed - pullRequestPanel.closePanelByHideButton(); - projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); - checkoutToBranch("origin/" + BASE_BRANCH_NAME); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - - // open PR panel by the 'Panel Selector' - panelSelector.selectPanelTypeFromPanelSelector(LEFT_RIGHT_BOTTOM_ID); - pullRequestPanel.waitOpenPanel(); - - // check the data of the second repository - pullRequestPanel.waitRepoUrl(secondProjectUrl); - pullRequestPanel.waitBranchName(BASE_BRANCH_NAME); - pullRequestPanel.waitProjectName(SECOND_PROJECT_NAME); - } - - @Test(priority = 1) - public void createPullRequestToNonDefaultBranch() throws Exception { - projectExplorer.waitItem(SECOND_PROJECT_NAME); - projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); - projectExplorer.openItemByPath(SECOND_PROJECT_NAME); - - // change content in README.md file - openFileAndChangeContent(PATH_TO_README_FILE_2ND_PROJECT, generate("", 12)); - - // create branch - pullRequestPanel.waitOpenPanel(); - pullRequestPanel.selectBranch(CREATE_BRANCH); - valueDialog.waitFormToOpen(); - valueDialog.typeAndWaitText(DEV_BRANCH_NAME); - valueDialog.clickOkBtn(); - valueDialog.waitFormToClose(); - pullRequestPanel.enterComment(COMMENT); - pullRequestPanel.enterTitle(TITLE); - - // commit the change create pull request - pullRequestPanel.clickCreatePullRequestButton(); - pullRequestPanel.clickOkCommitBtn(); - pullRequestPanel.waitStatusOk(BRANCH_PUSHED_ON_YOUR_ORIGIN); - pullRequestPanel.waitStatusOk(PULL_REQUEST_ISSUED); - pullRequestPanel.waitMessage(PULL_REQUEST_CREATED); - - // check the base and head branches in the pull request - assertEquals(testRepo2.getPullRequestHeadBranchName(1), DEV_BRANCH_NAME); - assertEquals(testRepo2.getPullRequestBaseBranchName(1), BASE_BRANCH_NAME); - } - - @Test(priority = 1) - public void createPullRequestToDefaultBranch() throws Exception { - projectExplorer.waitItem(FIRST_PROJECT_NAME); - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - projectExplorer.openItemByPath(FIRST_PROJECT_NAME); - - // checkout to another branch when the PR panel is opened - pullRequestPanel.waitOpenPanel(); - checkoutToBranch("origin/" + NEW_BRANCH_NAME); - pullRequestPanel.clickPullRequestBtn(); - pullRequestPanel.clickRefreshBranchListButton(); - pullRequestPanel.selectBranch(NEW_BRANCH_NAME); - - // change content in README.md file - openFileAndChangeContent(PATH_TO_README_FILE_1ST_PROJECT, generate("", 12)); - pullRequestPanel.enterComment(COMMENT); - pullRequestPanel.enterTitle(TITLE); - - // commit the change and create pull request - pullRequestPanel.clickCreatePullRequestButton(); - pullRequestPanel.clickOkCommitBtn(); - pullRequestPanel.waitStatusOk(BRANCH_PUSHED_ON_YOUR_ORIGIN); - pullRequestPanel.waitStatusOk(PULL_REQUEST_ISSUED); - pullRequestPanel.waitMessage(PULL_REQUEST_CREATED); - } - - @Test(priority = 2) - public void updatePullRequest() throws Exception { - String expectedText = - format( - "Branch '%s:%s' is already used. Would you like to overwrite it?", - gitHubUsername, NEW_BRANCH_NAME); - - // change content in README.md file - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - openFileAndChangeContent(PATH_TO_README_FILE_1ST_PROJECT, generate("", 12)); - - // update PR and check status - pullRequestPanel.clickUpdatePullRequestButton(); - pullRequestPanel.clickOkCommitBtn(); - askDialog.acceptDialogWithText(expectedText); - pullRequestPanel.waitStatusOk(NEW_COMMITS_PUSHED); - pullRequestPanel.waitStatusOk(PULL_REQUEST_UPDATED); - pullRequestPanel.waitMessage(PUll_REQUEST_UPDATED); - } - - @Test(priority = 3) - public void checkFactoryOnGitHub() throws IOException { - // check pull request description - assertEquals(testRepo2.getPullRequestUserName(1), gitHubUsername); - assertEquals(testRepo2.getPullRequestTitle(1), TITLE); - - String pullRequestDescription = testRepo2.getPullRequestBody(1); - - Matcher matcher = - compile( - format( - READ_FACTORY_URL_FROM_PR_DESCRIPTION_TEMPLATE, - testIdeUrlProvider.get().toString()), - Pattern.MULTILINE | Pattern.DOTALL) - .matcher(pullRequestDescription); - - assertTrue(matcher.find(), format("Actual PR description was '%s'.", pullRequestDescription)); - - // open factory from URL in pull request description - String factoryUrlFromPrDescription = matcher.group(1); - seleniumWebDriver.navigate().to(factoryUrlFromPrDescription); - seleniumWebDriverHelper.switchToIdeFrameAndWaitAvailability(); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(FIRST_PROJECT_NAME); - projectExplorer.waitItem(SECOND_PROJECT_NAME); - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - projectExplorer.openItemByPath(FIRST_PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_README_FILE_1ST_PROJECT); - editor.waitActive(); - } - - private void importProject(String projectUrl, String projectName) { - projectExplorer.waitProjectExplorer(); - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - importWidget.waitAndTypeImporterAsGitInfo(projectUrl, projectName); - configureTypeOfProject(); - } - - private void configureTypeOfProject() { - wizard.selectTypeProject(BLANK); - loader.waitOnClosed(); - wizard.clickSaveButton(); - loader.waitOnClosed(); - wizard.waitCreateProjectWizardFormIsClosed(); - } - - private void checkoutToBranch(String branchName) { - menu.runCommand(GIT, BRANCHES); - git.waitBranchInTheList(branchName); - git.selectBranchAndClickCheckoutBtn(branchName); - git.waitGitCompareBranchFormIsClosed(); - } - - private void openFileAndChangeContent(String filePath, String text) throws Exception { - projectExplorer.openItemByPath(filePath); - editor.waitActive(); - testProjectServiceClient.updateFile(testWorkspace.getId(), filePath, text); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginWithForkTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginWithForkTest.java deleted file mode 100644 index 2bde4c9fadf..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PullRequestPluginWithForkTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.CheSeleniumSuiteModule.AUXILIARY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PREFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PROFILE_MENU; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.BRANCH_PUSHED_ON_YOUR_FORK; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.FORK_CREATED; -import static org.eclipse.che.selenium.pageobject.PullRequestPanel.Status.NEW_COMMITS_PUSHED; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.PullRequestPanel.Status; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -@Test(groups = TestGroup.GITHUB) -public class PullRequestPluginWithForkTest { - private static final String PROJECT_NAME = "pull-request-plugin-fork-test"; - private static final String PATH_TO_README_FILE = PROJECT_NAME + "/README.md"; - private static final String PULL_REQUEST_CREATED = "Your pull request has been created."; - private static final String PULL_REQUEST_UPDATED = "Your pull request has been updated."; - private static final String TITLE = generate("Title-", 8); - private static final String COMMENT = generate("Comment-", 8); - - @Inject - @Named("github.username") - private String githubUserName; - - @Inject - @Named("github.password") - private String githubUserPassword; - - @Inject - @Named(AUXILIARY) - private TestGitHubRepository testAuxiliaryRepo; - - @Inject private Git git; - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private DefaultTestUser testUser; - @Inject private CodenvyEditor editor; - @Inject private Preferences preferences; - @Inject private TestWorkspace testWorkspace; - @Inject private ProjectExplorer projectExplorer; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testAuxiliaryRepo.addContent(entryPath); - - ide.open(testWorkspace); - // wait until jdt.ls initialized this need to avoid problem in next steps of test - consoles.waitJDTLSStartedMessage(); - - // add committer info - testUserPreferencesServiceClient.addGitCommitter(githubUserName, testUser.getEmail()); - - // authorize application on GitHub - menu.runCommand(PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - preferences.generateAndUploadSshKeyOnGithub(githubUserName, githubUserPassword); - } - - @AfterClass - public void removeTestRepository() { - try { - new TestGitHubRepository(githubUserName, githubUserPassword, testAuxiliaryRepo.getName()) - .delete(); - } catch (IOException e) { - // ignore IOException in case of there is no repository to delete - } - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void createPullRequest() throws Exception { - // import project - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testAuxiliaryRepo.getHtmlUrl(), PROJECT_NAME, MAVEN); - - // change content - projectExplorer.openItemByPath(PROJECT_NAME); - openFileAndChangeContent(PATH_TO_README_FILE, generate("", 12)); - - // change commit and create pull request - pullRequestPanel.clickPullRequestBtn(); - pullRequestPanel.enterComment(COMMENT); - pullRequestPanel.enterTitle(TITLE); - pullRequestPanel.clickCreatePullRequestButton(); - pullRequestPanel.clickOkCommitBtn(); - pullRequestPanel.waitStatusOk(FORK_CREATED); - pullRequestPanel.waitStatusOk(BRANCH_PUSHED_ON_YOUR_FORK); - pullRequestPanel.waitMessage(PULL_REQUEST_CREATED); - } - - @Test(priority = 1) - void updatePullRequest() throws Exception { - editor.closeAllTabs(); - loader.waitOnClosed(); - - // change content - openFileAndChangeContent(PATH_TO_README_FILE, generate("Update ", 12)); - - // update PR and check status - pullRequestPanel.clickUpdatePullRequestButton(); - pullRequestPanel.clickOkCommitBtn(); - pullRequestPanel.waitStatusOk(NEW_COMMITS_PUSHED); - pullRequestPanel.waitStatusOk(Status.PULL_REQUEST_UPDATED); - pullRequestPanel.waitMessage(PULL_REQUEST_UPDATED); - pullRequestPanel.clickPullRequestBtn(); - pullRequestPanel.waitClosePanel(); - } - - private void openFileAndChangeContent(String filePath, String text) throws Exception { - projectExplorer.openItemByPath(filePath); - editor.waitActive(); - testProjectServiceClient.updateFile(testWorkspace.getId(), filePath, text); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PushingChangesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PushingChangesTest.java deleted file mode 100644 index b708b6bae61..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/PushingChangesTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.BLANK; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestGitHubKeyUploader; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestGitHubServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Igor Vinokur - */ -@Test(groups = TestGroup.GITHUB) -public class PushingChangesTest { - private static final String PROJECT_NAME = NameGenerator.generate("PushingChangesTest-", 4); - private static final String NAME_OF_HARD_RESET_COMMAND = "hardReset"; - private static final String PROJECT_FOLDER_NAME = "plain-files"; - private static final String PUSH_MSG = "Pushed to origin"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private org.eclipse.che.selenium.pageobject.git.Git git; - @Inject private Events events; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private NotificationsPopupPanel notifications; - @Inject private Wizard projectWizard; - @Inject private ImportProjectFromLocation importProject; - @Inject private TestGitHubKeyUploader testGitHubKeyUploader; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private TestGitHubServiceClient gitHubClientService; - @Inject private TestGitHubRepository testRepo; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - - @BeforeClass - public void setUp() throws Exception { - testGitHubKeyUploader.updateGithubKey(); - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = Paths.get(getClass().getResource("/projects/git-pull-test").getPath()); - testRepo.addContent(entryPath); - prepareAmendCommitCommandByRestApi(); - ide.open(ws); - projectExplorer.waitProjectExplorer(); - git.importJavaApp(testRepo.getSshUrl(), PROJECT_NAME, BLANK); - projectExplorer.waitItem(PROJECT_NAME); - } - - @Test - public void pushChangesTest() throws Exception { - String newFileForPushing = "pushFile.txt"; - String nameOfHtmlFile = "file.html"; - String newContentForFirstPushing = String.valueOf(System.currentTimeMillis()); - String pathToHtmlFile = String.format("%s/%s", PROJECT_NAME, nameOfHtmlFile); - - doChangesInTheProjectFileByProjectServiceClient( - pathToHtmlFile, newFileForPushing, newContentForFirstPushing); - git.createNewFileAndPushItToGitHub(PROJECT_NAME, "file.html"); - git.waitGitStatusBarWithMess(String.format("Successfully pushed to %s", testRepo.getSshUrl())); - consoles.waitProcessInProcessConsoleTree("Git push", LOADER_TIMEOUT_SEC); - events.clickEventLogBtn(); - loader.waitOnClosed(); - events.waitExpectedMessage(PUSH_MSG); - assertEquals(testRepo.getFileContent(nameOfHtmlFile), newContentForFirstPushing); - assertEquals( - testRepo.getFileContent(PROJECT_FOLDER_NAME + "/" + newFileForPushing), - newContentForFirstPushing); - } - - @Test - public void forcePushTest() throws Exception { - String expectedMessageAfterGitConflict = - "failed to push 'master -> master' to '%s'. Try to merge remote changes using pull, and then push again."; - String contentForCheckingForcePushing = "check force pushing"; - String pathToFileWitChanging = - String.format("%s/%s/%s", PROJECT_NAME, PROJECT_FOLDER_NAME, "README.md"); - - // do conflict with changing file and amend commit - testProjectServiceClient.updateFile( - ws.getId(), pathToFileWitChanging, contentForCheckingForcePushing); - launchAmendCommitCommand(); - git.pushChanges(false); - git.waitGitStatusBarWithMess( - String.format(expectedMessageAfterGitConflict, testRepo.getSshUrl())); - - // Make force push and check changes on gitHub side - git.pushChanges(true); - git.waitGitStatusBarWithMess(String.format("Successfully pushed to %s", testRepo.getSshUrl())); - assertEquals( - testRepo.getFileContent(PROJECT_FOLDER_NAME + "/README.md"), - contentForCheckingForcePushing); - } - - private void doChangesInTheProjectFileByProjectServiceClient( - String pathToItem, String newFileForPushing, String newContent) throws Exception { - testProjectServiceClient.updateFile(ws.getId(), pathToItem, newContent); - testProjectServiceClient.createFileInProject( - ws.getId(), PROJECT_NAME + "/plain-files/", newFileForPushing, newContent); - } - - private void prepareAmendCommitCommandByRestApi() throws Exception { - String bashCommand = - String.format("cd /projects/%s && git commit --all --no-edit --amend", PROJECT_NAME); - testCommandServiceClient.createCommand( - bashCommand, NAME_OF_HARD_RESET_COMMAND, CUSTOM, ws.getId()); - } - - private void launchAmendCommitCommand() { - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(NAME_OF_HARD_RESET_COMMAND); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/RevertCommitTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/RevertCommitTest.java deleted file mode 100644 index 259adb2c607..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/RevertCommitTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.COMMIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.REVERT_COMMIT; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestGitConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.git.GitRevertCommit; -import org.eclipse.che.selenium.pageobject.git.GitStatusBar; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Anatolii Bazko - * @author Aleksandr Shmaraiev - */ -@Test(groups = TestGroup.GITHUB) -public class RevertCommitTest { - private static final String PROJECT_NAME = NameGenerator.generate("GitRevertProject-", 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @Inject - @Named("github.password") - private String gitHubPassword; - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskDialog askDialog; - @Inject private Menu menu; - @Inject private Git git; - @Inject private CodenvyEditor editor; - @Inject private GitRevertCommit gitRevertCommit; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - @Inject private GitStatusBar gitStatusBar; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - URL resource = getClass().getResource("/projects/git-pull-test"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.NODE_JS); - ide.open(ws); - } - - @Test - public void shouldRevertCommit() throws Exception { - // preconditions - String newFile = "newFile.xml"; - String htmlFile = "file.html"; - String changeContent = ""; - String initRepoMessage = "init"; - String createFileMessage = "create newFile.xml"; - String updateFileMessage = "update file.html"; - String pathToNewFile = String.format("%s/%s", PROJECT_NAME, newFile); - String pathToHtmlFile = String.format("%s/%s", PROJECT_NAME, htmlFile); - - // perform git initialize repository - projectExplorer.waitProjectExplorer(); - - gitInitRepo(); - commitFiles(initRepoMessage); - - // create new file and perform commit - testProjectServiceClient.createFileInProject(ws.getId(), PROJECT_NAME, newFile, changeContent); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitItem(pathToNewFile); - - commitFiles(createFileMessage); - - // perform git revert and check author and comment - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - performGitRevert(); - - // check that 'newFile.xml' is disappear from the project tree - projectExplorer.waitDisappearItemByPath(pathToNewFile); - - // update the 'file.html' and commit change - testProjectServiceClient.updateFile(ws.getId(), pathToHtmlFile, changeContent); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - commitFiles(updateFileMessage); - - // perform revert and check that 'change content' is not present in the editor - performGitRevert(); - - projectExplorer.openItemByPath(pathToHtmlFile); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(changeContent); - } - - private void gitInitRepo() { - menu.runCommand(GIT, INITIALIZE_REPOSITORY); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); - } - - private void performGitRevert() { - menu.runCommand(GIT, REVERT_COMMIT); - - String revision = gitRevertCommit.getTopCommitRevision(); - String comment = gitRevertCommit.getTopCommitComment(); - - gitRevertCommit.waitRevertPanelOpened(); - gitRevertCommit.selectRevision(revision); - gitRevertCommit.clickRevertButton(); - gitRevertCommit.waitRevertPanelClosed(); - - gitStatusBar.waitMessageInGitTab("Reverted commits: - " + revision); - - menu.runCommand(GIT, REVERT_COMMIT); - - assertEquals(gitRevertCommit.getTopCommitAuthor(), gitHubUsername); - assertTrue(gitRevertCommit.getTopCommitComment().contains("Revert \"" + comment + "\"")); - - gitRevertCommit.clickCancelButton(); - } - - private void commitFiles(String commiitMess) { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(GIT, COMMIT); - - git.waitAndRunCommit(commiitMess); - git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/SetGitCommitterTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/SetGitCommitterTest.java deleted file mode 100644 index a76049f0ec3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/git/SetGitCommitterTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.git; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PREFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PROFILE_MENU; -import static org.eclipse.che.selenium.pageobject.Preferences.DropDownGitInformationMenu.COMMITTER; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Kuznetsov Mihail */ -public class SetGitCommitterTest { - - @Inject private DefaultTestUser defaultUser; - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private Preferences preferences; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void testCommitterSettings() throws Exception { - loader.waitOnClosed(); - notificationsPopupPanel.waitProgressPopupPanelClose(); - loader.waitOnClosed(); - menu.runCommand(PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - - preferences.waitMenuInCollapsedDropdown(COMMITTER); - preferences.selectDroppedMenuByName(COMMITTER); - preferences.typeAndWaitNameCommitter(defaultUser.getName()); - preferences.typeAndWaitEmailCommitter(defaultUser.getEmail()); - preferences.clickOnOkBtn(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/gwt/CheckSimpleGwtAppTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/gwt/CheckSimpleGwtAppTest.java deleted file mode 100644 index 1275985322a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/gwt/CheckSimpleGwtAppTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.gwt; - -import static org.eclipse.che.dto.server.DtoFactory.newDto; -import static org.eclipse.che.selenium.core.constant.TestBuildConstants.BUILD_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.APPLICATION_START_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.REDRAW_UI_ELEMENTS_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.UBUNTU_JDK8; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.shared.dto.ServerConfigDto; -import org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.utils.WorkspaceDtoDeserializer; -import org.eclipse.che.selenium.core.workspace.CheTestWorkspaceProvider; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckSimpleGwtAppTest { - private static final String BUILD_COMMAND = "build"; - private static final String RUN_GWT_COMMAND = "runGwt"; - private static final String GWT_CODESERVER_NAME = "gwt-codeserver"; - - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private ToastLoader toastLoader; - @Inject private Consoles consoles; - - private TestWorkspace testWorkspace; - - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestWorkspaceServiceClient workspaceServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private WorkspaceDtoDeserializer workspaceDtoDeserializer; - @Inject private DefaultTestUser testUser; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private CheTestWorkspaceProvider testWorkspaceProvider; - - private String projectName; - - @BeforeClass - public void prepare() throws Exception { - projectName = NameGenerator.generate("project", 4); - - WorkspaceConfigDto workspace = - workspaceDtoDeserializer.deserializeWorkspaceTemplate(UBUNTU_JDK8); - workspace - .getEnvironments() - .get("replaced_name") - .getMachines() - .get("dev-machine") - .getServers() - .put( - GWT_CODESERVER_NAME, - newDto(ServerConfigDto.class).withProtocol("http").withPort("9876")); - - testWorkspace = - testWorkspaceProvider.createWorkspace( - NameGenerator.generate("check-gwt-test", 4), testUser, 4, true, workspace); - - URL resource = getClass().getResource("/projects/web-gwt-java-simple"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - projectName, - ProjectTemplates.MAVEN_SPRING); - testCommandServiceClient.createCommand( - "cd /projects/" + projectName + " && mvn clean install -DskipTests", - BUILD_COMMAND, - CUSTOM, - testWorkspace.getId()); - - testCommandServiceClient.createCommand( - "mvn clean gwt:run-codeserver -f ${current.project.path} -Dgwt.bindAddress=0.0.0.0", - RUN_GWT_COMMAND, - CUSTOM, - testWorkspace.getId()); - } - - @Test - public void checkLaunchingCodeServer() throws Exception { - ide.open(testWorkspace); - - String expectedTextOnCodeServerPage = - "GWT Code Server\n" - + "Drag these two bookmarklets to your browser's bookmark bar:\n" - + "Dev Mode On Dev Mode Off\n" - + "Visit a web page that uses one of these modules:\n" - + "GWT\n" - + "Click \"Dev Mode On\" to start development mode."; - - projectExplorer.waitItem(projectName); - toastLoader.waitAppeareanceAndClosing(); - projectExplorer.waitAndSelectItem(projectName); - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, projectName, BUILD_COMMAND); - consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS, 600); - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, projectName, RUN_GWT_COMMAND); - consoles.waitExpectedTextIntoConsole("The code server is ready", APPLICATION_START_TIMEOUT_SEC); - - String url = - workspaceServiceClient - .getServerFromDevMachineBySymbolicName(testWorkspace.getId(), GWT_CODESERVER_NAME) - .getUrl() - .replace("tcp", "http"); - - // the timeout needs for ocp platform - WaitUtils.sleepQuietly(10); - seleniumWebDriver.get(url); - - new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) - .until( - ExpectedConditions.textToBePresentInElementLocated( - By.tagName("body"), expectedTextOnCodeServerPage)); - } - - @AfterClass - public void tearDown() { - testWorkspace.delete(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/AutocompleteCommandsEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/AutocompleteCommandsEditorTest.java deleted file mode 100644 index 958ad221d4a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/AutocompleteCommandsEditorTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.selenium.core.constant.TestBuildConstants.BUILD_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.MAVEN_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.BUILD_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsEditorLocator.COMMAND_LINE_EDITOR; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsEditorLocator.PREVIEW_URL_EDITOR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class AutocompleteCommandsEditorTest { - private static final String PROJ_NAME = NameGenerator.generate("AutocompleteCommandsEditor", 4); - private static final String PATH_TO_JAVA_FILE = - PROJ_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String MAVEN_COMMAND = "mvn compile -f ${current.project.path}"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject protected CommandsEditor commandsEditor; - @Inject private CommandsExplorer commandsExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), Paths.get(resource.toURI()), PROJ_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJ_NAME); - } - - @Test(priority = 1) - public void checkAutocompleteCommandLine() { - projectExplorer.waitItem(PROJ_NAME); - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JAVA_FILE); - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - createMavenCommand(); - commandsEditor.setFocusIntoTypeCommandsEditor(COMMAND_LINE_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - commandsEditor.typeTextIntoEditor(MAVEN_COMMAND); - commandsEditor.waitTextIntoEditor(MAVEN_COMMAND); - commandsEditor.typeTextIntoEditor(Keys.ENTER.toString()); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoEditor("echo "); - commandsEditor.typeTextIntoEditor("type"); - commandsEditor.launchAutocompleteAndWaitContainer(); - String[] autocompleteItems = {"${editor.current.project.", "${explorer.current.project."}; - for (String autocompleteItem : autocompleteItems) { - commandsEditor.waitTextIntoAutocompleteContainer(autocompleteItem); - } - commandsEditor.selectAutocompleteProposal("${explorer.current.project."); - commandsEditor.waitTextIntoDescriptionMacrosForm( - "Project type of the file currently selected in explorer"); - commandsEditor.enterAutocompleteProposal("${editor.current.project."); - commandsEditor.waitAutocompleteContainerIsClosed(); - commandsEditor.waitTextIntoEditor("${editor.current.project.type"); - commandsEditor.typeTextIntoEditor(Keys.ENTER.toString()); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoEditor("echo "); - commandsEditor.typeTextIntoEditor("na"); - commandsEditor.launchAutocompleteAndWaitContainer(); - commandsEditor.selectItemIntoAutocompleteAndPerformDoubleClick("${explorer.current.project."); - commandsEditor.waitAutocompleteContainerIsClosed(); - commandsEditor.waitTextIntoEditor("${explorer.current.project.name"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS, PREPARING_WS_TIMEOUT_SEC); - consoles.waitExpectedTextIntoConsole("maven"); - consoles.waitExpectedTextIntoConsole(PROJ_NAME); - } - - @Test(priority = 2) - public void checkAutocompletePreviewUrl() { - commandsEditor.typeTextIntoEditor(Keys.ESCAPE.toString()); - commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - checkItemsInAutocompleteContainer(); - waitTextInMacrosForm(); - - commandsEditor.closeAutocomplete(); - commandsEditor.waitActive(); - commandsEditor.deleteAllContent(); - launchAutocompleteAndWaitText(); - - commandsEditor.typeTextIntoEditor(Keys.ENTER.toString()); - commandsEditor.waitActive(); - typeTextInEditorAndLaunchAutocomplete(); - commandsEditor.waitTextIntoAutocompleteContainer("${server.wsagent/ws}"); - commandsEditor.selectItemIntoAutocompleteAndPerformDoubleClick("/ws}"); - commandsEditor.waitTextIntoEditor("${server.wsagent/ws}"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS); - consoles.waitExpectedTextIntoPreviewUrl("ws:"); - } - - @Test(priority = 3) - public void checkAutocompleteAfterSave() { - commandsEditor.waitTabCommandWithUnsavedStatus(MAVEN_NAME); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - commandsEditor.waitTabFileWithSavedStatus(MAVEN_NAME); - commandsEditor.setFocusIntoTypeCommandsEditor(COMMAND_LINE_EDITOR); - commandsEditor.setCursorToLine(2); - commandsEditor.selectLineAndDelete(); - commandsEditor.waitActive(); - commandsEditor.launchAutocompleteAndWaitContainer(); - commandsEditor.selectItemIntoAutocompleteAndPerformDoubleClick("${current.class.fqn}"); - commandsEditor.waitAutocompleteContainerIsClosed(); - commandsEditor.waitTextIntoEditor("${current.class.fqn}"); - } - - private void createMavenCommand() { - projectExplorer.waitAndSelectItem(PROJ_NAME); - projectExplorer.waitItemIsSelected(PROJ_NAME); - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(BUILD_GOAL); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(MAVEN_TYPE); - loader.waitOnClosed(); - commandsExplorer.waitCommandInExplorerByName(MAVEN_NAME); - commandsEditor.waitTabIsPresent(MAVEN_NAME); - } - - protected void checkItemsInAutocompleteContainer() { - commandsEditor.typeTextIntoEditor("server.t"); - commandsEditor.launchAutocompleteAndWaitContainer(); - - String[] autocompleteItems = { - "${server.terminal}", "${server.tomcat8-debug}", "${server.tomcat8}" - }; - - for (String autocompleteItem : autocompleteItems) { - commandsEditor.waitTextIntoAutocompleteContainer(autocompleteItem); - } - } - - protected void waitTextInMacrosForm() { - commandsEditor.selectAutocompleteProposal("omcat8}"); - commandsEditor.waitTextIntoDescriptionMacrosForm("Returns address of the tomcat8 server"); - } - - protected void launchAutocompleteAndWaitText() { - commandsEditor.typeTextIntoEditor("omcat8"); - commandsEditor.launchAutocompleteAndWaitContainer(); - commandsEditor.selectItemIntoAutocompleteAndPerformDoubleClick("-debug}"); - commandsEditor.waitTextIntoEditor("${server.tomcat8-debug}"); - } - - protected void typeTextInEditorAndLaunchAutocomplete() { - commandsEditor.typeTextIntoEditor("wsagent"); - commandsEditor.launchAutocompleteAndWaitContainer(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckBasicFunctionalityInCommandsExplorerTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckBasicFunctionalityInCommandsExplorerTest.java deleted file mode 100644 index 2c9ed8157cc..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckBasicFunctionalityInCommandsExplorerTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.BUILD_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Igor Ohrimenko */ -public class CheckBasicFunctionalityInCommandsExplorerTest { - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private Consoles consoles; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - String projectName = "commandsExplorerTestProject"; - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), Paths.get(resource.toURI()), projectName, MAVEN_SPRING.toString()); - - ide.open(testWorkspace); - projectExplorer.waitItem(projectName); - commandsExplorer.openCommandsExplorer(); - } - - @Test - public void shouldCreateDifferentTypesCommandsInDifferentGoals() { - commandsExplorer.waitCommandExplorerIsOpened(); - - commandsBuilder(BUILD_GOAL, MAVEN_TYPE); - commandsExplorer.checkCommandIsPresentInGoal(BUILD_GOAL, CommandsDefaultNames.MAVEN_NAME); - cloneAndRemoveCommandByName(BUILD_GOAL, CommandsDefaultNames.MAVEN_NAME); - - commandsBuilder(CommandsGoals.COMMON_GOAL, CommandsTypes.JAVA_TYPE); - commandsExplorer.checkCommandIsPresentInGoal( - CommandsGoals.COMMON_GOAL, CommandsDefaultNames.JAVA_NAME); - cloneAndRemoveCommandByName(CommandsGoals.COMMON_GOAL, CommandsDefaultNames.JAVA_NAME); - - commandsBuilder(CommandsGoals.DEBUG_GOAL, CommandsTypes.CUSTOM_TYPE); - commandsExplorer.checkCommandIsPresentInGoal( - CommandsGoals.DEBUG_GOAL, CommandsDefaultNames.CUSTOM_NAME); - cloneAndRemoveCommandByName(CommandsGoals.DEBUG_GOAL, CommandsDefaultNames.CUSTOM_NAME); - - commandsBuilder(CommandsGoals.RUN_GOAL, CommandsTypes.GWT_TYPE); - commandsExplorer.checkCommandIsPresentInGoal( - CommandsGoals.RUN_GOAL, CommandsDefaultNames.GWT_NAME); - cloneAndRemoveCommandByName(CommandsGoals.RUN_GOAL, CommandsDefaultNames.GWT_NAME); - - commandsBuilder(CommandsGoals.TEST_GOAL, CommandsTypes.GWT_SDM_FOR_CHE_TYPE); - commandsExplorer.checkCommandIsPresentInGoal( - CommandsGoals.TEST_GOAL, CommandsDefaultNames.GWT_SDM_FOR_CHE); - cloneAndRemoveCommandByName(CommandsGoals.TEST_GOAL, CommandsDefaultNames.GWT_SDM_FOR_CHE); - } - - @Test(priority = 1) - public void shouldCreateAndRunBuildCommand() { - commandsExplorer.waitCommandExplorerIsOpened(); - commandsBuilder(BUILD_GOAL, MAVEN_TYPE); - cloneAndRunByName(CommandsDefaultNames.MAVEN_NAME); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - } - - @Test(priority = 2) - public void shouldCreateAndRunCustomCommand() { - commandsExplorer.waitCommandExplorerIsOpened(); - commandsBuilder(CommandsGoals.RUN_GOAL, CommandsTypes.CUSTOM_TYPE); - cloneAndRunByName(CommandsDefaultNames.CUSTOM_NAME); - consoles.waitExpectedTextIntoConsole("hello"); - } - - private void commandsBuilder(String goalName, String commandType) { - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(goalName); - commandsExplorer.chooseCommandTypeInContextMenu(commandType); - commandsEditor.waitActive(); - commandsEditor.clickOnCancelCommandEditorButton(); - } - - private void cloneAndRemoveCommandByName(String goalName, String commandName) { - commandsExplorer.waitCommandInExplorerByName(commandName); - commandsExplorer.cloneCommandByName(commandName); - commandsExplorer.waitCommandInExplorerByName(commandName + " copy"); - commandsExplorer.checkCommandIsPresentInGoal(goalName, commandName + " copy"); - commandsExplorer.deleteCommandByName(commandName + " copy"); - commandsExplorer.waitRemoveCommandFromExplorerByName(commandName + " copy"); - commandsExplorer.checkCommandIsNotPresentInGoal(goalName, commandName + " copy"); - commandsExplorer.deleteCommandByName(commandName); - commandsExplorer.waitRemoveCommandFromExplorerByName(commandName); - commandsExplorer.checkCommandIsNotPresentInGoal(goalName, commandName); - } - - private void cloneAndRunByName(String commandName) { - commandsExplorer.waitCommandInExplorerByName(commandName); - commandsExplorer.cloneCommandByName(commandName); - commandsExplorer.waitCommandInExplorerByName(commandName + " copy"); - commandsExplorer.runCommandByName(commandName + " copy"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckIntelligenceCommandFromToolbarTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckIntelligenceCommandFromToolbarTest.java deleted file mode 100644 index 0302a38a245..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CheckIntelligenceCommandFromToolbarTest.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; -import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsToolbar; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedCondition; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckIntelligenceCommandFromToolbarTest { - protected static final String PROJECT_NAME = generate("project", 2); - protected String currentWindow; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject protected ProjectExplorer projectExplorer; - @Inject protected Consoles consoles; - @Inject private Menu menu; - @Inject protected Wizard wizard; - @Inject protected CommandsToolbar commandsToolbar; - @Inject protected SeleniumWebDriver seleniumWebDriver; - @Inject protected SeleniumWebDriverHelper seleniumWebDriverHelper; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - projectExplorer.waitProjectExplorer(); - consoles.waitExpectedTextIntoConsole("Initialized language server"); - currentWindow = seleniumWebDriver.getWindowHandle(); - } - - @Test - public void launchClonedWepAppTest() { - menu.runCommand(WORKSPACE, CREATE_PROJECT); - selectSampleProject(); - wizard.waitCreateProjectWizardFormIsClosed(); - projectExplorer.waitItem(PROJECT_NAME); - clickAndLaunchCommandInCommandsToolbar(); - waitExpectedTextIntoConsole(); - waitOnAvailablePreviewPage(currentWindow); - - seleniumWebDriver.navigate().refresh(); - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.waitProjectExplorer(); - - selectProcessByTabName(); - waitExpectedTextIntoConsole(); - checkTestAppByPreviewUrlAndReturnToIde(currentWindow); - } - - @Test( - priority = 1, - groups = {TestGroup.DOCKER}) - public void checkButtonsOnToolbarOnDocker() { - checkButtonsOnToolbar("This site can’t be reached"); - } - - @Test( - priority = 1, - groups = {TestGroup.OPENSHIFT, TestGroup.K8S}) - public void checkButtonsOnToolbarOnOpenshift() { - checkButtonsOnToolbar("Application is not available"); - } - - protected void checkButtonsOnToolbar(String expectedText) { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - commandsToolbar.clickExecStopBtn(); - - checkTestAppByPreviewUrlAndReturnToIde(currentWindow, expectedText); - commandsToolbar.clickExecRerunBtn(); - waitExpectedTextIntoConsole(); - consoles.clickOnPreviewUrl(); - - waitOnAvailablePreviewPage(currentWindow); - commandsToolbar.waitTimerValuePattern("\\d\\d:\\d\\d"); - commandsToolbar.waitNumOfProcessCounter(3); - - checkTestAppByPreviewButtonAndReturnToIde(currentWindow); - commandsToolbar.clickExecStopBtn(); - commandsToolbar.clickWithHoldAndLaunchDebuCmdFromList(PROJECT_NAME + ": debug"); - consoles.waitExpectedTextIntoConsole( - "Listening for transport dt_socket at address: 8000", LOADER_TIMEOUT_SEC); - waitExpectedTextIntoConsole(); - } - - protected void checkTestAppByPreviewUrlAndReturnToIde(String currentWindow) { - String expectedText = "Enter your name:"; - new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until( - (ExpectedCondition) - driver -> - clickOnPreviewUrlAndCheckTextIsPresentInPageBody(currentWindow, expectedText)); - } - - protected void checkTestAppByPreviewUrlAndReturnToIde(String currentWindow, String expectedText) { - new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until( - (ExpectedCondition) - driver -> - clickOnPreviewUrlAndCheckTextIsPresentInPageBody(currentWindow, expectedText)); - } - - protected void checkTestAppByPreviewButtonAndReturnToIde(String currentWindow) { - String expectedText = "Enter your name:"; - new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until( - (ExpectedCondition) - driver -> - clickOnPreviewButtonAndCheckTextIsPresentInPageBody( - currentWindow, expectedText)); - } - - protected boolean clickOnPreviewUrlAndCheckTextIsPresentInPageBody( - String currentWindow, String expectedText) { - consoles.clickOnPreviewUrl(); - return switchToOpenedWindowAndCheckTextIsPresent(currentWindow, expectedText); - } - - protected boolean clickOnPreviewButtonAndCheckTextIsPresentInPageBody( - String currentWindow, String expectedText) { - commandsToolbar.clickOnPreviewCommandBtnAndSelectUrl("dev-machine:tomcat8"); - return switchToOpenedWindowAndCheckTextIsPresent(currentWindow, expectedText); - } - - protected boolean switchToOpenedWindowAndCheckTextIsPresent( - String currentWindow, String expectedText) { - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - boolean result = getBodyText().contains(expectedText); - seleniumWebDriver.close(); - seleniumWebDriver.switchTo().window(currentWindow); - - return result; - } - - protected void waitOnAvailablePreviewPage(String currentWindow) { - String expectedTextOnPreviewPage = "Enter your name:"; - new WebDriverWait(seleniumWebDriver, ELEMENT_TIMEOUT_SEC) - .until( - (ExpectedCondition) - driver -> isPreviewPageAvailable(currentWindow, expectedTextOnPreviewPage)); - } - - protected Boolean isPreviewPageAvailable(String currentWindow, String expectedText) { - consoles.clickOnPreviewUrl(); - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - - if (getBodyText().contains(expectedText)) { - seleniumWebDriver.close(); - seleniumWebDriver.switchTo().window(currentWindow); - return true; - } - - seleniumWebDriver.close(); - seleniumWebDriver.switchTo().window(currentWindow); - return false; - } - - private WebElement getBody() { - return new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until(visibilityOfElementLocated(By.tagName("body"))); - } - - protected String getBodyText() { - return new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) - .until((ExpectedCondition) driver -> getBody().getText()); - } - - protected void selectSampleProject() { - wizard.selectProjectAndCreate(WEB_JAVA_SPRING, PROJECT_NAME); - } - - protected void clickAndLaunchCommandInCommandsToolbar() { - commandsToolbar.clickWithHoldAndLaunchCommandFromList(PROJECT_NAME + ": build and run"); - } - - protected void waitExpectedTextIntoConsole() { - consoles.waitExpectedTextIntoConsole(" Server startup in", EXPECTED_MESS_IN_CONSOLE_SEC); - } - - protected void selectProcessByTabName() { - consoles.selectProcessByTabName(PROJECT_NAME + ": build and run"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsEditorTest.java deleted file mode 100644 index 3552061ac78..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsEditorTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.JAVA_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.NEW_COMMAND_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.RUN_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.JAVA_TYPE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraiev */ -public class CommandsEditorTest { - private static final String PROJECT_NAME = NameGenerator.generate("CommandsEditor", 4); - private static final String NAME_COMMAND = "runApp"; - private static final String COMMAND = - "cd ${current.project.path}\n" - + "javac -classpath ${project.java.classpath} -sourcepath ${project.java.sourcepath} -d ${current.project.path} src/com/company/nba/MainClass.java\n" - + "java -classpath ${project.java.classpath}${project.java.output.dir} com.company.nba.MainClass"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles consoles; - @Inject private Loader loader; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/java-project-for-commands"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.PLAIN_JAVA); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkCommandsEditor() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - - // open the 'Commands Explorer' and choose java command - loader.waitOnClosed(); - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(COMMON_GOAL); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(JAVA_TYPE); - loader.waitOnClosed(); - commandsExplorer.waitCommandInExplorerByName(JAVA_NAME); - commandsEditor.waitActive(); - commandsEditor.waitTabFileWithSavedStatus(JAVA_NAME); - commandsEditor.clickOnCancelCommandEditorButton(); - commandsEditor.waitTabIsNotPresent(JAVA_NAME); - - // edit name of the java command into editor - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.selectCommandByName(JAVA_NAME); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoNameCommandField(NAME_COMMAND); - commandsEditor.waitTextIntoNameCommandField(NAME_COMMAND); - commandsEditor.waitTabCommandWithUnsavedStatus(JAVA_NAME); - - // edit a content of command in the command editor - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - commandsEditor.typeTextIntoEditor(COMMAND); - commandsEditor.waitTextIntoEditor(COMMAND); - - // change the goal of command into editor - commandsEditor.selectGoalNameIntoCommandEditor(RUN_GOAL); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - editor.waitTabFileWithSavedStatus(NAME_COMMAND); - commandsExplorer.checkCommandIsPresentInGoal(RUN_GOAL, NAME_COMMAND); - commandsExplorer.checkCommandIsNotPresentInGoal(COMMON_GOAL, NAME_COMMAND); - commandsEditor.selectGoalNameIntoCommandEditor(NEW_COMMAND_GOAL); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("Custom"); - askForValueDialog.clickOkBtn(); - commandsEditor.waitTextIntoGoalField("Custom"); - commandsEditor.waitTabCommandWithUnsavedStatus(NAME_COMMAND); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - editor.waitTabFileWithSavedStatus(NAME_COMMAND); - commandsExplorer.checkCommandIsNotPresentInGoal(RUN_GOAL, NAME_COMMAND); - commandsExplorer.checkCommandIsPresentInGoal("Custom", NAME_COMMAND); - - // run application from commands editor - commandsEditor.clickOnRunButton(); - loader.waitOnClosed(); - consoles.waitExpectedTextIntoConsole("I love this game!"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsPaletteTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsPaletteTest.java deleted file mode 100644 index 1f96509ee6a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/CommandsPaletteTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.selenium.core.constant.TestBuildConstants.BUILD_SUCCESS; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.CUSTOM_TYPE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Sergey Skorik */ -public class CommandsPaletteTest { - protected static final String PROJECT_NAME = "project"; - protected static final String COMMAND = PROJECT_NAME + ": build"; - private static final String customCommandName = "newCustom"; - - @Inject private TestWorkspace testWorkspace; - @Inject protected CommandsPalette commandsPalette; - @Inject private ProjectExplorer projectExplorer; - @Inject protected Consoles consoles; - @Inject private Menu menu; - @Inject private CommandsEditor commandsEditor; - @Inject private CommandsExplorer commandsExplorer; - @Inject private Loader loader; - @Inject private AskDialog askDialog; - @Inject private Ide ide; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject protected Wizard wizard; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void commandPaletteTest() { - // Create a test project - projectExplorer.waitProjectExplorer(); - menu.runCommand(WORKSPACE, CREATE_PROJECT); - selectSampleProject(); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.waitJDTLSProjectResolveFinishedMessage(); - - // Open and close COP by hot keys - commandsPalette.openCommandPaletteByHotKeys(); - commandsPalette.closeCommandPalette(); - - // Start a command by Enter key - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByEnterKey(COMMAND); - consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS, EXPECTED_MESS_IN_CONSOLE_SEC); - - // Start a command by double click - commandsPalette.openCommandPalette(); - startCommandByDoubleClick(); - - // Start commands from list after search - commandsPalette.openCommandPalette(); - startCommandFromSearchList(); - - // Select commands from keyboard navigation (arrow buttons and "Enter" button) - commandsPalette.openCommandPalette(); - selectCommandByKeyboardNavigation(); - } - - @Test(priority = 1) - public void newCommandTest() { - projectExplorer.waitProjectExplorer(); - commandsBuilder(COMMON_GOAL, CUSTOM_TYPE); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(customCommandName); - consoles.waitExpectedTextIntoConsole("hello", EXPECTED_MESS_IN_CONSOLE_SEC); - commandDelete(customCommandName); - commandsPalette.openCommandPalette(); - commandsPalette.commandIsNotExists(customCommandName); - } - - private void commandsBuilder(String goalName, String commandType) { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - loader.waitOnClosed(); - commandsExplorer.clickAddCommandButton(goalName); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(commandType); - loader.waitOnClosed(); - commandsEditor.waitActive(); - commandsEditor.clickOnCancelCommandEditorButton(); - loader.waitOnClosed(); - } - - private void commandDelete(String commandName) { - loader.waitOnClosed(); - commandsExplorer.clickOnRemoveButtonInExplorerByName(commandName); - askDialog.waitFormToOpen(); - askDialog.confirmAndWaitClosed(); - loader.waitOnClosed(); - commandsExplorer.waitRemoveCommandFromExplorerByName(commandName); - } - - protected void selectSampleProject() { - wizard.selectProjectAndCreate(WEB_JAVA_SPRING, PROJECT_NAME); - } - - protected void startCommandByDoubleClick() { - commandsPalette.startCommandByDoubleClick(PROJECT_NAME + ": debug"); - consoles.waitExpectedTextIntoConsole("Server startup in", EXPECTED_MESS_IN_CONSOLE_SEC); - } - - protected void startCommandFromSearchList() { - commandsPalette.searchAndStartCommand("tomcat"); - commandsPalette.startCommandByDoubleClick(PROJECT_NAME + ": stop"); - consoles.waitTabNameProcessIsPresent(PROJECT_NAME + ": stop tomcat"); - } - - protected void selectCommandByKeyboardNavigation() { - commandsPalette.moveAndStartCommand(CommandsPalette.MoveTypes.DOWN, 3); - consoles.waitTabNameProcessIsPresent(PROJECT_NAME + ": run tomcat"); - consoles.waitExpectedTextIntoConsole("Server startup in", EXPECTED_MESS_IN_CONSOLE_SEC); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/MacrosCommandsEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/MacrosCommandsEditorTest.java deleted file mode 100644 index 56dce670971..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/MacrosCommandsEditorTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.JAVA_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.RUN_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.JAVA_TYPE; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsEditorLocator.COMMAND_LINE_EDITOR; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsEditorLocator.PREVIEW_URL_EDITOR; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsMacrosLinkLocator.EDITOR_MACROS_LINK; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsMacrosLinkLocator.PREVIEW_MACROS_LINK; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraiev */ -public class MacrosCommandsEditorTest { - private static final String PROJECT_NAME = generate("MacrosCommandsEditorTest-", 4); - private static final String PATH_TO_FILE = PROJECT_NAME + "/src/Main.java"; - private static final String PATH_TO_ROOT_FOLDER = "/projects/" + PROJECT_NAME; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private CommandsExplorer commandsExplorer; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/java-project-with-additional-source-folder"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test(priority = 1) - public void checkCommandMacrosIntoCommandLine() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitItem(PATH_TO_FILE); - projectExplorer.openItemByPath(PATH_TO_FILE); - createNewJavaCommand(); - commandsEditor.selectMacroLinkInCommandsEditor(EDITOR_MACROS_LINK); - commandsEditor.cancelFormInEditorByEscape(); - commandsEditor.waitCommandMacrosIsClosed(); - commandsEditor.setFocusIntoTypeCommandsEditor(COMMAND_LINE_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.typeTextIntoEditor(Keys.ENTER.toString()); - commandsEditor.typeTextIntoEditor(Keys.ARROW_UP.toString()); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoEditor("echo "); - commandsEditor.selectMacroLinkInCommandsEditor(EDITOR_MACROS_LINK); - commandsEditor.typeTextIntoSearchMacroField("rel"); - commandsEditor.waitTextIntoSearchMacroField("rel"); - - String[] macrosItems = { - "${current.project.relpath}", - "${editor.current.file.relpath}", - "${explorer.current.file.relpath}", - "Path relative to the /projects folder to the selected file in Editor", - "Path relative to the /projects folder in project tree" - }; - - for (String macrosItem : macrosItems) { - commandsEditor.waitTextIntoMacrosContainer(macrosItem); - } - commandsEditor.enterMacroCommandByEnter("${explorer.current.file.relpath}"); - commandsEditor.waitTextIntoEditor("echo ${explorer.current.file.relpath}"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole("/" + PROJECT_NAME + "/src/Main.java"); - commandsEditor.setCursorToLine(1); - commandsEditor.selectLineAndDelete(); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoEditor("echo "); - commandsEditor.selectMacroLinkInCommandsEditor(EDITOR_MACROS_LINK); - commandsEditor.selectMacroCommand("${current.class.fqn}"); - commandsEditor.typeTextIntoEditor(Keys.ARROW_DOWN.toString()); - commandsEditor.typeTextIntoEditor(Keys.SPACE.toString()); - commandsEditor.enterMacroCommandByDoubleClick("${current.project.path}"); - commandsEditor.waitTextIntoEditor("echo ${current.project.path}"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole(PATH_TO_ROOT_FOLDER); - } - - @Test(priority = 2) - public void checkCommandMacrosIntoPreviewUrl() { - commandsEditor.cancelFormInEditorByEscape(); - commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.waitActive(); - commandsEditor.selectMacroLinkInCommandsEditor(PREVIEW_MACROS_LINK); - commandsEditor.typeTextIntoSearchMacroField("server."); - commandsEditor.waitTextIntoSearchMacroField("server."); - - for (String macrosItem : getArraytMacrosItems()) { - commandsEditor.waitTextIntoMacrosContainer(macrosItem); - } - - commandsEditor.enterMacroCommandByEnter("${server.wsagent/http}"); - commandsEditor.waitTextIntoEditor("${server.wsagent/http"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoPreviewUrl("http"); - commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.selectLineAndDelete(); - commandsEditor.waitActive(); - commandsEditor.selectMacroLinkInCommandsEditor(PREVIEW_MACROS_LINK); - commandsEditor.selectMacroCommand("${server.wsagent/http}"); - commandsEditor.typeTextIntoEditor(Keys.ARROW_UP.toString()); - commandsEditor.typeTextIntoEditor(Keys.SPACE.toString()); - commandsEditor.enterMacroCommandByDoubleClick("${server.wsagent/http}"); - commandsEditor.waitTextIntoEditor("${server.wsagent/http}"); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoPreviewUrl("http"); - } - - private void createNewJavaCommand() { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(RUN_GOAL); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(JAVA_TYPE); - loader.waitOnClosed(); - commandsExplorer.waitCommandInExplorerByName(JAVA_NAME); - commandsEditor.waitTabIsPresent(JAVA_NAME); - } - - protected String[] getArraytMacrosItems() { - String[] macrosItems = { - "${server.codeserver}", - "${server.exec-agent/http}", - "${server.exec-agent/ws}", - "${server.terminal}", - "${server.tomcat8-debug}", - "${server.tomcat8}", - "${server.wsagent/http}", - "${server.wsagent/ws}" - }; - return macrosItems; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/PreviewUrlIntoCommandsEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/PreviewUrlIntoCommandsEditorTest.java deleted file mode 100644 index 33ff9c86d12..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/intelligencecommand/PreviewUrlIntoCommandsEditorTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.intelligencecommand; - -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.MAVEN_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE; -import static org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor.CommandsEditorLocator.PREVIEW_URL_EDITOR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.By; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class PreviewUrlIntoCommandsEditorTest { - private static final String PROJ_NAME = NameGenerator.generate("PeviewUrlCommandsEditor", 4); - private static final String NAME_COMM = "testCommand"; - private static final String PREVIEW_URL = "https://www.eclipse.org/che/getting-started/cloud/"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles consoles; - @Inject private Loader loader; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private CodenvyEditor editor; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), Paths.get(resource.toURI()), PROJ_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJ_NAME); - } - - @Test - public void checkSavePreviewUrlIntoCommand() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJ_NAME); - String currentWindow = seleniumWebDriver.getWindowHandle(); - - // create new preview url - createMavenCommand(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.selectCommandByName(MAVEN_NAME); - commandsEditor.waitActive(); - commandsEditor.typeTextIntoNameCommandField(NAME_COMM); - commandsEditor.waitTextIntoNameCommandField(NAME_COMM); - commandsEditor.setFocusIntoTypeCommandsEditor(PREVIEW_URL_EDITOR); - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - commandsEditor.typeTextIntoEditor(PREVIEW_URL); - commandsEditor.waitTextIntoEditor(PREVIEW_URL); - commandsEditor.waitTabCommandWithUnsavedStatus(MAVEN_NAME); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - editor.waitTabFileWithSavedStatus(NAME_COMM); - - // check preview url after run - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - consoles.waitPreviewUrlIsPresent(); - consoles.clickOnPreviewUrl(); - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - checkPageOpenedByPreviewUrl(); - } - - private void createMavenCommand() { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(COMMON_GOAL); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(MAVEN_TYPE); - loader.waitOnClosed(); - commandsExplorer.waitCommandInExplorerByName(MAVEN_NAME); - } - - private void checkPageOpenedByPreviewUrl() { - new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC) - .until( - ExpectedConditions.visibilityOfElementLocated( - By.xpath("//nav[@class='menu-desktop']//a[text()='Technology']"))); - new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC) - .until( - ExpectedConditions.visibilityOfElementLocated( - By.xpath("//nav[@class='menu-desktop']//a[text()='Docs']"))); - new WebDriverWait(seleniumWebDriver, TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC) - .until( - ExpectedConditions.visibilityOfElementLocated( - By.xpath("//nav[@class='menu-desktop']//a[text()='Get Started']"))); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java deleted file mode 100644 index 290e4b26eae..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ApacheCamelFileEditingTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.CONSOLE_JAVA_SIMPLE; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.APACHE_CAMEL; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class ApacheCamelFileEditingTest { - - private static final String PROJECT_NAME = "project-for-camel-ls"; - private static final String CAMEL_FILE_NAME = "camel.xml"; - private static final String PATH_TO_CAMEL_FILE = PROJECT_NAME + "/" + CAMEL_FILE_NAME; - private static final String LS_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.camel.server.languageserver'"; - private static final String[] EXPECTED_GO_TO_SYMBOL_ALTERNATIVES = { - "symbols (2)", "" - }; - - @InjectTestWorkspace(template = APACHE_CAMEL) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private AssistantFindPanel assistantFindPanel; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void checkLanguageServerInitialized() throws Exception { - URL resource = ApacheCamelFileEditingTest.class.getResource("/projects/project-for-camel-ls"); - - // check Apache Camel language server initialized - consoles.selectProcessByTabName("dev-machine"); - consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); - - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, CONSOLE_JAVA_SIMPLE); - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_CAMEL_FILE); - editor.waitTabIsPresent(CAMEL_FILE_NAME); - } - - @Test(priority = 1) - public void checkAutocompleteFeature() { - editor.selectTabByName(CAMEL_FILE_NAME); - - editor.goToPosition(50, 21); - - editor.launchAutocomplete(); - editor.waitTextIntoEditor("timer:timerName"); - - // launch autocomplete feature, select proposal and check expected text in the Editor - editor.typeTextIntoEditor("?"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("fixedRate "); - editor.enterAutocompleteProposal("fixedRate "); - editor.waitTextIntoEditor("timer:timerName?fixedRate=false"); - - editor.typeTextIntoEditor("&"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("exchangePattern "); - editor.enterAutocompleteProposal("exchangePattern "); - editor.waitTextIntoEditor("timer:timerName?fixedRate=false&exchangePattern="); - - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("InOnly"); - editor.enterAutocompleteProposal("InOnly"); - editor.waitTextIntoEditor("timer:timerName?fixedRate=false&exchangePattern=InOnly"); - } - - @Test(priority = 1, groups = UNDER_REPAIR) - public void checkHoverFeature() { - // move cursor on text and check expected text in hover popup - editor.moveCursorToText("velocity"); - - try { - editor.waitTextInHoverPopup("Transforms the message using a Velocity template."); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/10674", ex); - } - } - - @Test(priority = 1) - public void checkGoToSymbolFeature() { - editor.selectTabByName(CAMEL_FILE_NAME); - editor.waitActive(); - - // open and close 'Go To Symbol' panel by keyboard - editor.enterCtrlF12(); - assistantFindPanel.waitForm(); - editor.cancelFormInEditorByEscape(); - assistantFindPanel.waitFormIsClosed(); - - // select the item by click - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.waitAllNodes(EXPECTED_GO_TO_SYMBOL_ALTERNATIVES); - assistantFindPanel.clickOnActionNodeWithTextContains("symbols (2)"); - assistantFindPanel.waitFormIsClosed(); - editor.waitCursorPosition(49, 12); - - // select the item by keyboard - editor.enterCtrlF12(); - assistantFindPanel.waitForm(); - editor.pressArrowDown(); - editor.pressArrowDown(); - assistantFindPanel.waitActionNodeSelection(""); - editor.pressEnter(); - assistantFindPanel.waitFormIsClosed(); - editor.waitCursorPosition(63, 12); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ClangFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ClangFileEditingTest.java deleted file mode 100644 index b0b107cdeab..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/ClangFileEditingTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_DEFINITION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.LS_RENAME; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.CPP; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FORMAT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.openqa.selenium.Keys.F4; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class ClangFileEditingTest { - private static final String PROJECT_NAME = "console-cpp-simple"; - private static final String CPP_FILE_NAME = "hello.cc"; - private static final String H_FILE_NAME = "iseven.h"; - private static final String PATH_TO_CPP_FILE = PROJECT_NAME + "/" + CPP_FILE_NAME; - private static final String LS_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.clangd.languageserver'"; - - @InjectTestWorkspace(template = WorkspaceTemplate.ECLIPSE_CPP_GCC) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = ClangFileEditingTest.this.getClass().getResource("/projects/console-cpp-simple"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, CPP); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_CPP_FILE); - editor.waitActive(WIDGET_TIMEOUT_SEC); - editor.waitTabIsPresent(CPP_FILE_NAME); - } - - @Test - public void checkCodeValidation() { - projectExplorer.openItemByPath(PATH_TO_CPP_FILE); - editor.waitActive(); - - // make error in code and check error marker with message - editor.waitAllMarkersInvisibility(ERROR); - editor.goToCursorPositionVisible(14, 1); - editor.typeTextIntoEditor("c"); - editor.waitMarkerInPosition(ERROR, 14); - editor.moveCursorToText("cint"); - editor.waitTextInHoverPopup("unknown type name 'cint'"); - - // restore content and check error marker invisibility - editor.goToCursorPositionVisible(14, 1); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.waitAllMarkersInvisibility(ERROR); - - // comment line by Ctrl+'/' buttons - projectExplorer.openItemByPath(PROJECT_NAME + "/hello.cpp"); - editor.waitActive(); - - editor.goToPosition(21, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor("// return 0;"); - - // uncomment line by Ctrl+'/' buttons - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor(" return 0;"); - - // check Signature Help feature - editor.selectTabByName(CPP_FILE_NAME); - editor.goToPosition(17, 1); - editor.deleteCurrentLineAndInsertNew(); - editor.typeTextIntoEditor(" std::abs("); - - editor.waitSignaturesContainer(); - editor.waitProposalIntoSignaturesContainer("abs(int __x) -> int"); - editor.closeSignaturesContainer(); - editor.waitSignaturesContainerIsClosed(); - - editor.deleteCurrentLineAndInsertNew(); - } - - @Test - public void checkAutocompleteFeature() { - projectExplorer.openItemByPath(PATH_TO_CPP_FILE); - editor.waitActive(); - - // check contents of autocomplete container - editor.goToPosition(17, 1); - editor.deleteCurrentLineAndInsertNew(); - editor.typeTextIntoEditor("std::cou"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("cout ostream"); - editor.waitProposalIntoAutocompleteContainer("wcout wostream"); - editor.closeAutocomplete(); - - editor.deleteCurrentLineAndInsertNew(); - } - - @Test - public void checkFindDefinitionFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/hello.cpp"); - editor.waitActive(); - - // check Find Definition feature from Assistant menu - editor.goToPosition(20, 20); - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitTabIsPresent(H_FILE_NAME); - editor.clickOnCloseFileIcon(H_FILE_NAME); - - // check Find Definition feature by pressing F4 - editor.selectTabByName("hello.cpp"); - editor.goToPosition(20, 20); - editor.typeTextIntoEditor(F4.toString()); - editor.waitTabIsPresent(H_FILE_NAME); - } - - @Test - public void checkRenameFieldFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/iseven.h"); - editor.waitActive(); - - editor.goToCursorPositionVisible(15, 18); - menu.runCommand(ASSISTANT, REFACTORING, LS_RENAME); - editor.doRenamingByLanguageServerField("args"); - editor.waitTextIntoEditor("args"); - - editor.waitAllMarkersInvisibility(ERROR); - } - - @Test - public void checkSelectedCodeFormatFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/hello.cpp"); - editor.waitActive(); - - // check selected line formatting - editor.selectLines(18, 1); - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FORMAT); - editor.waitTextIntoEditor(" int x = 4;"); - } - - @Test - public void checkFormatCodeFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/iseven.cpp"); - editor.waitActive(); - - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FORMAT); - editor.waitTextIntoEditor("int isEven(int x) { return x % 2 == 0; }"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/GolangFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/GolangFileEditingTest.java deleted file mode 100644 index 8393f54a22c..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/GolangFileEditingTest.java +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_DEFINITION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_PROJECT_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_REFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.RENAME; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.UBUNTU_GO; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FORMAT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.openqa.selenium.Keys.ARROW_LEFT; -import static org.openqa.selenium.Keys.F4; -import static org.testng.Assert.fail; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FindReferencesConsoleTab; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.testng.internal.collections.Pair; - -/** @author Skoryk Serhii */ -public class GolangFileEditingTest { - - private static final String PROJECT_NAME = "desktop-go-simple"; - private static final String GO_FILE_NAME = "main.go"; - private static final String FORMATTED_CODE = - "package main\n" - + "\n" - + "import (\n" - + " \"fmt\"\n" - + " \"math\"\n" - + ")\n" - + "\n" - + "func print() {\n" - + " fmt.Printf(\"Hello, world. Sqrt(2) = %v\\n\", math.Sqrt(2))\n" - + "}"; - - private static final String REFERENCES_NOTHING_TO_SHOW_TEXT = "Nothing to show"; - - private static final String[] REFERENCES_EXPECTED_TEXT = { - "/desktop-go-simple/towers.go\nFrom:19:5 To:19:10", - "/desktop-go-simple/towers.go\nFrom:23:3 To:23:8", - "/desktop-go-simple/towers.go\nFrom:24:72 To:24:77", - "/desktop-go-simple/towers.go\nFrom:29:2 To:29:7", - "/desktop-go-simple/towers.go\nFrom:30:72 To:30:77" - }; - - private static final String[] GO_TO_SYMBOL_EXPECTED_TEXT = { - "mainsymbols (4)", "count", "hanoi", "main" - }; - - /** It is Map[node-name, Pair[tab-name, line-number]] */ - private static final ImmutableMap> PROJECT_SYMBOL_EXPECTED_TEXT = - ImmutableMap.of( - "print/desktop-go-simple/format.go", Pair.of("format.go", 23), - "Print/desktop-go-simple/print.go", Pair.of("print.go", 24)); - - private String textFirstNode; - private String textSecondNode; - - private List expectedProposals = ImmutableList.of("Print", "Println", "Printf"); - - @InjectTestWorkspace(template = UBUNTU_GO) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject protected Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private FindReferencesConsoleTab findReferencesConsoleTab; - @Inject private AssistantFindPanel assistantFindPanel; - - @BeforeClass - public void setUp() throws Exception { - URL resource = ApacheCamelFileEditingTest.class.getResource("/projects/go-simple"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.GO); - - ide.open(workspace); - } - - @Test - public void checkLanguageServerInitialized() { - projectExplorer.expandPathInProjectExplorerAndOpenFile(PROJECT_NAME, GO_FILE_NAME); - editor.waitTabIsPresent(GO_FILE_NAME); - - // check Golang language sever initialized - consoles.selectProcessByTabName("dev-machine"); - waitExpectedTextIntoConsole(); - } - - @Test(priority = 1) - public void checkAutocompleteFeature() { - editor.selectTabByName(GO_FILE_NAME); - - // launch autocomplete feature and check proposals list - editor.goToPosition(21, 58); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("fmt."); - editor.launchAutocompleteAndWaitContainer(); - - editor.waitProposalDocumentationHTML("

No documentation found.

\n"); - editor.waitProposalsIntoAutocompleteContainer(expectedProposals); - - editor.deleteCurrentLine(); - editor.waitAllMarkersInvisibility(ERROR); - } - - @Test(priority = 1) - public void checkCodeValidationFeature() { - editor.selectTabByName(GO_FILE_NAME); - - // make error in code and check error marker with message - editor.waitAllMarkersInvisibility(ERROR); - editor.goToCursorPositionVisible(13, 1); - editor.typeTextIntoEditor("p"); - editor.waitMarkerInPosition(ERROR, 13); - editor.moveToMarkerAndWaitAssistContent(ERROR); - editor.waitTextIntoAnnotationAssist("expected 'package', found 'IDENT' ppackage"); - - // restore content and check error marker invisibility - editor.goToCursorPositionVisible(13, 1); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.waitAllMarkersInvisibility(ERROR); - - // check code line commenting - editor.goToCursorPositionVisible(13, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor("//package main"); - - // check code line uncommenting - editor.launchCommentCodeFeature(); - editor.waitTextNotPresentIntoEditor("//package main"); - } - - @Test(priority = 1) - public void checkFormatCodeFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/format.go"); - editor.waitTabIsPresent("format.go"); - - // format code by Format feature from context menu - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FORMAT); - editor.waitTextIntoEditor(FORMATTED_CODE); - } - - @Test(priority = 1) - public void checkFindDefinitionFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitTabIsPresent("towers.go"); - - // check Find Definition feature from Assistant menu - editor.goToPosition(24, 8); - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitTabIsPresent("print.go"); - editor.waitCursorPosition(24, 6); - editor.clickOnCloseFileIcon("print.go"); - - // check Find Definition feature by pressing F4 - editor.selectTabByName("towers.go"); - editor.goToPosition(24, 8); - editor.typeTextIntoEditor(F4.toString()); - editor.waitTabIsPresent("print.go"); - editor.waitCursorPosition(24, 6); - editor.clickOnCloseFileIcon("print.go"); - } - - @Test(priority = 1) - public void checkFindReferencesFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitActive(); - - // check the LS info panel when is 'Nothing to show' - editor.goToPosition(12, 1); - menu.runCommand(ASSISTANT, FIND_REFERENCES); - findReferencesConsoleTab.waitExpectedTextInLsPanel(REFERENCES_NOTHING_TO_SHOW_TEXT); - - // check element in the editor - editor.goToPosition(19, 5); - menu.runCommand(ASSISTANT, FIND_REFERENCES); - findReferencesConsoleTab.waitAllReferencesWithText( - "/desktop-go-simple/towers.go\nFrom:24:72 To:24:77"); - findReferencesConsoleTab.doubleClickOnReference("From:24:72 To:24:77"); - editor.waitSpecifiedValueForLineAndChar(24, 77); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(24, 72); - editor.waitTextElementsActiveLine("count"); - - // check the references expected text - editor.goToPosition(19, 5); - menu.runCommand(ASSISTANT, FIND_REFERENCES); - findReferencesConsoleTab.waitAllReferencesWithText(REFERENCES_EXPECTED_TEXT); - } - - @Test(priority = 1) - public void checkSignatureHelpFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.goToPosition(27, 1); - editor.typeTextIntoEditor(" hanoi("); - - editor.waitSignaturesContainer(); - editor.waitProposalIntoSignaturesContainer("hanoi(n int, a, b, c string)"); - editor.closeSignaturesContainer(); - editor.waitSignaturesContainerIsClosed(); - - editor.deleteCurrentLineAndInsertNew(); - } - - @Test(priority = 1) - public void checkGoToSymbolFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitActive(); - - // open and close 'Go To Symbol' panel by keyboard - editor.enterCtrlF12(); - assistantFindPanel.waitForm(); - editor.cancelFormInEditorByEscape(); - assistantFindPanel.waitFormIsClosed(); - - // select item from 'Go To Symbol' panel - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.waitAllNodes(GO_TO_SYMBOL_EXPECTED_TEXT); - assistantFindPanel.clickOnActionNodeWithTextContains("count"); - assistantFindPanel.waitFormIsClosed(); - editor.waitCursorPosition(19, 5); - - // navigation to nodes by keyboard - editor.enterCtrlF12(); - assistantFindPanel.waitForm(); - editor.pressArrowDown(); - editor.pressArrowDown(); - assistantFindPanel.waitActionNodeSelection("count"); - editor.pressArrowUp(); - assistantFindPanel.waitActionNodeSelection("main" + "symbols (4)"); - editor.pressEnter(); - assistantFindPanel.waitFormIsClosed(); - editor.waitCursorPosition(13, 1); - - // find and select item from 'Go To Symbol' panel - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.typeToInputField("ha"); - assistantFindPanel.waitNode("hanoi"); - assistantFindPanel.clickOnActionNodeWithTextContains("hanoi"); - assistantFindPanel.waitFormIsClosed(); - editor.waitCursorPosition(21, 1); - } - - @Test(priority = 1) - public void checkFindProjectSymbolFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitActive(); - - // check item in the find panel - menu.runCommand(ASSISTANT, FIND_PROJECT_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.clickOnInputField(); - assistantFindPanel.typeToInputField("hanoi"); - assistantFindPanel.waitAllNodes("hanoi/desktop-go-simple/towers.go"); - assistantFindPanel.typeToInputField("print"); - assistantFindPanel.waitAllNodes(PROJECT_SYMBOL_EXPECTED_TEXT.keySet()); - - // select item in the find panel by clicking on node - assistantFindPanel.clickOnActionNodeWithTextContains("print/desktop-go-simple/format.go"); - assistantFindPanel.waitFormIsClosed(); - editor.waitTabVisibilityAndCheckFocus("format.go"); - editor.waitCursorPosition(23, 1); - - // select item in the find panel by keyboard - openFindPanelAndPrintInputTetx("print"); - - // go to instantly - assistantFindPanel.waitActionNodeSelection(textFirstNode); - editor.pressEnter(); - assistantFindPanel.waitFormIsClosed(); - editor.waitTabVisibilityAndCheckFocus(PROJECT_SYMBOL_EXPECTED_TEXT.get(textFirstNode).first()); - editor.waitCursorPosition(PROJECT_SYMBOL_EXPECTED_TEXT.get(textFirstNode).second(), 1); - - // go to from second node - openFindPanelAndPrintInputTetx("print"); - editor.pressArrowDown(); - https: // github.com/eclipse/che/issues/10524 - assistantFindPanel.waitActionNodeSelection(textSecondNode); - editor.pressEnter(); - assistantFindPanel.waitFormIsClosed(); - editor.waitTabVisibilityAndCheckFocus(PROJECT_SYMBOL_EXPECTED_TEXT.get(textSecondNode).first()); - editor.waitCursorPosition(PROJECT_SYMBOL_EXPECTED_TEXT.get(textSecondNode).second(), 1); - } - - @Test(priority = 1, groups = UNDER_REPAIR) - public void checkHoverFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitTabIsPresent("towers.go"); - - editor.moveCursorToText("COLOR_YELLOW"); - - try { - editor.waitTextInHoverPopup("const COLOR_YELLOW string = \"\\x1b[33;1m \""); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/10674", ex); - } - } - - @Test(priority = 2) - public void checkRenameFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.go"); - editor.waitTabIsPresent("towers.go"); - editor.goToCursorPositionVisible(22, 5); - - // has to be changed when https://github.com/eclipse/che/issues/11907 resolved - menu.runCommand(ASSISTANT, REFACTORING); - menu.waitCommandIsNotPresentInMenu(RENAME); - } - - private void openFindPanelAndPrintInputTetx(String inputText) { - editor.selectTabByName("towers.go"); - menu.runCommand(ASSISTANT, FIND_PROJECT_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.typeToInputField(inputText); - assistantFindPanel.waitAllNodes(PROJECT_SYMBOL_EXPECTED_TEXT.keySet()); - - textFirstNode = assistantFindPanel.getActionNodeText(0); - textSecondNode = assistantFindPanel.getActionNodeText(1); - } - - protected void waitExpectedTextIntoConsole() { - String lsInitMessage = "Finished running tool: /usr/local/go/bin/go build"; - consoles.waitExpectedTextIntoConsole(lsInitMessage); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/JsonFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/JsonFileEditingTest.java deleted file mode 100644 index a00a63e117b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/JsonFileEditingTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.WIDGET_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.NODEJS_WITH_JSON_LS; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.NODEJS_HELLO_WORLD; -import static org.openqa.selenium.Keys.BACK_SPACE; -import static org.openqa.selenium.Keys.ENTER; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -@Test(groups = UNDER_REPAIR) -public class JsonFileEditingTest { - - private static final String PROJECT_NAME = "nodejs-hello-world"; - private static final String JSON_FILE_NAME = "package.json"; - private static final String PATH_TO_JSON_FILE = PROJECT_NAME + "/" + JSON_FILE_NAME; - private static final String NEW_OBJECT = "\"newObj\":[1,2,3],"; - private static final String LS_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.json.languageserver"; - - private String[] symbols = { - "namesymbols (12)", - "version", - "description", - "main", - "scripts", - "test", - "author", - "license", - "dependencies", - "express" - }; - - @InjectTestWorkspace(template = NODEJS_WITH_JSON_LS) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject protected Wizard wizard; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private Loader loader; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskForValueDialog askForValueDialog; - @Inject private AssistantFindPanel assistantFindPanel; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - createProjectFromWizard(); - loader.waitOnClosed(); - } - - @Test - public void checkLanguageServerInitialized() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_JSON_FILE); - editor.waitActive(WIDGET_TIMEOUT_SEC); - editor.waitTabIsPresent(JSON_FILE_NAME); - - // check JSON language server initialized - consoles.selectProcessByTabName("dev-machine"); - - try { - consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/12472"); - } - } - - @Test(priority = 1) - public void checkCodeValidationFeature() { - editor.selectTabByName(JSON_FILE_NAME); - - // delete comma after bracket and check error marker with message - editor.goToCursorPositionVisible(8, 5); - editor.typeTextIntoEditor(BACK_SPACE.toString()); - editor.waitMarkerInPosition(ERROR, 9); - editor.moveToMarkerAndWaitAssistContent(ERROR); - editor.waitTextIntoAnnotationAssist("Expected '(end)' and instead saw ':'."); - - // move cursor on text and check expected text in hover popup - editor.moveCursorToText("author"); - editor.waitTextInHoverPopup("Expected comma or closing brace"); - - // return comma and check error marker invisibility - editor.goToCursorPositionVisible(8, 4); - editor.typeTextIntoEditor(","); - editor.waitAllMarkersInvisibility(ERROR); - - // add new object - editor.goToCursorPositionVisible(9, 16); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(NEW_OBJECT); - editor.waitAllMarkersInvisibility(ERROR); - - // add duplicated object and check error marker with 'duplicate' message - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(NEW_OBJECT); - editor.waitMarkerInPosition(ERROR, 11); - editor.moveToMarkerAndWaitAssistContent(ERROR); - editor.waitTextIntoAnnotationAssist("Duplicate key 'newObj'."); - - // delete the duplicated object and check error marker invisibility - editor.deleteCurrentLine(); - editor.waitAllMarkersInvisibility(ERROR); - - // add duplicated object in other {} block - editor.goToCursorPositionVisible(6, 15); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(NEW_OBJECT); - editor.waitAllMarkersInvisibility(ERROR); - } - - @Test(priority = 1) - public void checkAutocompleteFeature() { - editor.selectTabByName(JSON_FILE_NAME); - - editor.goToCursorPositionVisible(13, 4); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - - editor.typeTextIntoEditor("obj"); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("\"obj\""); - - editor.typeTextIntoEditor(":"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("Empty object"); - editor.waitProposalIntoAutocompleteContainer("Empty array"); - editor.closeAutocomplete(); - - editor.deleteCurrentLine(); - } - - @Test(priority = 1) - public void checkHoverFeature() { - menu.runCommand(Project.PROJECT, New.NEW, New.FILE); - askForValueDialog.createNotJavaFileByName("schema.json"); - editor.waitTabIsPresent("schema.json"); - - editor.goToPosition(1, 1); - editor.typeTextIntoEditor("{\n"); - editor.typeTextIntoEditor( - " \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n" - + "\"title\": \"Items\",\n" - + "\"type\": \"string\""); - - editor.moveCursorToText("title"); - editor.waitTextInHoverPopup("A descriptive title of the element"); - - editor.moveCursorToText("$schema"); - editor.waitTextInHoverPopup("The schema to verify this document against"); - } - - @Test(priority = 2) - public void checkGoToSymbolFeature() { - editor.selectTabByName(JSON_FILE_NAME); - - // check list for expected items - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.waitAllNodes(symbols); - - // open item by mouse click - assistantFindPanel.clickOnActionNodeWithTextContains("version"); - editor.waitCursorPosition(3, 3); - - // find and open item from Go To Symbol panel - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.typeToInputField("nam"); - assistantFindPanel.waitNode("name"); - assistantFindPanel.clickOnActionNodeWithTextContains("name"); - editor.waitCursorPosition(2, 3); - - // select items by DOWN and UP buttons - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(2, 26); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(3, 21); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(4, 20); - editor.typeTextIntoEditor(Keys.UP.toString()); - editor.waitCursorPosition(3, 21); - - // open item by pressing ENTER key - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitCursorPosition(3, 3); - } - - private void createProjectFromWizard() { - projectExplorer.waitProjectExplorer(); - - menu.runCommand(WORKSPACE, CREATE_PROJECT); - selectSampleProject(); - wizard.typeProjectNameOnWizard(PROJECT_NAME); - wizard.clickCreateButton(); - wizard.waitCloseProjectConfigForm(); - } - - protected void selectSampleProject() { - wizard.selectSample(NODEJS_HELLO_WORLD); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/TypeScriptEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/TypeScriptEditingTest.java deleted file mode 100644 index 4b3e4080699..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/TypeScriptEditingTest.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_DEFINITION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_PROJECT_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_REFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.EDIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.FORMAT; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.NODE_JS; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.ECLIPSE_NODEJS; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR_OVERVIEW; -import static org.openqa.selenium.Keys.ARROW_LEFT; -import static org.openqa.selenium.Keys.DELETE; -import static org.openqa.selenium.Keys.ENTER; -import static org.openqa.selenium.Keys.SPACE; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FindReferencesConsoleTab; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class TypeScriptEditingTest { - private static final String PROJECT_NAME = - NameGenerator.generate(TypeScriptEditingTest.class.getSimpleName(), 4); - private static final String PATH_TO_GREETER_FILE = PROJECT_NAME + "/Greeter.ts"; - private static final String PATH_TO_PRINT_TEST_FILE = PROJECT_NAME + "/printTest.ts"; - public static final String INITIALIZE_LANG_SERVER_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.web.typescript'"; - - @InjectTestWorkspace(template = ECLIPSE_NODEJS) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private ProjectExplorer projectExplorer; - @Inject private AssistantFindPanel assistantFindPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private FindReferencesConsoleTab findReferencesConsoleTab; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/type-script-simple-project"); - - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, NODE_JS); - - ide.open(workspace); - - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_GREETER_FILE); - consoles.waitExpectedTextIntoConsole(INITIALIZE_LANG_SERVER_MESSAGE); - } - - @Test - public void checkGoToSymbolFeature() { - editor.goToCursorPositionVisible(14, 7); - List expectedGoToSymbolAlternatives = - Arrays.asList( - "greeter", - "Greeter", - "greet", - "constructor", - "\"Greeter\"", - "print", - "printVar", - "greeting"); - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitAllNodes(expectedGoToSymbolAlternatives); - assistantFindPanel.clickOnActionNodeWithTextEqualsTo("greet"); - editor.waitCursorPosition(19, 5); - } - - @Test(priority = 1, alwaysRun = true) - public void checkFindProjectSymbolsFeature() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(ASSISTANT, FIND_PROJECT_SYMBOL); - assistantFindPanel.typeToInputField("testPrint"); - assistantFindPanel.clickOnActionNodeWithTextContains("testPrint"); - editor.waitCursorPosition(26, 6); - } - - @Test(priority = 2, alwaysRun = true) - public void checkMainFeaturesTypeScriptLS() { - checkCodeValidation(); - checkCodeAssistant(); - checkGoToDefinition(); - } - - @Test(priority = 3, alwaysRun = true) - public void checkFindReferencesFeature() { - String referenceInGreeterClass = format("/%s/Greeter.ts\nFrom:25:18 To:25:23", PROJECT_NAME); - String referenceInTestPrintClass = format("/%s/testPrint.ts\nFrom:15:1 To:15:6", PROJECT_NAME); - - menu.runCommand(ASSISTANT, FIND_REFERENCES); - - findReferencesConsoleTab.waitAllReferencesWithText( - referenceInGreeterClass, referenceInTestPrintClass); - findReferencesConsoleTab.doubleClickOnReferenceEqualsTo(referenceInGreeterClass); - editor.waitSpecifiedValueForLineAndChar(25, 23); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(25, 18); - editor.waitTextElementsActiveLine("print"); - } - - @Test(priority = 4, alwaysRun = true, groups = UNDER_REPAIR) - public void checkHoveringFeature() { - editor.moveCursorToText("Greeter"); - try { - editor.waitHoverPopupAppearance(); - } catch (TimeoutException ex) { - fail("Known permanent failure https://github.com/eclipse/che/issues/11324"); - } - } - - @Test(priority = 5, alwaysRun = true) - public void checkSignatureHelpProvider() { - editor.goToCursorPositionVisible(25, 38); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor("printVar.print("); - - editor.waitSignaturesContainer(); - editor.waitProposalIntoSignaturesContainer("print(setVAlue: string): void"); - editor.closeSignaturesContainer(); - editor.waitSignaturesContainerIsClosed(); - } - - @Test(priority = 6, alwaysRun = true) - public void checkCodeCommentFeature() { - editor.goToCursorPositionVisible(26, 9); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor("// printVar.print()", 2); - editor.launchCommentCodeFeature(); - // after uncommenting we get error in the editor - editor.waitMarkerInPosition(CodenvyEditor.MarkerLocator.ERROR, 26); - } - - @Test(priority = 7, alwaysRun = true) - public void checkCodeFormattingFeature() throws URISyntaxException, IOException { - // read all lines from template - URL resources = - getClass() - .getResource("/org/eclipse/che/selenium/languageServers/typeScriptAfterFormatting.txt"); - List listWithAllLines = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - - // save it ot StringBuilder with return symbols - StringBuilder stringBuilder = new StringBuilder(); - for (String currentLine : listWithAllLines) { - stringBuilder.append(currentLine + "\n"); - } - - // format text and compare with text from template - menu.runCommand(EDIT, FORMAT); - editor.waitTextIntoEditor(stringBuilder.toString()); - } - - private void checkCodeValidation() { - - final int expectedAmountOfErrorMarkers = 9; - - String tooltipWithErrorMessage = "Cannot find name 'c'."; - - editor.waitActive(); - editor.goToPosition(14, 2); - editor.typeTextIntoEditor(SPACE.toString()); - final int actualValueErrorMarkers = editor.getMarkersQuantity(ERROR); - assertEquals( - actualValueErrorMarkers, - expectedAmountOfErrorMarkers, - format( - "The expected value of errors marker should be %d but actual %d", - expectedAmountOfErrorMarkers, actualValueErrorMarkers)); - editor.moveToMarker(ERROR_OVERVIEW, 14); - editor.waitTextInToolTipPopup(tooltipWithErrorMessage); - editor.goToPosition(14, 2); - editor.typeTextIntoEditor(DELETE.toString()); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void checkCodeAssistant() { - String textFromWholeCodeAssistantScope = - "AbortController\nAbortSignal\nabstract\nActiveXObject\naddEventListener\nalert"; - - String textFromGreeterObject = "greet\ngreeting\ntestPrint"; - - String nameOfGreeterClassRef = "greeter."; - String methodToComplete = "greet"; - - // check autocomplete form content after the ";" - editor.goToPosition(29, 36); - editor.launchAutocomplete(); - editor.waitProposalIntoAutocompleteContainer(textFromWholeCodeAssistantScope); - - editor.closeAutocomplete(); - - // Check autocomplete of method 'Greeter.greet' by double clicking in autocomplete form - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(nameOfGreeterClassRef); - - editor.launchAutocomplete(); - editor.waitProposalIntoAutocompleteContainer(textFromGreeterObject); - editor.selectItemIntoAutocompleteAndPerformDoubleClick(methodToComplete); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void checkGoToDefinition() { - // set cursor to printVar.print place - editor.goToPosition(25, 20); - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitActiveTabFileName("testPrint.ts"); - editor.waitCursorPosition(15, 6); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/YamlFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/YamlFileEditingTest.java deleted file mode 100644 index cfb42bb0c5d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/YamlFileEditingTest.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PREFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PROFILE_MENU; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.FILE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.NODE_JS; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.ECLIPSE_NODEJS_YAML; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.Preferences.DropDownLanguageServerSettings.YAML; -import static org.openqa.selenium.Keys.DELETE; -import static org.openqa.selenium.Keys.ENTER; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class YamlFileEditingTest { - - private static final String PROJECT_NAME = generate("project", 4); - private static final String YAML_FILE_NAME = "openshift.yaml"; - private static final String PATH_TO_YAML_FILE = PROJECT_NAME + "/" + YAML_FILE_NAME; - private static final String LS_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.yaml.server.languageserver'"; - private static final List EXPECTED_GO_TO_SYMBOL_ALTERNATIVES = - Arrays.asList("apiVersionsymbols (194)", "kind", "metadata"); - - private static final String COMMENTED_CODE = - "# generation: 4\n" - + " labels:\n" - + "# app: che\n" - + " template: che\n" - + "# name: che"; - private static final String UNCOMMENTED_CODE = - " generation: 4\n" - + " labels:\n" - + " app: che\n" - + " template: che\n" - + " name: che"; - - @InjectTestWorkspace(template = ECLIPSE_NODEJS_YAML) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private Preferences preferences; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskForValueDialog askForValueDialog; - @Inject private AssistantFindPanel assistantFindPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = YamlFileEditingTest.class.getResource("/projects/nodejs-with-yaml"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, NODE_JS); - ide.open(workspace); - - ide.waitOpenedWorkspaceIsReadyToUse(); - - addYamlSchema(); - } - - @AfterClass - public void tearDown() { - deleteSchema(); - } - - @Test - public void checkLanguageServerInitialized() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - menu.runCommand(PROJECT, NEW, FILE); - askForValueDialog.createNotJavaFileByName(YAML_FILE_NAME); - editor.waitTabIsPresent(YAML_FILE_NAME); - - projectExplorer.openItemByPath(PROJECT_NAME + "/deployment.yaml"); - editor.waitTabIsPresent("deployment.yaml"); - - // check Yaml language server initialized - consoles.selectProcessByTabName("dev-machine"); - consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); - } - - @Test(priority = 1) - public void checkAutocompleteFeature() { - editor.selectTabByName(YAML_FILE_NAME); - - // launch autocomplete feature and check proposal documentation - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("diskName"); - editor.selectAutocompleteProposal("diskName"); - editor.waitProposalDocumentationHTML( - "

The Name of the data disk in the blob storage

\n", 2); - editor.waitProposalIntoAutocompleteContainer("diskURI"); - editor.selectAutocompleteProposal("diskURI"); - editor.waitProposalDocumentationHTML("

The URI the data disk in the blob storage

\n", 2); - - // select proposal and check expected text in the Editor - editor.enterAutocompleteProposal("kind"); - editor.waitTextIntoEditor("kind:"); - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("PersistentVolume"); - editor.enterAutocompleteProposal("PersistentVolume"); - editor.waitTextIntoEditor("kind: PersistentVolume"); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(ENTER.toString()); - - // launch autocomplete feature and check expected text in the Editor - editor.typeTextIntoEditor("api"); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("apiVersion: "); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("apiVersion: v1"); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(ENTER.toString()); - - // launch autocomplete feature, select proposal and check expected text in the Editor - editor.typeTextIntoEditor("me"); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("metadata:"); - - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("status"); - editor.enterAutocompleteProposal("status"); - editor.waitMarkerInPosition(ERROR, 4); - editor.moveToMarkerAndWaitAssistContent(ERROR); - editor.waitTextIntoAnnotationAssist("Using tabs can lead to unpredictable results"); - - editor.goToPosition(4, 1); - editor.typeTextIntoEditor(DELETE.toString()); - editor.waitMarkerInvisibility(ERROR, 4); - - editor.goToPosition(5, 1); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("spec:"); - } - - @Test(priority = 1, groups = FLAKY) - public void checkHoverFeature() { - editor.selectTabByName("deployment.yaml"); - - // move cursor on text and check expected text in hover popup - editor.moveCursorToText("namespace:"); - waitTextInHoverPopup("Namespace defines the space within each name must be unique."); - - editor.moveCursorToText("kind:"); - waitTextInHoverPopup( - "Kind is a string value representing the REST resource this object represents."); - - editor.moveCursorToText("apiVersion:"); - editor.waitTextInHoverPopUpEqualsTo( - "APIVersion defines the versioned schema of this representation of an object. " - + "Servers should convert recognized schemas to the latest internal value, " - + "and may reject unrecognized values. More info: " - + "http://releases\\.k8s\\.io/HEAD/docs/devel/api\\-conventions\\.md\\#resources"); - } - - @Test(priority = 1, groups = FLAKY) - public void checkCodeValidation() { - editor.selectTabByName("deployment.yaml"); - editor.waitAllMarkersInvisibility(ERROR); - - editor.goToPosition(13, 2); - editor.typeTextIntoEditor("a"); - editor.waitTextElementsActiveLine("aapiVersion: v1"); - editor.moveCursorToText("aapiVersion"); - waitTextInHoverPopup("Unexpected property aapiVersion"); - - editor.goToPosition(13, 1); - editor.typeTextIntoEditor(DELETE.toString()); - editor.waitAllMarkersInvisibility(ERROR); - editor.moveCursorToText("apiVersion"); - waitTextInHoverPopup( - "APIVersion defines the versioned schema of this representation of an object."); - } - - @Test(priority = 1) - public void checkCommentCodeFeature() { - editor.selectTabByName("deployment.yaml"); - - // comment lines by Ctrl+'/' buttons - editor.goToPosition(19, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor("# generation: 4"); - editor.goToPosition(21, 1); - editor.launchCommentCodeFeature(); - editor.goToPosition(23, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor(COMMENTED_CODE); - - // uncomment all commented lines - editor.goToPosition(19, 1); - editor.launchCommentCodeFeature(); - editor.goToPosition(21, 1); - editor.launchCommentCodeFeature(); - editor.goToPosition(23, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor(UNCOMMENTED_CODE); - } - - @Test(priority = 1) - public void checkGoToSymbolFeature() { - editor.selectTabByName("deployment.yaml"); - - // check list for expected items - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.waitAllNodes(EXPECTED_GO_TO_SYMBOL_ALTERNATIVES); - - // open item by mouse click - assistantFindPanel.clickOnActionNodeWithTextContains("apiVersion"); - editor.waitCursorPosition(13, 1); - - // find and open item from Go To Symbol panel - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - assistantFindPanel.typeToInputField("kin"); - assistantFindPanel.waitNode("kind"); - assistantFindPanel.clickOnActionNodeWithTextContains("kind"); - editor.waitCursorPosition(14, 1); - - // select items by DOWN and UP buttons - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitForm(); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(13, 15); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(14, 23); - editor.typeTextIntoEditor(Keys.DOWN.toString()); - editor.waitCursorPosition(27, 44); - editor.typeTextIntoEditor(Keys.UP.toString()); - editor.waitCursorPosition(14, 23); - - // open item by pressing ENTER key - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitCursorPosition(14, 1); - } - - private void addYamlSchema() { - menu.runCommand(PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - - preferences.waitMenuInCollapsedDropdown(YAML); - preferences.selectDroppedMenuByName(YAML); - - preferences.clickOnAddSchemaUrlButton(); - preferences.addSchemaUrl("kubernetes"); - preferences.clickOnOkBtn(); - - preferences.close(); - } - - private void deleteSchema() { - menu.runCommand(PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - - preferences.waitMenuInCollapsedDropdown(YAML); - preferences.selectDroppedMenuByName(YAML); - - preferences.deleteSchema(); - preferences.clickOnOkBtn(); - - preferences.close(); - } - - private void waitTextInHoverPopup(String expectedText) { - try { - editor.waitTextInHoverPopup(expectedText); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10674", ex); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpClassRenamingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpClassRenamingTest.java deleted file mode 100644 index 398309147ed..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpClassRenamingTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.csharp; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.LS_RENAME; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.DOT_NET; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -@Test(groups = UNDER_REPAIR) -public class CSharpClassRenamingTest { - private static final String PROJECT_NAME = - NameGenerator.generate(CSharpClassRenamingTest.class.getSimpleName(), 4); - private final String LANGUAGE_SERVER_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.csharp.languageserver"; - - private static final String PATH_TO_DOTNET_FILE = PROJECT_NAME + "/Hello.cs"; - - @InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU_LSP) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Wizard wizard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/CSharpHelloWorld"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, DOT_NET); - ide.open(workspace); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_DOTNET_FILE); - consoles.waitExpectedTextIntoConsole(LANGUAGE_SERVER_INIT_MESSAGE); - } - - @Test - public void checkRenaming() { - String newClassName = "HelloWorld"; - String textFragmentAfterRenaming = "public class HelloWorld"; - consoles.selectProcessByTabName("dev-machine"); - editor.goToCursorPositionVisible(18, 18); - menu.runCommand(ASSISTANT, REFACTORING, LS_RENAME); - editor.doRenamingByLanguageServerField(newClassName); - - try { - editor.waitTextIntoEditor(textFragmentAfterRenaming); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/10180", ex); - } - - editor.waitAllMarkersInvisibility(ERROR); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileAdvancedOperationsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileAdvancedOperationsTest.java deleted file mode 100644 index 6c1f514a0c1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileAdvancedOperationsTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.csharp; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_DEFINITION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.DOT_NET; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -@Test(groups = UNDER_REPAIR) -public class CSharpFileAdvancedOperationsTest { - private static final String PROJECT_NAME = - NameGenerator.generate(CSharpClassRenamingTest.class.getSimpleName(), 4); - - private static final String PATH_TO_DOT_NET_FILE = PROJECT_NAME + "/Hello.cs"; - - private final String LANGUAGE_SERVER_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.csharp.languageserver"; - - @InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU_LSP) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Wizard wizard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private AssistantFindPanel assistantFindPanel; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/CSharpFileAdvancedOperations"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, DOT_NET); - ide.open(workspace); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_DOT_NET_FILE); - - // after opening the file we are checking initializing message from LS and than check, that - // dependencies have been added properly in this case - // folders obj and bin should appear in the Project tree - consoles.waitExpectedTextIntoConsole(LANGUAGE_SERVER_INIT_MESSAGE); - projectExplorer.waitItem(PROJECT_NAME + "/obj"); - projectExplorer.waitItem(PROJECT_NAME + "/bin"); - } - - @Test - public void checkHoveringFeature() { - String expectedTextInHoverPopUp = - "System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited."; - - editor.moveCursorToText("Console"); - editor.waitTextInHoverPopUpEqualsTo(expectedTextInHoverPopUp); - } - - @Test(priority = 1, alwaysRun = true) - public void checkFindDefinition() { - // check Find definition from Test.getStr() - editor.goToCursorPositionVisible(21, 18); - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitTabIsPresent("Test.cs"); - editor.waitCursorPosition(18, 22); - } - - @Test(priority = 2, alwaysRun = true) - public void checkCodeCommentFeature() { - editor.goToPosition(17, 1); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor("//private counter = 5;"); - editor.typeTextIntoEditor(Keys.END.toString()); - } - - @Test(priority = 3, alwaysRun = true, groups = UNDER_REPAIR) - public void checkGoToSymbolFeature() { - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - try { - assistantFindPanel.waitNode("Main(string[] args)"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure: https://github.com/eclipse/che/issues/11258", ex); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileEditingTest.java deleted file mode 100644 index cedd2f67988..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/csharp/CSharpFileEditingTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.csharp; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.INFO; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.ASP_DOT_NET_WEB_SIMPLE; -import static org.openqa.selenium.Keys.BACK_SPACE; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CSharpFileEditingTest { - - protected final String PROJECT_NAME = generate("dotnet-web-simple-", 4); - protected final String LANGUAGE_SERVER_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.csharp.languageserver"; - protected final String NAME_OF_EDITING_FILE = "Program.cs"; - - @InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU_LSP) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject protected ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject protected CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Wizard wizard; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; - @Inject protected Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - createDotNetAppFromWizard(); - initLanguageServer(); - } - - @AfterMethod - public void restartWorkspace() throws Exception { - editor.closeAllTabs(); - testWorkspaceServiceClient.stop(workspace.getName(), workspace.getOwner().getName()); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - initLanguageServer(); - } - - @Test(groups = FLAKY) - public void checkCodeEditing() { - checkCodeValidation(); - } - - @Test(priority = 1, groups = UNDER_REPAIR) - public void checkInitializingAfterFirstStarting() { - projectExplorer.openItemByPath(PROJECT_NAME + "/Program.cs"); - - try { - editor.waitMarkerInPosition(INFO, 1); - editor.waitMarkerInPosition(INFO, 2); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/10151", ex); - } - } - - private void checkCodeValidation() { - editor.goToCursorPositionVisible(24, 12); - for (int i = 0; i < 9; i++) { - editor.typeTextIntoEditor(BACK_SPACE.toString()); - } - - try { - editor.waitMarkerInPosition(INFO, 23); - } catch (TimeoutException ex) { - fail("Known random failure https://github.com/eclipse/che/issues/10789", ex); - } - - editor.waitMarkerInPosition(ERROR, 21); - checkAutocompletion(); - } - - protected void initLanguageServer() { - projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/" + NAME_OF_EDITING_FILE); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + NAME_OF_EDITING_FILE); - consoles.selectProcessByTabName("dev-machine"); - consoles.waitExpectedTextIntoConsole(LANGUAGE_SERVER_INIT_MESSAGE); - editor.selectTabByName(NAME_OF_EDITING_FILE); - } - - private void checkAutocompletion() { - editor.goToCursorPositionVisible(23, 49); - editor.typeTextIntoEditor("."); - editor.launchAutocomplete(); - editor.enterAutocompleteProposal("Build "); - editor.typeTextIntoEditor("();"); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void createDotNetAppFromWizard() { - projectExplorer.waitProjectExplorer(); - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.selectSample(ASP_DOT_NET_WEB_SIMPLE); - wizard.typeProjectNameOnWizard(PROJECT_NAME); - wizard.clickCreateButton(); - wizard.waitCloseProjectConfigForm(); - - projectExplorer.waitProjectInitialization(PROJECT_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/php/PhpAssistantFeaturesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/php/PhpAssistantFeaturesTest.java deleted file mode 100644 index e8dd97961fb..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/php/PhpAssistantFeaturesTest.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.php; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_PROJECT_SYMBOL; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_REFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.openqa.selenium.Keys.ARROW_LEFT; -import static org.openqa.selenium.Keys.CONTROL; -import static org.openqa.selenium.Keys.ENTER; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.FindReferencesConsoleTab; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class PhpAssistantFeaturesTest { - private static final String PROJECT = "php-tests"; - private static final String PATH_TO_INDEX_PHP = PROJECT + "/index.php"; - private static final String TEXT_FOR_HOVERING = "sayHello"; - private static final String EXPECTED_ORIGINAL_TEXT = - "/*\n" + " * Copyright (c) 2012-2018 Red Hat, Inc."; - private static final String EXPECTED_COMMENTED_TEXT = - "/*\n" + "// * Copyright (c) 2012-2018 Red Hat, Inc."; - private static final String EXPECTED_HOVER_POPUP_TEXT = " expectedProposals = - ImmutableList.of( - "expm1 float", "exp float", "error_log bool", "explode array", "exec string"); - - @InjectTestWorkspace(template = WorkspaceTemplate.ECLIPSE_PHP) - private TestWorkspace ws; - - @Inject private Ide ide; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - testProjectServiceClient.importProject( - ws.getId(), Paths.get(RESOURCE.toURI()), PROJECT, ProjectTemplates.PHP); - - // open IDE - ide.open(ws); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notificationPopup.waitProgressPopupPanelClose(); - - // open project tree - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_INDEX_PHP); - editor.waitActive(); - } - - @Test - public void checkMainFeaturesPhpLS() { - consoles.waitExpectedTextIntoConsole(INITIALIZE_LANG_SERVER_MESSAGE); - - checkCodeValidation(); - checkAutocompletion(); - checkCodeAssistant(); - checkGoToDefinition(); - } - - private void checkGoToDefinition() { - editor.deleteCurrentLine(); - - editor.goToPosition(15, 9); - - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitActiveTabFileName("lib.php"); - editor.waitCursorPosition(15, 2); - } - - private void checkCodeAssistant() { - editor.goToCursorPositionVisible(16, 7); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor("e"); - editor.launchAutocomplete(); - - // check expected proposals in Autocomplete container - expectedProposals.forEach( - proposal -> { - editor.waitProposalIntoAutocompleteContainer(proposal); - }); - } - - private void checkAutocompletion() { - editor.goToCursorPositionVisible(14, 1); - editor.typeTextIntoEditor("$color = \"blue\";"); - - editor.goToCursorPositionVisible(15, 22); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitCursorPosition(16, 1); - - editor.typeTextIntoEditor("$"); - editor.launchAutocomplete(); - editor.waitTextIntoEditor("$color = \"blue\";\necho sayHello(\"man\");\n$color\n?>", 3); - editor.closeAutocomplete(); - } - - private void checkCodeValidation() { - editor.goToPosition(15, 2); - editor.typeTextIntoEditor(" "); - editor.clickOnMarker(ERROR_OVERVIEW, 15); - editor.waitTextInToolTipPopup("';' expected."); - - editor.goToPosition(15, 3); - editor.typeTextIntoEditor(Keys.BACK_SPACE.toString()); - editor.waitAllMarkersInvisibility(ERROR_OVERVIEW); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonAssistantFeaturesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonAssistantFeaturesTest.java deleted file mode 100644 index f351bbae253..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonAssistantFeaturesTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.python; - -import static java.util.Arrays.asList; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_REFERENCES; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.GO_TO_SYMBOL; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.PYTHON; -import static org.openqa.selenium.Keys.ARROW_LEFT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AssistantFindPanel; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.FindReferencesConsoleTab; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class PythonAssistantFeaturesTest { - private static final String PROJECT_NAME = "console-python3-simple"; - private static final String CALC_TAB_NAME = "calc.py"; - private static final String MAIN_TAB_NAME = "main.py"; - private static final String RENAMED_VARIABLE_NAME = "renamedVar"; - private static final String EXPECTED_CODE_BEFORE_COMMENTING = "var2 = module.add(100, 200)"; - private static final String EXPECTED_COMMENTED_CODE = "#var2 = module.add(100, 200)"; - private static final String EXPECTED_HOVER_TEXT = "function(self)"; - private static final String EXPECTED_FIND_REFERENCE_NODE_TEXT = - "/console-python3-simple/calc.py\n" + "From:16:1 To:16:5"; - private static final String TEXT_FOR_INVOKING_SIGNATURE_HELP = "module.add("; - private static final String EXPECTED_SIGNATURE_TEXT = "add(a, b)"; - private static final String EXPECTED_LINE_TEXT = "class MyClass:"; - private static final List EXPECTED_GO_TO_SYMBOL_NODES = - asList("MyClasssymbols (4)", "var", "variable", "function"); - private static final String EXPECTED_TEXT_AFTER_RENAME = - "class MyClass:\n" + " renamedVar = 1\n" + " variable = \"variable\""; - - @InjectTestWorkspace(template = PYTHON) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private ProjectExplorer projectExplorer; - @Inject private AssistantFindPanel assistantFindPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private FindReferencesConsoleTab findReferencesConsoleTab; - - @BeforeClass - public void setUp() throws Exception { - URL resource = PythonFileEditingTest.class.getResource("/projects/console-python3-simple"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PYTHON); - ide.open(workspace); - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME); - } - - @Test - public void checkCodeCommentFeature() { - projectExplorer.waitProjectExplorer(); - - projectExplorer.openItemByPath(PROJECT_NAME + "/" + CALC_TAB_NAME); - editor.waitTabIsPresent(CALC_TAB_NAME); - editor.waitActive(); - editor.waitTextIntoEditor(EXPECTED_CODE_BEFORE_COMMENTING); - - editor.setCursorToLine(16); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor(EXPECTED_COMMENTED_CODE); - editor.launchCommentCodeFeature(); - editor.waitTextIntoEditor(EXPECTED_CODE_BEFORE_COMMENTING); - } - - @Test - public void checkRenameFeature() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + MAIN_TAB_NAME); - editor.waitTabIsPresent(MAIN_TAB_NAME); - editor.waitActive(); - - editor.goToCursorPositionVisible(15, 6); - editor.launchLocalRefactor(); - editor.doRenamingByLanguageServerField(RENAMED_VARIABLE_NAME); - editor.waitTextIntoEditor(EXPECTED_TEXT_AFTER_RENAME); - } - - @Test - public void checkHoverFeature() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + MAIN_TAB_NAME); - editor.waitTabIsPresent(MAIN_TAB_NAME); - editor.waitActive(); - - editor.moveCursorToText("function"); - editor.waitTextInHoverPopUpEqualsTo(EXPECTED_HOVER_TEXT); - } - - @Test - public void checkFindReferenceFeature() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + CALC_TAB_NAME); - editor.waitTabIsPresent(CALC_TAB_NAME); - editor.waitActive(); - - editor.goToCursorPositionVisible(16, 2); - menu.runCommand(ASSISTANT, FIND_REFERENCES); - findReferencesConsoleTab.waitAllReferencesWithText(EXPECTED_FIND_REFERENCE_NODE_TEXT); - findReferencesConsoleTab.doubleClickOnReference("From:16:1 To:16:5"); - editor.waitSpecifiedValueForLineAndChar(16, 5); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(16, 1); - editor.waitTextElementsActiveLine("var2"); - } - - @Test - public void checkSignatureHelpFeature() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + CALC_TAB_NAME); - editor.waitTabIsPresent(CALC_TAB_NAME); - editor.waitActive(); - - editor.setCursorToLine(15); - editor.typeTextIntoEditor(TEXT_FOR_INVOKING_SIGNATURE_HELP); - editor.waitSignaturesContainer(); - editor.waitProposalIntoSignaturesContainer(EXPECTED_SIGNATURE_TEXT); - editor.closeSignaturesContainer(); - editor.waitSignaturesContainerIsClosed(); - - editor.deleteCurrentLineAndInsertNew(); - } - - @Test - public void checkGoToSymbolFeature() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME + "/" + MAIN_TAB_NAME); - editor.waitTabIsPresent(MAIN_TAB_NAME); - editor.waitActive(); - editor.setCursorToLine(1); - - menu.runCommand(ASSISTANT, GO_TO_SYMBOL); - assistantFindPanel.waitAllNodes(EXPECTED_GO_TO_SYMBOL_NODES); - assistantFindPanel.clickOnActionNodeWithTextContains(EXPECTED_GO_TO_SYMBOL_NODES.get(0)); - editor.waitCursorPosition(14, 1); - editor.waitVisibleTextEqualsTo(14, EXPECTED_LINE_TEXT); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonFileEditingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonFileEditingTest.java deleted file mode 100644 index f5312c6f9be..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/languageserver/python/PythonFileEditingTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.languageserver.python; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_DEFINITION; -import static org.eclipse.che.selenium.core.workspace.WorkspaceTemplate.PYTHON; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.ContextMenuLocator.FORMAT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; -import static org.openqa.selenium.Keys.F4; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skoryk Serhii */ -public class PythonFileEditingTest { - private static final String PROJECT_NAME = "console-python3-simple"; - private static final String PYTHON_FILE_NAME = "main.py"; - private static final String PYTHON_MODULE_FILE_NAME = "module.py"; - private static final String PATH_TO_PYTHON_FILE = PROJECT_NAME + "/" + PYTHON_FILE_NAME; - private static final String LS_INIT_MESSAGE = - "Initialized language server 'org.eclipse.che.plugin.python.languageserver"; - - @InjectTestWorkspace(template = PYTHON) - private TestWorkspace workspace; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = PythonFileEditingTest.class.getResource("/projects/console-python3-simple"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PYTHON); - ide.open(workspace); - } - - @Test - public void checkLanguageServerInitialized() { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PATH_TO_PYTHON_FILE); - editor.waitTabIsPresent(PYTHON_FILE_NAME); - - // check python language sever initialized - consoles.selectProcessByTabName("dev-machine"); - consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); - } - - @Test(priority = 1) - public void checkMarkers() { - editor.selectTabByName(PYTHON_FILE_NAME); - - // check warning marker message - editor.goToPosition(19, 53); - editor.typeTextIntoEditor("\n"); - editor.waitMarkerInPosition(WARNING, editor.getPositionVisible()); - editor.moveToMarkerAndWaitAssistContent(WARNING); - editor.waitTextIntoAnnotationAssist("W293 blank line contains whitespace"); - - // check error marker message - editor.goToCursorPositionVisible(14, 1); - editor.waitAllMarkersInvisibility(ERROR); - editor.typeTextIntoEditor("c"); - editor.waitMarkerInPosition(ERROR, 14); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.waitAllMarkersInvisibility(ERROR); - } - - @Test(priority = 1) - public void checkAutocompleteFeature() { - editor.selectTabByName(PYTHON_FILE_NAME); - - // check contents of autocomplete container - editor.goToPosition(20, 1); - editor.typeTextIntoEditor("\n\nobject = MyClass()\nprint(object."); - - editor.launchAutocompleteAndWaitContainer(); - editor.waitProposalIntoAutocompleteContainer("function"); - editor.waitProposalIntoAutocompleteContainer("var"); - editor.waitProposalIntoAutocompleteContainer("variable"); - - editor.enterAutocompleteProposal("function() "); - editor.waitTextIntoEditor("print(object.function"); - } - - @Test(priority = 1) - public void checkFindDefinitionFeature() { - // check Find Definition feature from Assistant menu - projectExplorer.openItemByPath(PROJECT_NAME + "/calc.py"); - editor.selectTabByName("calc.py"); - - editor.goToPosition(16, 17); - menu.runCommand(ASSISTANT, FIND_DEFINITION); - editor.waitTabIsPresent(PYTHON_MODULE_FILE_NAME); - editor.closeFileByNameWithSaving(PYTHON_MODULE_FILE_NAME); - - // check Find Definition feature by pressing F4 - editor.goToPosition(16, 17); - editor.typeTextIntoEditor(F4.toString()); - editor.waitTabIsPresent(PYTHON_MODULE_FILE_NAME); - } - - @Test(priority = 1) - public void checkFormatCodeFeature() { - projectExplorer.openItemByPath(PROJECT_NAME + "/towers.py"); - editor.selectTabByName("towers.py"); - - // select Format feature from context menu - editor.openContextMenuInEditor(); - editor.clickOnItemInContextMenu(FORMAT); - editor.waitTextIntoEditor( - " towers(i-1, middle, finish, start)\n\n\ntowers(5, 'X', 'Z', 'Y')\n"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckGeneratingMavenArchetypeTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckGeneratingMavenArchetypeTest.java deleted file mode 100644 index 270a13a9de6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckGeneratingMavenArchetypeTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.mavenplugin; - -import java.util.stream.Stream; -import javax.inject.Inject; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckGeneratingMavenArchetypeTest { - private static final String PROJECT_NAME = NameGenerator.generate("quickStart", 4); - private static final String ARTIFACT_ID = "artifact"; - private static final String GROUP_ID = "group"; - @Inject private Wizard projectWizard; - @Inject private Menu menu; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles console; - @Inject private CodenvyEditor editor; - @Inject private Ide ide; - @Inject private TestWorkspace workspace; - @Inject private ConfigureClasspath selectPath; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Consoles consoles; - - @Test - public void createMavenArchetypeStartProjectByWizard() throws Exception { - String expectedContnetInPomXml = - String.format( - " %s\n" - + " %s\n" - + " 1.0-SNAPSHOT", - GROUP_ID, ARTIFACT_ID); - - Stream expectedItems = - Stream.of( - PROJECT_NAME + "/src/main/java/" + GROUP_ID + "/App.java", - PROJECT_NAME + "/src/test/java/" + GROUP_ID + "/AppTest.java", - PROJECT_NAME + "/pom.xml"); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - projectWizard.typeProjectNameOnWizard(PROJECT_NAME); - projectWizard.clickNextButton(); - projectWizard.waitOpenProjectConfigForm(); - projectWizard.selectArcheTypeFromList(Wizard.Archetypes.QUICK_START); - projectWizard.setArtifactIdOnWizard(ARTIFACT_ID); - projectWizard.checkArtifactIdOnWizardContainsText(ARTIFACT_ID); - projectWizard.setGroupIdOnWizard(GROUP_ID); - projectWizard.checkGroupIdOnWizardContainsText(GROUP_ID); - projectWizard.checkVersionOnWizardContainsText("1.0-SNAPSHOT"); - projectWizard.clickCreateButton(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - expectedItems.forEach(projectExplorer::waitItem); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - editor.waitTextIntoEditor(expectedContnetInPomXml); - } - - @Test(priority = 1) - public void shouldHideTheArchetypeFieldIfProjectPathHasPomXml() { - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); - projectWizard.clickOnSelectPathForParentBtn(); - selectPath.openItemInSelectPathForm("Workspace"); - selectPath.selectItemInSelectPathForm(PROJECT_NAME); - selectPath.clickSelectBtnSelectPathForm(); - projectWizard.typeProjectNameOnWizard(PROJECT_NAME); - projectWizard.clickNextButton(); - projectWizard.waitInvisibilityOfAchetypeSection(); - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose( - "'From Archetype' section is disabled because selected parent contains 'pom.xml' file"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckMavenPluginTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckMavenPluginTest.java deleted file mode 100644 index f6ef21b8c01..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/CheckMavenPluginTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.mavenplugin; - -import static java.nio.file.Paths.get; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.JAVA_CLASS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; -import static org.eclipse.che.selenium.pageobject.AskForValueDialog.JavaFiles.CLASS; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER; - -import com.google.inject.Inject; -import java.net.URL; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckMavenPluginTest { - private static final String PROJECT_NAME = generate("project", 6); - private static final String PATH_TO_EXTERNAL_LIBRARIES_IN_MODULE_1 = - PROJECT_NAME + "/my-lib/External Libraries"; - private static final String PATH_TO_EXTERNAL_LIBRARIES_IN_MODULE_2 = - PROJECT_NAME + "/my-webapp/External Libraries"; - private static final String PATH_TO_HELLO_PACKAGE = PROJECT_NAME + "/my-lib/src/main/java/hello"; - private static final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/my-webapp/src/main/java/che/eclipse/sample/Aclass.java"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private AskForValueDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/check-maven-plugin-test"); - testProjectServiceClient.importProject( - workspace.getId(), get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - } - - @Test - public void shouldAccessClassCreatedInAnotherModule() { - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_HELLO_PACKAGE); - createNewFileFromMenuFile("TestClass", CLASS, ".java"); - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JAVA_FILE); - projectExplorer.openItemByPath(PATH_TO_JAVA_FILE); - editor.waitActive(); - - editor.setCursorToLine(15); - enterClassNameViaAutocomplete(); - editor.waitTextIntoEditor("import hello.TestClass;"); - editor.typeTextIntoEditor(" testClass = new TestClass();"); - editor.waitAllMarkersInvisibility(ERROR); - } - - @Test(priority = 1) - public void shouldExcludeModules() { - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - editor.waitActive(); - editor.goToCursorPositionVisible(26, 8); - editor.typeTextIntoEditor("!--"); - editor.goToCursorPositionVisible(27, 32); - editor.typeTextIntoEditor("--"); - - projectExplorer.waitItemInvisibility(PATH_TO_EXTERNAL_LIBRARIES_IN_MODULE_1); - projectExplorer.waitItemInvisibility(PATH_TO_EXTERNAL_LIBRARIES_IN_MODULE_2); - } - - @Test(priority = 2) - public void shouldAccessClassCreatedInAnotherModuleAfterIncludingModule() { - includeModulesInTheParentPom(); - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.openItemByPath( - PROJECT_NAME + "/my-webapp/src/main/java/che/eclipse/sample/Aclass.java"); - editor.waitActive(); - - editor.goToCursorPositionVisible(18, 1); - enterClassNameViaAutocomplete(); - editor.typeTextIntoEditor(" testClass2 = new TestClass();"); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void includeModulesInTheParentPom() { - editor.goToCursorPositionVisible(27, 32); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.goToCursorPositionVisible(26, 8); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/my-lib", PROJECT_FOLDER); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/my-webapp", PROJECT_FOLDER); - editor.closeAllTabs(); - } - - /** check ability just created class in autocomplete container */ - private void enterClassNameViaAutocomplete() { - editor.typeTextIntoEditor("Test"); - editor.waitTextIntoEditor("Test"); - editor.launchAutocomplete(); - } - - /** - * create file with UI - * - * @param name name of the file - * @param item the type of item in the create file widget - * @param fileExt the extension of file for checking in the Project explorer tree - */ - private void createNewFileFromMenuFile( - String name, AskForValueDialog.JavaFiles item, String fileExt) { - projectExplorer.waitAndSelectItem(PATH_TO_HELLO_PACKAGE); - menu.runCommand(PROJECT, NEW, JAVA_CLASS); - loader.waitOnClosed(); - askDialog.createJavaFileByNameAndType(name, item); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(name + fileExt); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/GenerateEffectivePomTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/GenerateEffectivePomTest.java deleted file mode 100644 index 90bdba69918..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/mavenplugin/GenerateEffectivePomTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.mavenplugin; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class GenerateEffectivePomTest { - private static final String PROJECT_NAME = GenerateEffectivePomTest.class.getSimpleName(); - private static final String JAR_MODULE_PATH = PROJECT_NAME + "/my-lib"; - private static final String WAR_MODULE_PATH = PROJECT_NAME + "/my-webapp"; - - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/java-multimodule"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - } - - @Test( - description = - "add additional try/catch block for workaround problem in https://github.com/eclipse/che/issues/2877") - public void generateEffectivePomTest() throws Exception { - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - URL mainEffectivePomPath = GenerateEffectivePomTest.class.getResource("main"); - URL jarModuleEffectivePomPath = GenerateEffectivePomTest.class.getResource("jar-module"); - URL warModuleEffectivePomPath = GenerateEffectivePomTest.class.getResource("war-module"); - - List expectedMainEffectivePom = - Files.readAllLines(Paths.get(mainEffectivePomPath.toURI()), Charset.forName("UTF-8")); - List expectedJarEffectivePom = - Files.readAllLines(Paths.get(jarModuleEffectivePomPath.toURI()), Charset.forName("UTF-8")); - List expectedWarEffectivePom = - Files.readAllLines(Paths.get(warModuleEffectivePomPath.toURI()), Charset.forName("UTF-8")); - - projectExplorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - Assert.assertTrue( - checkCurrentEffectivePom( - PROJECT_NAME, expectedMainEffectivePom, "qa-multimodule [effective pom]"), - "Check Effective Pom for multi-module project"); - editor.closeAllTabsByContextMenu(); - Assert.assertTrue( - checkCurrentEffectivePom( - JAR_MODULE_PATH, expectedJarEffectivePom, "my-lib [effective pom]"), - "Check Effective Pom for jar maven module"); - editor.closeAllTabsByContextMenu(); - Assert.assertTrue( - checkCurrentEffectivePom( - WAR_MODULE_PATH, expectedWarEffectivePom, "my-webapp [effective pom]"), - "Check Effective Pom for war maven module"); - } - - private boolean checkCurrentEffectivePom( - String modulePath, List expectedText, String nameOfTab) { - projectExplorer.openItemByPath(modulePath); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(modulePath); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.GENERATE_EFFECTIVE_POM); - loader.waitOnClosed(); - editor.selectTabByName(nameOfTab); - List actualText = Arrays.asList(editor.getVisibleTextFromEditor().split("\n")); - return actualText.containsAll(expectedText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckCreatingProjectInEmptyWsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckCreatingProjectInEmptyWsTest.java deleted file mode 100644 index 4cbd520026b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckCreatingProjectInEmptyWsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.action.ActionsFactory; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.openqa.selenium.By; -import org.openqa.selenium.Keys; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class CheckCreatingProjectInEmptyWsTest { - - @Inject private Loader loader; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Wizard wizard; - @Inject private ImportProjectFromLocation importProjectFromLocation; - @Inject private ActionsFactory actionsFactory; - @Inject private SeleniumWebDriver seleniumWebDriver; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - } - - @Test - public void checkImportAndCreatingFromProjectExplorer() throws InterruptedException { - ide.waitOpenedWorkspaceIsReadyToUse(); - loader.waitOnClosed(); - projectExplorer.clickOnCreateProjectLink(10); - wizard.closeWithIcon(); - projectExplorer.clickOnEmptyAreaOfProjectTree(1); - projectExplorer.clickOnImportProjectLink(1); - importProjectFromLocation.closeWithIcon(); - - projectExplorer.clickOnEmptyAreaOfProjectTree(1); - try { - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ALT.toString() + "x").perform(); - wizard.closeWithIcon(); - } catch (org.openqa.selenium.TimeoutException e) { - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ALT.toString() + "x").perform(); - wizard.closeWithIcon(); - } - projectExplorer.clickOnEmptyAreaOfProjectTree(1); - try { - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") - .perform(); - importProjectFromLocation.closeWithIcon(); - } catch (org.openqa.selenium.TimeoutException e) { - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") - .perform(); - importProjectFromLocation.closeWithIcon(); - } - } - - @Test(priority = 1) - public void checkImportAndCreatingFromEditorPanel() { - WebDriverWait waitForWebElements = new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC); - String locatorToEditorContaiPaineId = - "//div[@id='gwt-debug-editorMultiPartStack-contentPanel']"; - String locatorToImportProjectLnk = - locatorToEditorContaiPaineId + "//div[text()='Import Project...']"; - String locatorToCreateProjectLnk = - locatorToEditorContaiPaineId + "//div[text()='Create Project...']"; - - loader.waitOnClosed(); - waitForWebElements - .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToImportProjectLnk))) - .click(); - importProjectFromLocation.closeWithIcon(); - waitForWebElements - .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locatorToCreateProjectLnk))) - .click(); - wizard.closeWithIcon(); - - waitForWebElements - .until( - ExpectedConditions.visibilityOfElementLocated((By.xpath(locatorToEditorContaiPaineId)))) - .click(); - try { - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ALT.toString() + "x").perform(); - wizard.closeWithIcon(); - } catch (org.openqa.selenium.TimeoutException e) { - actionsFactory.createAction(seleniumWebDriver).sendKeys(Keys.ALT.toString() + "x").perform(); - wizard.closeWithIcon(); - } - waitForWebElements - .until( - ExpectedConditions.visibilityOf( - seleniumWebDriver.findElement(By.xpath(locatorToEditorContaiPaineId)))) - .click(); - try { - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") - .perform(); - importProjectFromLocation.closeWithIcon(); - } catch (org.openqa.selenium.TimeoutException e) { - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(Keys.ALT.toString() + Keys.SHIFT.toString() + "A") - .perform(); - importProjectFromLocation.closeWithIcon(); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckMacrosFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckMacrosFeatureTest.java deleted file mode 100644 index aa145f98c3d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckMacrosFeatureTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.CUSTOM_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.CUSTOM_TYPE; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckMacrosFeatureTest { - - private static final String PROJECT_NAME = NameGenerator.generate("project", 5); - private static final String COMMAND = - "echo ${editor.current.file.name} ${editor.current.file.path}" - + " ${editor.current.file.relpath} ${editor.current.project.name}" - + " ${editor.current.project.type}"; - private static final String COMMAND_NAME = "firstCommand"; - private String expectedText = - format("README.md /projects/%1$s/README.md" + " /%1$s/README.md %1$s maven", PROJECT_NAME); - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles console; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING.toString()); - ide.open(workspace); - } - - @Test - public void checkMacrosFeature() throws Exception { - List textList; - - ide.waitOpenedWorkspaceIsReadyToUse(); - createCommand(COMMAND_NAME, COMMAND); - - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME + "/README.md"); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTabIsPresent("README.md"); - - projectExplorer.invokeCommandWithContextMenu( - ContextMenuCommandGoals.COMMON_GOAL, PROJECT_NAME, COMMAND_NAME); - console.waitIsCommandConsoleOpened(20); - console.waitExpectedTextIntoConsole(expectedText); - - textList = Arrays.asList(console.getVisibleTextFromCommandConsole().split("\n")); - loader.waitOnClosed(); - Assert.assertTrue(textLineOncePresent(textList, expectedText)); - } - - private boolean textLineOncePresent(List textList, String expectTextLine) { - int quantity = 0; - for (String textLine : textList) { - if (textLine.contains(expectTextLine)) { - quantity++; - } - } - return quantity == 1; - } - - private void createCommand(String commandName, String command) { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - loader.waitOnClosed(); - commandsExplorer.clickAddCommandButton(COMMON_GOAL); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(CUSTOM_TYPE); - loader.waitOnClosed(); - commandsExplorer.waitCommandInExplorerByName(CUSTOM_NAME); - commandsEditor.waitActive(); - commandsEditor.waitTabFileWithSavedStatus(CUSTOM_NAME); - commandsEditor.clickOnCancelCommandEditorButton(); - commandsEditor.waitTabIsNotPresent(CUSTOM_NAME); - - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.selectCommandByName(CUSTOM_NAME); - editor.waitActive(); - commandsEditor.typeTextIntoNameCommandField(commandName); - commandsEditor.waitTextIntoNameCommandField(commandName); - commandsEditor.waitTabCommandWithUnsavedStatus(CUSTOM_NAME); - - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - commandsEditor.typeTextIntoEditor(command); - commandsEditor.waitTextIntoEditor(command); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - loader.waitOnClosed(); - - projectExplorer.clickOnProjectExplorerTab(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckRestoringWorkspaceAfterStoppingWsAgentProcessTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckRestoringWorkspaceAfterStoppingWsAgentProcessTest.java deleted file mode 100644 index 8beea89e743..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/CheckRestoringWorkspaceAfterStoppingWsAgentProcessTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; - -import com.google.inject.Inject; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.api.core.model.workspace.WorkspaceStatus; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.executor.DockerCliCommandExecutor; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckRestoringWorkspaceAfterStoppingWsAgentProcessTest { - private static final String PROJECT_NAME = NameGenerator.generate("WsAgentTest", 4); - private static final int WAITING_NOTIFICATION_TIMEOUT_IN_SEC = 180; - private static final String nameCommandForKillWsAgent = "killWsAgent"; - private static final String killPIDWSAgentCommand = - "kill -9 $(ps ax | grep java | grep ws-agent | grep conf | grep -v grep | awk '{print $1}')"; - private static final String EXPECTED_POPUP_MESSAGE = - "Workspace agent is not running, open editors are switched to read-only mode"; - private static final String TEXT_FOR_TYPING = "text for checking"; - private static final String FILE_NAME = "Aclass"; - private static final String PATH_TO_CHECKING_FILE = - PROJECT_NAME + "/src/main/java/che.eclipse.sample"; - private static final String EXPECTED_EDITOR_TEXT = - "/*\n" - + " * Copyright (c) 2012-2018 Red Hat, Inc.\n" - + " * This program and the accompanying materials are made\n" - + " * available under the terms of the Eclipse Public License 2.0\n" - + " * which is available at https://www.eclipse.org/legal/epl-2.0/\n" - + " *\n" - + " * SPDX-License-Identifier: EPL-2.0\n" - + " *\n" - + " * Contributors:\n" - + " * Red Hat, Inc. - initial API and implementation\n" - + " */\n" - + "package che.eclipse.sample;\n" - + "\n" - + "public class Aclass {\n" - + "}\n"; - - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Ide ide; - @Inject private TestWorkspace testWorkspace; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private DefaultTestUser defaultTestUser; - @Inject private DockerCliCommandExecutor dockerCliCommandExecutor; - @Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private ToastLoader toastLoader; - @Inject private TestCommandServiceClient testCommandServiceClient; - - @BeforeClass - public void prepare() throws Exception { - Path projectPath = - Paths.get(getClass().getResource("/projects/default-spring-project").toURI()); - testProjectServiceClient.importProject( - testWorkspace.getId(), projectPath, PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - testCommandServiceClient.createCommand( - killPIDWSAgentCommand, nameCommandForKillWsAgent, CUSTOM, testWorkspace.getId()); - - ide.open(testWorkspace); - } - - @Test - public void editorShouldBeInReadonlyModeAfterUnexpectedWsAgentStopping() throws Exception { - goToFileAndCheckText(); - - // execute kill ws agent command - projectExplorer.invokeCommandWithContextMenu( - COMMON_GOAL, PROJECT_NAME, nameCommandForKillWsAgent); - - // check that ws agent has stopped and current editor tab is displayed - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose( - EXPECTED_POPUP_MESSAGE, WAITING_NOTIFICATION_TIMEOUT_IN_SEC); - toastLoader.waitToastLoaderIsOpen(); - toastLoader.waitExpectedTextInToastLoader("Workspace agent is not running"); - editor.waitTabIsPresent(FILE_NAME); - editor.waitTextIntoEditor(EXPECTED_EDITOR_TEXT); - - // check that editor is in read only mode - editor.waitActive(); - editor.typeTextIntoEditor(TEXT_FOR_TYPING); - editor.waitTextIntoEditor(EXPECTED_EDITOR_TEXT); - - // check ws agent restoring - toastLoader.clickOnToastLoaderButton("Restart"); - toastLoader.waitExpectedTextInToastLoader("Starting workspace runtime..."); - waitWorkspaceRunningStatus(); - goToFileAndCheckText(); - editor.waitActive(); - editor.typeTextIntoEditor(TEXT_FOR_TYPING); - editor.waitTextIntoEditor(TEXT_FOR_TYPING); - } - - private void waitWorkspaceRunningStatus() throws Exception { - testWorkspaceServiceClient.waitStatus( - testWorkspace.getName(), defaultTestUser.getName(), WorkspaceStatus.RUNNING); - } - - private void goToFileAndCheckText() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PATH_TO_CHECKING_FILE, FILE_NAME + ".java"); - editor.waitActive(); - editor.waitTabIsPresent(FILE_NAME); - editor.waitTextIntoEditor(EXPECTED_EDITOR_TEXT); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java deleted file mode 100644 index 8a6716a5d24..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToMavenProjectTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.UPDATE_PROJECT_CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CONVERT_TO_PROJECT; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.PROJECT_OF_UNDEFINED_TYPE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.action.ActionsFactory; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.InformationDialog; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev, Musienko Maxim */ -public class ConvertToMavenProjectTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 4); - private static final String WEB_APP_MODULE = "my-webapp"; - private static final String NONE_MAVEN_PROJECT = NameGenerator.generate("noneMavenProject", 4); - private static final String PARENT_ARTIFACT_SECTION = - "\n" - + "org.eclipse.che.examples\n" - + "qa-multimodule\n" - + " 1.0-SNAPSHOT\n" - + "\n"; - private static final String CONVERT_PATH = format("%s/%s", PROJECT_NAME, WEB_APP_MODULE); - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private Wizard wizard; - @Inject private AskForValueDialog askForValueDialog; - @Inject private InformationDialog informationDialog; - @Inject private ActionsFactory actionsFactory; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - private String workspaceId; - - @BeforeClass - public void setUp() throws Exception { - workspaceId = workspace.getId(); - URL mavenMultimodule = getClass().getResource("/projects/java-multimodule"); - URL noneMavenProject = getClass().getResource("/projects/console-cpp-simple"); - testProjectServiceClient.importProject( - workspaceId, Paths.get(mavenMultimodule.toURI()), PROJECT_NAME, PROJECT_OF_UNDEFINED_TYPE); - testProjectServiceClient.importProject( - workspaceId, - Paths.get(noneMavenProject.toURI()), - NONE_MAVEN_PROJECT, - PROJECT_OF_UNDEFINED_TYPE); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.quickRevealToItemWithJavaScript(format("%s/%s", PROJECT_NAME, WEB_APP_MODULE)); - } - - @Test - public void shouldConvertToMavenMultimoduleProject() throws Exception { - convertPredefinedFolderToMavenProjectWithContextMenu(CONVERT_PATH); - testProjectServiceClient.checkProjectType(workspaceId, CONVERT_PATH, "maven"); - addParentArticatSectionIntoPomFile(); - menu.runCommand(PROJECT, UPDATE_PROJECT_CONFIGURATION); - convertToMavenByWizard("/", PROJECT_NAME); - testProjectServiceClient.checkProjectType(workspaceId, CONVERT_PATH, "maven"); - } - - @Test - public void shouldNotConvertToMavenProject() { - projectExplorer.waitAndSelectItem(NONE_MAVEN_PROJECT); - menu.runCommand(PROJECT, UPDATE_PROJECT_CONFIGURATION); - wizard.waitOpenProjectConfigForm(); - wizard.waitTextParentDirectoryName("/"); - wizard.waitTextProjectNameInput(NONE_MAVEN_PROJECT); - wizard.selectSample(Wizard.TypeProject.MAVEN); - informationDialog.acceptInformDialogWithText("pom.xml does not exist."); - wizard.closeWithIcon(); - } - - private void convertPredefinedFolderToMavenProjectWithContextMenu(String converPath) { - projectExplorer.waitAndSelectItem(converPath); - projectExplorer.openContextMenuByPathSelectedItem(converPath); - projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); - convertToMavenByWizard("/" + PROJECT_NAME, WEB_APP_MODULE); - } - - private void convertToMavenByWizard(String pathToDirectory, String convertedFolder) { - wizard.waitOpenProjectConfigForm(); - wizard.waitTextParentDirectoryName(pathToDirectory); - wizard.waitTextProjectNameInput(convertedFolder); - wizard.selectSample(Wizard.TypeProject.MAVEN); - loader.waitOnClosed(); - wizard.clickSaveButton(); - wizard.waitCloseProjectConfigForm(); - } - - private void addParentArticatSectionIntoPomFile() { - projectExplorer.openItemByPath(CONVERT_PATH + "/pom.xml"); - editor.goToPosition(23, 3); - editor.typeTextIntoEditor(PARENT_ARTIFACT_SECTION); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectFromConfigurationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectFromConfigurationTest.java deleted file mode 100644 index a2649f10781..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ConvertToProjectFromConfigurationTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.FOLDER; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CONVERT_TO_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVASCRIPT_FILE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; - -import com.google.common.base.Joiner; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.action.ActionsFactory; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuItems; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class ConvertToProjectFromConfigurationTest { - private static final String PROJECT_NAME = NameGenerator.generate("project", 4); - private static final String PHP_FOLDER_NAME = "phpFolder"; - private static final String JS_FOLDER_NAME = "jsFolder"; - private static final String PATH_TO_PHP_FILE = - PROJECT_NAME + "/src/main/webapp/" + PHP_FOLDER_NAME; - private static final String PATH_TO_JS_FILE = - PROJECT_NAME + "/src/main/webapp/WEB-INF/" + JS_FOLDER_NAME; - - private static final String TEXT_FILE_JS = - "var express = require('express');\n" - + "var app = express();\n" - + "\n" - + "app.get('/', function (req, res) {\n" - + " res.send('Hello World!');\n" - + "});\n" - + "\n" - + "app.listen(3000, function () {\n" - + " console.log('Example app listening on port 3000!');\n" - + "});"; - private static final String TEXT_FILE_CSS = "echo \"Hello World!\"\n" + "\n" + "?>"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private Wizard wizard; - @Inject private AskForValueDialog askForValueDialog; - @Inject private ActionsFactory actionsFactory; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - ide.open(workspace); - } - - @Test - public void checkConvertToProjectFromConfiguration() throws Exception { - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/src/main/webapp"); - - // create folder with php file and convert to project - createNewFolder(PROJECT_NAME + "/src/main/webapp", PHP_FOLDER_NAME); - createNewFile("file.php", PATH_TO_PHP_FILE, FILE); - projectExplorer.waitVisibilityByName("file.php"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/phpFolder/file.php"); - editor.waitActive(); - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(getContentFromFile("file.php")) - .perform(); - editor.waitTextIntoEditor(TEXT_FILE_CSS); - - convertToProject(PHP_FOLDER_NAME, PROJECT_NAME + "/src/main/webapp"); - wizard.selectTypeProject(Wizard.TypeProject.BLANK); - loader.waitOnClosed(); - wizard.clickSaveButton(); - wizard.waitCloseProjectConfigForm(); - - projectExplorer.waitItem(PATH_TO_PHP_FILE); - projectExplorer.waitAndSelectItem(PATH_TO_PHP_FILE); - menu.runCommand(PROJECT, CONFIGURATION); - wizard.waitOpenProjectConfigForm(); - wizard.waitTextParentDirectoryName("/" + PROJECT_NAME + "/src/main/webapp"); - wizard.waitTextProjectNameInput(PHP_FOLDER_NAME); - wizard.selectTypeProject(Wizard.TypeProject.BLANK); - loader.waitOnClosed(); - wizard.clickSaveButton(); - wizard.waitCloseProjectConfigForm(); - - // create folder with js file and convert to project - projectExplorer.quickRevealToItemWithJavaScript(PROJECT_NAME + "/src/main/webapp/WEB-INF"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/WEB-INF"); - createNewFolder(PROJECT_NAME + "/src/main/webapp/WEB-INF", JS_FOLDER_NAME); - createNewFile("fileJS", PATH_TO_JS_FILE, JAVASCRIPT_FILE); - projectExplorer.waitVisibilityByName("fileJS.js"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/WEB-INF/jsFolder/fileJS.js"); - editor.waitActive(); - actionsFactory - .createAction(seleniumWebDriver) - .sendKeys(getContentFromFile("file.js")) - .perform(); - editor.waitTextIntoEditor(TEXT_FILE_JS); - - convertToProject(JS_FOLDER_NAME, PROJECT_NAME + "/src/main/webapp/WEB-INF"); - wizard.selectTypeProject(Wizard.TypeProject.BLANK); - loader.waitOnClosed(); - wizard.clickSaveButton(); - wizard.waitCloseProjectConfigForm(); - - projectExplorer.waitItem(PATH_TO_JS_FILE); - projectExplorer.waitAndSelectItem(PATH_TO_JS_FILE); - menu.runCommand(PROJECT, CONFIGURATION); - wizard.waitOpenProjectConfigForm(); - wizard.waitTextParentDirectoryName("/" + PROJECT_NAME + "/src/main/webapp/WEB-INF"); - wizard.waitTextProjectNameInput(JS_FOLDER_NAME); - wizard.selectTypeProject(Wizard.TypeProject.BLANK); - loader.waitOnClosed(); - wizard.clickSaveButton(); - wizard.waitCloseProjectConfigForm(); - } - - public void createNewFolder(String path, String folderName) { - projectExplorer.waitAndSelectItem(path); - menu.runCommand(PROJECT, TestMenuCommandsConstants.Project.New.NEW, FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(folderName); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(folderName, ELEMENT_TIMEOUT_SEC); - loader.waitOnClosed(); - } - - private void convertToProject(String folderName, String parentDirectory) { - projectExplorer.waitAndSelectItemByName(folderName); - projectExplorer.openContextMenuByPathSelectedItem(parentDirectory + "/" + folderName); - projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); - wizard.waitOpenProjectConfigForm(); - wizard.waitTextParentDirectoryName("/" + parentDirectory); - wizard.waitTextProjectNameInput(folderName); - } - - private void createNewFile(String name, String pathToFile, ContextMenuItems type) { - projectExplorer.waitAndSelectItem(pathToFile); - projectExplorer.openContextMenuByPathSelectedItem(pathToFile); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnItemInContextMenu(type); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(name); - askForValueDialog.clickOkBtn(); - } - - private String getContentFromFile(String path) throws Exception { - List textFromFile = - Files.readAllLines( - Paths.get(getClass().getResource(path).toURI()), Charset.forName("UTF-8")); - return Joiner.on("\n").join(textFromFile); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/DialogAboutTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/DialogAboutTest.java deleted file mode 100644 index aefe99f57db..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/DialogAboutTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Help.ABOUT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Help.HELP; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.DialogAbout; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.Test; - -/** @author Anatolii Bazko */ -public class DialogAboutTest { - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private DialogAbout dialogAbout; - - @Test - public void dialogAboutTest() throws Exception { - ide.open(testWorkspace); - - ide.waitOpenedWorkspaceIsReadyToUse(); - menu.runCommand(HELP, ABOUT); - - dialogAbout.waitVerifyTextElements("About"); - dialogAbout.waitVerifyTextElements("Build Details"); - dialogAbout.clickOnBuildDetailsAnchor(); - dialogAbout.waitBuildDetailsDialogIsOpen(); - dialogAbout.closeBuildDetailsDialog(); - dialogAbout.closeAboutDialog(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureBaseOperationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureBaseOperationTest.java deleted file mode 100644 index 7dd7c7753a1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureBaseOperationTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FILE_STRUCTURE; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FileStructure; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 11.12.15 */ -public class FileStructureBaseOperationTest { - private static final String PROJECT_NAME = generate("project", 4); - - private static final String CLASS_MEMBERS_1 = - "AppController\n" + "secretNum\n" + "handleRequest(HttpServletRequest, HttpServletResponse)"; - - private static final String CLASS_MEMBERS_2 = - "AppController\n" - + "secretNum\n" - + "handleRequest(HttpServletRequest, HttpServletResponse):ModelAndView\n"; - - private static final String INHERITED_MEMBERS = - "Object() - java.lang.Object\n" - + "registerNatives() - java.lang.Object\n" - + "getClass() - java.lang.Object\n" - + "hashCode() - java.lang.Object\n" - + "equals(...) - java.lang.Object\n" - + "clone() - java.lang.Object\n" - + "toString() - java.lang.Object\n" - + "notify() - java.lang.Object\n" - + "notifyAll() - java.lang.Object\n" - + "wait(...) - java.lang.Object\n" - + "wait(...) - java.lang.Object\n" - + "wait() - java.lang.Object\n" - + "finalize() - java.lang.Object\n" - + "() - java.lang.Object"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private FileStructure fileStructure; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkFileStructureBaseOperations() { - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - - // Check the opening and closing the 'file structure' form - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen("AppController"); - fileStructure.launchFileStructureFormByKeyboard(); - fileStructure.closeFileStructureFormByEscape(); - - loader.waitOnClosed(); - fileStructure.waitFileStructureFormIsClosed(); - fileStructure.launchFileStructureFormByKeyboard(); - fileStructure.launchFileStructureFormByKeyboard(); - loader.waitOnClosed(); - fileStructure.waitFileStructureFormIsOpen("AppController"); - fileStructure.clickFileStructureCloseIcon(); - loader.waitOnClosed(); - fileStructure.waitFileStructureFormIsClosed(); - - // Show inherited members - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - loader.waitOnClosed(); - fileStructure.waitFileStructureFormIsOpen("AppController"); - fileStructure.waitExpectedTextInFileStructure(CLASS_MEMBERS_1); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(INHERITED_MEMBERS); - fileStructure.launchFileStructureFormByKeyboard(); - fileStructure.waitExpectedTextInFileStructure(CLASS_MEMBERS_2); - fileStructure.waitExpectedTextInFileStructure(INHERITED_MEMBERS); - fileStructure.launchFileStructureFormByKeyboard(); - fileStructure.waitExpectedTextInFileStructure(CLASS_MEMBERS_1); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(INHERITED_MEMBERS); - fileStructure.closeFileStructureFormByEscape(); - editor.closeAllTabs(); - loader.waitOnClosed(); - - // Check the the 'file structure' is not present in the menu - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/index.jsp"); - editor.waitActive(); - menu.runCommand(ASSISTANT); - menu.waitCommandIsNotPresentInMenu(FILE_STRUCTURE); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureByKeyboardTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureByKeyboardTest.java deleted file mode 100644 index cdf4cb426d3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureByKeyboardTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SIMPLE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FileStructure; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class FileStructureByKeyboardTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String JAVA_FILE_NAME = "Company"; - private static final String INNER_CLASS_NAME = "CompanyHelper"; - private static final String INTERFACE_NAME = "Inter"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private FileStructure fileStructure; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/prOutline"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SIMPLE); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkFileStructureByKeyboard() { - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.openItemByPath(PROJECT_NAME); - expandTReeProjectAndOpenClass(JAVA_FILE_NAME); - - // check work nodes in the 'file structure' by keyboard - fileStructure.launchFileStructureFormByKeyboard(); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(FileStructureNodesTest.ITEMS_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_CLASS_1); - fileStructure.selectItemInFileStructure(INNER_CLASS_NAME); - fileStructure.waitExpectedTextIsNotPresentInFileStructure( - FileStructureNodesTest.ITEMS_INNER_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_INNER_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.waitExpectedTextIsNotPresentInFileStructure( - FileStructureNodesTest.ITEMS_INNER_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_INNER_CLASS); - fileStructure.selectItemInFileStructure(INTERFACE_NAME); - fileStructure.waitExpectedTextIsNotPresentInFileStructure( - FileStructureNodesTest.ITEMS_INTERFACE); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_INTERFACE); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.waitExpectedTextIsNotPresentInFileStructure( - FileStructureNodesTest.ITEMS_INTERFACE); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_INTERFACE); - - // check go on the root node after 'double click arrow left' - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(FileStructureNodesTest.ITEMS_CLASS); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.clickOnIconNodeInFileStructure(INTERFACE_NAME); - fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_CLASS); - - // check scroll by keyboard - fileStructure.selectItemInFileStructure(JAVA_FILE_NAME); - fileStructure.waitExpectedTextInFileStructure(FileStructureNodesTest.ITEMS_CLASS); - fileStructure.moveDownToItemInFileStructure("TEN"); - // TODO add code scroll up later - } - - private void expandTReeProjectAndOpenClass(String fileName) { - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.waitItem( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - editor.waitActive(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureCodeEditorTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureCodeEditorTest.java deleted file mode 100644 index 3538ed7ba19..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureCodeEditorTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FILE_STRUCTURE; -import static org.openqa.selenium.Keys.ENTER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FileStructure; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 15.12.15 */ -public class FileStructureCodeEditorTest { - private static final String PROJECT_NAME = generate("project", 5); - private static final String JAVA_FILE_NAME = "Company"; - - private static final String NEW_CONTENT = - "private int a;\n" + "private long b;\n" + "private String s;"; - - private static final String EXPECTED_TEXT = - "private int a;\n" + "private long b;\n" + "private String s;"; - - private static final String NEW_ITEMS = "a\n" + "b\n" + "s"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private FileStructure fileStructure; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/prOutline"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkFileStructureCodeEditor() { - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.openItemByPath(PROJECT_NAME); - expandTReeProjectAndOpenClass(JAVA_FILE_NAME); - - // check the highlighted item in editor - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - fileStructure.selectItemInFileStructureByDoubleClick("getInstance():Company"); - fileStructure.waitFileStructureFormIsClosed(); - editor.waitSpecifiedValueForLineAndChar(41, 38); - - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - fileStructure.selectAndOpenItemInFileStructureByEnter("INSTANCE"); - fileStructure.waitFileStructureFormIsClosed(); - editor.waitSpecifiedValueForLineAndChar(25, 46); - - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - fileStructure.selectAndOpenItemInFileStructureByEnter("getId():double"); - fileStructure.waitFileStructureFormIsClosed(); - editor.waitSpecifiedValueForLineAndChar(37, 28); - - // check new elements in the 'file structure' form - editor.setCursorToLine(20); - editor.waitActive(); - editor.typeTextIntoEditor(ENTER.toString()); - editor.typeTextIntoEditor(NEW_CONTENT); - editor.waitTextIntoEditor(EXPECTED_TEXT); - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - fileStructure.waitExpectedTextInFileStructure(NEW_ITEMS); - } - - private void expandTReeProjectAndOpenClass(String fileName) { - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.waitItem( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - editor.waitActive(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureNodesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureNodesTest.java deleted file mode 100644 index 4ec0a70a5fe..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FileStructureNodesTest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FILE_STRUCTURE; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SIMPLE; -import static org.openqa.selenium.Keys.ESCAPE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FileStructure; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Serhii Skoryk - */ -public class FileStructureNodesTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String JAVA_FILE_NAME = "Company"; - private static final String INNER_CLASS_NAME = "CompanyHelper"; - private static final String INTERFACE_NAME = "Inter"; - - public static final String ITEMS_CLASS = - "Company\n" - + "Company()\n" - + "CompanyHelper\n" - + "INSTANCE\n" - + "ONE\n" - + "QWE\n" - + "TWO\n" - + "Inter\n" - + "ASD\n" - + "FIVE\n" - + "TEN\n" - + "setDate():void\n" - + "getId():double\n" - + "getDate():String\n" - + "getInstance():Company\n" - + "listEmployees\n" - + "listId\n" - + "listName\n" - + "listDate\n" - + "doListId():List\n" - + "doListName():List\n" - + "doListDate():List\n" - + "createListEmpl():List\n" - + "createListEmpl(int):List\n" - + "removeEmployee(String):List\n" - + "getListEmployees():List\n" - + "sortSalary():List\n" - + "sortSurname():List\n" - + "sortId():List\n" - + "sortDate():List"; - - public static final String ITEMS_CLASS_1 = - "Company\n" - + "Company()\n" - + "CompanyHelper\n" - + "Inter\n" - + "getInstance():Company\n" - + "listEmployees\n" - + "listId\n" - + "listName\n" - + "listDate\n" - + "doListId():List\n" - + "doListName():List\n" - + "doListDate():List\n" - + "createListEmpl():List\n" - + "createListEmpl(int):List\n" - + "removeEmployee(String):List\n" - + "getListEmployees():List\n" - + "sortSalary():List\n" - + "sortSurname():List\n" - + "sortId():List\n" - + "sortDate():List"; - - public static final String ITEMS_INNER_CLASS = "INSTANCE\n" + "ONE\n" + "QWE\n" + "TWO\n"; - - public static final String ITEMS_INTERFACE = - "ASD\n" + "FIVE\n" + "TEN\n" + "setDate():void\n" + "getId():double\n" + "getDate():String"; - - private static final String ITEMS_FILTERED_GET = - "Company\n" - + "Inter\n" - + "getId():double\n" - + "getDate():String\n" - + "getInstance():Company\n" - + "getListEmployees():List\n"; - - private static final String ITEMS_FILTERED_I = - "Company\n" - + "CompanyHelper\n" - + "INSTANCE\n" - + "Inter\n" - + "FIVE\n" - + "setDate():void\n" - + "getId():double\n" - + "getDate():String\n" - + "getInstance():Company\n" - + "listEmployees\n" - + "listId\n" - + "listName\n" - + "listDate\n" - + "doListId():List\n" - + "doListName():List\n" - + "doListDate():List\n" - + "createListEmpl():List\n" - + "createListEmpl(int):List\n" - + "removeEmployee(String):List\n" - + "getListEmployees():List\n" - + "sortSalary():List\n" - + "sortSurname():List\n" - + "sortId():List\n" - + "sortDate():List"; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private TestWorkspace workspace; - @Inject private FileStructure fileStructure; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/prOutline"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SIMPLE); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - void checkFileStructureFilter() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("Company.java"); - - menu.runCommand(ASSISTANT, FILE_STRUCTURE); - fileStructure.waitFileStructureFormIsOpen(JAVA_FILE_NAME); - - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS); - fileStructure.type("get"); - fileStructure.waitExpectedTextInFileStructure(ITEMS_FILTERED_GET); - fileStructure.type(ESCAPE.toString()); - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS); - fileStructure.type("i"); - fileStructure.waitExpectedTextInFileStructure(ITEMS_FILTERED_I); - fileStructure.type(ESCAPE.toString()); - } - - @Test(priority = 1) - public void checkFileStructureNodes() { - // check work nodes in the 'file structure' by click on the icon - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS); - fileStructure.waitExpectedTextInFileStructure(ITEMS_INNER_CLASS); - fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INNER_CLASS); - fileStructure.waitExpectedTextInFileStructure(ITEMS_INTERFACE); - fileStructure.clickOnIconNodeInFileStructure(INTERFACE_NAME); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_INTERFACE); - - // open nodes in the File Structure form by click - fileStructure.clickOnIconNodeInFileStructure(INTERFACE_NAME); - fileStructure.waitExpectedTextInFileStructure(ITEMS_INTERFACE); - fileStructure.clickOnIconNodeInFileStructure(INNER_CLASS_NAME); - fileStructure.waitExpectedTextInFileStructure(ITEMS_INNER_CLASS); - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS); - - fileStructure.selectItemInFileStructure(JAVA_FILE_NAME); - fileStructure.clickOnIconNodeInFileStructure(JAVA_FILE_NAME); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_CLASS); - fileStructure.clickOnIconNodeInFileStructure(JAVA_FILE_NAME); - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS_1); - - // close and open root node in the File Structure form - fileStructure.selectItemInFileStructure(JAVA_FILE_NAME); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_LEFT.toString()); - fileStructure.waitExpectedTextIsNotPresentInFileStructure(ITEMS_CLASS); - fileStructure.selectItemInFileStructure(JAVA_FILE_NAME); - fileStructure.sendCommandByKeyboardInFileStructure(Keys.ARROW_RIGHT.toString()); - fileStructure.waitExpectedTextInFileStructure(ITEMS_CLASS_1); - - // close File Structure form by ESC button - fileStructure.closeFileStructureFormByEscape(); - fileStructure.waitFileStructureFormIsClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindTextFeatureTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindTextFeatureTest.java deleted file mode 100644 index 41dea357ea8..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindTextFeatureTest.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.format; -import static java.util.Arrays.asList; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.EDIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit.FIND; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOAD_PAGE_TIMEOUT_SEC; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_PETCLINIC; -import static org.openqa.selenium.Keys.ARROW_DOWN; -import static org.openqa.selenium.Keys.ARROW_RIGHT; -import static org.openqa.selenium.Keys.ENTER; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.FindText; -import org.eclipse.che.selenium.pageobject.FindText.SearchFileResult; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.PanelSelector; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class FindTextFeatureTest { - - private static final String PROJECT_NAME = generate("project", 4); - private static final int SUM_FOUND_OCCURRENCES = 313; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject protected ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject protected Menu menu; - @Inject private ConfigureClasspath configureClasspath; - @Inject private CheTerminal terminal; - @Inject protected FindText findTextPage; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private PanelSelector panelSelector; - @Inject protected NotificationsPopupPanel notificationsPopupPanel; - @Inject protected Wizard wizard; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/java-multimodule"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void checkFindTextForm() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Open the Find Text form from menu - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.waitSearchBtnMainFormIsDisabled(); - findTextPage.closeFindTextMainForm(); - - // Open the Find Text form by keyboard - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.waitSearchBtnMainFormIsDisabled(); - findTextPage.closeFindTextFormByEscape(); - } - - @Test - public void checkRecentlyCreatedFiles() throws Exception { - String expectedText1 = - format( - "1 occurrence found in 1 file (per page results) for 'Filesystem'. Total file count - 1\n" - + "/%s/readme.con\n" - + "(1 occurrence of 'Filesystem' found)\n" - + "1: Filesystem 1K-blocks Used Available Use%% Mounted on", - PROJECT_NAME); - String expectedText2 = - format( - "1 occurrence found in 1 file (per page results) for 'Feature'. Total file count - 1\n" - + "/%s/readme.api\n" - + "(1 occurrence of 'Feature' found)\n" - + "1: FindTextFeatureTest", - PROJECT_NAME); - String content = "FindTextFeatureTest"; - String fileNameCreatedFromAPI = "readme.api"; - String fileNameCreatedFromTerminal = "readme.con"; - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Check that the Processes tab is opened - if (!consoles.processesMainAreaIsOpen()) { - panelSelector.selectPanelTypeFromPanelSelector(PanelSelector.PanelTypes.LEFT_BOTTOM_ID); - } - consoles.clickOnProcessesButton(); - - // Create a file from terminal - terminal.waitFirstTerminalTab(); - terminal.selectFirstTerminalTab(); - createFileInTerminal(fileNameCreatedFromTerminal); - WaitUtils.sleepQuietly(LOAD_PAGE_TIMEOUT_SEC); - - // Check that created from terminal file found by "Filesystem" text - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("Filesystem"); - findTextPage.waitTextIntoFindField("Filesystem"); - findTextPage.setAndWaitWholeWordCheckbox(false); - findTextPage.waitPathIntoRootField("/" + PROJECT_NAME); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText1.split("\n"))); - findTextPage.selectItemInFindInfoPanel( - format("/%s/readme.con", PROJECT_NAME), - "1: Filesystem 1K-blocks Used Available Use% Mounted on"); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ENTER.toString()); - editor.waitActiveTabFileName(fileNameCreatedFromTerminal); - assertEquals(editor.getPositionVisible(), 1); - - // Create a file from API - createFileFromAPI(PROJECT_NAME, fileNameCreatedFromAPI, content); - WaitUtils.sleepQuietly(LOAD_PAGE_TIMEOUT_SEC); - - // Check that created from API file found by "Feature" text - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("Feature"); - findTextPage.waitTextIntoFindField("Feature"); - findTextPage.setAndWaitWholeWordCheckbox(false); - findTextPage.waitPathIntoRootField("/" + PROJECT_NAME); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText2.split("\n"))); - findTextPage.selectItemInFindInfoPanel( - format("/%s/readme.api", PROJECT_NAME), "1: FindTextFeatureTest"); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ENTER.toString()); - editor.waitActiveTabFileName(fileNameCreatedFromAPI); - assertEquals(editor.getPositionVisible(), 1); - - editor.closeAllTabsByContextMenu(); - } - - @Test - public void checkFindTextBasic() { - String expectedText = - format( - "9 occurrences found in 4 files (per page results) for 'String'. Total file count - 4\n" - + "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "(4 occurrences of 'String' found)\n" - + "/%1$s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n" - + "(2 occurrences of 'String' found)\n" - + "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n" - + "(1 occurrence of 'String' found)\n" - + "/%1$s/my-lib/src/main/java/hello/SayHello.java\n" - + "(2 occurrences of 'String' found)", - PROJECT_NAME); - String findNothing = "No results found for\n'dddhhh'\n"; - String pathToQuessNumFile = - format("/%s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp", PROJECT_NAME); - String pathToSayHelloFile = - format("/%s/my-lib/src/main/java/hello/SayHello.java", PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Check that no occurrences found - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.waitSearchBtnMainFormIsDisabled(); - findTextPage.typeTextIntoFindField("dddhhh"); - findTextPage.waitTextIntoFindField("dddhhh"); - loader.waitOnClosed(); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel(findNothing); - - // check find info panel when switch to processes panel - consoles.clickOnProcessesButton(); - findTextPage.waitFindInfoPanelIsClosed(); - findTextPage.clickFindTextButton(); - findTextPage.waitFindInfoPanelIsOpen(); - consoles.closeProcessesArea(); - findTextPage.waitFindInfoPanelIsClosed(); - - // Find files with 'String' text. Open 'guess_num.jsp' file and check cursor position - projectExplorer.waitAndSelectItem(PROJECT_NAME); - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("String"); - findTextPage.waitTextIntoFindField("String"); - findTextPage.setAndWaitStateSearchRootCheckbox(false); - findTextPage.waitPathIntoRootField("/" + PROJECT_NAME); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText.split("\n"))); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.selectItemInFindInfoPanel( - pathToQuessNumFile, - "26: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");"); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ENTER.toString()); - editor.waitActive(); - editor.waitActiveTabFileName("guess_num.jsp"); - editor.waitTextIntoEditor("String"); - assertEquals(editor.getPositionVisible(), 26); - - // Check that the Find Info panel state restored - consoles.closeProcessesArea(); - findTextPage.waitFindInfoPanelIsClosed(); - panelSelector.selectPanelTypeFromPanelSelector(PanelSelector.PanelTypes.LEFT_BOTTOM_ID); - findTextPage.waitFindInfoPanelIsOpen(); - - // Open 'SayHello.java' file and check cursor position - findTextPage.selectItemInFindInfoPanel( - pathToQuessNumFile, - "26: java.lang.String attempt = (java.lang.String)request.getAttribute(\"num\");"); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_RIGHT.toString()); - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - findTextPage.selectItemInFindInfoPanelByDoubleClick( - pathToSayHelloFile, "21: public String sayHello(String name)"); - editor.waitActive(); - editor.waitActiveTabFileName("SayHello"); - editor.waitTextIntoEditor("String"); - assertEquals(editor.getPositionVisible(), 21); - - editor.closeAllTabsByContextMenu(); - } - - @Test - public void checkFindWholeWordOnly() { - String expectedText = - format( - "10 occurrences found in 4 files (per page results) for 'uess'. Total file count - 4\n" - + "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "(6 occurrences of 'uess' found)\n" - + "/%1$s/my-webapp/src/main/webapp/index.jsp\n" - + "(1 occurrence of 'uess' found)\n" - + "/%1$s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n" - + "(2 occurrences of 'uess' found)\n" - + "/%1$s/my-webapp/src/main/webapp/WEB-INF/spring-servlet.xml\n" - + "(1 occurrence of 'uess' found)", - PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Find text with whole world feature is disabled - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("uess"); - findTextPage.waitTextIntoFindField("uess"); - findTextPage.setAndWaitWholeWordCheckbox(false); - findTextPage.waitPathIntoRootField("/" + PROJECT_NAME); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText.split("\n"))); - - // Find text with whole world feature is enabled - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("uess"); - findTextPage.waitTextIntoFindField("uess"); - findTextPage.setAndWaitWholeWordCheckbox(true); - findTextPage.waitPathIntoRootField("/" + PROJECT_NAME); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel("No results found for\n'uess'\n"); - } - - @Test - public void checkFindIntoSelectedPath() { - String path1 = PROJECT_NAME + "/my-webapp/src/main/java/org/eclipse/qa/examples"; - String expectedText1 = - format( - "6 occurrences found in 1 file (per page results) for 'uess'. Total file count - 1\n" - + "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "(6 occurrences of 'uess' found)", - PROJECT_NAME); - String path2 = format("/%s/my-lib", PROJECT_NAME); - String expectedText2 = - format( - "15 occurrences found in 2 files (per page results) for 'hello'. Total file count - 2\n" - + "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n" - + "(10 occurrences of 'hello' found)\n" - + "/%1$s/my-lib/src/main/java/hello/SayHello.java\n" - + "(5 occurrences of 'hello' found)", - PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem(path1); - - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("uess"); - findTextPage.waitTextIntoFindField("uess"); - findTextPage.setAndWaitStateSearchRootCheckbox(false); - findTextPage.waitPathIntoRootField("/" + path1); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText1.split("\n"))); - - projectExplorer.waitAndSelectItem(PROJECT_NAME); - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("hello"); - findTextPage.waitTextIntoFindField("hello"); - findTextPage.setAndWaitStateSearchRootCheckbox(true); - findTextPage.clickSearchDirectoryBtn(); - configureClasspath.waitSelectPathFormIsOpen(); - configureClasspath.openItemInSelectPathForm(PROJECT_NAME); - configureClasspath.waitItemInSelectPathForm("my-lib"); - configureClasspath.waitItemInSelectPathForm("my-webapp"); - configureClasspath.selectItemInSelectPathForm("my-lib"); - configureClasspath.clickOkBtnSelectPathForm(); - findTextPage.waitPathIntoRootField(path2); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText2.split("\n"))); - } - - @Test - public void checkFindByFileMask() { - String expectedText1 = - format( - "7 occurrences found in 3 files (per page results) for 'String'. Total file count - 3\n" - + "/%1$s/my-webapp/src/main/java/org/eclipse/qa/examples/AppController.java\n" - + "(4 occurrences of 'String' found)\n" - + "/%1$s/my-lib/src/test/java/hello/SayHelloTest.java\n" - + "(1 occurrence of 'String' found)\n" - + "/%1$s/my-lib/src/main/java/hello/SayHello.java\n" - + "(2 occurrences of 'String' found)", - PROJECT_NAME); - String expectedText2 = - format( - "2 occurrences found in 1 file (per page results) for 'String'. Total file count - 1\n" - + "/%s/my-webapp/src/main/webapp/WEB-INF/jsp/guess_num.jsp\n" - + "(2 occurrences of 'String' found)", - PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - - // Find text with '*.java' file mask - menu.runCommand(EDIT, FIND); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("String"); - findTextPage.waitTextIntoFindField("String"); - findTextPage.setAndWaitFileMaskCheckbox(true); - findTextPage.typeTextIntoFileNameFilter("*.java"); - findTextPage.waitTextIntoFileNameFilter("*.java"); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText1.split("\n"))); - findTextPage.waitExpectedTextIsNotPresentInFindInfoPanel(expectedText2); - - // Find text with '*.jsp' file mask - projectExplorer.waitAndSelectItem(PROJECT_NAME); - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("String"); - findTextPage.waitTextIntoFindField("String"); - findTextPage.setAndWaitFileMaskCheckbox(true); - findTextPage.typeTextIntoFileNameFilter("*.jsp"); - findTextPage.waitTextIntoFileNameFilter("*.jsp"); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - findTextPage.waitExpectedTextIsNotPresentInFindInfoPanel(expectedText1); - findTextPage.waitExpectedTextInFindInfoPanel(asList(expectedText2.split("\n"))); - } - - @Test - public void checkTextResultsPagination() { - SearchFileResult searchFileResult; - int sumOfFoundOccurrences = 0; - int sumOfFoundFiles = 0; - - // Import the web-java-petclinic project and find all occurrences of 'Str' - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.selectProjectAndCreate(WEB_JAVA_PETCLINIC, "web-java-petclinic"); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.waitItem("web-java-petclinic"); - projectExplorer.waitAndSelectItem("web-java-petclinic"); - - findTextPage.launchFindFormByKeyboard(); - findTextPage.waitFindTextMainFormIsOpen(); - findTextPage.typeTextIntoFindField("Str"); - findTextPage.waitTextIntoFindField("Str"); - findTextPage.clickOnSearchButtonMainForm(); - findTextPage.waitFindInfoPanelIsOpen(); - - // Check move page buttons status on the first page - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - assertTrue(findTextPage.checkNextPageButtonIsEnabled()); - assertFalse(findTextPage.checkPreviousPageButtonIsEnabled()); - searchFileResult = findTextPage.getResults(); - sumOfFoundFiles += searchFileResult.getFoundFilesOnPage(); - sumOfFoundOccurrences += searchFileResult.getFoundOccurrencesOnPage(); - findTextPage.clickOnNextPageButton(); - - // Check move page buttons status on the second page - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - assertTrue(findTextPage.checkNextPageButtonIsEnabled()); - assertTrue(findTextPage.checkPreviousPageButtonIsEnabled()); - searchFileResult = findTextPage.getResults(); - sumOfFoundFiles += searchFileResult.getFoundFilesOnPage(); - sumOfFoundOccurrences += searchFileResult.getFoundOccurrencesOnPage(); - findTextPage.clickOnNextPageButton(); - - // Check move page buttons status on the third page - findTextPage.sendCommandByKeyboardInFindInfoPanel(ARROW_DOWN.toString()); - assertFalse(findTextPage.checkNextPageButtonIsEnabled()); - assertTrue(findTextPage.checkPreviousPageButtonIsEnabled()); - searchFileResult = findTextPage.getResults(); - sumOfFoundFiles += searchFileResult.getFoundFilesOnPage(); - sumOfFoundOccurrences += searchFileResult.getFoundOccurrencesOnPage(); - - // Checking that sums of found files and occurrences correct - assertEquals(sumOfFoundFiles, findTextPage.getResults().getTotalNumberFoundFiles()); - assertEquals(sumOfFoundOccurrences, SUM_FOUND_OCCURRENCES); - } - - private void createFileFromAPI(String path, String fileName, String content) throws Exception { - testProjectServiceClient.createFileInProject(workspace.getId(), path, fileName, content); - } - - private void createFileInTerminal(String fileName) { - terminal.typeIntoActiveTerminal("cd " + PROJECT_NAME + ENTER); - terminal.typeIntoActiveTerminal("df > " + fileName + ENTER); - terminal.typeIntoActiveTerminal("cat " + fileName + ENTER); - terminal.typeIntoActiveTerminal("ls" + ENTER); - terminal.waitTextInFirstTerminal(fileName); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindUsagesBaseOperationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindUsagesBaseOperationTest.java deleted file mode 100644 index b966211d8ab..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/FindUsagesBaseOperationTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.FIND_USAGES; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; -import static org.openqa.selenium.Keys.ARROW_DOWN; -import static org.openqa.selenium.Keys.ARROW_LEFT; -import static org.openqa.selenium.Keys.ARROW_RIGHT; -import static org.openqa.selenium.Keys.ARROW_UP; -import static org.openqa.selenium.Keys.ENTER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.FindUsages; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class FindUsagesBaseOperationTest { - private static final String PROJECT_NAME = generate("project", 4); - - private static final String EXPECTED_TEXT = - "Usages of numGuessByUser [3 occurrences]\n" - + PROJECT_NAME - + "\n" - + "org.eclipse.qa.examples\n" - + "- src/main/java\n" - + "AppController\n" - + "handleRequest(HttpServletRequest, HttpServletResponse)\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "34: else if (numGuessByUser != null) {"; - - private static final String EXPECTED_TEXT_1 = - "org.eclipse.qa.examples\n" - + "- src/main/java\n" - + "AppController\n" - + "handleRequest(HttpServletRequest, HttpServletResponse)\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "34: else if (numGuessByUser != null) {"; - - private static final String EXPECTED_TEXT_2 = - "handleRequest(HttpServletRequest, HttpServletResponse)\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "30: if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + "34: else if (numGuessByUser != null) {"; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private Events events; - @Inject private CodenvyEditor editor; - @Inject private FindUsages findUsages; - @Inject private TestWorkspace workspace; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkFindUsagesBaseOperation() { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - - // Check basic operations of the Find Usages panel - editor.selectTabByName("AppController"); - editor.goToCursorPositionVisible(27, 17); - menu.runCommand(ASSISTANT, FIND_USAGES); - loader.waitOnClosed(); - findUsages.waitFindUsagesPanelIsOpen(); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT); - findUsages.waitSelectedElementInFindUsagesPanel("numGuessByUser"); - - // Switch to the Events panel and check that the Find Usages panel is not visible - findUsages.waitFindUsagesPanelIsOpen(); - events.clickEventLogBtn(); - events.waitOpened(); - findUsages.waitFindUsagesPanelIsClosed(); - - // Switch to the Find Usages panel and check its expected content - findUsages.clickFindUsagesIcon(); - findUsages.waitFindUsagesPanelIsOpen(); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT); - findUsages.waitSelectedElementInFindUsagesPanel("numGuessByUser"); - - // Check nodes in the Find Usages panel by 'double click' - findUsages.selectNodeInFindUsagesByDoubleClick(PROJECT_NAME); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1); - findUsages.selectNodeInFindUsagesByDoubleClick(PROJECT_NAME); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1); - findUsages.selectNodeInFindUsagesByDoubleClick("org.eclipse.qa.examples"); - findUsages.waitExpectedTextInFindUsagesPanel("AppController"); - findUsages.selectNodeInFindUsagesByDoubleClick("AppController"); - findUsages.waitExpectedTextInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.selectNodeInFindUsagesByDoubleClick( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT); - - // Check nodes in the Find Usages panel by click on node icon - findUsages.clickOnIconNodeInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2); - findUsages.clickOnIconNodeInFindUsagesPanel("AppController"); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1); - findUsages.clickOnIconNodeInFindUsagesPanel("org.eclipse.qa.examples"); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - - // Check nodes in the Find Usages panel by 'Enter' button - // Close node by ENTER button and check it closed - findUsages.selectNodeInFindUsagesPanel(PROJECT_NAME); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel("org.eclipse.qa.examples"); - - // Open node and check that only "org.eclipse.qa.examples" node is opened - findUsages.selectNodeInFindUsagesPanel(PROJECT_NAME); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextInFindUsagesPanel("org.eclipse.qa.examples"); - findUsages.selectNodeInFindUsagesPanel("org.eclipse.qa.examples"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.selectNodeInFindUsagesPanel("AppController"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.selectNodeInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_1); - - // Close "AppController" node by ENTER button and check it closed - findUsages.selectNodeInFindUsagesPanel("AppController"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - - // Open "AppController" node and check that only "handleRequest(HttpServletRequest, - // HttpServletResponse)" node is opened - findUsages.selectNodeInFindUsagesPanel("AppController"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.selectNodeInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ENTER.toString()); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2); - - // Check nodes in the Find Usages panel by keyboard - findUsages.selectNodeInFindUsagesPanel( - "handleRequest(HttpServletRequest, HttpServletResponse)"); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_LEFT.toString()); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_2); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_RIGHT.toString()); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_UP.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_UP.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_UP.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_LEFT.toString()); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_RIGHT.toString()); - findUsages.waitExpectedTextIsNotPresentInFindUsagesPanel(EXPECTED_TEXT_1); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_DOWN.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_RIGHT.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_DOWN.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_RIGHT.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_DOWN.toString()); - findUsages.sendCommandByKeyboardInFindUsagesPanel(ARROW_RIGHT.toString()); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_2); - findUsages.waitExpectedTextInFindUsagesPanel(EXPECTED_TEXT_1); - - // Check the found items in the editor - findUsages.selectHighlightedItemInFindUsagesByDoubleClick(30); - editor.waitActive(); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.expectedNumberOfActiveLine(30); - editor.waitTextElementsActiveLine("numGuessByUser"); - - findUsages.selectHighlightedItemInFindUsagesByDoubleClick(34); - editor.waitActive(); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.expectedNumberOfActiveLine(34); - editor.waitTextElementsActiveLine("numGuessByUser"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ImplementationBaseOperationsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ImplementationBaseOperationsTest.java deleted file mode 100644 index 98347753094..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ImplementationBaseOperationsTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.IMPLEMENTATION_S; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SIMPLE; -import static org.openqa.selenium.Keys.ARROW_LEFT; -import static org.openqa.selenium.Keys.ENTER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 12.01.16 */ -public class ImplementationBaseOperationsTest { - private static final String PROJECT_NAME = generate("project", 5); - private static final String JAVA_FILE_NAME = "Company"; - private static final String ABSTRACT_CLASS_NAME = "Empl"; - private static final String INTERFACE_NAME = "Employee"; - private static final String GENERAL_INTERFACE_NAME = "Remote"; - private static final String NO_FOUND_TEXT = "No implementations found"; - private static final String LIST_IMPLEMENTATIONS = - "Empl - (/" - + PROJECT_NAME - + "/src/main/java/com/codenvy/qa/Empl.java)\n" - + "EmployeeFixedSalary - (/" - + PROJECT_NAME - + "/src/main/java/com/codenvy/qa/EmployeeFixedSalary.java)\n" - + "Employee - (/" - + PROJECT_NAME - + "/src/main/java/com/codenvy/qa/Employee.java)\n" - + "EmployeeHourlyWages - (/" - + PROJECT_NAME - + "/src/main/java/com/codenvy/qa/EmployeeHourlyWages.java)"; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private TestWorkspace workspace; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/prOutline"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkImplementationInEditor() { - projectExplorer.openItemByPath(PROJECT_NAME); - expandTReeProjectAndOpenClass(JAVA_FILE_NAME); - - // check that the 'Implementation' container is not present - editor.setCursorToLine(13); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitImplementationFormIsClosed(JAVA_FILE_NAME); - - // check the 'implementation' for simple java class - editor.setCursorToLine(21); - editor.clickOnSelectedElementInEditor(JAVA_FILE_NAME); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitImplementationFormIsOpen(JAVA_FILE_NAME); - editor.cancelFormInEditorByEscape(); - editor.waitImplementationFormIsClosed(JAVA_FILE_NAME); - editor.setCursorToLine(21); - editor.clickOnSelectedElementInEditor(JAVA_FILE_NAME); - editor.launchImplementationFormByKeyboard(); - editor.waitImplementationFormIsOpen(JAVA_FILE_NAME); - editor.waitTextInImplementationForm(NO_FOUND_TEXT); - - // check the 'implementation' for abstract class - projectExplorer.openItemByVisibleNameInExplorer(ABSTRACT_CLASS_NAME + ".java"); - editor.goToCursorPositionVisible(16, 25); - editor.waitActive(); - editor.waitTextElementsActiveLine(ABSTRACT_CLASS_NAME); - editor.launchImplementationFormByKeyboard(); - editor.waitActiveTabFileName("EmployeeFixedSalary"); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(14, 14); - editor.waitTextElementsActiveLine("EmployeeFixedSalary extends Empl"); - editor.clickOnCloseFileIcon("EmployeeFixedSalary"); - editor.waitActiveTabFileName(ABSTRACT_CLASS_NAME); - editor.selectTabByName(ABSTRACT_CLASS_NAME); - editor.setCursorToLine(23); - editor.clickOnSelectedElementInEditor("toString"); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitActiveTabFileName("EmployeeFixedSalary"); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(39, 19); - editor.waitTextElementsActiveLine("toString"); - - // check the 'implementations' for interface - projectExplorer.openItemByVisibleNameInExplorer(INTERFACE_NAME + ".java"); - editor.goToCursorPositionVisible(16, 20); - editor.waitTextElementsActiveLine(INTERFACE_NAME); - editor.launchImplementationFormByKeyboard(); - editor.waitActiveTabFileName("EmployeeHourlyWages"); - editor.expectedNumberOfActiveLine(15); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(15, 14); - editor.waitTextElementsActiveLine("EmployeeHourlyWages implements Employee"); - editor.clickOnCloseFileIcon("EmployeeHourlyWages"); - editor.waitActiveTabFileName(INTERFACE_NAME); - editor.selectTabByName(INTERFACE_NAME); - editor.setCursorToLine(19); - editor.clickOnSelectedElementInEditor("toString"); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitActiveTabFileName("EmployeeHourlyWages"); - editor.typeTextIntoEditor(ARROW_LEFT.toString()); - editor.waitSpecifiedValueForLineAndChar(59, 19); - editor.waitTextElementsActiveLine("toString"); - editor.selectTabByName(INTERFACE_NAME); - editor.goToCursorPositionVisible(16, 38); - editor.waitTextElementsActiveLine("interface Employee extends Remote"); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitImplementationFormIsOpen(GENERAL_INTERFACE_NAME); - - editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS); - editor.typeTextIntoEditor(ENTER.toString()); - editor.waitImplementationFormIsClosed(GENERAL_INTERFACE_NAME); - editor.waitActiveTabFileName(ABSTRACT_CLASS_NAME); - editor.setCursorToLine(16); - editor.waitTextElementsActiveLine("class Empl implements Remote"); - editor.selectTabByName(INTERFACE_NAME); - editor.launchImplementationFormByKeyboard(); - editor.waitImplementationFormIsOpen(GENERAL_INTERFACE_NAME); - editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS); - editor.selectImplementationByClick("EmployeeHourlyWages"); - editor.typeTextIntoEditor(ENTER.toString()); - editor.waitImplementationFormIsClosed(GENERAL_INTERFACE_NAME); - editor.waitActiveTabFileName("EmployeeHourlyWages"); - editor.selectTabByName(INTERFACE_NAME); - menu.runCommand(ASSISTANT, IMPLEMENTATION_S); - editor.waitImplementationFormIsOpen(GENERAL_INTERFACE_NAME); - editor.waitTextInImplementationForm(LIST_IMPLEMENTATIONS); - editor.chooseImplementationByDoubleClick("EmployeeFixedSalary"); - editor.waitImplementationFormIsClosed(GENERAL_INTERFACE_NAME); - editor.waitActiveTabFileName("EmployeeFixedSalary"); - } - - private void expandTReeProjectAndOpenClass(String fileName) { - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java"); - projectExplorer.waitItem(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa"); - projectExplorer.waitItem( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src" + "/main" + "/java" + "/com/codenvy/qa/" + fileName + ".java"); - editor.waitActive(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/MachinesAsynchronousStartTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/MachinesAsynchronousStartTest.java deleted file mode 100644 index b5a78657cc9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/MachinesAsynchronousStartTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.format; -import static java.util.Arrays.asList; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.ActionButton.SAVE_BUTTON; -import static org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails.WorkspaceDetailsTab.MACHINES; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.util.List; -import org.eclipse.che.api.core.model.workspace.Workspace; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.client.TestWorkspaceServiceClient; -import org.eclipse.che.selenium.core.executor.OpenShiftCliCommandExecutor; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.webdriver.WebDriverWaitFactory; -import org.eclipse.che.selenium.core.workspace.TestWorkspaceProvider; -import org.eclipse.che.selenium.pageobject.dashboard.Dashboard; -import org.eclipse.che.selenium.pageobject.dashboard.NewWorkspace; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.EditMachineForm; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetails; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.WorkspaceDetailsMachines; -import org.eclipse.che.selenium.pageobject.dashboard.workspaces.Workspaces; -import org.openqa.selenium.TimeoutException; -import org.openqa.selenium.support.ui.ExpectedCondition; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -@Test(groups = {TestGroup.OPENSHIFT, UNDER_REPAIR}) -public class MachinesAsynchronousStartTest { - private static final String WORKSPACE_NAME = generate("test-workspace-", 4); - private static final String MACHINE_NAME = "dev-machine"; - private static final String SUCCESS_NOTIFICATION_TEST = "Workspace updated."; - private static final String GET_WORKSPACE_EVENTS_COMMAND_TEMPLATE = - "get event --no-headers=true | grep %s | awk '{print $7 \" \" $8}'"; - - protected final String IMAGE_NAME = getImageName(); - protected final String IMAGE_NAME_SUFFIX = generate("-", 4); - protected final String NOT_EXISTED_IMAGE_NAME = IMAGE_NAME + IMAGE_NAME_SUFFIX; - protected final String EXPECTED_ERROR_NOTIFICATION_TEXT = - format( - "Unrecoverable event occurred: 'Failed', 'Failed to pull image \"%s\": " - + "rpc error: code = Unknown desc = Error response from daemon: pull " - + "access denied for %s, repository does not exist or may require 'docker login''", - NOT_EXISTED_IMAGE_NAME, NOT_EXISTED_IMAGE_NAME); - - @Inject private Dashboard dashboard; - @Inject private Workspaces workspaces; - @Inject private TestWorkspaceProvider testWorkspaceProvider; - @Inject private TestWorkspaceServiceClient testWorkspaceServiceClient; - @Inject private DefaultTestUser defaultTestUser; - @Inject private OpenShiftCliCommandExecutor openShiftCliCommandExecutor; - @Inject private WebDriverWaitFactory webDriverWaitFactory; - @Inject private NewWorkspace newWorkspace; - @Inject private WorkspaceDetails workspaceDetails; - @Inject private WorkspaceDetailsMachines workspaceDetailsMachines; - @Inject private EditMachineForm editMachineForm; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - - private Workspace brokenWorkspace; - - @AfterClass - public void cleanUp() throws Exception { - testWorkspaceServiceClient.delete(brokenWorkspace.getNamespace(), defaultTestUser.getName()); - } - - @BeforeClass - public void setUp() { - // open "New Workspace" page - dashboard.open(); - dashboard.waitDashboardToolbarTitle(); - dashboard.selectWorkspacesItemOnDashboard(); - workspaces.clickOnAddWorkspaceBtn(); - newWorkspace.waitPageLoad(); - - // create new workspace - newWorkspace.typeWorkspaceName(WORKSPACE_NAME); - newWorkspace.clickOnCreateButtonAndEditWorkspace(); - - // change base image of workspace to nonexistent one - workspaceDetails.waitToolbarTitleName(WORKSPACE_NAME); - workspaceDetails.selectTabInWorkspaceMenu(MACHINES); - workspaceDetailsMachines.waitMachineListItem(MACHINE_NAME); - workspaceDetailsMachines.clickOnEditButton(MACHINE_NAME); - editMachineForm.waitForm(); - editMachineForm.clickOnRecipeForm(); - editMachineForm.waitRecipeCursorVisibility(); - seleniumWebDriverHelper.sendKeys(IMAGE_NAME_SUFFIX); - editMachineForm.waitRecipeText(NOT_EXISTED_IMAGE_NAME); - editMachineForm.waitSaveButtonEnabling(); - editMachineForm.clickOnSaveButton(); - editMachineForm.waitFormInvisibility(); - - // save changes - workspaceDetailsMachines.waitImageNameInMachineListItem(MACHINE_NAME, NOT_EXISTED_IMAGE_NAME); - workspaceDetails.waitAllEnabled(SAVE_BUTTON); - workspaceDetails.clickOnSaveChangesBtn(); - workspaceDetailsMachines.waitNotificationMessage(SUCCESS_NOTIFICATION_TEST); - - // open "Workspaces" page - dashboard.selectWorkspacesItemOnDashboard(); - workspaces.waitPageLoading(); - workspaces.waitWorkspaceIsPresent(WORKSPACE_NAME); - } - - @Test - public void checkWorkspace() { - // check behavior of the broken workspace - workspaces.clickOnWorkspaceStopStartButton(WORKSPACE_NAME); - try { - workspaces.waitErrorNotificationContainsText(getExpectedErrorNotificationText()); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/12419"); - } - - // check openshift events log - waitEvent("Failed"); - } - - private List getWorkspaceEvents() throws Exception { - brokenWorkspace = - testWorkspaceServiceClient.getByName(WORKSPACE_NAME, defaultTestUser.getName()); - final String command = format(GET_WORKSPACE_EVENTS_COMMAND_TEMPLATE, brokenWorkspace.getId()); - final String events = openShiftCliCommandExecutor.execute(command); - - return asList(events.split("[\\ \\n]")); - } - - private boolean eventIsPresent(String event) { - try { - return getWorkspaceEvents().contains(event); - } catch (Exception e) { - throw new RuntimeException("Fail of events logs reading", e); - } - } - - private void waitEvent(String event) { - final int timeoutInSeconds = 12; - final int delayBetweenRequestsInSeconds = 2; - - webDriverWaitFactory - .get(timeoutInSeconds, delayBetweenRequestsInSeconds) - .until((ExpectedCondition) driver -> eventIsPresent(event)); - } - - protected String getImageName() { - return "eclipse/ubuntu_jdk8"; - } - - protected String getExpectedErrorNotificationText() { - return EXPECTED_ERROR_NOTIFICATION_TEXT; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java deleted file mode 100644 index 611d11dcc6d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/NavigateToFileTest.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.format; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestCommandsConstants.CUSTOM; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.NAVIGATE_TO_FILE; -import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SIMPLE; -import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Map; -import java.util.concurrent.ThreadLocalRandom; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NavigateToFile; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.openqa.selenium.WebDriverException; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** Created by aleksandr shmaraev on 10.12.15 */ -public class NavigateToFileTest { - private static final String PROJECT_NAME = "NavigateFile"; - private static final String PROJECT_NAME_2 = "NavigateFile_2"; - private static final String FILE_CREATED_FROM_CONSOLE = "createdFrom.con"; - private static final String COMMAND_FOR_FILE_CREATION = "createFile"; - private static final String HIDDEN_FOLDER_NAME = ".hiddenFolder"; - private static final String HIDDEN_FILE_NAME = ".hiddenFile"; - private static final String FILE_IN_HIDDEN_FOLDER = "innerFile.css"; - private static final int MAX_TIMEOUT_FOR_UPDATING_INDEXES = 10; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NavigateToFile navigateToFile; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SIMPLE); - - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME_2, MAVEN_SIMPLE); - testCommandServiceClient.createCommand( - format("touch /projects/%s/%s", PROJECT_NAME_2, FILE_CREATED_FROM_CONSOLE), - COMMAND_FOR_FILE_CREATION, - CUSTOM, - workspace.getId()); - ide.open(workspace); - consoles.waitJDTLSStartedMessage(); - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME_2); - } - - @Test(dataProvider = "dataForCheckingTheSameFileInDifferentProjects", groups = FLAKY) - public void shouldNavigateToFileForFirstProject( - String inputValueForChecking, Map expectedValues) { - // Open the project one and check function 'Navigate To File' - launchNavigateToFileAndCheckResults(inputValueForChecking, expectedValues, 1); - } - - @Test(dataProvider = "dataForCheckingTheSameFileInDifferentProjects", groups = FLAKY) - public void shouldDoNavigateToFileForSecondProject( - String inputValueForChecking, Map expectedValues) { - launchNavigateToFileAndCheckResults(inputValueForChecking, expectedValues, 2); - } - - @Test(dataProvider = "dataToNavigateToFileCreatedOutsideIDE", groups = FLAKY) - public void shouldNavigateToFileWithJustCreatedFiles( - String inputValueForChecking, Map expectedValues) throws Exception { - - String content = "NavigateToFileTest"; - testProjectServiceClient.createFileInProject( - workspace.getId(), PROJECT_NAME, expectedValues.get(1).split(" ")[0], content); - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(COMMAND_FOR_FILE_CREATION); - sleepQuietly(MAX_TIMEOUT_FOR_UPDATING_INDEXES); - int randomItemFromList = ThreadLocalRandom.current().nextInt(1, 2); - launchNavigateToFileAndCheckResults(inputValueForChecking, expectedValues, randomItemFromList); - } - - @Test - public void shouldNotDisplayHiddenFilesAndFoldersInDropDown() throws Exception { - addHiddenFoldersAndFileThroughProjectService(); - launchNavigateToFileFromUIAndTypeValue(FILE_IN_HIDDEN_FOLDER); - assertTrue(navigateToFile.getText().isEmpty()); - navigateToFile.closeNavigateToFileForm(); - launchNavigateToFileFromUIAndTypeValue(HIDDEN_FILE_NAME); - assertTrue(navigateToFile.getText().isEmpty()); - } - - @Test(dataProvider = "dataToCheckNavigateByNameWithSpecialSymbols") - public void shouldDisplayFilesFoundByMask( - String inputValueForChecking, Map expectedValues) { - launchNavigateToFileFromUIAndTypeValue(inputValueForChecking); - navigateToFile.waitSuggestedPanel(); - waitExpectedItemsInNavigateToFileDropdown(expectedValues); - navigateToFile.closeNavigateToFileForm(); - navigateToFile.waitFormToClose(); - } - - private void addHiddenFoldersAndFileThroughProjectService() throws Exception { - testProjectServiceClient.createFolder( - workspace.getId(), PROJECT_NAME + "/" + HIDDEN_FOLDER_NAME); - testProjectServiceClient.createFileInProject( - workspace.getId(), - PROJECT_NAME + "/" + HIDDEN_FOLDER_NAME, - FILE_IN_HIDDEN_FOLDER, - "contentFile1"); - testProjectServiceClient.createFileInProject( - workspace.getId(), PROJECT_NAME_2 + "/", HIDDEN_FILE_NAME, "content-of-hidden-file"); - sleepQuietly(MAX_TIMEOUT_FOR_UPDATING_INDEXES); - } - - private void launchNavigateToFileAndCheckResults( - String navigatingValue, - Map expectedItems, - final int numValueFromDropDawnList) { - - // extract the path (without opened class) - String dropdownVerificationPath = expectedItems.get(numValueFromDropDawnList).split(" ")[1]; - String openedFileWithExtension = expectedItems.get(numValueFromDropDawnList).split(" ")[0]; - - // extract the name of opened files that display in a tab (the ".java" extension are not shown - // in tabs) - String openedFileNameInTheTab = openedFileWithExtension.replace(".java", ""); - launchNavigateToFileFromUIAndTypeValue(navigatingValue); - navigateToFile.waitSuggestedPanel(); - waitExpectedItemsInNavigateToFileDropdown(expectedItems); - - try { - navigateToFile.selectFileByName(dropdownVerificationPath); - } catch (WebDriverException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/8465", ex); - } - - editor.waitActive(); - editor.getAssociatedPathFromTheTab(openedFileNameInTheTab); - editor.closeFileByNameWithSaving(openedFileNameInTheTab); - } - - private void launchNavigateToFileFromUIAndTypeValue(String navigatingValue) { - loader.waitOnClosed(); - menu.runCommand(ASSISTANT, NAVIGATE_TO_FILE); - navigateToFile.waitFormToOpen(); - loader.waitOnClosed(); - navigateToFile.typeSymbolInFileNameField(navigatingValue); - loader.waitOnClosed(); - } - - private void waitExpectedItemsInNavigateToFileDropdown(Map expectedItems) { - expectedItems - .values() - .stream() - .map(it -> it.toString()) - .forEach(it -> Assert.assertTrue(navigateToFile.isFilenameSuggested(it))); - } - - @DataProvider - private Object[][] dataForCheckingTheSameFileInDifferentProjects() { - return new Object[][] { - { - "A", - ImmutableMap.of( - 1, "AppController.java (/NavigateFile/src/main/java/org/eclipse/qa/examples)", - 2, "AppController.java (/NavigateFile_2/src/main/java/org/eclipse/qa/examples)") - }, - { - "R", - ImmutableMap.of( - 1, "README.md (/NavigateFile)", - 2, "README.md (/NavigateFile_2)") - } - }; - } - - @DataProvider - private Object[][] dataToNavigateToFileCreatedOutsideIDE() { - return new Object[][] { - { - "c", - ImmutableMap.of( - 1, "createdFrom.api (/NavigateFile)", 2, "createdFrom.con (/NavigateFile_2)") - } - }; - } - - @DataProvider - private Object[][] dataToCheckNavigateByNameWithSpecialSymbols() { - return new Object[][] { - { - "*.java", - ImmutableMap.of( - 1, "AppController.java (/NavigateFile/src/main/java/org/eclipse/qa/examples)", - 2, "AppController.java (/NavigateFile_2/src/main/java/org/eclipse/qa/examples)") - }, - { - "ind*.jsp", - ImmutableMap.of( - 1, "index.jsp (/NavigateFile/src/main/webapp)", - 2, "index.jsp (/NavigateFile_2/src/main/webapp)") - }, - { - "*R*.md", - ImmutableMap.of( - 1, "README.md (/NavigateFile)", - 2, "README.md (/NavigateFile_2)") - }, - { - "we?.xml", - ImmutableMap.of( - 1, "web.xml (/NavigateFile/src/main/webapp/WEB-INF)", - 2, "web.xml (/NavigateFile_2/src/main/webapp/WEB-INF)") - }, - { - "gu?ss_n?m.j?p", - ImmutableMap.of( - 1, "guess_num.jsp (/NavigateFile/src/main/webapp/WEB-INF/jsp)", - 2, "guess_num.jsp (/NavigateFile_2/src/main/webapp/WEB-INF/jsp)") - } - }; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/OpenInTerminalTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/OpenInTerminalTest.java deleted file mode 100644 index d55b5df9b4e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/OpenInTerminalTest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_IN_TERMINAL; -import static org.openqa.selenium.Keys.ALT; -import static org.openqa.selenium.Keys.F12; -import static org.openqa.selenium.Keys.SHIFT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * Test "Open in Terminal" action. Will check action calling from context menu on selected project, - * folder and file - * - * @author Vitalii Parfonov - */ -public class OpenInTerminalTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_EXPAND = "/src/main/java"; - private static final String FILE = "/README.md"; - - @SuppressWarnings("unused") - @Inject - protected TestWorkspace workspace; - - @SuppressWarnings("unused") - @Inject - private Ide ide; - - @SuppressWarnings("unused") - @Inject - private ProjectExplorer projectExplorer; - - @SuppressWarnings("unused") - @Inject - private TestProjectServiceClient testProjectServiceClient; - - @SuppressWarnings("unused") - @Inject - private CheTerminal terminal; - - @SuppressWarnings("unused") - @Inject - private SeleniumWebDriverHelper seleniumWebDriverHelper; - - @SuppressWarnings("unused") - @Inject - private SeleniumWebDriver seleniumWebDriver; - - @BeforeClass - public void setUp() throws Exception { - URL resource = this.getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - } - - /** - * - * - *
-   *  - Select project in project explorer
-   *  - Open context menu on selected project
-   *  - Click on "Open in Terminal" action
-   *  - Wait on opening new terminal, number of opened terminal should increase
-   *  - Check working directory in open terminal, should point to the selected project
-   * 
- */ - @Test - public void openProjectInTerminalTest() { - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(OPEN_IN_TERMINAL); - terminal.waitTerminalTab(2); - terminal.waitTextInTerminal(2, PROJECT_NAME); - } - - /** - * - * - *
-   * First check:
-   *  - Expend project tree
-   *  - Select some folder
-   *  - Open context menu on selected folder
-   *  - Click on "Open in Terminal" action
-   *  - Wait on opening new terminal, number of opened terminal should increase
-   *  - Check working directory in open terminal, should point to the selected folder
-   *
-   * Second check:
-   *  - Select some file in project tree
-   *  - Open context menu on selected folder
-   *  - Click on "Open in Terminal" action
-   *  - Wait on opening new terminal, number of opened terminal should increase
-   *  - Check working directory in open terminal, should point to the parent of selected file
-   * 
- */ - @Test - public void openFolderInTerminalTest() throws Exception { - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorer(PROJECT_NAME + PATH_TO_EXPAND); - projectExplorer.waitAndSelectItem(PROJECT_NAME + PATH_TO_EXPAND); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + PATH_TO_EXPAND); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(OPEN_IN_TERMINAL); - terminal.waitTerminalTab(2); - terminal.waitTextInTerminal(2, getExpectedTextInTerminal()); - - projectExplorer.waitAndSelectItem(PROJECT_NAME + FILE); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + FILE); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(OPEN_IN_TERMINAL); - terminal.waitTerminalTab(3); - terminal.waitTextInTerminal(3, PROJECT_NAME); - } - - /** - * - * - *
-   *  - Select project in project explorer
-   *  - Open context menu on selected project
-   *  - Call hot key Alt+Shift+F12
-   *  - Wait on opening new terminal, number of opened terminal should increase
-   *  - Check working directory in open terminal, should point to the selected project
-   * 
- */ - @Test - public void openInTerminalTestByHotKey() { - seleniumWebDriver.navigate().refresh(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - seleniumWebDriverHelper.sendKeys(Keys.chord(ALT, SHIFT, F12)); - terminal.waitTerminalTab(2); - terminal.waitTextInTerminal(2, PROJECT_NAME); - } - - protected String getExpectedTextInTerminal() throws Exception { - return PROJECT_NAME + PATH_TO_EXPAND; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ResolveDependencyAfterRecreateProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ResolveDependencyAfterRecreateProjectTest.java deleted file mode 100644 index 88da0a4d01d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ResolveDependencyAfterRecreateProjectTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.CREATE_PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.DELETE; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.Wizard.SamplesName.WEB_JAVA_SPRING; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Musienko Maxim - * @author Aleksandr Shmaraev - */ -public class ResolveDependencyAfterRecreateProjectTest { - private static final String PROJECT_NAME1 = generate("project1", 4); - private static final String PROJECT_NAME2 = generate("project2", 4); - private static final String PATH_TO_EXPAND = "/src/main/java/org.eclipse.che.examples"; - private static final String PATH_TO_FILE = - "/src/main/java/org/eclipse/che/examples/GreetingController.java"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject private Wizard wizard; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void updateDependencyWithInheritTest() { - createProjectFromUI(PROJECT_NAME1); - - projectExplorer.waitAndSelectItem(PROJECT_NAME1); - projectExplorer.expandPathInProjectExplorer(PROJECT_NAME1 + getPathToExpand()); - projectExplorer.openItemByPath(PROJECT_NAME1 + getPathToFile()); - editor.waitActive(); - editor.waitAllMarkersInvisibility(ERROR); - - removeProjectFromUI(); - createProjectFromUI(PROJECT_NAME2); - - projectExplorer.waitAndSelectItem(PROJECT_NAME2); - projectExplorer.expandPathInProjectExplorer(PROJECT_NAME2 + getPathToExpand()); - projectExplorer.openItemByPath(PROJECT_NAME2 + getPathToFile()); - editor.waitActive(); - editor.waitAllMarkersInvisibility(ERROR); - } - - private void removeProjectFromUI() { - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME1); - projectExplorer.clickOnItemInContextMenu(DELETE); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - projectExplorer.waitItemIsNotPresentVisibleArea(PROJECT_NAME1); - } - - /** - * create project with UI - * - * @param nameOfTheProject name of created project - */ - private void createProjectFromUI(String nameOfTheProject) { - menu.runCommand(WORKSPACE, CREATE_PROJECT); - wizard.selectTypeProject(MAVEN); - wizard.selectSample(getSampleProjectName()); - wizard.typeProjectNameOnWizard(nameOfTheProject); - wizard.clickCreateButton(); - wizard.waitCloseProjectConfigForm(); - - projectExplorer.waitItem(nameOfTheProject); - mavenPluginStatusBar.waitClosingInfoPanel(); - notificationsPopupPanel.waitProgressPopupPanelClose(); - } - - protected String getSampleProjectName() { - return WEB_JAVA_SPRING; - } - - protected String getPathToExpand() { - return PATH_TO_EXPAND; - } - - protected String getPathToFile() { - return PATH_TO_FILE; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ServerRuntimeInfoTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ServerRuntimeInfoTest.java deleted file mode 100644 index 30db154f7b4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/ServerRuntimeInfoTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import com.google.common.collect.Lists; -import com.google.inject.Inject; -import java.util.List; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Vlad Zhukovskyi */ -public class ServerRuntimeInfoTest { - - private List expectedReferenceList = - Lists.newArrayList( - "codeserver", - "tomcat8", - "tomcat8-debug", - "wsagent/ws", - "exec-agent/ws", - "wsagent/http", - "exec-agent/http", - "wsagent-debug"); - - @Inject private TestWorkspace testWorkspace; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CheTerminal terminal; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void testShouldCheckServerList() throws Exception { - ide.waitOpenedWorkspaceIsReadyToUse(); - - consoles.clickOnPlusMenuButton(); - consoles.clickOnServerItemInContextMenu(); - consoles.waitProcessInProcessConsoleTree("Servers"); - consoles.waitTabNameProcessIsPresent("Servers"); - consoles.waitExpectedTextIntoServerTableCation("Servers of dev-machine:"); - - for (String server : expectedReferenceList) { - consoles.checkThatServerExists(server); - } - - consoles.clickOnHideInternalServers(); - consoles.waitReferenceIsNotPresent("gwt-debug-runtime-info-reference-3"); - consoles.waitReferenceIsNotPresent("gwt-debug-runtime-info-reference-6"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/TerminalTypingTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/TerminalTypingTest.java deleted file mode 100644 index 7fa416eae90..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/TerminalTypingTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.testng.internal.collections.Pair; - -/** @author Alexander Andrienko */ -public class TerminalTypingTest { - - private List> keyPairs = - Arrays.asList( - new Pair<>("a", "A"), - new Pair<>("b", "B"), - new Pair<>("c", "C"), - new Pair<>("d", "D"), - new Pair<>("e", "E"), - new Pair<>("f", "F"), - new Pair<>("g", "G"), - new Pair<>("h", "H"), - new Pair<>("i", "I"), - new Pair<>("j", "J"), - new Pair<>("k", "K"), - new Pair<>("l", "L"), - new Pair<>("m", "M"), - new Pair<>("n", "N"), - new Pair<>("o", "O"), - new Pair<>("p", "P"), - new Pair<>("q", "Q"), - new Pair<>("r", "R"), - new Pair<>("s", "S"), - new Pair<>("t", "T"), - new Pair<>("u", "U"), - new Pair<>("v", "V"), - new Pair<>("w", "W"), - new Pair<>("x", "X"), - new Pair<>("v", "V"), - new Pair<>("z", "Z"), - new Pair<>("-", "_"), - new Pair<>("1", "!"), - new Pair<>("2", "@"), - new Pair<>("3", "#"), - new Pair<>("4", "$"), - new Pair<>("5", "%"), - new Pair<>("6", "^"), - new Pair<>("7", "&"), - new Pair<>("8", "*"), - new Pair<>("9", "("), - new Pair<>("0", ")"), - new Pair<>("=", "+"), - new Pair<>("[", "{"), - new Pair<>("]", "}"), - new Pair<>("'", "\""), - new Pair<>("\\", "|"), - new Pair<>(",", "<"), - new Pair<>(".", ">"), - new Pair<>("/", "?"), - new Pair<>("<", "<"), - new Pair<>("`", "~")); - - @Inject private Loader loader; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private CheTerminal terminal; - @Inject private ProjectExplorer projectExplorer; - - @BeforeClass - public void setUp() throws Exception { - ide.open(workspace); - projectExplorer.waitProjectExplorer(); - terminal.waitFirstTerminalTab(); - } - - @Test - public void checkTerminalTypingCharsWithoutShift() { - loader.waitOnClosed(); - terminal.selectFirstTerminalTab(); - terminal.waitTerminalConsole(); - terminal.waitFirstTerminalIsNotEmpty(); - - for (Pair pair : keyPairs) { - terminal.typeIntoActiveTerminal(pair.first()); - terminal.waitTextInFirstTerminal(pair.first()); - terminal.typeIntoActiveTerminal(Keys.BACK_SPACE.toString()); - } - } - - @Test - public void checkTerminalTypingWithShift() { - loader.waitOnClosed(); - terminal.selectFirstTerminalTab(); - terminal.waitTerminalConsole(); - terminal.waitFirstTerminalIsNotEmpty(); - - for (Pair pair : keyPairs) { - terminal.typeIntoActiveTerminal(Keys.SHIFT + pair.first()); - terminal.waitTextInFirstTerminal(pair.second()); - terminal.typeIntoActiveTerminal(Keys.BACK_SPACE.toString()); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithSplitPanelTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithSplitPanelTest.java deleted file mode 100644 index 2d0768904f3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithSplitPanelTest.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.util.Arrays.stream; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.GIT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Git.STATUS; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; -import static org.eclipse.che.selenium.pageobject.MultiSplitPanel.SplitPaneCommands.CLOSE_ALL_TABS; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.MultiSplitPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class WorkingWithSplitPanelTest { - - private static final String PROJECT_NAME = generate("MultiSplitPane", 4); - private static final String BUILD_COMM = "newMaven"; - private static final String[] checkMcTerminal = {"Left", "File", "Command", "Options", "Right"}; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private CheTerminal terminal; - @Inject private Consoles consoles; - @Inject private MultiSplitPanel multiSplitPanel; - @Inject private AskDialog askDialog; - @Inject private Git git; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - } - - @Test - public void checkMultiSplitPane() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - terminal.waitFirstTerminalTab(); - loader.waitOnClosed(); - - // open menu of the split pane - multiSplitPanel.waitNumberOpenSplitPanels(1); - multiSplitPanel.clickOnIconMultiSplitPanel(1); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.clickOnIconMultiSplitPanel(1); - multiSplitPanel.waitSplitPanelMenuIsClosed(); - loader.waitOnClosed(); - - // create a several panels - multiSplitPanel.clickOnIconMultiSplitPanel(1); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.selectCommandSplitPane(MultiSplitPanel.SplitPaneCommands.SPLIT_PANE_IN_COLUMNS); - multiSplitPanel.waitNumberOpenSplitPanels(2); - multiSplitPanel.clickOnIconMultiSplitPanel(1); - multiSplitPanel.selectCommandSplitPane(MultiSplitPanel.SplitPaneCommands.SPLIT_PANE_IN_ROWS); - multiSplitPanel.waitNumberOpenSplitPanels(3); - multiSplitPanel.clickOnIconMultiSplitPanel(3); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.selectCommandSplitPane(MultiSplitPanel.SplitPaneCommands.SPLIT_PANE_IN_ROWS); - multiSplitPanel.waitNumberOpenSplitPanels(4); - - // close one panel from split pane menu - multiSplitPanel.clickOnIconMultiSplitPanel(4); - multiSplitPanel.waitProcessIsNotPresentIntoPaneMenu( - MultiSplitPanel.SplitPaneCommands.CLOSE_PANE); - multiSplitPanel.clickOnIconMultiSplitPanel(3); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.selectCommandSplitPane(MultiSplitPanel.SplitPaneCommands.CLOSE_PANE); - multiSplitPanel.waitSplitPanelMenuIsClosed(); - multiSplitPanel.waitNumberOpenSplitPanels(3); - } - - @Test(priority = 1) - public void checkTerminalAndBuild() { - // make build, open terminal and check tabs - multiSplitPanel.selectSplitPanel(3); - commandsBuilder( - TestIntelligentCommandsConstants.CommandsGoals.COMMON_GOAL, - TestIntelligentCommandsConstants.CommandsTypes.MAVEN_TYPE); - projectExplorer.invokeCommandWithContextMenu(COMMON_GOAL, PROJECT_NAME, BUILD_COMM); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS, 120); - multiSplitPanel.waitTabProcessIsPresent(3, BUILD_COMM); - multiSplitPanel.selectSplitPanel(1); - consoles.clickOnPlusMenuButton(); - consoles.clickOnTerminalItemInContextMenu(); - consoles.startTerminalFromProcessesArea("dev-machine"); - multiSplitPanel.waitTabProcessIsPresent(1, "Terminal-2"); - terminal.waitTerminalIsNotEmpty(2); // terminal.waitTerminalIsNotEmpty(2) - loader.waitOnClosed(); - terminal.typeIntoActiveTerminal(getCommandToCheckTerminal()); - terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); - terminal.waitTerminalIsNotEmpty(3); - loader.waitOnClosed(); - checkExpectedTextIsPresent(); - multiSplitPanel.waitTabProcessIsNotPresent(2, BUILD_COMM); - } - - @Test(priority = 2) - public void checkTabsOnSplitPanel() { - // check tabs on split panels - multiSplitPanel.selectSplitPanel(2); - menu.runCommand( - TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); - askDialog.confirmAndWaitClosed(); - loader.waitOnClosed(); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.STATUS); - multiSplitPanel.waitTabProcessIsPresent(2, "Git status"); - multiSplitPanel.waitTabProcessIsPresent(2, "Git init"); - multiSplitPanel.waitMesageIntoSplitGitPanel( - 2, " On branch master\n" + " Changes not staged for commit"); - multiSplitPanel.clickOnIconMultiSplitPanel(2); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.selectCommandSplitPane("Git status"); - multiSplitPanel.waitTabNameProcessIsFocused("Git status"); - multiSplitPanel.waitSplitPanelMenuIsClosed(); - multiSplitPanel.closeProcessByTabName("Git status"); - multiSplitPanel.waitTabProcessIsNotPresent(2, "Git status"); - multiSplitPanel.clickOnIconMultiSplitPanel(2); - multiSplitPanel.waitSplitPanelMenuIsOpen(); - multiSplitPanel.waitProcessIsNotPresentIntoPaneMenu("Git status"); - multiSplitPanel.closeProcessIntoPaneMenu("Git init"); - multiSplitPanel.waitSplitPanelMenuIsClosed(); - multiSplitPanel.waitTabProcessIsNotPresent(2, "Git init"); - menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.ADD_TO_INDEX); - git.confirmAddToIndexForm(); - multiSplitPanel.waitTabProcessIsPresent(2, "Git add to index"); - } - - @Test(priority = 3) - public void checkSwitchingTabsAndPanels() { - // switch tabs and panels - consoles.clickOnMaximizePanelIcon(); - multiSplitPanel.selectSplitPanel(1); - menu.runCommand(GIT, STATUS); - multiSplitPanel.waitTabProcessIsPresent(1, "Git status"); - multiSplitPanel.waitTabNameProcessIsFocused("Git status"); - multiSplitPanel.waitMesageIntoSplitGitPanel( - 1, " On branch master\n" + " Changes to be committed"); - multiSplitPanel.selectProcessByTabName(2, "Git add to index"); - multiSplitPanel.waitTabNameProcessIsFocused("Git add to index"); - multiSplitPanel.waitMesageIntoSplitGitPanel(2, "Git index updated"); - consoles.clickOnPlusMenuButton(); - consoles.clickOnServerItemInContextMenu(); - multiSplitPanel.waitTabProcessIsPresent(1, "Servers"); - multiSplitPanel.clickOnIconMultiSplitPanel(1); - multiSplitPanel.selectCommandSplitPane(CLOSE_ALL_TABS); - multiSplitPanel.waitSplitPanelMenuIsClosed(); - multiSplitPanel.waitTabProcessIsNotPresent(1, BUILD_COMM); - multiSplitPanel.waitTabProcessIsNotPresent(1, "Terminal-2"); - multiSplitPanel.waitTabProcessIsNotPresent(1, "Git status"); - } - - private void commandsBuilder(String goalName, String commandType) { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - loader.waitOnClosed(); - commandsExplorer.clickAddCommandButton(goalName); - loader.waitOnClosed(); - commandsExplorer.chooseCommandTypeInContextMenu(commandType); - loader.waitOnClosed(); - commandsEditor.waitActive(); - commandsEditor.clickOnCancelCommandEditorButton(); - loader.waitOnClosed(); - projectExplorer.clickOnProjectExplorerTab(); - } - - protected String getCommandToCheckTerminal() { - return "mc"; - } - - protected void checkExpectedTextIsPresent() { - String visibleTextFromTerminal = getExpectedContentOfTerminal(); - stream(checkMcTerminal) - .forEach(content -> assertTrue(visibleTextFromTerminal.contains(content))); - } - - private String getExpectedContentOfTerminal() { - return terminal.getVisibleTextFromTerminal(3); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithTerminalTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithTerminalTest.java deleted file mode 100644 index 7e47b901941..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/miscellaneous/WorkingWithTerminalTest.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.miscellaneous; - -import static java.lang.String.valueOf; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.pageobject.PanelSelector.PanelTypes.LEFT_BOTTOM_ID; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.PanelSelector; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Alexander Andrienko - */ -public class WorkingWithTerminalTest { - private static final String PROJECT_NAME = generate("project", 4); - - private static final String[] CHECK_MC_OPENING = { - "Left", "File", "Command", "Options", "Right", "Name", "bin", "dev", "etc", "home", - "lib", "lib64", "bin", "1Help", "2Menu", "3View", "4Edit", "5Copy", "6RenMov", "7Mkdir", - "8Delete", "9PullDn", "10Quit" - }; - - private static final String MESS_IN_CONSOLE = - "Installing /projects/" + PROJECT_NAME + "/target/qa-spring-sample-1.0-SNAPSHOT.war"; - private static final String WAR_NAME = "qa-spring-sample-1.0-SNAPSHOT.war"; - - private static final String BASH_SCRIPT = - "for i in `seq 1 10`; do sleep 1; echo \"test=$i\"; done"; - - private static final String MC_HELP_DIALOG = - "This is the main help screen for GNU Midnight Commander."; - private static final String MC_USER_MENU_DIALOG = "User menu"; - private static final String[] VIEW_BIN_FOLDER = {"bash", "chmod", "date"}; - - @Inject private Ide ide; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private CheTerminal terminal; - @Inject private TestWorkspace workspace; - @Inject private PanelSelector panelSelector; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @BeforeMethod - protected void prepareNewTerminal() { - panelSelector.selectPanelTypeFromPanelSelector(LEFT_BOTTOM_ID); - - projectExplorer.waitItem(PROJECT_NAME); - - if (terminal.terminalIsPresent()) { - consoles.closeTerminalIntoConsoles(); - terminal.waitTerminalIsNotPresent(1); - } - - consoles.clickOnPlusMenuButton(); - consoles.clickOnTerminalItemInContextMenu(); - - terminal.selectFirstTerminalTab(); - terminal.waitTerminalConsole(); - terminal.waitFirstTerminalIsNotEmpty(); - } - - @Test - public void shouldLaunchCommandWithBigOutput() { - // build the web java application - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME); - terminal.waitTerminalConsole(1); - terminal.typeIntoActiveTerminal("cd /projects/" + PROJECT_NAME + Keys.ENTER); - terminal.waitTextInFirstTerminal("/projects/" + PROJECT_NAME); - terminal.typeIntoActiveTerminal("mvn clean install" + Keys.ENTER); - terminal.waitTextInTerminal( - TestBuildConstants.BUILD_SUCCESS, TestTimeoutsConstants.EXPECTED_MESS_IN_CONSOLE_SEC); - terminal.waitTextInFirstTerminal(MESS_IN_CONSOLE); - - // check the target folder - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME + "/target"); - projectExplorer.waitItem(PROJECT_NAME + "/target/" + WAR_NAME); - } - - @Test - public void shouldScrollAndAppearMCDialogs() { - terminal.typeIntoActiveTerminal("cd ~ && touch -f testfile.txt" + Keys.ENTER); - - openMC("~"); - // check END + F5 - terminal.typeIntoActiveTerminal("" + Keys.END + Keys.F5); - terminal.waitTextInFirstTerminal("Copy file \"testfile.txt\" with source mask"); - terminal.typeIntoActiveTerminal("" + Keys.ESCAPE + Keys.ESCAPE); - - // check HOME + F6 - // we need to press END, HOME or PAGE_DOWN.. keys before functional key because click in MC - // moves - // selection to another file in panel - terminal.typeIntoActiveTerminal("" + Keys.HOME + Keys.F6.toString()); - terminal.waitTextInFirstTerminal("Cannot operate on \"..\"!"); - terminal.typeIntoActiveTerminal("" + Keys.ESCAPE + Keys.ESCAPE); - - // check F7 - terminal.typeIntoActiveTerminal(Keys.F7.toString()); - terminal.waitTextInFirstTerminal("Enter directory name:"); - terminal.typeIntoActiveTerminal("" + Keys.ESCAPE + Keys.ESCAPE); - - // check PAGE_DOWN + F8 - terminal.typeIntoActiveTerminal( - "" - + Keys.PAGE_DOWN - + Keys.PAGE_DOWN - + Keys.PAGE_DOWN - + Keys.PAGE_DOWN - + Keys.F8.toString()); - terminal.waitTextInFirstTerminal("Delete file"); - terminal.waitTextInFirstTerminal("\"testfile.txt\"?"); - terminal.typeIntoActiveTerminal("" + Keys.ESCAPE + Keys.ESCAPE); - - // check F9 - Select menu in MC - terminal.typeIntoActiveTerminal("" + Keys.F9 + Keys.ENTER); - terminal.waitTextInFirstTerminal("File listing"); - terminal.typeIntoActiveTerminal("" + Keys.ESCAPE + Keys.ESCAPE); - } - - @Test(groups = FLAKY) - public void shouldResizeTerminal() { - openMC("/"); - - try { - // check the root content of the midnight commander - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitTextInFirstTerminal(partOfContent); - } - terminal.waitNoTextInFirstTerminal(".dockerenv"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10854", ex); - } - - consoles.clickOnMaximizePanelIcon(); - loader.waitOnClosed(); - - // check resize of the terminal - try { - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitTextInFirstTerminal(partOfContent); - } - terminal.waitTextInFirstTerminal(".dockerenv"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10854", ex); - } - - consoles.clickOnMaximizePanelIcon(); - loader.waitOnClosed(); - - try { - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitTextInFirstTerminal(partOfContent); - } - terminal.waitNoTextInFirstTerminal(".dockerenv"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10854", ex); - } - } - - @Test(groups = FLAKY) - public void shouldNavigateToMC() { - openMC("/"); - - // navigate to midnight commander tree - consoles.selectProcessByTabName("Terminal"); - terminal.typeIntoActiveTerminal(Keys.ARROW_DOWN.toString()); - terminal.typeIntoActiveTerminal(Keys.ARROW_DOWN.toString()); - terminal.typeIntoActiveTerminal(Keys.ARROW_DOWN.toString()); - terminal.typeIntoActiveTerminal(Keys.ARROW_DOWN.toString()); - terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); - terminal.typeIntoActiveTerminal(Keys.ARROW_DOWN.toString()); - terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); - - try { - // check the home content of the midnight commander - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitTextInFirstTerminal(partOfContent); - } - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10854", ex); - } - - terminal.typeIntoActiveTerminal(Keys.F10.toString()); - } - - @Test - public void shouldCreateFileTest() { - terminal.typeIntoActiveTerminal("cd ~" + Keys.ENTER); - terminal.typeIntoActiveTerminal("ls" + Keys.ENTER); - terminal.waitTextInFirstTerminal("che"); - terminal.typeIntoActiveTerminal("touch a.txt" + Keys.ENTER); - - terminal.typeIntoActiveTerminal("ls" + Keys.ENTER); - terminal.waitTextInFirstTerminal(getExpectedContent()); - } - - @Test(groups = UNDER_REPAIR) - public void shouldCancelProcessByCtrlC() { - terminal.typeIntoActiveTerminal("cd /" + Keys.ENTER); - - // launch bash script - terminal.typeIntoActiveTerminal(BASH_SCRIPT + Keys.ENTER); - terminal.waitTextInFirstTerminal("test=1"); - - // cancel script - terminal.typeIntoActiveTerminal(Keys.CONTROL + "c"); - - // wait 1 sec. If process was really stopped we should not get text "test=2" - WaitUtils.sleepQuietly(1); - - try { - terminal.waitNoTextInFirstTerminal("test=2"); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known permanent failure https://github.com/eclipse/che/issues/8390"); - } - } - - @Test - public void shouldBeClear() { - terminal.typeIntoActiveTerminal("cd / && ls -l" + Keys.ENTER); - - // clear terminal - terminal.typeIntoActiveTerminal("clear" + Keys.ENTER); - terminal.waitNoTextInFirstTerminal("clear"); - terminal.waitTextInFirstTerminal("@"); - } - - @Test - public void shouldBeReset() { - terminal.typeIntoActiveTerminal("cd / && ls -l" + Keys.ENTER); - - // clear terminal - terminal.typeIntoActiveTerminal("reset" + Keys.ENTER.toString()); - terminal.waitNoTextInFirstTerminal("reset"); - terminal.waitTextInFirstTerminal("@"); - } - - @Test - public void shouldTurnToNormalModeFromAlternativeScreenModeAndOtherwise() { - // open MC - terminal will switch off from normal mode to alternative screen with text user - // interface (pseudo user graphics). - openMC("/"); - - // turn back to "normal" mode - terminal.typeIntoActiveTerminal(Keys.CONTROL + "o"); - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitNoTextInFirstTerminal(partOfContent); - } - - terminal.typeIntoActiveTerminal(Keys.CONTROL + "o" + Keys.ENTER); - for (String partOfContent : CHECK_MC_OPENING) { - terminal.waitTextInFirstTerminal(partOfContent); - } - } - - @Test - public void shouldOpenMCHelpDialogAndUserMenuDialog() { - openMC("/"); - - // check "F1" - terminal.typeIntoActiveTerminal(Keys.F1.toString()); - terminal.waitTextInFirstTerminal(MC_HELP_DIALOG); - terminal.typeIntoActiveTerminal(Keys.F10.toString()); - terminal.waitNoTextInFirstTerminal(MC_HELP_DIALOG); - - // check "F2" key - terminal.typeIntoActiveTerminal(Keys.F2.toString()); - terminal.waitTextInFirstTerminal(MC_USER_MENU_DIALOG); - terminal.typeIntoActiveTerminal(Keys.F10.toString()); - terminal.waitNoTextInFirstTerminal(MC_USER_MENU_DIALOG); - } - - @Test - public void shouldViewFolderIntoMC() { - terminal.waitFirstTerminalTab(); - consoles.clickOnMaximizePanelIcon(); - openMC("/"); - - // select bin folder and view this folder by "F3" key - terminal.waitTextInFirstTerminal("bin"); - terminal.typeIntoActiveTerminal(Keys.HOME.toString() + Keys.F3.toString()); - for (String partOfContent : VIEW_BIN_FOLDER) { - terminal.waitTextInFirstTerminal(partOfContent); - } - terminal.typeIntoActiveTerminal("cd ~" + Keys.ENTER); - terminal.waitTextInFirstTerminal("che"); - consoles.clickOnMaximizePanelIcon(); - } - - @Test - public void closeTerminalByExitCommand() { - terminal.waitTerminalConsole(); - terminal.typeIntoActiveTerminal("exit" + Keys.ENTER); - terminal.waitTerminalIsNotPresent(1); - } - - @Test - public void shouldEditFileIntoMCEdit() { - openMC("/projects/" + PROJECT_NAME); - - // check End, Home, F4, Delete keys - terminal.typeIntoActiveTerminal( - "" + Keys.END + Keys.ENTER + Keys.END + Keys.ARROW_UP + Keys.F4); - // select editor - terminal.typeIntoActiveTerminal(valueOf(1) + Keys.ENTER); - - terminal.waitTextInFirstTerminal("README.md"); - terminal.typeIntoActiveTerminal(""); - terminal.typeIntoActiveTerminal( - "" + Keys.HOME + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.ARROW_RIGHT + Keys.DELETE); - terminal.waitTextInFirstTerminal(""); - } - - @Test - public void checkDeleteAction() { - // if the bug exists -> the dialog appears and the terminal lose focus - terminal.typeIntoActiveTerminal(Keys.DELETE.toString()); - terminal.typeIntoActiveTerminal("pwd"); - } - - private void openMC(String currentLocation) { - // launch mc from root directory - loader.waitOnClosed(); - consoles.selectProcessByTabName("Terminal"); - terminal.typeIntoActiveTerminal("cd " + currentLocation); - terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); - terminal.typeIntoActiveTerminal("mc"); - terminal.typeIntoActiveTerminal(Keys.ENTER.toString()); - terminal.waitTextInFirstTerminal("Modify time"); - } - - protected String[] getExpectedContent() { - return new String[] {"che", "a.txt", "tomcat8"}; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0087Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0087Test.java deleted file mode 100644 index fa80a0f6540..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0087Test.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0087Test { - - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0087Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0087"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0087() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test/Test.java"); - editor.waitActive(); - editor.waitMarkerInPosition(WARNING, 13); - editor.goToCursorPositionVisible(13, 45); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Myclass0087"); - editor.waitSpecifiedValueForLineAndChar(14, 25); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0091Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0091Test.java deleted file mode 100644 index 52470d86b25..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0091Test.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0091Test { - - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0091Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0091"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0091() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test/Test.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(14, 5); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("MyAnnot"); - editor.waitSpecifiedValueForLineAndChar(14, 26); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0093Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0093Test.java deleted file mode 100644 index 29863137be1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0093Test.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0093Test { - - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0093Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0093"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0093() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples", "Test.java"); - editor.waitMarkerInPosition(WARNING, 13); - editor.goToCursorPositionVisible(18, 26); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("MyEnum"); - editor.waitSpecifiedValueForLineAndChar(15, 19); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0097Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0097Test.java deleted file mode 100644 index 5d80d5cd876..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0097Test.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0097Test { - - private static final String PATH_TO_PACKAGE_PREFIX = "/src/main/java/org/eclipse/qa/examples/"; - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0097Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0097"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0097() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_PACKAGE_PREFIX + "Test.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(14, 31); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Key"); - editor.waitSpecifiedValueForLineAndChar(14, 17); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0114Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0114Test.java deleted file mode 100644 index b1343c98376..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0114Test.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0114Test { - - private static final String PATH_TO_PACKAGE_PREFIX = "/src/main/java/org/eclipse/qa/examples/"; - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0114Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0114"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0114() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_PACKAGE_PREFIX + "Test2.java"); - editor.waitActive(); - editor.waitAllMarkersInvisibility(ERROR); - editor.goToCursorPositionVisible(15, 12); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Test"); - editor.waitActive(); - editor.waitSpecifiedValueForLineAndChar(15, 15); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0115Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0115Test.java deleted file mode 100644 index 9913400a049..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0115Test.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0115Test { - - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0115Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0115"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0115() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples", "X.java"); - editor.waitMarkerInPosition(WARNING, 15); - editor.goToCursorPositionVisible(33, 14); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitSpecifiedValueForLineAndChar(36, 29); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0119Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0119Test.java deleted file mode 100644 index d71e62aee56..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0119Test.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0119Test { - - private static final String PATH_TO_PACKAGE_PREFIX = "/src/main/java/org/eclipse/qa/examples/"; - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0119Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0119"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0119() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_PACKAGE_PREFIX + "Test.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(16, 28); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Collections"); - editor.waitSpecifiedValueForLineAndChar(15, 44); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0120Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0120Test.java deleted file mode 100644 index f5e24dcaccd..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0120Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.*; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class Eclipse0120Test { - private static final String PROJECT_NAME = NameGenerator.generate("Eclipse0120Test-", 4); - private static final String PATH_TO_EXPAND = - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Loader loader; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0120"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0120() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile(PATH_TO_EXPAND, "Test.java"); - editor.waitActive(); - editor.waitMarkerInPosition(WARNING, 17); - editor.goToCursorPositionVisible(17, 42); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Collections"); - editor.waitSpecifiedValueForLineAndChar(15, 44); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0121Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0121Test.java deleted file mode 100644 index ba81411e93b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0121Test.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0121Test { - - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0121Test.class.getSimpleName(), 4); - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0121"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0121() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile(PATH_FOR_EXPAND, "Test.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(16, 43); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitTabIsPresent("Collections"); - editor.waitSpecifiedValueForLineAndChar(15, 44); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0122Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0122Test.java deleted file mode 100644 index 7cc9547fd39..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/opendeclaration/Eclipse0122Test.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.opendeclaration; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Maxim Musienko - * @author Aleksandr Shmaraev - */ -public class Eclipse0122Test { - - private static final String PATH_TO_PACKAGE_PREFIX = "/src/main/java/org/eclipse/qa/examples/"; - private static final String PROJECT_NAME = - NameGenerator.generate(Eclipse0122Test.class.getSimpleName(), 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/resolveTests_1_5_t0122"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SPRING); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void test0122() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PROJECT_NAME + PATH_TO_PACKAGE_PREFIX + "Test.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(16, 24); - editor.typeTextIntoEditor(Keys.F4.toString()); - editor.waitSpecifiedValueForLineAndChar(15, 19); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureClasspathBaseTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureClasspathBaseTest.java deleted file mode 100644 index 0e824eefdba..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureClasspathBaseTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.plainjava; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class ConfigureClasspathBaseTest { - private static final String PROJECT_NAME = NameGenerator.generate("ConfigureClasspathBase_", 4); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private ConfigureClasspath configureClasspath; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/java-multimodule"); - testProjectServiceClient.importProject( - ws.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_JAVA_MULTIMODULE); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkConfigureClasspath() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME + "/my-lib"); - projectExplorer.waitItem(PROJECT_NAME + "/my-webapp"); - - // check opening main form and closing it by icon - menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.closeConfigureClasspathFormByIcon(); - - // check the 'Java Build Path' header - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.waitExpectedTextJavaBuildPathArea("Libraries"); - configureClasspath.waitExpectedTextJavaBuildPathArea("Source"); - configureClasspath.clickOnJavaBuildPathHeader(); - configureClasspath.waitExpectedTextIsNotPresentInJavaBuildPathArea("Libraries"); - configureClasspath.waitExpectedTextIsNotPresentInJavaBuildPathArea("Source"); - configureClasspath.clickOnJavaBuildPathHeader(); - configureClasspath.waitExpectedTextJavaBuildPathArea("Libraries"); - configureClasspath.waitExpectedTextJavaBuildPathArea("Source"); - configureClasspath.clickOnDoneBtnConfigureClasspath(); - - // check the 'JARs and folders' area for 'my-lib' module - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/my-lib"); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/my-lib"); - menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.selectSourceCategory(); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "/" + PROJECT_NAME + "/my-lib/src/main/java"); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "/" + PROJECT_NAME + "/my-lib/src/test/java"); - configureClasspath.selectLibrariesCategory(); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"); - configureClasspath.waitExpectedTextJarsAndFolderArea("org.eclipse.jdt.launching.JRE_CONTAINER"); - configureClasspath.closeConfigureClasspathFormByIcon(); - - // check the 'JARs and folders' area for 'my-webapp' module - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/my-webapp"); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/my-webapp"); - menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.selectSourceCategory(); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "/" + PROJECT_NAME + "/my-webapp/src/main/java"); - configureClasspath.selectLibrariesCategory(); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"); - configureClasspath.waitExpectedTextJarsAndFolderArea("org.eclipse.jdt.launching.JRE_CONTAINER"); - configureClasspath.closeConfigureClasspathFormByIcon(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureSomeSourceFoldersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureSomeSourceFoldersTest.java deleted file mode 100644 index ddf08911674..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/ConfigureSomeSourceFoldersTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.plainjava; - -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.JAVA_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.RUN_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.JAVA_TYPE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.BUILD_PATH; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.USE_AS_SOURCE_FOLDER; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_CLASS; -import static org.eclipse.che.selenium.pageobject.AskForValueDialog.JavaFiles.CLASS; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.JAVA_SOURCE_FOLDER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Musienko Maxim - * @author Aleksandr Shmaraiev - */ -public class ConfigureSomeSourceFoldersTest { - private static final String PROJECT_NAME = NameGenerator.generate("PlainJava-", 4); - private String newJavaClassName = "NewClass"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor codenvyEditor; - @Inject private Loader loader; - @Inject private AskForValueDialog askForValueDialog; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/java-project-with-additional-source-folder"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkConfigureClasspathPlainJavaProject() { - String pathToNewJavaFile = PROJECT_NAME + "/source/NewClass.java"; - String methodForChecking = - " public static String typeCheckMess(){\n" - + " return \"Message from source folder\";\n" - + " "; - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/source"); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/source", JAVA_SOURCE_FOLDER); - projectExplorer.waitDefinedTypeOfFolder(PROJECT_NAME + "/src", JAVA_SOURCE_FOLDER); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/source"); - createNewJavaClass(newJavaClassName); - projectExplorer.openItemByPath(pathToNewJavaFile); - codenvyEditor.waitActive(); - codenvyEditor.waitTextIntoEditor("public class NewClass {"); - codenvyEditor.waitAllMarkersInvisibility(ERROR); - codenvyEditor.goToCursorPositionVisible(2, 24); - codenvyEditor.typeTextIntoEditor(Keys.ENTER.toString()); - codenvyEditor.typeTextIntoEditor(methodForChecking); - codenvyEditor.waitAllMarkersInvisibility(ERROR); - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/src/Main.java"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/Main.java"); - codenvyEditor.waitTabFileWithSavedStatus("Main"); - launchMainClassFromCommandWidget(); - consoles.waitExpectedTextIntoConsole("Message from source", 15); - } - - private void createNewJavaClass(String name) { - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem(JAVA_CLASS); - askForValueDialog.createJavaFileByNameAndType(name, CLASS); - codenvyEditor.waitActive(); - loader.waitOnClosed(); - codenvyEditor.waitTabIsPresent(name); - codenvyEditor.closeFileByNameWithSaving(name); - projectExplorer.clickOnRefreshTreeButton(); - } - - private void launchMainClassFromCommandWidget() { - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(RUN_GOAL); - commandsExplorer.chooseCommandTypeInContextMenu(JAVA_TYPE); - commandsExplorer.checkCommandIsPresentInGoal(RUN_GOAL, JAVA_NAME); - commandsEditor.waitTabFileWithSavedStatus(JAVA_NAME); - commandsEditor.clickOnRunButton(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/PlainJavaProjectConfigureClasspathTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/PlainJavaProjectConfigureClasspathTest.java deleted file mode 100644 index 20ba65b5423..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/PlainJavaProjectConfigureClasspathTest.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.plainjava; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.BUILD_PATH; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.CONFIGURE_CLASSPATH; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.UNMARK_AS_SOURCE_FOLDER; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.USE_AS_SOURCE_FOLDER; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class PlainJavaProjectConfigureClasspathTest { - private static final String PROJECT_NAME = NameGenerator.generate("PlainJava-", 4); - private static final String LIB_PROJECT = "lib"; - - private static final List listJar = - Arrays.asList( - "rt.jar", - "cldrdata.jar", - "dnsns.jar", - "localedata.jar", - "nashorn.jar", - "sunec.jar", - "sunjce_provider.jar", - "sunpkcs11.jar", - "zipfs.jar"); - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private ConfigureClasspath configureClasspath; - @Inject private CodenvyEditor codenvyEditor; - @Inject private Loader loader; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/simple-java-project"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PLAIN_JAVA); - - resource = getClass().getResource("/projects/lib"); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), LIB_PROJECT, ProjectTemplates.PLAIN_JAVA); - ide.open(ws); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkConfigureClasspathPlainJavaProject() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitItem(LIB_PROJECT); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME + "/bin"); - projectExplorer.waitItem(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/test"); - - // check build path to the subfolder 'java' from context menu - projectExplorer.openItemByPath(PROJECT_NAME + "/test"); - projectExplorer.openItemByPath(PROJECT_NAME + "/test/java"); - projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com"); - projectExplorer.openItemByPath(PROJECT_NAME + "/test/java/com/company"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/test/java"); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java"); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); - projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/test/java"); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/java"); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - loader.waitOnClosed(); - projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); - - // check build path to the folder 'test' from context menu - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/test"); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test"); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); - projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/test"); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test"); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - loader.waitOnClosed(); - projectExplorer.clickOnItemInContextMenu(UNMARK_AS_SOURCE_FOLDER); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); - - // check the 'Cancel' button of the 'Select Path' form - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.selectSourceCategory(); - configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER); - configureClasspath.waitSelectPathFormIsOpen(); - configureClasspath.clickCancelBtnSelectPathForm(); - - // check adding and deleting of a source folder - configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/src"); - configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_FOLDER); - configureClasspath.waitSelectPathFormIsOpen(); - configureClasspath.openItemInSelectPathForm(PROJECT_NAME); - configureClasspath.waitItemInSelectPathForm("bin"); - configureClasspath.waitItemInSelectPathForm("src"); - configureClasspath.waitItemInSelectPathForm("test"); - configureClasspath.selectItemInSelectPathForm("test"); - configureClasspath.clickOkBtnSelectPathForm(); - configureClasspath.waitExpectedTextJarsAndFolderArea("/" + PROJECT_NAME + "/test"); - configureClasspath.clickOnDoneBtnConfigureClasspath(); - projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/company"); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - projectExplorer.clickOnItemInContextMenu(CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.selectSourceCategory(); - configureClasspath.deleteJarOrFolderFromBuildPath("/" + PROJECT_NAME + "/test"); - configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea( - "/" + PROJECT_NAME + "/test"); - configureClasspath.clickOnDoneBtnConfigureClasspath(); - projectExplorer.openItemByPath(PROJECT_NAME + "/test"); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/test/java/com/company"); - - // check the library container - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(PROJECT, TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER"); - for (String jarName : listJar) { - Assert.assertTrue(configureClasspath.getTextFromJarsAndFolderArea().contains(jarName)); - } - configureClasspath.clickLibraryContainer("org.eclipse.jdt.launching.JRE_CONTAINER"); - configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea( - "rt.jar - /opt/jdk1.8.0_45/jre/lib"); - - // check adding jar file - configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR); - configureClasspath.waitSelectPathFormIsOpen(); - configureClasspath.openItemInSelectPathForm(LIB_PROJECT); - configureClasspath.selectItemInSelectPathForm("log4j-1.2.17.jar"); - configureClasspath.clickOkBtnSelectPathForm(); - configureClasspath.waitExpectedTextJarsAndFolderArea("log4j-1.2.17.jar - /lib"); - configureClasspath.deleteJarOrFolderFromBuildPath("log4j-1.2.17.jar - /lib"); - configureClasspath.waitExpectedTextIsNotPresentInJarsAndFolderArea( - "log4j-1.2.17.jar - /projects/lib"); - configureClasspath.addJarOrFolderToBuildPath(ConfigureClasspath.ADD_JAR); - configureClasspath.waitSelectPathFormIsOpen(); - configureClasspath.openItemInSelectPathForm(LIB_PROJECT); - configureClasspath.selectItemInSelectPathForm("mockito-core-2.21.0.jar"); - configureClasspath.clickOkBtnSelectPathForm(); - configureClasspath.waitExpectedTextJarsAndFolderArea("mockito-core-2.21.0.jar - /lib"); - configureClasspath.clickOnDoneBtnConfigureClasspath(); - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/Main.java"); - codenvyEditor.waitActive(); - codenvyEditor.setCursorToLine(17); - codenvyEditor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - codenvyEditor.setCursorToLine(17); - codenvyEditor.typeTextIntoEditor(Keys.TAB.toString()); - codenvyEditor.typeTextIntoEditor("Mockito mockito = new Mockito();"); - codenvyEditor.waitTextIntoEditor("Mockito mockito = new Mockito();"); - codenvyEditor.waitMarkerInPosition(ERROR, 17); - codenvyEditor.launchPropositionAssistPanel(); - codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'Mockito' (org.mockito)"); - codenvyEditor.waitErrorPropositionPanelClosed(); - codenvyEditor.waitTextIntoEditor("import org.mockito.Mockito;"); - codenvyEditor.setCursorToLine(19); - codenvyEditor.waitMarkerInvisibility(ERROR, 19); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/RunPlainJavaProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/RunPlainJavaProjectTest.java deleted file mode 100644 index 54b8b9c9d37..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/plainjava/RunPlainJavaProjectTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.plainjava; - -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsDefaultNames.JAVA_NAME; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsGoals.RUN_GOAL; -import static org.eclipse.che.selenium.core.constant.TestIntelligentCommandsConstants.CommandsTypes.JAVA_TYPE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.CONFIGURATION; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.CONFIGURE_CLASSPATH; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.JAVA_CLASS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.NEW; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.New.PACKAGE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.IMPORT_PROJECT; -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 com.google.inject.Inject; -import com.google.inject.name.Named; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ImportProjectFromLocation; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsEditor; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class RunPlainJavaProjectTest { - private static final String PROJECT_NAME = "run-plain-java-project"; - private static final String NEW_PACKAGE = "base.test"; - private static final String NAME_COMMAND = "startApp"; - private static final String COMMAND = - "cd ${current.project.path}\n" - + "javac -classpath ${project.java.classpath} -sourcepath ${project.java.sourcepath} -d ${project.java.output.dir} src/com/company/nba/MainClass.java\n" - + "java -classpath ${project.java.classpath}${project.java.output.dir} com.company.nba.MainClass"; - private static final String CONSOLE_MESS = - "javac: directory not found: /projects/" + PROJECT_NAME + "/bin"; - - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private DefaultTestUser productUser; - @Inject private TestGitHubRepository testRepo; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor codenvyEditor; - @Inject private ConfigureClasspath configureClasspath; - @Inject private CommandsExplorer commandsExplorer; - @Inject private CommandsEditor commandsEditor; - @Inject private Consoles consoles; - @Inject private AskForValueDialog askForValueDialog; - @Inject private ImportProjectFromLocation importFromLocation; - @Inject private Wizard projectWizard; - @Inject private Loader loader; - @Inject private Menu menu; - - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @Inject - @Named("github.username") - private String gitHubUsername; - - @BeforeClass - public void prepare() throws Exception { - testUserPreferencesServiceClient.addGitCommitter(gitHubUsername, productUser.getEmail()); - - Path entryPath = - Paths.get(getClass().getResource("/projects/run-plain-java-project").getPath()); - testRepo.addContent(entryPath); - - ide.open(ws); - consoles.waitJDTLSStartedMessage(); - } - - @Test - public void checkRunPlainJavaProject() { - // import the project and configure - projectExplorer.waitProjectExplorer(); - importPlainJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, Wizard.TypeProject.PLAIN_JAVA); - - // check library into configure classpath form - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - menu.runCommand(PROJECT, CONFIGURE_CLASSPATH); - configureClasspath.waitConfigureClasspathFormIsOpen(); - configureClasspath.waitExpectedTextJarsAndFolderArea( - "testLibrary.jar - /" + PROJECT_NAME + "/store"); - configureClasspath.closeConfigureClasspathFormByIcon(); - - // create the instance of the library - projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/nba/MainClass.java"); - codenvyEditor.waitActive(); - codenvyEditor.setCursorToLine(20); - codenvyEditor.typeTextIntoEditor(Keys.TAB.toString()); - codenvyEditor.typeTextIntoEditor("Mockito mockito = new Mockito();"); - codenvyEditor.waitTextIntoEditor("Mockito mockito = new Mockito();"); - codenvyEditor.waitMarkerInPosition(ERROR, 20); - - // check code assist - codenvyEditor.launchPropositionAssistPanel(); - codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'Mockito' (org.mockito)"); - codenvyEditor.waitTextIntoEditor("import org.mockito.Mockito;"); - - createNewPackageAndJavaClass(); - - // create the instance of new Java class - projectExplorer.openItemByPath(PROJECT_NAME + "/src/com/company/nba/MainClass.java"); - codenvyEditor.waitActive(); - codenvyEditor.setCursorToLine(23); - codenvyEditor.typeTextIntoEditor(Keys.TAB.toString()); - codenvyEditor.typeTextIntoEditor("A a = new A();"); - codenvyEditor.waitTextIntoEditor("A a = new A();"); - codenvyEditor.waitMarkerInPosition(ERROR, 23); - - // check the code assist - codenvyEditor.launchPropositionAssistPanel(); - codenvyEditor.enterTextIntoFixErrorPropByDoubleClick("Import 'A' (base.test)"); - codenvyEditor.waitErrorPropositionPanelClosed(); - codenvyEditor.waitTextIntoEditor("import base.test.A;"); - - // open the 'Commands Explorer' and choose java command - projectExplorer.waitAndSelectItem(PROJECT_NAME); - commandsExplorer.openCommandsExplorer(); - commandsExplorer.waitCommandExplorerIsOpened(); - commandsExplorer.clickAddCommandButton(RUN_GOAL); - commandsExplorer.chooseCommandTypeInContextMenu(JAVA_TYPE); - commandsExplorer.waitCommandInExplorerByName(JAVA_NAME); - commandsEditor.waitActive(); - commandsEditor.waitTabFileWithSavedStatus(JAVA_NAME); - - // edit the name and the content of the java command into editor - commandsEditor.typeTextIntoNameCommandField(NAME_COMMAND); - commandsEditor.waitTextIntoNameCommandField(NAME_COMMAND); - commandsEditor.waitTabCommandWithUnsavedStatus(JAVA_NAME); - commandsEditor.setCursorToLine(1); - commandsEditor.deleteAllContent(); - commandsEditor.typeTextIntoEditor(COMMAND); - commandsEditor.waitTextIntoEditor(COMMAND); - commandsEditor.clickOnSaveButtonInTheEditCommand(); - commandsEditor.waitTabFileWithSavedStatus(NAME_COMMAND); - - // check not starting application - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole(CONSOLE_MESS); - - // add the folder 'bin' - projectExplorer.clickOnProjectExplorerTab(); - commandsExplorer.waitCommandExplorerIsClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.NEW); - projectExplorer.clickOnNewContextMenuItem(FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("bin"); - askForValueDialog.clickOkBtn(); - projectExplorer.waitItem(PROJECT_NAME + "/bin"); - - // check starting application - commandsEditor.selectTabByName(NAME_COMMAND); - commandsEditor.waitActiveTabFileName(NAME_COMMAND); - commandsEditor.clickOnRunButton(); - consoles.waitExpectedTextIntoConsole("I love this game!"); - - // check the 'bin' folder contains compiling classes - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitItem(PROJECT_NAME + "/bin/com/company/nba/MainClass.class"); - projectExplorer.waitItem(PROJECT_NAME + "/bin/base/test/A.class"); - } - - private void importPlainJavaApp(String url, String nameApp, String typeProject) { - menu.runCommand(WORKSPACE, IMPORT_PROJECT); - importFromLocation.waitAndTypeImporterAsGitInfo(url, nameApp); - projectWizard.waitCreateProjectWizardForm(); - projectWizard.selectTypeProject(typeProject); - projectWizard.clickNextButton(); - - // set library folder - projectWizard.clickBrowseButton(Wizard.TypeFolder.LIBRARY_FOLDER); - configureClasspath.openItemInSelectPathForm(nameApp); - configureClasspath.waitItemInSelectPathForm("store"); - configureClasspath.selectItemInSelectPathForm("store"); - configureClasspath.clickOkBtnSelectPathForm(); - projectWizard.waitExpTextInSourceFolder("store", Wizard.TypeFolder.LIBRARY_FOLDER); - projectWizard.clickSaveButton(); - projectWizard.waitCloseProjectConfigForm(); - projectExplorer.waitVisibilityByName(nameApp); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - // check that srs folder has been set properly - menu.runCommand(PROJECT, CONFIGURATION); - projectWizard.waitCreateProjectWizardForm(); - projectWizard.selectTypeProject(typeProject); - projectWizard.clickNextButton(); - projectWizard.waitExpTextInSourceFolder("src", Wizard.TypeFolder.SOURCE_FOLDER); - projectWizard.clickSaveButton(); - projectWizard.waitCloseProjectConfigForm(); - } - - private void createNewPackageAndJavaClass() { - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src"); - - // create new package - menu.runCommand(PROJECT, NEW, PACKAGE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(NEW_PACKAGE); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(NEW_PACKAGE); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/base/test"); - - // create new java file - menu.runCommand(PROJECT, NEW, JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName("A"); - askForValueDialog.clickOkBtnNewJavaClass(); - askForValueDialog.waitNewJavaClassClose(); - projectExplorer.waitItem(PROJECT_NAME + "/src/base/test/A.java"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/CheckErrorsWarningsTabTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/CheckErrorsWarningsTabTest.java deleted file mode 100644 index a5325ccf025..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/CheckErrorsWarningsTabTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.preferences; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Profile.PREFERENCES; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; -import static org.eclipse.che.selenium.core.utils.FileUtil.readFile; -import static org.eclipse.che.selenium.core.utils.FileUtil.readFileToString; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR_OVERVIEW; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.WARNING_OVERVIEW; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckErrorsWarningsTabTest { - private static final String PROJECT_NAME = - NameGenerator.generate(CheckErrorsWarningsTabTest.class.getSimpleName(), 4); - private static final String PATH_TO_CLASS_IN_SPRING_PACKAGE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private Preferences preferences; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - final URL resource = getClass().getResource("/projects/prefs-spring-project"); - final URL embedCodeFilePath = getClass().getResource("embed-code"); - final String embedCode = readFileToString(embedCodeFilePath); - - // import project - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - // open workspace - ide.open(workspace); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - - // prepare file for testing - testProjectServiceClient.updateFile( - workspace.getId(), PATH_TO_CLASS_IN_SPRING_PACKAGE, embedCode); - - // expand project explorer tree and wait LS init - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void errorsWarningTest() throws Exception { - final String expectedTabTitle = "AppController"; - final URL errorsWarningFilePath = getClass().getResource("errors-warnings"); - final List expectedErrorsWarningsList = readFile(errorsWarningFilePath); - - // open file - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_CLASS_IN_SPRING_PACKAGE); - projectExplorer.openItemByPath(PATH_TO_CLASS_IN_SPRING_PACKAGE); - editor.waitTabIsPresent(expectedTabTitle); - editor.waitTabSelection(0, expectedTabTitle); - editor.waitActive(); - - // check markers default settings - menu.runCommand(TestMenuCommandsConstants.Profile.PROFILE_MENU, PREFERENCES); - preferences.waitPreferencesForm(); - preferences.waitMenuInCollapsedDropdown(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); - preferences.selectDroppedMenuByName(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); - assertEquals(preferences.getItemsFromErrorWarningsWidget(), expectedErrorsWarningsList); - preferences.close(); - consoles.closeProcessesArea(); - - // change and check markers settings for displaying warnings - menu.runCommand(TestMenuCommandsConstants.Profile.PROFILE_MENU, PREFERENCES); - changeAllSettingsInErrorsWarningsTab(Preferences.DropDownValueForErrorWaitingWidget.WARNING); - editor.waitAnnotationsAreNotPresent(ERROR_OVERVIEW); - waitWarningMarkersQuantity(); - - // change and check markers settings for displaying errors - editor.waitAnnotationsAreNotPresent(ERROR_OVERVIEW); - menu.runCommand(TestMenuCommandsConstants.Profile.PROFILE_MENU, PREFERENCES); - changeAllSettingsInErrorsWarningsTab(Preferences.DropDownValueForErrorWaitingWidget.ERROR); - waitErrorMarkersQuantity(); - - // change and check markers settings for ignoring all markers - editor.waitAnnotationsAreNotPresent(WARNING_OVERVIEW); - menu.runCommand(TestMenuCommandsConstants.Profile.PROFILE_MENU, PREFERENCES); - changeAllSettingsInErrorsWarningsTab(Preferences.DropDownValueForErrorWaitingWidget.IGNORE); - editor.waitAnnotationsAreNotPresent(ERROR_OVERVIEW); - editor.waitAnnotationsAreNotPresent(WARNING_OVERVIEW); - } - - private void waitWarningMarkersQuantity() { - // browser window resolution a bit different on local mode and on CI - // according to this different count of markers are displayed - editor.waitMarkersQuantityBetween(WARNING_OVERVIEW, 12, 13); - editor.waitMarkersQuantityBetween(WARNING, 22, 24); - } - - private void waitErrorMarkersQuantity() { - // browser window resolution a bit different on local mode and on CI - // according to this different count of markers are displayed - editor.waitMarkersQuantityBetween(ERROR_OVERVIEW, 12, 13); - editor.waitMarkersQuantityBetween(ERROR, 22, 24); - } - - private void changeAllSettingsInErrorsWarningsTab( - Preferences.DropDownValueForErrorWaitingWidget valueOfRadioButton) { - preferences.waitPreferencesForm(); - preferences.waitMenuInCollapsedDropdown(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); - preferences.selectDroppedMenuByName(Preferences.DropDownJavaCompilerMenu.ERRORS_WARNINGS); - preferences.setAllSettingsInErrorWaitingWidget(valueOfRadioButton); - preferences.clickOnOkBtn(); - preferences.close(); - loader.waitOnClosed(); - projectExplorer.waitItem(PATH_TO_CLASS_IN_SPRING_PACKAGE); - projectExplorer.openItemByPath(PATH_TO_CLASS_IN_SPRING_PACKAGE); - loader.waitOnClosed(); - editor.setCursorToLine(85); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ARROW_LEFT.toString()); - editor.typeTextIntoEditorWithoutDelayForSaving(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - editor.typeTextIntoEditor(Keys.DELETE.toString()); - WaitUtils.sleepQuietly(DEFAULT_TIMEOUT); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/ContributeTabTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/ContributeTabTest.java deleted file mode 100644 index 5ec7b54c9ce..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/preferences/ContributeTabTest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.preferences; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ToolWindows.CONTRIBUTE_TOOL_WIDOWS; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ToolWindows.TOOL_WINDOWS; -import static org.eclipse.che.selenium.pageobject.PanelSelector.PanelTypes.LEFT_RIGHT_BOTTOM_ID; -import static org.eclipse.che.selenium.pageobject.Wizard.TypeProject.MAVEN; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestGitHubRepository; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.client.TestUserPreferencesServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.PanelSelector; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.PullRequestPanel; -import org.eclipse.che.selenium.pageobject.git.Git; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class ContributeTabTest { - private static final String FIRST_PROJECT_NAME = "first-vcs-project"; - private static final String SECOND_PROJECT_NAME = "second-vcs-project"; - private static final String THIRD_PROJECT_NAME = "not-vcs-project"; - private static final String EXP_TEXT_NOT_VCS = - "Project does not provide VCS, supported by contribution plugin."; - private static final String NOTIFICATION_MESSAGE = - "To activate Contribute Panel by clicking on a project go to Profile -> Preferences -> Git -> Contribute"; - - private String firstProjectUrl; - private String secondProjectUrl; - - @Inject private Ide ide; - @Inject private Menu menu; - @Inject private Git git; - @Inject private DefaultTestUser user; - @Inject private AskDialog askDialog; - @Inject private Preferences preferences; - @Inject private TestWorkspace testWorkspace; - @Inject private TestGitHubRepository testRepo; - @Inject private TestGitHubRepository testRepo2; - @Inject private ProjectExplorer projectExplorer; - @Inject private PullRequestPanel pullRequestPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private PanelSelector panelSelector; - @Inject private TestUserPreferencesServiceClient testUserPreferencesServiceClient; - - @BeforeClass - public void setUp() throws Exception { - Path entryPath = - Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); - testRepo.addContent(entryPath); - testRepo2.addContent(entryPath); - - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - THIRD_PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(testWorkspace); - } - - @AfterMethod - public void closeForm() { - if (askDialog.isOpened()) { - askDialog.confirmAndWaitClosed(); - } - - if (preferences.isPreferencesFormOpened()) { - preferences.clickOnCloseButton(); - } - - if (askDialog.isOpened()) { - askDialog.confirmAndWaitClosed(); - } - - preferences.waitPreferencesFormIsClosed(); - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(true); - } - - @AfterClass - public void restoreContributionTabPreference() throws Exception { - testUserPreferencesServiceClient.restoreDefaultContributionTabPreference(); - } - - @Test - public void checkSettingContributeTab() { - firstProjectUrl = testRepo.getHtmlUrl() + ".git"; - secondProjectUrl = testRepo2.getHtmlUrl() + ".git"; - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(THIRD_PROJECT_NAME); - - // import the first and second projects - git.importJavaApp(firstProjectUrl, FIRST_PROJECT_NAME, MAVEN); - git.importJavaApp(secondProjectUrl, SECOND_PROJECT_NAME, MAVEN); - - // check opening the PR panel by select a project - pullRequestPanel.waitClosePanel(); - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - - // check the text when a project is not under VCS - projectExplorer.waitAndSelectItem(THIRD_PROJECT_NAME); - pullRequestPanel.waitTextNotVcsProject(EXP_TEXT_NOT_VCS); - - // check the 'Contribute' checkbox is true by default - preferences.openContributeTab(); - preferences.waitContributeCheckboxIsSelected(); - preferences.close(); - } - - @Test(priority = 1) - public void checkRefreshAndSaveButton() { - preferences.openContributeTab(); - - preferences.setContributeCheckbox(true); - preferences.clickOnOkBtn(); - - assertFalse(preferences.isSaveButtonIsEnabled()); - - // check the 'Refresh button - preferences.clickOnContributeCheckbox(); - preferences.waitContributeCheckboxIsNotSelected(); - - assertTrue(preferences.isSaveButtonIsEnabled()); - - preferences.clickRefreshButton(); - preferences.waitContributeCheckboxIsSelected(); - - assertFalse(preferences.isSaveButtonIsEnabled()); - - preferences.close(); - } - - @Test(priority = 1) - public void checkSwitchProjectsWhenContributeIsFalse() { - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(true); - - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(false); - - // switch between projects - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitRepoUrl(firstProjectUrl); - pullRequestPanel.waitProjectName(FIRST_PROJECT_NAME); - - projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); - pullRequestPanel.waitRepoUrl(secondProjectUrl); - pullRequestPanel.waitProjectName(SECOND_PROJECT_NAME); - - projectExplorer.waitAndSelectItem(THIRD_PROJECT_NAME); - pullRequestPanel.waitTextNotVcsProject(EXP_TEXT_NOT_VCS); - } - - @Test(priority = 1) - public void checkAutomaticChangeContributeToFalse() { - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(true); - - // change 'Contribute' to false by 'Hide' button - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - pullRequestPanel.closePanelByHideButton(); - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose(NOTIFICATION_MESSAGE); - - preferences.openContributeTab(); - preferences.waitContributeCheckboxIsNotSelected(); - - // change 'Contribute' to false by 'Hide' from 'Options' on the PR panel - preferences.setStateContributeChecboxAndCloseForm(true); - - projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - pullRequestPanel.openOptionsMenu(); - pullRequestPanel.closePanelFromContextMenu(); - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose(NOTIFICATION_MESSAGE); - - preferences.openContributeTab(); - preferences.waitContributeCheckboxIsNotSelected(); - - // change 'Contribute' to false by 'Contribute' action from 'Assistant' - preferences.setStateContributeChecboxAndCloseForm(true); - - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - pullRequestPanel.clickPullRequestBtn(); - - menu.runCommand(ASSISTANT, TOOL_WINDOWS, CONTRIBUTE_TOOL_WIDOWS); - pullRequestPanel.waitClosePanel(); - - preferences.openContributeTab(); - preferences.waitContributeCheckboxIsNotSelected(); - preferences.close(); - } - - @Test(priority = 1) - public void checkDirectAccessToContributeTab() { - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(false); - - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitClosePanel(); - - // open PR panel by the 'Panel Selector' - panelSelector.selectPanelTypeFromPanelSelector(LEFT_RIGHT_BOTTOM_ID); - pullRequestPanel.waitOpenPanel(); - pullRequestPanel.closePanelByHideButton(); - - // open PR panel by the 'Contribute' action from the 'Assistant - menu.runCommand(ASSISTANT, TOOL_WINDOWS, CONTRIBUTE_TOOL_WIDOWS); - pullRequestPanel.waitOpenPanel(); - - menu.runCommand(ASSISTANT, TOOL_WINDOWS, CONTRIBUTE_TOOL_WIDOWS); - pullRequestPanel.waitClosePanel(); - - // open PR panel from call the 'Contribute' by hot key (Ctrl + ALT + '6') - preferences.callContributeActionByHotKey(); - pullRequestPanel.waitOpenPanel(); - - preferences.callContributeActionByHotKey(); - pullRequestPanel.waitClosePanel(); - } - - @Test(priority = 1) - public void checkHidingPrPanelWhenProjectExplorerIsMaximized() { - preferences.openContributeTab(); - preferences.setStateContributeChecboxAndCloseForm(true); - - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitOpenPanel(); - projectExplorer.clickOnMaximizeButton(); - pullRequestPanel.waitClosePanel(); - - // check the PR panel is closed after select project - projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); - pullRequestPanel.waitClosePanel(); - - projectExplorer.clickOnMaximizeButton(); - pullRequestPanel.waitOpenPanel(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckAutoSaveForFileWhichAlreadyExistTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckAutoSaveForFileWhichAlreadyExistTest.java deleted file mode 100644 index 85eabcd78f3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckAutoSaveForFileWhichAlreadyExistTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CheckAutoSaveForFileWhichAlreadyExistTest { - - private static final String PROJECT_NAME = - CheckAutoSaveForFileWhichAlreadyExistTest.class.getSimpleName(); - private static final String PATH_TO_JAVA = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_TO_LESS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"; - private static final String PATH_TO_SIMPLE_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"; - private static final String PATH_TO_SQL = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"; - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JSP = PROJECT_NAME + "/src/main/webapp/index.jsp"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void saveDialogForChangedFiles() throws Exception { - projectExplorer.waitProjectExplorer(); - // open .html file, get text from there and compare with expected text - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_JAVA); - // change java file - addChangingToFile("AppController", 36, "String ll = null;"); - loader.waitOnClosed(); - - // change less file - projectExplorer.openItemByPath(PATH_TO_LESS); - addChangingToFile("LessFile.less", 12, "p {color: red}"); - loader.waitOnClosed(); - - // change simple file - projectExplorer.openItemByPath(PATH_TO_SIMPLE_FILE); - addChangingToFile("another", 16, "simple text for simple file"); - loader.waitOnClosed(); - - // change css file - projectExplorer.openItemByPath(PATH_TO_CSS); - addChangingToFile("cssFile.css", 16, "a {color: red}"); - loader.waitOnClosed(); - - // change xml file - projectExplorer.openItemByPath(PATH_TO_XML); - addChangingToFile("web.xml", 29, ""); - loader.waitOnClosed(); - - // change html file - projectExplorer.openItemByPath(PATH_TO_HTML); - addChangingToFile("htmlFile.html", 20, ""); - loader.waitOnClosed(); - - // change jsp - projectExplorer.openItemByPath(PATH_TO_JSP); - addChangingToFile("index.jsp", 15, "

some text

"); - loader.waitOnClosed(); - - // change sql file - projectExplorer.openItemByPath(PATH_TO_SQL); - addChangingToFile("sqlFile.sql", 12, "use cardb;"); - loader.waitOnClosed(); - } - - private void addChangingToFile(String fileName, int line, String text) { - editor.waitActive(); - editor.setCursorToLine(line); - editor.typeTextIntoEditor("\n"); - editor.setCursorToLine(line); - editor.typeTextIntoEditor(text); - editor.waitTabFileWithSavedStatus(fileName); - editor.clickOnCloseFileIcon(fileName); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCollapseAllNodesProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCollapseAllNodesProjectTest.java deleted file mode 100644 index aaeb3dd16df..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCollapseAllNodesProjectTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Andrey Chizhikov - */ -public class CheckCollapseAllNodesProjectTest { - - private static final String PROJECT_NAME = "TestProjectCollapseAll"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkCollapseAllBtnProjectTree() throws Exception { - // Preconditions - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - - // Expand the nodes - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - editor.waitTabIsPresent("AppController"); - projectExplorer.openItemByVisibleNameInExplorer("AppControlleTest.java"); - loader.waitOnClosed(); - editor.waitTabIsPresent("AppControlleTest"); - - // Perform the 'collapse all' - projectExplorer.collapseProjectTreeByOptionsButton(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitDisappearItemByPath(PROJECT_NAME + "/pom.xml"); - - // Open the project and check the tree - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME + "/src"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main"); - projectExplorer.waitItem(PROJECT_NAME + "/src/test"); - projectExplorer.waitDisappearItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - projectExplorer.waitDisappearItemByPath( - PROJECT_NAME + "/src/test/java/org/eclipse/qa/examples/AppControlleTest.java"); - editor.waitTabIsPresent("AppController"); - editor.waitTabIsPresent("AppControlleTest"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCopyCutFeaturesForFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCopyCutFeaturesForFilesTest.java deleted file mode 100644 index 7d08ce3cf40..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckCopyCutFeaturesForFilesTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.COPY; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.CUT; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.PASTE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.ChoiceDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckCopyCutFeaturesForFilesTest { - private static final String PROJECT_NAME = CheckCopyCutFeaturesForFilesTest.class.getSimpleName(); - private static final String PATH_TO_JSP_FOLDER = PROJECT_NAME + "/src/main/webapp/WEB-INF/jsp"; - private static final String PATH_TO_WEB_INF_FOLDER = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_XML_AFTER_MOVING = - PROJECT_NAME + "/src/main/webapp/WEB-INF/jsp/web.xml"; - private static final String PATH_TO_CSS_AFTER_MOVING = - PROJECT_NAME + "/src/main/webapp/WEB-INF/jsp/cssFile.css"; - private static final String PATH_TO_HTML_AFTER_MOVING = - PROJECT_NAME + "/src/main/webapp/WEB-INF/jsp/htmlFile.html"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private WarningDialog warningDialog; - @Inject private ChoiceDialog choiceDialog; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkCopyPutFeaturesForFilesTest() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - - moveFile(PATH_TO_XML, PATH_TO_JSP_FOLDER); - moveFile(PATH_TO_CSS, PATH_TO_JSP_FOLDER); - moveFile(PATH_TO_HTML, PATH_TO_JSP_FOLDER); - - projectExplorer.waitItemInvisibility(PATH_TO_XML); - projectExplorer.waitItemInvisibility(PATH_TO_CSS); - projectExplorer.waitItemInvisibility(PATH_TO_HTML); - - projectExplorer.waitItem(PATH_TO_XML_AFTER_MOVING); - projectExplorer.waitItem(PATH_TO_CSS_AFTER_MOVING); - projectExplorer.waitItem(PATH_TO_HTML_AFTER_MOVING); - } - - @Test - public void shouldShowErrorMessageDialogWhenPastingFileToOwnDirectory() { - moveFile(PATH_TO_CSS_AFTER_MOVING, PATH_TO_JSP_FOLDER); - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess( - "Cannot create cssFile.css. Resource already exists."); - warningDialog.clickOkBtn(); - projectExplorer.waitItem(PATH_TO_CSS_AFTER_MOVING); - } - - @Test - public void shouldShowErrorChoiceDialogWhenWhenFileExists() { - copyFile(PATH_TO_CSS_AFTER_MOVING, PATH_TO_WEB_INF_FOLDER); - moveFile(PATH_TO_CSS, PATH_TO_JSP_FOLDER); - choiceDialog.containsText( - "cssFile.css already exists in /CheckCopyCutFeaturesForFilesTest/src/main/webapp/WEB-INF/jsp."); - choiceDialog.clickSecondButton(); - projectExplorer.waitItem(PATH_TO_CSS_AFTER_MOVING); - } - - private void moveFile(String filePath, String folderPath) { - projectExplorer.waitAndSelectItem(filePath); - projectExplorer.openContextMenuByPathSelectedItem(filePath); - projectExplorer.clickOnNewContextMenuItem(CUT); - projectExplorer.waitAndSelectItem(folderPath); - projectExplorer.openContextMenuByPathSelectedItem(folderPath); - projectExplorer.clickOnNewContextMenuItem(PASTE); - loader.waitOnClosed(); - } - - private void copyFile(String filePath, String folderPath) { - projectExplorer.waitAndSelectItem(filePath); - projectExplorer.openContextMenuByPathSelectedItem(filePath); - projectExplorer.clickOnNewContextMenuItem(COPY); - projectExplorer.waitAndSelectItem(folderPath); - projectExplorer.openContextMenuByPathSelectedItem(folderPath); - projectExplorer.clickOnNewContextMenuItem(PASTE); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckDisplayingArtifactIdTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckDisplayingArtifactIdTest.java deleted file mode 100644 index 18359cd91f4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckDisplayingArtifactIdTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.Preferences; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class CheckDisplayingArtifactIdTest { - - private static final String PROJECT_NAME = NameGenerator.generate("project", 4); - private static final String ARTIFACT_ID = "[qa-spring-sample]"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient projectServiceClient; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private Preferences preferences; - - @BeforeClass - public void setup() throws Exception { - projectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(getClass().getResource("/projects/default-spring-project").toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void shouldEnableDisplayingProjIdAndCheckConfiguration() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - menu.runCommand( - TestMenuCommandsConstants.Profile.PROFILE_MENU, - TestMenuCommandsConstants.Profile.PREFERENCES); - preferences.waitPreferencesForm(); - preferences.selectDroppedMenuByName("Maven"); - preferences.clickOnShowArtifactCheckBox(); - preferences.clickOnOkBtn(); - preferences.close(); - preferences.waitPreferencesFormIsClosed(); - projectExplorer.waitVisibilityByName(PROJECT_NAME + " " + ARTIFACT_ID); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java"); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/src/main/java"); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem( - TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.clickCancelButtonJava(); - askForValueDialog.waitNewJavaClassClose(); - - menu.runCommand( - TestMenuCommandsConstants.Profile.PROFILE_MENU, - TestMenuCommandsConstants.Profile.PREFERENCES); - preferences.waitPreferencesForm(); - preferences.selectDroppedMenuByName("Maven"); - preferences.clickOnShowArtifactCheckBox(); - preferences.clickOnOkBtn(); - preferences.close(); - - projectExplorer.waitVisibilityByName(PROJECT_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckErrorMessageWhenCreationDuplicateFolderOrFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckErrorMessageWhenCreationDuplicateFolderOrFileTest.java deleted file mode 100644 index 871dfb85879..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckErrorMessageWhenCreationDuplicateFolderOrFileTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.WarningDialog; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skorik Sergey */ -public class CheckErrorMessageWhenCreationDuplicateFolderOrFileTest { - private static final String PROJECT_NAME = - CheckErrorMessageWhenCreationDuplicateFolderOrFileTest.class.getSimpleName(); - private static final String DUPLICATED_FOLDER_NAME = "src"; - private static final String DUPLICATED_FILE_NAME = "pom.xml"; - private static final String ERROR_DIALOG_MESSAGE = "Resource already exists"; - private static final String NOTIFICATION_MESSAGE = "Failed to create resource"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Menu menu; - @Inject private Events events; - @Inject private Consoles consoles; - @Inject private WarningDialog warningDialog; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkDuplicatedFile() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitVisibilityByName(DUPLICATED_FILE_NAME); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(DUPLICATED_FILE_NAME); - askForValueDialog.clickOkBtn(); - notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClose(NOTIFICATION_MESSAGE); - askForValueDialog.waitFormToClose(); - events.clickEventLogBtn(); - events.waitExpectedMessage(NOTIFICATION_MESSAGE); - } - - @Test(priority = 1) - public void checkDuplicatedFolder() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(DUPLICATED_FOLDER_NAME); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - warningDialog.waitWaitWarnDialogWindowWithSpecifiedTextMess(ERROR_DIALOG_MESSAGE); - warningDialog.clickOkBtn(); - warningDialog.waitWaitClosingWarnDialogWindow(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckHiddenFolderAndFileCreatedFromCommandTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckHiddenFolderAndFileCreatedFromCommandTest.java deleted file mode 100644 index 8eb39f44fa6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckHiddenFolderAndFileCreatedFromCommandTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuCommandGoals.COMMON_GOAL; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Skorik Sergey */ -public class CheckHiddenFolderAndFileCreatedFromCommandTest { - private static final String PROJECT_NAME = - CheckHiddenFolderAndFileCreatedFromCommandTest.class.getSimpleName(); - private static final String FILE_NAME = ".hidden"; - private static final String PATH_TO_FILE = PROJECT_NAME + "/" + FILE_NAME; - private static final String FOLDER_NAME = ".resources"; - private static final String PATH_TO_FOLDER = PROJECT_NAME + "/" + FOLDER_NAME; - private static final String COMMAND_CREATE_FOLDER_NAME = "createHiddenFolder"; - private static final String COMMAND_FOLDER = "cd " + PROJECT_NAME + " && mkdir " + FOLDER_NAME; - private static final String COMMAND_CREATE_FILE_NAME = "createHiddenFile"; - private static final String COMMAND_FILE = "cd " + PROJECT_NAME + " && pwd | cat >> " + FILE_NAME; - private static final String FILE_CONTENT = "/projects/" + PROJECT_NAME; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Menu menu; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - testCommandServiceClient.createCommand( - COMMAND_FOLDER, - COMMAND_CREATE_FOLDER_NAME, - TestCommandsConstants.CUSTOM, - testWorkspace.getId()); - - testCommandServiceClient.createCommand( - COMMAND_FILE, - COMMAND_CREATE_FILE_NAME, - TestCommandsConstants.CUSTOM, - testWorkspace.getId()); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - /** - * The 'checkHiddenFolderAndFile' test: 1. Open project and set 'SHOW_HIDE_HIDDEN_FILES' in the - * 'Project' menu to show hidden files; 2. Start "createHiddenFolder" command which create a - * ".res" folder and verify if it exists; 3. Start "createHiddenFile" command which create a - * ".text" folder and verify if it exists and have text(result of 'pwd'). - */ - @Test - public void checkHiddenFolderAndFile() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project - .SHOW_HIDE_HIDDEN_FILES); // all hidden files and folders are visible - projectExplorer.invokeCommandWithContextMenu( - COMMON_GOAL, PROJECT_NAME, COMMAND_CREATE_FOLDER_NAME); - loader.waitOnClosed(); - projectExplorer.waitItem(PATH_TO_FOLDER); - projectExplorer.openItemByPath(PATH_TO_FOLDER); // the created hidden folder is visible - projectExplorer.invokeCommandWithContextMenu( - COMMON_GOAL, PROJECT_NAME, COMMAND_CREATE_FILE_NAME); - loader.waitOnClosed(); - projectExplorer.waitItem(PATH_TO_FILE); - projectExplorer.openItemByPath(PATH_TO_FILE); // the created hidden file is visible - editor.waitActive(); - editor.waitTextIntoEditor(FILE_CONTENT); - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.SHOW_HIDE_HIDDEN_FILES); - projectExplorer.waitDisappearItemByPath(PATH_TO_FOLDER); - projectExplorer.waitDisappearItemByPath( - PATH_TO_FILE); // all hidden files and folders are hidden - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.SHOW_HIDE_HIDDEN_FILES); - projectExplorer.waitItem(PATH_TO_FOLDER); - projectExplorer.waitItem(PATH_TO_FILE); // all hidden files and folders are visible again - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidClassNameTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidClassNameTest.java deleted file mode 100644 index 97ae7db6c56..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidClassNameTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_CLASS; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Test tries to create classes with valid and invalid names inside source root folder and inside - * another package. - * - * @author Ihor Okhrimenko - */ -public class CheckOnValidAndInvalidClassNameTest { - private static final String PROJECT_NAME = generate("classNameTest", 4); - private static final String PATH_TO_JAVA_FOLDER = PROJECT_NAME + "/src/main/java"; - private static final String ROOT_PACKAGE = "/org/eclipse/qa/examples"; - private static final String TYPE = ".java"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - } - - @Test(dataProvider = "validClassNames") - public void shouldCreateClassWithValidNameInJavaFolder(String className) { - createJavaClassByPath(PATH_TO_JAVA_FOLDER, className); - - projectExplorer.waitItem(PATH_TO_JAVA_FOLDER + "/" + className + TYPE, ELEMENT_TIMEOUT_SEC); - } - - @Test(priority = 1, dataProvider = "validClassNames") - public void shouldCreateClassWithValidNameInRootPackage(String className) { - createJavaClassByPath(PATH_TO_JAVA_FOLDER + ROOT_PACKAGE, className); - - projectExplorer.waitItem( - PATH_TO_JAVA_FOLDER + ROOT_PACKAGE + "/" + className + TYPE, ELEMENT_TIMEOUT_SEC); - } - - @Test(priority = 2, dataProvider = "invalidClassNames") - public void shouldNotCreateClassWithInvalidNameInJavaFolder(String className) { - tryToCreateJavaClassWithNotValidNameByPath(PATH_TO_JAVA_FOLDER, className); - } - - @Test(priority = 3, dataProvider = "invalidClassNames") - public void shouldNotCreateClassWithInvalidNameInRootPackage(String className) { - tryToCreateJavaClassWithNotValidNameByPath(PATH_TO_JAVA_FOLDER + ROOT_PACKAGE, className); - } - - private void createJavaClassByPath(String classPath, String className) { - projectExplorer.openContextMenuByPathSelectedItem(classPath); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnNewContextMenuItem(JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName(className); - askForValueDialog.clickOkBtnNewJavaClass(); - askForValueDialog.waitNewJavaClassClose(); - } - - private void tryToCreateJavaClassWithNotValidNameByPath(String elementPath, String className) { - projectExplorer.openContextMenuByPathSelectedItem(elementPath); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnNewContextMenuItem(JAVA_CLASS); - askForValueDialog.waitNewJavaClassOpen(); - askForValueDialog.typeTextInFieldName(className); - askForValueDialog.waitErrorMessageInJavaClass(); - askForValueDialog.clickCancelButtonJava(); - askForValueDialog.waitNewJavaClassClose(); - } - - @DataProvider(name = "validClassNames") - private Object[][] validNames() { - return new Object[][] {{"Name"}, {"ClassName"}, {"ClassName1"}}; - } - - @DataProvider(name = "invalidClassNames") - private Object[][] invalidNames() { - return new Object[][] { - {"1234"}, - {"###secondInvalid"}, - {"123NotValid"}, - {"@#$%"}, - {"invalidClass@#"}, - {"boolean"}, - {"private"}, - {"space between"}, - {"Class+Name"} - }; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidPackageNameTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidPackageNameTest.java deleted file mode 100644 index 383c921b4e3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckOnValidAndInvalidPackageNameTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_PACKAGE; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Test tries to create packages with valid and invalid names inside source root folder and inside - * another package. - * - * @author Igor Ohrimenko - */ -public class CheckOnValidAndInvalidPackageNameTest { - private static final String PROJECT_NAME = "packageNameTest"; - private static final String PATH_TO_JAVA_FOLDER = "/src/main/java"; - private static final String ROOT_PACKAGE = "/org/eclipse/qa/examples"; - private static final String PREFIX = "inner"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Consoles console; - @Inject private Loader loader; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - console.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @Test(dataProvider = "validPackageNames") - public void createValidPackageNameInJavaFolderTest(String packageName) { - createPackageByPath(PROJECT_NAME + PATH_TO_JAVA_FOLDER, packageName); - - projectExplorer.waitVisibilityByName(packageName); - console.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.openItemByVisibleNameInExplorer(packageName); - } - - @Test(dataProvider = "validPackageNames", priority = 1) - public void createValidPackageNameInRootPackageTest(String packageName) { - createPackageByPath(PROJECT_NAME + PATH_TO_JAVA_FOLDER + ROOT_PACKAGE, packageName + PREFIX); - - projectExplorer.waitVisibilityByName(packageName + PREFIX); - projectExplorer.openItemByVisibleNameInExplorer(packageName + PREFIX); - } - - @Test(dataProvider = "invalidPackageNames", priority = 2) - public void createInvalidPackageNameInJavaFolderTest(String packageName) { - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + PATH_TO_JAVA_FOLDER); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem(JAVA_PACKAGE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(packageName); - if (!askForValueDialog.waitErrorMessage()) { - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - fail("Expected error message not shown , user able to create package with invalid name"); - } - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - } - - @Test(dataProvider = "invalidPackageNames", priority = 3) - public void createInvalidPackageNameInRootPackageTest(String packageName) { - projectExplorer.openContextMenuByPathSelectedItem( - PROJECT_NAME + PATH_TO_JAVA_FOLDER + ROOT_PACKAGE); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem(JAVA_PACKAGE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(packageName); - if (!askForValueDialog.waitErrorMessage()) { - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - fail("Expected error message not shown , user able to create package with invalid name"); - } - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - } - - private void createPackageByPath(String packagePath, String packageName) { - projectExplorer.openContextMenuByPathSelectedItem(packagePath); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnNewContextMenuItem(JAVA_PACKAGE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(packageName); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - } - - @DataProvider - private Object[][] validPackageNames() { - return new Object[][] { - {"com.valid"}, {"validPackage"}, {"_validPackage"}, {"PackageName"}, {"gov._1valid"} - }; - } - - @DataProvider - private Object[][] invalidPackageNames() { - return new Object[][] { - {"...packageName"}, - {"1packageName"}, - {"+packageName"}, - {" spaceOnBegin"}, - {"spaceOnEnd "}, - {"space between"}, - {"package-name"}, - {"package"}, - {"int"}, - {"boolean"} - }; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRecentFilesAndRevealResourceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRecentFilesAndRevealResourceTest.java deleted file mode 100644 index 341346e11b7..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRecentFilesAndRevealResourceTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.RecentFiles; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckRecentFilesAndRevealResourceTest { - private static final String FIRST_PROJECT_NAME = "checkRevealResource"; - private static final String SECOND_PROJECT_NAME = "checkRecentFiles"; - private static final String PATH_TO_FILE_FIRST_PROJECT = - FIRST_PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_TO_FILE_SECOND_PROJECT = - SECOND_PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_FOR_EXPAND_FIRST_PROJECT = - FIRST_PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_FOR_EXPAND_SECOND_PROJECT = - SECOND_PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private RecentFiles recentFiles; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - FIRST_PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - SECOND_PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(FIRST_PROJECT_NAME, SECOND_PROJECT_NAME); - } - - @Test - public void checkRevealResourceTest() { - projectExplorer.waitProjectExplorer(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND_FIRST_PROJECT); - projectExplorer.openItemByPath(PATH_TO_FILE_FIRST_PROJECT); - loader.waitOnClosed(); - editor.waitActive(); - editor.goToCursorPositionVisible(5, 1); - projectExplorer.collapseProjectTreeByOptionsButton(); - projectExplorer.waitDisappearItemByPath(PATH_TO_FILE_FIRST_PROJECT); - projectExplorer.revealResourceByOptionsButton(); - projectExplorer.waitItem(PATH_TO_FILE_FIRST_PROJECT); - } - - @Test - public void checkRecentFilesTest() { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.quickRevealToItemWithJavaScript(PATH_FOR_EXPAND_SECOND_PROJECT); - projectExplorer.openItemByPath(PATH_TO_FILE_SECOND_PROJECT); - menu.runCommand( - TestMenuCommandsConstants.Edit.EDIT, - TestMenuCommandsConstants.Edit.RECENT, - TestMenuCommandsConstants.Edit.Recent.CLEAR_LIST); - loader.waitOnClosed(); - - projectExplorer.openItemByPath(SECOND_PROJECT_NAME + "/pom.xml"); - projectExplorer.openItemByPath(SECOND_PROJECT_NAME + "/src/main/webapp"); - projectExplorer.openItemByPath(SECOND_PROJECT_NAME + "/src/main/webapp/index.jsp"); - editor.closeAllTabs(); - menu.runCommand( - TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.OPEN_RECENT_FILE); - - recentFiles.waitRecentFiles(); - recentFiles.closeRecentFiles(); - - menu.runCommand( - TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.OPEN_RECENT_FILE); - recentFiles.waitItemIsPresent("pom.xml"); - recentFiles.waitItemIsPresent("index.jsp"); - recentFiles.waitItemIsNotPresent("AppController.java"); - recentFiles.openItemByName("index.jsp"); - - editor.waitTabIsPresent("index.jsp"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRefreshProjectTreeTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRefreshProjectTreeTest.java deleted file mode 100644 index be098f2b2b7..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckRefreshProjectTreeTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.REFRESH; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Aleksandr Shmaraev - * @author Andrey Chizhikov - */ -public class CheckRefreshProjectTreeTest { - - private static String PROJECT_NAME = "RefreshProject"; - private static String FILE_NAME = "new_file"; - private static String FILE_CONTENT = "*** some content ***"; - private static String FILE_TEXT = "*** some text ***"; - private static String PATH_TO_FILE_1 = PROJECT_NAME + "/src/main/webapp"; - private static String PATH_TO_FILE_2 = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkRefreshProjectTree() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - - // Create a file in the 'webapp' folder - createFile(PATH_TO_FILE_1, FILE_NAME, FILE_CONTENT); - loader.waitOnClosed(); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/src/main/webapp"); - projectExplorer.clickOnItemInContextMenu(REFRESH); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/webapp/new_file"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/new_file"); - editor.waitTextIntoEditor(FILE_CONTENT); - loader.waitOnClosed(); - - // Create a file in the 'WEB-INF' folder - createFile(PATH_TO_FILE_2, FILE_NAME, FILE_TEXT); - loader.waitOnClosed(); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/src/main/webapp/WEB-INF"); - projectExplorer.clickOnItemInContextMenu(REFRESH); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/webapp/WEB-INF/new_file"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp/WEB-INF/new_file"); - editor.waitTextIntoEditor(FILE_TEXT); - } - - private void createFile(String path, String fileName, String content) throws Exception { - - testProjectServiceClient.createFileInProject(testWorkspace.getId(), path, fileName, content); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckShowHideHiddenFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckShowHideHiddenFilesTest.java deleted file mode 100644 index 6f910cfc92d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckShowHideHiddenFilesTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckShowHideHiddenFilesTest { - private static final String PROJECT_NAME = "RefreshProject"; - private static final String PATH_TO_CLASSPATH_FILE = PROJECT_NAME + "/.classpath"; - private static final String PATH_TO_PROJECT_FILE = PROJECT_NAME + "/.project"; - public static final String CLASSPATH_CONTENT = ""; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Menu menu; - @Inject protected Wizard projectWizard; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void checkShowHideHiddenFilesTest() { - createProject(PROJECT_NAME); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.SHOW_HIDE_HIDDEN_FILES); - loader.waitOnClosed(); - projectExplorer.waitItem(PATH_TO_CLASSPATH_FILE); - projectExplorer.waitItem(PATH_TO_PROJECT_FILE); - projectExplorer.openItemByPath(PATH_TO_CLASSPATH_FILE); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTextIntoEditor(CLASSPATH_CONTENT); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.SHOW_HIDE_HIDDEN_FILES); - loader.waitOnClosed(); - editor.waitTabIsPresent(".classpath"); - projectExplorer.waitItemInvisibility(PATH_TO_CLASSPATH_FILE); - projectExplorer.waitItemInvisibility(PATH_TO_PROJECT_FILE); - } - - private void createProject(String projectName) { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - projectWizard.waitCreateProjectWizardForm(); - projectWizard.typeProjectNameOnWizard(projectName); - selectSampleProject(); - projectWizard.clickCreateButton(); - loader.waitOnClosed(); - projectWizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - loader.waitOnClosed(); - } - - protected void selectSampleProject() { - projectWizard.selectSample(Wizard.SamplesName.WEB_JAVA_SPRING); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckTreeStructureAfterCloseTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckTreeStructureAfterCloseTest.java deleted file mode 100644 index 2b20f607509..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CheckTreeStructureAfterCloseTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CheckTreeStructureAfterCloseTest { - - private static final String PROJECT_NAME = "TestTree"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_SRC_FOLDER = PROJECT_NAME + "/src"; - private static final String PATH_TO_POM_XML_FILE = PROJECT_NAME + "/pom.xml"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void openProjectWizard() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TO_POM_XML_FILE); - loader.waitOnClosed(); - editor.waitActive(); - - // close project explorer - projectExplorer.openItemByPath(PROJECT_NAME); - // open project explorer - projectExplorer.openItemByPath(PROJECT_NAME); - - // check tree structure project explorer - projectExplorer.waitItem(PATH_TO_POM_XML_FILE); - projectExplorer.waitItem(PATH_TO_SRC_FOLDER); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ClosingSeveralOpenFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ClosingSeveralOpenFilesTest.java deleted file mode 100644 index 59f21b4833f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ClosingSeveralOpenFilesTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author mmusienko */ -public class ClosingSeveralOpenFilesTest { - private static final String PROJECT_NAME = - NameGenerator.generate(ClosingSeveralOpenFilesTest.class.getSimpleName(), 4); - private static final String PATH_FOR_EXPAND_FIRST_MODULE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_FOR_EXPAND_SECOND_MODULE = - PROJECT_NAME + "/src/main/webapp/WEB-INF"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void closingSeveralOpenFilesTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - // step 1 expand and build first module - - projectExplorer.openItemByPath(PATH_FOR_EXPAND_FIRST_MODULE + "/AppController.java"); - loader.waitOnClosed(); - loader.waitOnClosed(); - - // step 2 expand and build second module - projectExplorer.openItemByPath(PATH_FOR_EXPAND_SECOND_MODULE + "/cssFile.css"); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - projectExplorer.openItemByPath(PROJECT_NAME + "/README.md"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/webapp" + "/index.jsp"); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - editor.closeAllTabsByContextMenu(); - editor.waitWhileAllFilesWillClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewFoldersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewFoldersTest.java deleted file mode 100644 index ca371edf1ee..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewFoldersTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewFoldersTest { - - private static final String PROJECT_NAME = "FileCreation7"; - private static final String NEW_FOLDER_NAME = "newfolder"; - private static final String SOURCE_FOLDER = "src/main/webapp"; - private static final String NEW_FOLDER_NAME_2 = "newfolder_2"; - private static final String SOURCE_FOLDER_2 = "src/main"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewFolder() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - - // Create new folder in the folder webapp - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + SOURCE_FOLDER); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(NEW_FOLDER_NAME); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(NEW_FOLDER_NAME); - - // Create new folder in the folder main - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + SOURCE_FOLDER_2); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(NEW_FOLDER_NAME_2); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(NEW_FOLDER_NAME_2); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesFromContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesFromContextMenuTest.java deleted file mode 100644 index 0bb332b4b04..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesFromContextMenuTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_CLASS; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewJavaFilesFromContextMenuTest { - - private static final String PROJECT_NAME = "FileCreation5"; - private static final String NEW_CLASS = "NewClass"; - private static final String NEW_INTERFACE = "NewInterface"; - private static final String NEW_ENUM = "NewEnum"; - private static final String DEFAULT_TEXT_FOR_NEW_CLASS = - "package org.eclipse.qa.examples;\n" + "\n" + "public class NewClass {\n" + "}\n"; - private static final String DEFAULT_TEXT_FOR_NEW_INTERFACE = - "package org.eclipse.qa.examples;\n" + "\n" + "public interface NewInterface {\n" + "}\n"; - private static final String DEFAULT_TEXT_FOR_NEW_ENUM = - "package org.eclipse.qa.examples;\n" + "\n" + "public enum NewEnum {\n" + "}\n"; - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewFileFromContextMenuTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - - // go to folder for creation files - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - - // create new class - createNewFile(NEW_CLASS, AskForValueDialog.JavaFiles.CLASS); - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_CLASS); - - // create new interface - createNewFile(NEW_INTERFACE, AskForValueDialog.JavaFiles.INTERFACE); - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_INTERFACE); - - // create new enum - createNewFile(NEW_ENUM, AskForValueDialog.JavaFiles.ENUM); - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_ENUM); - } - - private void createNewFile(String name, AskForValueDialog.JavaFiles item) { - projectExplorer.waitAndSelectItem(PATH_TO_FILES); - - // create new File from context menu - projectExplorer.openContextMenuByPathSelectedItem(PATH_TO_FILES); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem(JAVA_CLASS); - - askForValueDialog.createJavaFileByNameAndType(name, item); - - projectExplorer.waitVisibilityByName(name + ".java"); - - editor.waitActive(); - loader.waitOnClosed(); - editor.waitTabIsPresent(name); - } - - private void checkDefaultTextInEditorForFile(String defaultText) { - editor.waitActive(); - editor.waitTextIntoEditor(defaultText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesTest.java deleted file mode 100644 index a7368344263..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewJavaFilesTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewJavaFilesTest { - - private static final String PROJECT_NAME = "FileCreation6"; - private static final String NEW_CLASS = "NewClass"; - private static final String NEW_INTERFACE = "NewInterface"; - private static final String NEW_ENUM = "NewEnum"; - private static final String DEFAULT_TEXT_FOR_NEW_CLASS = - "package org.eclipse.qa.examples;\n" + "\n" + "public class NewClass {\n" + "}\n"; - private static final String DEFAULT_TEXT_FOR_NEW_INTERFACE = - "package org.eclipse.qa.examples;\n" + "\n" + "public interface NewInterface {\n" + "}\n"; - private static final String DEFAULT_TEXT_FOR_NEW_ENUM = - "package org.eclipse.qa.examples;\n" + "\n" + "public enum NewEnum {\n" + "}\n"; - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - } - - @Test - public void createNewJavaFilesTest() throws Exception { - projectExplorer.waitVisibilityByName("AppController.java"); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - - // create new class - createNewFileFromMenuFile(NEW_CLASS, AskForValueDialog.JavaFiles.CLASS, ".java"); - - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_CLASS, NEW_CLASS); - - // create new interface - createNewFileFromMenuFile(NEW_INTERFACE, AskForValueDialog.JavaFiles.INTERFACE, ".java"); - - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_INTERFACE, NEW_INTERFACE); - - // create new enum - createNewFileFromMenuFile(NEW_ENUM, AskForValueDialog.JavaFiles.ENUM, ".java"); - - checkDefaultTextInEditorForFile(DEFAULT_TEXT_FOR_NEW_ENUM, NEW_ENUM); - } - - private void createNewFileFromMenuFile( - String name, AskForValueDialog.JavaFiles item, String fileExt) { - - projectExplorer.waitAndSelectItem(PATH_TO_FILES); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - - loader.waitOnClosed(); - askForValueDialog.createJavaFileByNameAndType(name, item); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(name + fileExt, ELEMENT_TIMEOUT_SEC); - } - - private void checkDefaultTextInEditorForFile(String defaultText, String fileName) { - editor.waitActive(); - editor.waitTabIsPresent(fileName); - loader.waitOnClosed(); - editor.waitTextIntoEditor(defaultText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesFromContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesFromContextMenuTest.java deleted file mode 100644 index c9db116e808..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesFromContextMenuTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.CSS_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.HTML_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVASCRIPT_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.LESS_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.XML_FILE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuItems; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewNotJavaFilesFromContextMenuTest { - - private static final String PROJECT_NAME = "FileCreation1"; - private static final String NEW_FILE_NAME = "file.txt"; - private static final String NEW_XML_FILE = "NewXml"; - private static final String NEW_LESS_FILE = "NewLess"; - private static final String NEW_CSS_FILE = "NewCSS"; - private static final String NEW_HTML_FILE = "NewHTML"; - private static final String NEW_JS_FILE = "NewJS"; - private static final String DEFAULT_TEXT_FOR_NEW_FILE_NAME = ""; - private static final String DEFAULT_TEXT_FOR_NEW_XML_FILE = - "\n"; - private static final String DEFAULT_TEXT_FOR_NEW_LESS_FILE = "@CHARSET \"UTF-8\"\n;"; - private static final String DEFAULT_TEXT_FOR_NEW_CSS_FILE = "@CHARSET \"UTF-8\";"; - private static final String DEFAULT_TEXT_FOR_NEW_HTML_FILE = - "\n" - + "\n" - + "\n" - + " \n" - + "\n" - + "\n" - + "\n" - + "\n" - + ""; - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewFileFromContextMenuTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - - // create new file - createNewFile(NEW_FILE_NAME, FILE, ""); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_FILE_NAME, NEW_FILE_NAME); - editor.closeFileByNameWithSaving(NEW_FILE_NAME); - - // create new xml file - createNewFile(NEW_XML_FILE, XML_FILE, ".xml"); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_XML_FILE, NEW_XML_FILE + ".xml"); - editor.closeFileByNameWithSaving(NEW_XML_FILE + ".xml"); - - // create new less file - createNewFile(NEW_LESS_FILE, LESS_FILE, ".less"); - checkDefaultTextInCodeMirrorEditorForFile( - DEFAULT_TEXT_FOR_NEW_LESS_FILE, NEW_LESS_FILE + ".less"); - editor.closeFileByNameWithSaving(NEW_LESS_FILE + ".less"); - - // create new css file - createNewFile(NEW_CSS_FILE, CSS_FILE, ".css"); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_CSS_FILE, NEW_CSS_FILE + ".css"); - editor.closeFileByNameWithSaving(NEW_CSS_FILE + ".css"); - - // create new html file - createNewFile(NEW_HTML_FILE, HTML_FILE, ".html"); - checkDefaultTextInCodeMirrorEditorForFile( - DEFAULT_TEXT_FOR_NEW_HTML_FILE, NEW_HTML_FILE + ".html"); - editor.closeFileByNameWithSaving(NEW_HTML_FILE + ".html"); - - // create new js file - createNewFile(NEW_JS_FILE, JAVASCRIPT_FILE, ".js"); - editor.closeFileByNameWithSaving(NEW_JS_FILE + ".js"); - } - - public void createNewFile(String name, ContextMenuItems type, String fileExt) throws Exception { - projectExplorer.waitAndSelectItem(PATH_TO_FILES); - - // create new File from context menu - projectExplorer.openContextMenuByPathSelectedItem(PATH_TO_FILES); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnItemInContextMenu(type); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(name); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(name + fileExt); - } - - public void checkDefaultTextInCodeMirrorEditorForFile(String defaultText, String fileName) - throws InterruptedException { - editor.waitActive(); - editor.waitTabIsPresent(fileName); - editor.waitTextIntoEditor(defaultText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesTest.java deleted file mode 100644 index fca0f2eecc4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewNotJavaFilesTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewNotJavaFilesTest { - - private static final String PROJECT_NAME = "FileCreation4"; - private static final String NEW_FILE_NAME = "file.txt"; - private static final String TEST_FILE_NAME = "fileTest"; - private static final String NEW_XML_FILE = "NewXml"; - private static final String NEW_LESS_FILE = "NewLess"; - private static final String NEW_CSS_FILE = "NewCSS"; - private static final String NEW_HTML_FILE = "NewHTML"; - private static final String NEW_JS_FILE = "NewJS"; - private static final String DEFAULT_TEXT_FOR_NEW_FILE_NAME = ""; - private static final String DEFAULT_TEXT_FOR_NEW_XML_FILE = - "\n"; - private static final String DEFAULT_TEXT_FOR_NEW_LESS_FILE = "@CHARSET \"UTF-8\"\n;"; - private static final String DEFAULT_TEXT_FOR_NEW_CSS_FILE = "@CHARSET \"UTF-8\";"; - private static final String DEFAULT_TEXT_FOR_NEW_JS_FILE = ""; - private static final String DEFAULT_TEXT_FOR_NEW_HTML_FILE = - "\n" - + "\n" - + "\n" - + " \n" - + "\n" - + "\n" - + "\n" - + "\n" - + ""; - private static final String PATH_TO_FILES = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewFileFromContextMenuTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - - // go to folder for creation files - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - editor.closeFileByNameWithSaving("AppController"); - loader.waitOnClosed(); - - // create new file - createNewFile(PATH_TO_FILES, NEW_FILE_NAME, TestMenuCommandsConstants.Project.New.FILE, ""); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_FILE_NAME, NEW_FILE_NAME); - editor.closeFileByNameWithSaving(NEW_FILE_NAME); - - // set the focus on the file and create some file - String pathToFile = PATH_TO_FILES + "/" + NEW_FILE_NAME; - createNewFile(pathToFile, TEST_FILE_NAME, TestMenuCommandsConstants.Project.New.FILE, ""); - editor.setCursorToLine(1); - editor.typeTextIntoEditor("Hello, World!"); - checkDefaultTextInCodeMirrorEditorForFile("Hello, World!", TEST_FILE_NAME); - - // create new xml file - createNewFile( - PATH_TO_FILES, NEW_XML_FILE, TestMenuCommandsConstants.Project.New.XML_FILE, ".xml"); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_XML_FILE, NEW_XML_FILE + ".xml"); - editor.closeFileByNameWithSaving(NEW_XML_FILE + ".xml"); - - // create new less file - createNewFile( - PATH_TO_FILES, NEW_LESS_FILE, TestMenuCommandsConstants.Project.New.LESS_FILE, ".less"); - checkDefaultTextInCodeMirrorEditorForFile( - DEFAULT_TEXT_FOR_NEW_LESS_FILE, NEW_LESS_FILE + ".less"); - editor.closeFileByNameWithSaving(NEW_LESS_FILE + ".less"); - - // create new css file - createNewFile( - PATH_TO_FILES, NEW_CSS_FILE, TestMenuCommandsConstants.Project.New.CSS_FILE, ".css"); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_CSS_FILE, NEW_CSS_FILE + ".css"); - editor.closeFileByNameWithSaving(NEW_CSS_FILE + ".css"); - - // create new html file - createNewFile( - PATH_TO_FILES, NEW_HTML_FILE, TestMenuCommandsConstants.Project.New.HTML_FILE, ".html"); - checkDefaultTextInCodeMirrorEditorForFile( - DEFAULT_TEXT_FOR_NEW_HTML_FILE, NEW_HTML_FILE + ".html"); - editor.closeFileByNameWithSaving(NEW_HTML_FILE + ".html"); - - // create new js file - createNewFile( - PATH_TO_FILES, NEW_JS_FILE, TestMenuCommandsConstants.Project.New.JAVASCRIPT_FILE, ".js"); - checkDefaultTextInCodeMirrorEditorForFile(DEFAULT_TEXT_FOR_NEW_JS_FILE, NEW_JS_FILE + ".js"); - editor.closeFileByNameWithSaving(NEW_JS_FILE + ".js"); - } - - private void createNewFile(String pathFromItem, String name, String type, String fileExt) - throws Exception { - - projectExplorer.waitAndSelectItem(pathFromItem); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, TestMenuCommandsConstants.Project.New.NEW, type); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(name); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(name + fileExt); - } - - private void checkDefaultTextInCodeMirrorEditorForFile(String defaultText, String fileName) - throws InterruptedException { - editor.waitActive(); - editor.waitTabIsPresent(fileName); - editor.waitTextIntoEditor(defaultText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackageFromContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackageFromContextMenuTest.java deleted file mode 100644 index b107abf227d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackageFromContextMenuTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_PACKAGE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewPackageFromContextMenuTest { - - private static final String PROJECT_NAME = "FileCreation3"; - private static final String NEW_PACKAGE_NAME = "newpackagename"; - private static final String SOURCE_FOLDER = "src/main/java"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewPackageFromContextMenuTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + SOURCE_FOLDER); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + SOURCE_FOLDER); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem(JAVA_PACKAGE); - - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(NEW_PACKAGE_NAME); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(NEW_PACKAGE_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackagesWithHelpCreationJavaClassTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackagesWithHelpCreationJavaClassTest.java deleted file mode 100644 index 477fe18697f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateNewPackagesWithHelpCreationJavaClassTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.api.core.rest.HttpJsonRequestFactory; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.provider.TestApiEndpointUrlProvider; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateNewPackagesWithHelpCreationJavaClassTest { - private static final String PROJECT_NAME = - CreateNewPackagesWithHelpCreationJavaClassTest.class.getSimpleName(); - private static final String NEW_PACKAGE_NAME1 = "tu"; - private static final String NEW_PACKAGE_NAME2 = "test.ua"; - private static final String JAVA1 = "TestClass1"; - private static final String JAVA2 = "TestClass2"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private HttpJsonRequestFactory httpJsonRequestFactory; - @Inject private TestApiEndpointUrlProvider testApiEndpointUrlProvider; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createNewPackageFromContextMenuTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorer(PROJECT_NAME + "/src/main/java"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - askForValueDialog.createJavaFileByNameAndType( - NEW_PACKAGE_NAME1 + "." + JAVA1, AskForValueDialog.JavaFiles.CLASS); - - editor.waitActive(); - editor.waitTabIsPresent("TestClass1"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/tu"); - - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/tu/TestClass1.java"); - - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - - askForValueDialog.createJavaFileByNameAndType( - NEW_PACKAGE_NAME2 + "." + JAVA2, AskForValueDialog.JavaFiles.CLASS); - - editor.waitActive(); - editor.waitTabIsPresent("TestClass2"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test/ua"); - projectExplorer.waitVisibilityByName("TestClass2.java"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectInSelectedFolderTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectInSelectedFolderTest.java deleted file mode 100644 index 2b26b01f0d1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectInSelectedFolderTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.FOLDER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.ConfigureClasspath; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CreateProjectInSelectedFolderTest { - - private static final String PROJECT_NAME = - CreateProjectInSelectedFolderTest.class.getSimpleName(); - private static final String PROJECT_NAME_WITH_ARTIFACT_ID = PROJECT_NAME + " [qa-spring-sample]"; - private static final String INNER_PROJECT_NAME = "blank-project"; - private static final String PATH_TO_FOLDER = PROJECT_NAME + "/blank-project"; - private static final String FOLDER_NAME = "blank-project"; - private static final String EXPECTED_TEXT = "You have created a blank project."; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer explorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Wizard projectWizard; - @Inject private ConfigureClasspath selectPath; - @Inject private Menu menu; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void createProjectInSelectedFolder() { - explorer.waitProjectExplorer(); - explorer.openItemByPath(PROJECT_NAME); - explorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - explorer.clickOnItemInContextMenu(NEW); - explorer.clickOnNewContextMenuItem(FOLDER); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(FOLDER_NAME); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - explorer.waitItem(PATH_TO_FOLDER); - - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - - projectWizard.selectSample(Wizard.TypeProject.BLANK); - projectWizard.typeProjectNameOnWizard(INNER_PROJECT_NAME); - - projectWizard.clickOnSelectPathForParentBtn(); - selectPath.openItemInSelectPathForm("Workspace"); - selectPath.waitItemInSelectPathForm(PROJECT_NAME); - selectPath.selectItemInSelectPathForm(PROJECT_NAME); - selectPath.openItemInSelectPathForm(PROJECT_NAME); - selectPath.waitItemInSelectPathForm(FOLDER_NAME); - selectPath.selectItemInSelectPathForm(FOLDER_NAME); - selectPath.clickSelectBtnSelectPathForm(); - - projectWizard.clickCreateButton(); - loader.waitOnClosed(); - - projectExplorer.quickExpandWithJavaScript(); - explorer.openItemByPath( - PROJECT_NAME + "/" + FOLDER_NAME + "/" + INNER_PROJECT_NAME + "/README"); - editor.waitActive(); - editor.waitTextIntoEditor(EXPECTED_TEXT); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectTest.java deleted file mode 100644 index bc4d966382d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class CreateProjectTest { - - private static final List PROJECT_NAMES = - Arrays.asList("CreateProjectTest1", "CreateProjectTest2", "CreateProjectTest3"); - private static final String VERSION_OF_PROJECT = "1.0"; - private static final String ARTIFACT_ID_OF_PROJECT = "test.project"; - private static final String GROUP_ID_OF_PROJECT = "com.test.project"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Wizard projectWizard; - @Inject private Consoles consoles; - @Inject private Menu menu; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void openProjectWizard() throws Exception { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - // create project with help context menu in the list of projects - createProject(PROJECT_NAMES.get(0), Wizard.PackagingMavenType.NOT_SPECIFIED); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAMES.get(0)); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAMES.get(0)); - loader.waitOnClosed(); - createProject(PROJECT_NAMES.get(1), Wizard.PackagingMavenType.JAR); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAMES.get(1)); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAMES.get(1)); - loader.waitOnClosed(); - createProject(PROJECT_NAMES.get(2), Wizard.PackagingMavenType.WAR); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAMES.get(2)); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAMES.get(2)); - loader.waitOnClosed(); - } - - private void createProject(String projectName, Wizard.PackagingMavenType packageType) { - - loader.waitOnClosed(); - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - projectWizard.waitCreateProjectWizardForm(); - projectWizard.typeProjectNameOnWizard(projectName); - projectWizard.clickNextButton(); - projectWizard.waitOpenProjectConfigForm(); - projectWizard.setArtifactIdOnWizard(ARTIFACT_ID_OF_PROJECT); - projectWizard.checkArtifactIdOnWizardContainsText(ARTIFACT_ID_OF_PROJECT); - projectWizard.setGroupIdOnWizard(GROUP_ID_OF_PROJECT); - projectWizard.checkGroupIdOnWizardContainsText(GROUP_ID_OF_PROJECT); - projectWizard.setVersionOnWizard(VERSION_OF_PROJECT); - projectWizard.checkVersionOnWizardContainsText(VERSION_OF_PROJECT); - projectWizard.selectPackagingType(packageType); - projectWizard.clickCreateButton(); - loader.waitOnClosed(); - projectWizard.waitCloseProjectConfigForm(); - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(projectName); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectsForArtikPluginTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectsForArtikPluginTest.java deleted file mode 100644 index d287c58008b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/CreateProjectsForArtikPluginTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.C_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.C_PLUS_PLUS_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.H_FILE; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuNew.PYTHON_FILE; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuItems; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CreateProjectsForArtikPluginTest { - private static final String NAME_C_PROJECT = "C-project"; - private static final String NAME_CPP_PROJECT = "C-plus-plus"; - private static final String NAME_PYTHON_PROJECT = "Python-project"; - - private static final String TYPE_OF_PROJECT_C = "C"; - private static final String TYPE_OF_PROJECT_CPP = "C++"; - private static final String TYPE_OF_PROJECT_PYTHON = "Python"; - - private static final String NAME_C_FILE = "newC"; - private static final String NAME_CPP_FILE = "newCPlusPlus"; - private static final String NAME_H_FILE = "newH"; - private static final String NAME_PYTHON_FILE = "newPython"; - - private static final String TEXT_IN_CPP_FILE = - "#include \n" - + "\n" - + "int main()\n" - + "{\n" - + " std::cout << \"Hello, world!\\n\";\n" - + " return 0;\n" - + "}"; - private static final String TEXT_IN_C_FILE = - "#include \n" - + "\n" - + "int main(void)\n" - + "{\n" - + " printf(\"hello, world\\n\");\n" - + "}"; - private static final String TEXT_IN_H_FILE = - "#ifndef VARIABLE\n" + "#define VARIABLE\n" + "// Write your header file here.\n" + "#endif"; - private static final String TEXT_IN_PYTHON_FILE = ""; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Wizard projectWizard; - @Inject private Menu menu; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - } - - @Test - public void createCProjectTest() throws Exception { - createProject(NAME_C_PROJECT, TYPE_OF_PROJECT_C); - createAndCheckNewFile(NAME_C_PROJECT, NAME_C_FILE, C_FILE, ".c"); - checkTextInEditorForFile(TEXT_IN_C_FILE, NAME_C_FILE + ".c"); - createAndCheckNewFile(NAME_C_PROJECT, NAME_H_FILE, H_FILE, ".h"); - checkTextInEditorForFile(TEXT_IN_H_FILE, NAME_H_FILE + ".h"); - createAndCheckNewFile(NAME_C_PROJECT, NAME_CPP_FILE, C_PLUS_PLUS_FILE, ".cpp"); - checkTextInEditorForFile(TEXT_IN_CPP_FILE, NAME_CPP_FILE + ".cpp"); - } - - @Test - public void createCPlusPlusProjectTest() throws Exception { - createProject(NAME_CPP_PROJECT, TYPE_OF_PROJECT_CPP); - createAndCheckNewFile(NAME_CPP_PROJECT, NAME_C_FILE, C_FILE, ".c"); - checkTextInEditorForFile(TEXT_IN_C_FILE, NAME_C_FILE + ".c"); - createAndCheckNewFile(NAME_CPP_PROJECT, NAME_H_FILE, H_FILE, ".h"); - checkTextInEditorForFile(TEXT_IN_H_FILE, NAME_H_FILE + ".h"); - createAndCheckNewFile(NAME_CPP_PROJECT, NAME_CPP_FILE, C_PLUS_PLUS_FILE, ".cpp"); - checkTextInEditorForFile(TEXT_IN_CPP_FILE, NAME_CPP_FILE + ".cpp"); - } - - @Test - public void createPythonProjectTest() throws Exception { - createProject(NAME_PYTHON_PROJECT, TYPE_OF_PROJECT_PYTHON); - createAndCheckNewFile(NAME_PYTHON_PROJECT, NAME_PYTHON_FILE, PYTHON_FILE, ".py"); - checkTextInEditorForFile(TEXT_IN_PYTHON_FILE, NAME_PYTHON_FILE + ".py"); - } - - private void createProject(String projectName, String projectType) { - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - menu.runCommand( - TestMenuCommandsConstants.Workspace.WORKSPACE, - TestMenuCommandsConstants.Workspace.CREATE_PROJECT); - projectWizard.selectSample(projectType); - projectWizard.typeProjectNameOnWizard(projectName); - projectWizard.clickCreateButton(); - loader.waitOnClosed(); - } - - private void createAndCheckNewFile( - String projectName, String fileName, ContextMenuItems type, String fileExt) { - - projectExplorer.waitAndSelectItem(projectName); - projectExplorer.openContextMenuByPathSelectedItem(projectName); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnItemInContextMenu(type); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(fileName); - askForValueDialog.clickOkBtn(); - loader.waitOnClosed(); - projectExplorer.waitVisibilityByName(fileName + fileExt); - projectExplorer.openItemByPath(projectName + "/" + fileName + fileExt); - } - - private void checkTextInEditorForFile(String defaultText, String fileName) - throws InterruptedException { - editor.waitActive(); - editor.waitTabIsPresent(fileName); - editor.waitTextIntoEditor(defaultText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesFromContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesFromContextMenuTest.java deleted file mode 100644 index ed5127b7af3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesFromContextMenuTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.DELETE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class DeleteFilesFromContextMenuTest { - - private static final String PROJECT_NAME = DeleteFilesFromContextMenuTest.class.getSimpleName(); - private static final String ASK_PREFIX = "Delete file "; - private static final String DELETE_TEXT_FOR_JSP = ASK_PREFIX + "\"index.jsp\"?"; - private static final String DELETE_TEXT_FOR_LESS = ASK_PREFIX + "\"LessFile.less\"?"; - private static final String DELETE_TEXT_FOR_CSS = ASK_PREFIX + "\"cssFile.css\"?"; - private static final String DELETE_TEXT_FOR_XML = ASK_PREFIX + "\"web.xml\"?"; - private static final String DELETE_TEXT_FOR_HTML = ASK_PREFIX + "\"htmlFile.html\"?"; - private static final String DELETE_TEXT_FOR_JS = ASK_PREFIX + "\"jsFile.js\"?"; - private static final String DELETE_TEXT_FOR_JAVA_CLASS = ASK_PREFIX + "\"AppController.java\"?"; - private static final String DELETE_TEXT_FOR_SIMPLE_FILE = ASK_PREFIX + "\"another\"?"; - private static final String DELETE_TEXT_FOR_SQL = ASK_PREFIX + "\"sqlFile.sql\"?"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_JSP = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String PATH_TO_LESS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"; - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JAVASCRIPT = - PROJECT_NAME + "/src/main/webapp/WEB-INF/jsFile.js"; - private static final String PATH_TO_JAVA_CLASS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_TO_SIMPLE_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"; - private static final String PATH_TO_SQL = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void deleteFileTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - loader.waitOnClosed(); - - // delete java class file - deleteFromContextMenu(DELETE_TEXT_FOR_JAVA_CLASS, PATH_TO_JAVA_CLASS); - - // delete jsp file - deleteFromContextMenu(DELETE_TEXT_FOR_JSP, PATH_TO_JSP); - - // delete css file - deleteFromContextMenu(DELETE_TEXT_FOR_CSS, PATH_TO_CSS); - - // delete xml file - deleteFromContextMenu(DELETE_TEXT_FOR_XML, PATH_TO_XML); - - // delete less file - deleteFromContextMenu(DELETE_TEXT_FOR_LESS, PATH_TO_LESS); - - // delete html file - deleteFromContextMenu(DELETE_TEXT_FOR_HTML, PATH_TO_HTML); - checkDeletion(PATH_TO_HTML); - - // delete js file - deleteFromContextMenu(DELETE_TEXT_FOR_JS, PATH_TO_JAVASCRIPT); - - // delete simple file - deleteFromContextMenu(DELETE_TEXT_FOR_SIMPLE_FILE, PATH_TO_SIMPLE_FILE); - - // delete sql file - deleteFromContextMenu(DELETE_TEXT_FOR_SQL, PATH_TO_SQL); - } - - private void deleteFromContextMenu(String deleteText, String pathToFile) { - loader.waitOnClosed(); - projectExplorer.waitItem(pathToFile); - projectExplorer.openContextMenuByPathSelectedItem(pathToFile); - projectExplorer.clickOnNewContextMenuItem(DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText(deleteText); - checkDeletion(pathToFile); - } - - private void checkDeletion(String pathToFile) { - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(pathToFile); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesTest.java deleted file mode 100644 index 84347140ece..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteFilesTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class DeleteFilesTest { - private static final String PROJECT_NAME = "DeletionPrj1"; - private static final String DELETE_TEXT_FOR_JSP = "Delete file \"index.jsp\"?"; - private static final String DELETE_TEXT_FOR_LESS = "Delete file \"LessFile.less\"?"; - private static final String DELETE_TEXT_FOR_CSS = "Delete file \"cssFile.css\"?"; - private static final String DELETE_TEXT_FOR_XML = "Delete file \"web.xml\"?"; - private static final String DELETE_TEXT_FOR_HTML = "Delete file \"htmlFile.html\"?"; - private static final String DELETE_TEXT_FOR_JS = "Delete file \"jsFile.js\"?"; - private static final String DELETE_TEXT_FOR_JAVA_CLASS = "Delete file \"AppController.java\"?"; - private static final String DELETE_TEXT_FOR_SIMPLE_FILE = "Delete file \"another\"?"; - private static final String DELETE_TEXT_FOR_SQL = "Delete file \"sqlFile.sql\"?"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_JSP = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String PATH_TO_LESS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"; - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JAVASCRIPT = - PROJECT_NAME + "/src/main/webapp/WEB-INF/jsFile.js"; - private static final String PATH_TO_JAVA_CLASS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_TO_SIMPLE_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"; - private static final String PATH_TO_SQL = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void deleteFileTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - - // delete jsp file - deleteFromMenuFile(DELETE_TEXT_FOR_JSP, PATH_TO_JSP); - - // delete css file - deleteFromMenuFile(DELETE_TEXT_FOR_CSS, PATH_TO_CSS); - - // delete xml file - deleteFromMenuFile(DELETE_TEXT_FOR_XML, PATH_TO_XML); - - // delete less file - deleteFromMenuFile(DELETE_TEXT_FOR_LESS, PATH_TO_LESS); - - // delete html file - deleteFromMenuFile(DELETE_TEXT_FOR_HTML, PATH_TO_HTML); - checkDeletion(PATH_TO_HTML); - - // delete js file - deleteFromMenuFile(DELETE_TEXT_FOR_JS, PATH_TO_JAVASCRIPT); - - // delete java class file - deleteFromMenuFile(DELETE_TEXT_FOR_JAVA_CLASS, PATH_TO_JAVA_CLASS); - - // delete simple file - deleteFromMenuFile(DELETE_TEXT_FOR_SIMPLE_FILE, PATH_TO_SIMPLE_FILE); - - // delete sql file - deleteFromMenuFile(DELETE_TEXT_FOR_SQL, PATH_TO_SQL); - } - - private void deleteFromMenuFile(String deleteText, String pathToFile) { - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(pathToFile); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - askDialog.acceptDialogWithText(deleteText); - checkDeletion(pathToFile); - } - - private void checkDeletion(String pathToFile) { - loader.waitOnClosed(); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(pathToFile); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageFromContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageFromContextMenuTest.java deleted file mode 100644 index 8819739668a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageFromContextMenuTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.DELETE; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class DeletePackageFromContextMenuTest { - - private static final String PROJECT_NAME = "DeletionPrj3"; - private static final String PATH_TO_WEB_INF = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String DELETE_TEXT1 = "Delete folder \"WEB-INF\"?"; - private static final String DELETE_TEXT2 = "Delete folder \"webapp\"?"; - private static final String DELETE_TEXT3 = "Delete folder \"examples\"?"; - private static final String PATH_TO_PACKAGE1 = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - private static final String PATH_TO_PACKAGE2 = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_PACKAGE3 = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void deletePackageFromContextMenuTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - notificationsPopupPanel.waitProgressPopupPanelClose(); - openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - openItemByPath(PATH_TO_WEB_INF + "/spring-servlet.xml"); - openItemByPath(PATH_TO_WEB_INF + "/web.xml"); - - // select package1 for deletion - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE1); - deletePackage(PATH_TO_PACKAGE1, DELETE_TEXT1); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - - editor.waitTabIsNotPresent("spring-servlet.xml"); - editor.waitTabIsNotPresent("web.xml"); - - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE1); - - // select package2 for deletion - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE2); - deletePackage(PATH_TO_PACKAGE2, DELETE_TEXT2); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - editor.waitTabIsNotPresent("index.jsp"); - - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE2); - - // select package3 for deletion - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE3); - deletePackage(PATH_TO_PACKAGE3, DELETE_TEXT3); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - editor.waitTabIsNotPresent("AppController"); - - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE3); - } - - /** - * delete package for menu File - * - * @param expectedMessage warning message about delete package - */ - private void deletePackage(String pathToPackage, String expectedMessage) { - projectExplorer.openContextMenuByPathSelectedItem(pathToPackage); - projectExplorer.clickOnNewContextMenuItem(DELETE); - - askDialog.waitFormToOpen(); - askDialog.containsText(expectedMessage); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - } - - private void openItemByPath(String path) { - projectExplorer.openItemByPath(path); - editor.waitActive(); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageTest.java deleted file mode 100644 index 8b3cadf9a57..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class DeletePackageTest { - - private static final String PROJECT_NAME = "DeletionPrj2"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_TO_WEB_INF = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String DELETE_TEXT1 = "Delete folder \"WEB-INF\"?"; - private static final String DELETE_TEXT2 = "Delete folder \"webapp\"?"; - private static final String DELETE_TEXT3 = "Delete folder \"examples\"?"; - private static final String PATH_TO_PACKAGE1 = PROJECT_NAME + "/src/main/webapp/WEB-INF"; - private static final String PATH_TO_PACKAGE2 = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_PACKAGE3 = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - } - - @Test - public void deletePackageTest() throws Exception { - projectExplorer.openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - editor.waitActive(); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - - projectExplorer.waitItem(PATH_TO_WEB_INF + "/spring-servlet.xml"); - projectExplorer.openItemByPath(PATH_TO_WEB_INF + "/spring-servlet.xml"); - projectExplorer.waitItem(PATH_TO_WEB_INF + "/web.xml"); - projectExplorer.openItemByPath(PATH_TO_WEB_INF + "/web.xml"); - - loader.waitOnClosed(); - // select package1 for deletion - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE1); - deletePackage(DELETE_TEXT1); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - editor.waitTabIsNotPresent("spring-servlet.xml"); - editor.waitTabIsNotPresent("web.xml"); - - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE1, ELEMENT_TIMEOUT_SEC); - - // select package2 for deletion - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE2); - deletePackage(DELETE_TEXT2); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - - editor.waitTabIsNotPresent("index.jsp"); - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE2, ELEMENT_TIMEOUT_SEC); - - // select package3 for deletion - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE3); - deletePackage(DELETE_TEXT3); - loader.waitOnClosed(); - // check that files from deleted package was closed in editor - editor.waitTabIsNotPresent("AppController"); - - // check that package disappeared in editor - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_PACKAGE3, ELEMENT_TIMEOUT_SEC); - } - - /** - * delete package for menu File - * - * @param expectedMessage warning message about delete package - */ - private void deletePackage(String expectedMessage) { - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - askDialog.waitFormToOpen(); - askDialog.containsText(expectedMessage); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageWithOpenedFilesTabTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageWithOpenedFilesTabTest.java deleted file mode 100644 index 6bd5e7e80fc..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeletePackageWithOpenedFilesTabTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andery Chizhikov - */ -public class DeletePackageWithOpenedFilesTabTest { - private static final String PROJECT_NAME = - DeletePackageWithOpenedFilesTabTest.class.getSimpleName(); - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_PACKAGE1 = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String PATH_TO_PACKAGE2 = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_PACKAGE3 = PROJECT_NAME + "/src/main/java/com/example"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void deletePackageTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - // active tab is first tab - - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - openFile("LessFile.less"); - openFile("sqlFile.sql"); - openFile("another"); - editor.waitActive(); - editor.selectTabByName("AppController"); - - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE1); - deletePackage(); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE1); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE1 + "/AppController.java"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE1 + "/LessFile.less"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE1 + "/sqlFile.sql"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE1 + "/another"); - - // active tab is middle tab - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - openFile("spring-servlet.xml"); - openFile("web.xml"); - openFile("guess_num.jsp"); - openFile("htmlFile.html"); - editor.waitActive(); - editor.selectTabByName("web.xml"); - - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE2); - deletePackage(); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2 + "/index.jsp"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2 + "/spring-servlet.xml"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2 + "/web.xml"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2 + "/guess_num.jsp"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE2 + "/htmlFile.html"); - - // active tab is last tab - openJavaFile(PATH_TO_PACKAGE3 + "/Test1.java", "Test1"); - openJavaFile(PATH_TO_PACKAGE3 + "/Test2.java", "Test2"); - openJavaFile(PATH_TO_PACKAGE3 + "/Test3.java", "Test3"); - openJavaFile(PATH_TO_PACKAGE3 + "/Test4.java", "Test4"); - - projectExplorer.waitAndSelectItem(PATH_TO_PACKAGE3); - deletePackage(); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE3); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE3 + "/Test1.java"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE3 + "/Test2.java"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE3 + "/Test3.java"); - projectExplorer.waitRemoveItemsByPath(PATH_TO_PACKAGE3 + "/Test4.java"); - } - - /** delete package for menu File */ - private void deletePackage() { - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - } - - private void openFile(String fileName) { - projectExplorer.openItemByVisibleNameInExplorer(fileName); - editor.waitTabIsPresent(fileName); - editor.waitActive(); - } - - private void openJavaFile(String path, String fileName) { - projectExplorer.openItemByPath(path); - try { - editor.waitTabIsPresent(fileName); - } catch (TimeoutException ex) { - projectExplorer.openItemByPath(path); - editor.waitTabIsPresent(fileName); - } - - editor.waitActive(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteProjectsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteProjectsTest.java deleted file mode 100644 index 6583ab11bdc..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DeleteProjectsTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.DELETE; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.IdeMainDockPanel; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Anderey Chizhikov - */ -public class DeleteProjectsTest { - - private static final List PROJECT_NAMES = - Arrays.asList( - "DeleteProjectTest1", - "DeleteProjectTest2", - "DeleteProjectTest3", - "DeleteProjectTest4", - "DeleteProjectTest5"); - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private Consoles consoles; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private Loader loader; - @Inject private IdeMainDockPanel ideMainDockPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - for (String projectName : PROJECT_NAMES) { - URL resource = getClass().getResource("/projects/ProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - projectName, - ProjectTemplates.MAVEN_SPRING); - } - ide.open(workspace); - projectExplorer.waitProjectExplorer(); - waitAllProjectsInProjectExplorer(); - loader.waitOnClosed(); - consoles.selectProcessByTabName("dev-machine"); - consoles.waitJDTLSProjectResolveFinishedMessage( - PROJECT_NAMES.get(0), - PROJECT_NAMES.get(1), - PROJECT_NAMES.get(2), - PROJECT_NAMES.get(3), - PROJECT_NAMES.get(4)); - } - - @BeforeMethod - public void clearTerminalOutput() { - if (askDialog.isOpened()) { - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - loader.waitOnClosed(); - } - consoles.clickOnClearOutputButton(); - consoles.waitEmptyConsole(ELEMENT_TIMEOUT_SEC); - } - - @Test - public void shouldDeleteProjectByContextMenu() { - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAMES.get(0)); - projectExplorer.clickOnItemInContextMenu(DELETE); - acceptDeletion(PROJECT_NAMES.get(0)); - } - - @Test - public void shouldDeleteProjectByMenuFile() { - projectExplorer.waitItem(PROJECT_NAMES.get(1)); - projectExplorer.waitAndSelectItem(PROJECT_NAMES.get(1)); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - acceptDeletion(PROJECT_NAMES.get(1)); - } - - @Test - public void shouldDeleteOpenedProjectByMenuFile() { - projectExplorer.waitItem(PROJECT_NAMES.get(3)); - projectExplorer.openItemByPath(PROJECT_NAMES.get(3)); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAMES.get(3)); - projectExplorer.waitAndSelectItem(PROJECT_NAMES.get(3)); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - acceptDeletion(PROJECT_NAMES.get(3)); - projectExplorer.waitDisappearItemByPath(PROJECT_NAMES.get(3)); - } - - @Test - public void shouldDeleteOpenedProjectFromContextMenu() { - projectExplorer.waitItem(PROJECT_NAMES.get(4)); - projectExplorer.openItemByPath(PROJECT_NAMES.get(4)); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAMES.get(4)); - projectExplorer.waitAndSelectItem(PROJECT_NAMES.get(4)); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAMES.get(4)); - projectExplorer.clickOnItemInContextMenu(DELETE); - acceptDeletion(PROJECT_NAMES.get(4)); - projectExplorer.waitDisappearItemByPath(PROJECT_NAMES.get(4)); - } - - private void deleteFromDeleteIcon(String pathToProject) { - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(pathToProject); - ideMainDockPanel.clickDeleteIcon(); - loader.waitOnClosed(); - } - - private void acceptDeletion(String projectName) { - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - loader.waitOnClosed(); - projectExplorer.waitDisappearItemByPath(projectName); - } - - private void waitAllProjectsInProjectExplorer() { - PROJECT_NAMES.forEach((String projectName) -> projectExplorer.waitItem(projectName)); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DownloadProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DownloadProjectTest.java deleted file mode 100644 index 78fcac0c824..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/DownloadProjectTest.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static java.util.Arrays.asList; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.DOWNLOAD_AS_ZIP; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; -import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.io.IOException; -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; -import java.util.stream.Collectors; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems; -import org.eclipse.che.selenium.core.constant.TestTimeoutsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.DownloadedFileUtil; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -public class DownloadProjectTest { - private static final String TEST_PROJECT_1 = "TestProject1"; - private static final String TEST_PROJECT_2 = "TestProject2"; - private static final String TEST_FILE_NAME = "README.md"; - private static final String TEST_DIRECTORY_NAME = "src"; - - private static final int MAX_ATTEMPTS = 5; - - private static final URL PROJECT_1_SOURCES = - DownloadProjectTest.class.getResource("/projects/ProjectWithDifferentTypeOfFiles"); - private static final URL PROJECT_2_SOURCES = - DownloadProjectTest.class.getResource("/projects/ProjectWithDifferentTypeOfFiles2"); - - private static final String DOWNLOADED_PROJECTS_PACKAGE_NAME = "download.zip"; - private static final String DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME = TEST_PROJECT_1 + ".zip"; - private static final String DOWNLOADED_TEST_DIRECTORY_PACKAGE_NAME = TEST_DIRECTORY_NAME + ".zip"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private DownloadedFileUtil downloadedFileUtil; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private DefaultTestUser user; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(PROJECT_1_SOURCES.toURI()), - TEST_PROJECT_1, - ProjectTemplates.MAVEN_SPRING); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(PROJECT_2_SOURCES.toURI()), - TEST_PROJECT_2, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(TEST_PROJECT_1, TEST_PROJECT_2); - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - } - - @BeforeMethod - public void cleanUpDownloads() throws IOException { - downloadedFileUtil.removeDownloadedFiles( - seleniumWebDriver, - DOWNLOADED_PROJECTS_PACKAGE_NAME, - DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME, - DOWNLOADED_TEST_DIRECTORY_PACKAGE_NAME, - TEST_FILE_NAME); - } - - @Test - public void downloadAllProjectsTest() throws IOException { - // given - List expectedPackageFileList = - asList( - "TestProject1/.classpath", - "TestProject1/.project", - "TestProject1/.settings/org.eclipse.jdt.apt.core.prefs", - "TestProject1/.settings/org.eclipse.jdt.core.prefs", - "TestProject1/.settings/org.eclipse.m2e.core.prefs", - "TestProject1/README.md", - "TestProject1/pom.xml", - "TestProject1/src/main/java/org/eclipse/qa/examples/AppController.java", - "TestProject1/src/main/webapp/WEB-INF/jsp/guess_num.jsp", - "TestProject1/src/main/webapp/WEB-INF/spring-servlet.xml", - "TestProject1/src/main/webapp/WEB-INF/web.xml", - "TestProject1/src/main/webapp/index.jsp", - "TestProject2/.classpath", - "TestProject2/.project", - "TestProject2/.settings/org.eclipse.jdt.apt.core.prefs", - "TestProject2/.settings/org.eclipse.jdt.core.prefs", - "TestProject2/.settings/org.eclipse.m2e.core.prefs", - "TestProject2/pom.xml", - "TestProject2/src/main/java/org/eclipse/qa/examples/AppController.java", - "TestProject2/src/main/webapp/WEB-INF/jsp/hello_view.jsp", - "TestProject2/src/main/webapp/WEB-INF/spring-servlet.xml", - "TestProject2/src/main/webapp/WEB-INF/web.xml", - "TestProject2/src/main/webapp/index.jsp"); - - // when - menu.runCommand(WORKSPACE, DOWNLOAD_AS_ZIP); - - // then - assertEquals(getPackageFileList(DOWNLOADED_PROJECTS_PACKAGE_NAME), expectedPackageFileList); - } - - @Test - public void downloadSingleProjectTest() throws IOException { - // given - List expectedPackageFileList = - asList( - ".classpath", - ".project", - ".settings/org.eclipse.jdt.apt.core.prefs", - ".settings/org.eclipse.jdt.core.prefs", - ".settings/org.eclipse.m2e.core.prefs", - "README.md", - "pom.xml", - "src/main/java/org/eclipse/qa/examples/AppController.java", - "src/main/webapp/WEB-INF/jsp/guess_num.jsp", - "src/main/webapp/WEB-INF/spring-servlet.xml", - "src/main/webapp/WEB-INF/web.xml", - "src/main/webapp/index.jsp"); - - projectExplorer.waitAndSelectItem(TEST_PROJECT_1); - - // when - projectExplorer.openContextMenuByPathSelectedItem(TEST_PROJECT_1); - projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.DOWNLOAD); - - // then - assertEquals( - getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList); - - // when - downloadedFileUtil.removeDownloadedFiles( - seleniumWebDriver, DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME); - - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.DOWNLOAD_AS_ZIP); - - // then - assertEquals( - getPackageFileList(DOWNLOADED_TEST_PROJECT_1_PACKAGE_NAME), expectedPackageFileList); - } - - @Test - public void downloadDirectoryTest() throws IOException { - // given - String pathToTestDirectory = "TestProject1/" + TEST_DIRECTORY_NAME; - List expectedPackageFileList = - asList( - "main/java/org/eclipse/qa/examples/AppController.java", - "main/webapp/WEB-INF/jsp/guess_num.jsp", - "main/webapp/WEB-INF/spring-servlet.xml", - "main/webapp/WEB-INF/web.xml", - "main/webapp/index.jsp"); - - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem(pathToTestDirectory); - - // when - projectExplorer.openContextMenuByPathSelectedItem(pathToTestDirectory); - projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.DOWNLOAD); - - // then - assertEquals( - getPackageFileList(DOWNLOADED_TEST_DIRECTORY_PACKAGE_NAME), expectedPackageFileList); - } - - @Test - public void downloadFileTest() throws IOException { - // given - String pathToTestFile = "TestProject1/" + TEST_FILE_NAME; - String testFileContent = "Developer Workspace"; - - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem(pathToTestFile); - - // when - projectExplorer.openContextMenuByPathSelectedItem(pathToTestFile); - projectExplorer.clickOnItemInContextMenu(ContextMenuFirstLevelItems.DOWNLOAD); - - // then - String downloadedFileContent = getDownloadedFileContent(TEST_FILE_NAME); - assertEquals(downloadedFileContent, testFileContent); - } - - private String getDownloadedFileContent(String testFileName) throws IOException { - IOException lastException = null; - for (int i = 0; i < MAX_ATTEMPTS; i++) { - try { - return downloadedFileUtil.getDownloadedFileContent(seleniumWebDriver, testFileName); - } catch (IOException e) { - lastException = e; - sleepQuietly(TestTimeoutsConstants.MINIMUM_SEC); - } - } - - throw lastException; - } - - private List getPackageFileList(String downloadedTestProject1PackageName) - throws IOException { - IOException lastException = null; - for (int i = 0; i < MAX_ATTEMPTS; i++) { - try { - return downloadedFileUtil - .getPackageFileList(seleniumWebDriver, downloadedTestProject1PackageName) - .stream() - // target && .che directories appears asynchronously and leads to failed tests - .filter(s -> !s.contains("target/") && !s.startsWith(".che")) - .collect(Collectors.toList()); - } catch (IOException e) { - lastException = e; - sleepQuietly(TestTimeoutsConstants.MINIMUM_SEC); - } - } - - throw lastException; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileNotExistIntoEditorAfterDeleteTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileNotExistIntoEditorAfterDeleteTest.java deleted file mode 100644 index f9641f786d6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileNotExistIntoEditorAfterDeleteTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class FileNotExistIntoEditorAfterDeleteTest { - - private static final String PROJECT_NAME = "FileNotExistIntoEditorAfterDelete"; - private static final String EXPECTED_TEXT_1 = - "<%\n" + " response.sendRedirect(\"spring/guess\");\n" + "%>"; - private static final String PATH_TO_JSP_FILE = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String PATH_TO_JAVA_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String EXPECTED_TEXT_2 = - "package org.eclipse.qa.examples;\n" - + "\n" - + "import java.util.Random;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\";\n" - + " \n" - + " if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view;\n" - + " }\n" - + "}\n"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskDialog askDialog; - @Inject private Menu menu; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void fileNotExitInEditorAfterDeleting() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - - // open .java file, get text from there and compare with expected text - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByVisibleNameInExplorer("AppController.java"); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTextIntoEditor(EXPECTED_TEXT_2); - - projectExplorer.waitAndSelectItem(PATH_TO_JAVA_FILE); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - - loader.waitOnClosed(); - askDialog.waitFormToOpen(); - - loader.waitOnClosed(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - - editor.waitWhileFileIsClosed("AppController.java"); - - // open .jsp file, get text from there and compare with expected text - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByVisibleNameInExplorer("index.jsp"); - - loader.waitOnClosed(); - editor.waitTextIntoEditor(EXPECTED_TEXT_1); - - projectExplorer.waitItem(PATH_TO_JSP_FILE); - projectExplorer.openItemByPath(PATH_TO_JSP_FILE); - projectExplorer.waitAndSelectItem(PATH_TO_JSP_FILE); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - loader.waitOnClosed(); - - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - - editor.waitWhileFileIsClosed("index"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileOpenedAfterCreationTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileOpenedAfterCreationTest.java deleted file mode 100644 index b993ccc5473..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/FileOpenedAfterCreationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class FileOpenedAfterCreationTest { - - private static final String PROJECT_NAME = "TestFileOpenedAfterCreation"; - private static final String EXPECTED_TEXT_1 = - "package org.eclipse.qa.examples;\n" + "\n" + "public class TestClass {\n" + "}\n"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Menu menu; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void fileOpenedSuccessTest() throws Exception { - // open .html file, get text from there and compare with expected text - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - notificationsPopupPanel.waitProgressPopupPanelClose(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItemByName("webapp"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.HTML_FILE); - loader.waitOnClosed(); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("index"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - - // open .java file, get text from there and compare with expected text - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.JAVA_CLASS); - loader.waitOnClosed(); - askForValueDialog.typeTextInFieldName("TestClass"); - askForValueDialog.clickOkBtnNewJavaClass(); - editor.waitActiveTabFileName("TestClass"); - editor.waitActive(); - loader.waitOnClosed(); - editor.waitTextIntoEditor(EXPECTED_TEXT_1); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/JustCreatedFileNotExistIntoEditorAfterDeleteTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/JustCreatedFileNotExistIntoEditorAfterDeleteTest.java deleted file mode 100644 index 68619d49f84..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/JustCreatedFileNotExistIntoEditorAfterDeleteTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class JustCreatedFileNotExistIntoEditorAfterDeleteTest { - - private static final String PROJECT_NAME = "DeletionPrj4"; - private static final String PATH_TO_FILE = PROJECT_NAME + "/src/main/webapp/fileForeTest.jsp"; - private static final String DELETE_TEXT = "Delete file \"fileForeTest.jsp\"?"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private AskDialog askDialog; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void deleteFileTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItemByName("webapp"); - loader.waitOnClosed(); - - // create new file - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FILE); - - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("fileForeTest.jsp"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.openItemByVisibleNameInExplorer("fileForeTest.jsp"); - loader.waitOnClosed(); - editor.waitTabIsPresent("fileForeTest.jsp"); - - // delete new file - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/webapp/fileForeTest.jsp"); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.DELETE); - - askDialog.waitFormToOpen(); - askDialog.containsText(DELETE_TEXT); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitDisappearItemByPath(PATH_TO_FILE); - - editor.waitTabIsNotPresent("fileForeTest.jsp"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/NavigationByKeyboardTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/NavigationByKeyboardTest.java deleted file mode 100644 index c428d95d181..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/NavigationByKeyboardTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author mmusienko - * @author Andrey Chizhikov - */ -public class NavigationByKeyboardTest { - - private static final String PROJECT_NAME = NavigationByKeyboardTest.class.getSimpleName(); - - private String nameFirstModule = "External Libraries"; - private String nameSecondModule = "org.eclipse.qa.examples"; - private final String PATH_TO_SECOND_MODULE = - PROJECT_NAME + "/src/main/java/" + nameSecondModule.replace('.', '/'); - private final String EXPECTED_TEXT_IN_JAVA_FILE = - "package org.eclipse.qa.examples;\n" - + "\n" - + "import java.util.Random;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\";\n" - + " \n" - + " if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view;\n" - + " }\n" - + "}\n"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - } - - @Test - public void navigationByKeyboard() throws Exception { - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.waitVisibleItem(PROJECT_NAME + "/src"); - - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/src"); - - projectExplorer.sendToItemEnterKey(); - projectExplorer.waitVisibilityByName("main"); - projectExplorer.waitVisibilityByName("test"); - - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/src/main"); - - projectExplorer.sendToItemRightArrowKey(); - projectExplorer.waitVisibilityByName("java"); - projectExplorer.waitVisibilityByName("webapp"); - - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.waitItemIsSelected(PROJECT_NAME + "/src/main/java"); - - projectExplorer.sendToItemEnterKey(); - projectExplorer.waitVisibilityByName(nameSecondModule); - projectExplorer.waitVisibilityByName("com.example"); - - projectExplorer.waitAndSelectItem(PATH_TO_SECOND_MODULE); - projectExplorer.waitItemIsSelected(PATH_TO_SECOND_MODULE); - - projectExplorer.sendToItemRightArrowKey(); - checkItemsOfTheSecondModuleIsVisible(); - - projectExplorer.sendToItemLeftArrowKey(); - checkItemsOfTheSecondModuleIsNotVisible(); - - projectExplorer.sendToItemEnterKey(); - checkItemsOfTheSecondModuleIsVisible(); - - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.waitItemIsSelected(PATH_TO_SECOND_MODULE + "/AppController.java"); - - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(EXPECTED_TEXT_IN_JAVA_FILE); - - projectExplorer.waitAndSelectItemByName(nameFirstModule); - projectExplorer.sendToItemEnterKey(); - checkLibrariesIsVisible(); - - projectExplorer.sendToItemLeftArrowKey(); - checkLibrariesIsNotVisible(); - - projectExplorer.sendToItemRightArrowKey(); - checkLibrariesIsVisible(); - projectExplorer.waitAndSelectItemByName("servlet-api-2.5.jar"); - - projectExplorer.sendToItemEnterKey(); - projectExplorer.waitVisibilityByName("META-INF"); - projectExplorer.waitVisibilityByName("javax.servlet"); - - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemRightArrowKey(); - projectExplorer.waitVisibilityByName("MANIFEST.MF"); - projectExplorer.waitAndSelectItemByName(nameFirstModule); - - projectExplorer.sendToItemEnterKey(); - checkServletInnerFilesIsNotVisible(); - checkLibrariesIsNotVisible(); - - projectExplorer.sendToItemEnterKey(); - checkLibrariesIsVisible(); - checkServletInnerFilesIsNotVisible(); - } - - private void checkItemsOfTheSecondModuleIsNotVisible() { - String modulePath = nameSecondModule.replace('.', '/'); - projectExplorer.waitItemIsNotPresentVisibleArea( - PROJECT_NAME + "/src/main/java/" + modulePath + "/AppController.java"); - projectExplorer.waitItemIsNotPresentVisibleArea( - PROJECT_NAME + "/src/main/java/" + modulePath + "/LessFile.less"); - projectExplorer.waitItemIsNotPresentVisibleArea( - PROJECT_NAME + "/src/main/java/" + modulePath + "/another"); - projectExplorer.waitItemIsNotPresentVisibleArea( - PROJECT_NAME + "/src/main/java/" + modulePath + "/sqlFile.sql"); - } - - private void checkItemsOfTheSecondModuleIsVisible() { - String modulePath = nameSecondModule.replace('.', '/'); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/" + modulePath + "/AppController.java"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/" + modulePath + "/LessFile.less"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/" + modulePath + "/another"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/" + modulePath + "/sqlFile.sql"); - } - - private void checkLibrariesIsVisible() { - projectExplorer.waitVisibilityByName("servlet-api-2.5.jar"); - projectExplorer.waitVisibilityByName("spring-asm-3.0.5.RELEASE.jar"); - projectExplorer.waitVisibilityByName("spring-beans-3.0.5.RELEASE.jar"); - projectExplorer.waitVisibilityByName("junit-4.12.jar"); - } - - private void checkLibrariesIsNotVisible() { - projectExplorer.waitItemIsNotPresentVisibleArea("servlet-api-2.5.jar"); - projectExplorer.waitItemIsNotPresentVisibleArea("spring-asm-3.0.5.RELEASE.jar"); - projectExplorer.waitItemIsNotPresentVisibleArea("spring-beans-3.0.5.RELEASE.jar"); - projectExplorer.waitItemIsNotPresentVisibleArea("junit-4.12.jar"); - } - - private void checkServletInnerFilesIsNotVisible() { - projectExplorer.waitItemIsNotPresentVisibleArea("META-INF"); - projectExplorer.waitItemIsNotPresentVisibleArea("javax.servlet"); - projectExplorer.waitItemIsNotPresentVisibleArea("MANIFEST.MF"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/OpenFileWithHelpContextMenuTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/OpenFileWithHelpContextMenuTest.java deleted file mode 100644 index 720f8052e2b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/OpenFileWithHelpContextMenuTest.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.EDIT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Alexander Andrienko - * @author Andrey Chizhikov - */ -public class OpenFileWithHelpContextMenuTest { - - private static final String PROJECT_NAME = OpenFileWithHelpContextMenuTest.class.getSimpleName(); - private static final String NAME_JSP = "index.jsp"; - private static final String NAME_LESS = "LessFile.less"; - private static final String NAME_CSS = "cssFile.css"; - private static final String NAME_XML = "web.xml"; - private static final String NAME_HTML = "htmlFile.html"; - private static final String NAME_JAVA_CLASS = "AppController"; - private static final String NAME_FILE = "another"; - private static final String NAME_SQL = "sqlFile.sql"; - private static final String PATH_TO_JSP = PROJECT_NAME + "/src/main/webapp/index.jsp"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_LESS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/LessFile.less"; - private static final String PATH_TO_CSS = PROJECT_NAME + "/src/main/webapp/WEB-INF/cssFile.css"; - private static final String PATH_TO_XML = PROJECT_NAME + "/src/main/webapp/WEB-INF/web.xml"; - private static final String PATH_TO_HTML = - PROJECT_NAME + "/src/main/webapp/WEB-INF/htmlFile.html"; - private static final String PATH_TO_JAVA_CLASS = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_TO_SIMPLE_FILE = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/another"; - private static final String PATH_TO_SQL = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/sqlFile.sql"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"; - private static final String JSP_TEXT = - "<%\n" + " response.sendRedirect(\"spring/guess\");\n" + "\n" + "%>"; - private static final String CSS_TEST = - "@CHARSET \"UTF-8\";\n" - + "h1 {\n" - + " font-size:180%;\n" - + "}\n" - + "\n" - + "h2 {\n" - + " font-size:190%;\n" - + "}\n" - + "\n" - + "p {\n" - + " font-size:110%;\n" - + "}"; - - private static final String LESS_TEXT = "@CHARSET \"UTF-8\"\n" + ";"; - private static final String XML_TEXT = - "\n" - + "\n" - + "\n" - + " Spring Web Application\n" - + " \n" - + " spring\n" - + " org.springframework.web.servlet.DispatcherServlet\n" - + " 1\n" - + " \n" - + " \n" - + " spring\n" - + " /spring/*\n" - + " \n" - + "\n"; - private static final String HTML_TEXT = - "\n" - + "\n" - + "\n" - + " \n" - + " Title\n" - + "\n" - + "\n" - + "\n" - + "\n" - + ""; - private static final String APP_CONTROLLER_TEXT = - "package org.eclipse.qa.examples;\n" - + "\n" - + "import java.util.Random;\n" - + "\n" - + "import org.springframework.web.servlet.ModelAndView;\n" - + "import org.springframework.web.servlet.mvc.Controller;\n" - + "\n" - + "import javax.servlet.http.HttpServletRequest;\n" - + "import javax.servlet.http.HttpServletResponse;\n" - + "\n" - + "public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + "\n" - + " @Override\n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\";\n" - + " \n" - + " if (numGuessByUser != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " }\n" - + "\n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view;\n" - + " }\n" - + "}\n"; - private static final String ANOTHER_FILE_TEXT = - "testExample1\n" - + "testExample2\n" - + "testExample3\n" - + "testExample4\n" - + "testExample5\n" - + "testExample6\n" - + "testExample7\n" - + "testExample8\n" - + "testExample9\n" - + "testExample10\n" - + "testExample11"; - private static final String SQL_TEXT = - "Select * From Car Where Car.id > 100 and Car.speed < 180\n" - + "Select * From Car Where Car.id > 100 and Car.speed < 190\n" - + "Select * From Car Where Car.id > 100 and Car.speed < 210\n" - + "\n" - + "\n" - + "\n" - + "Select * From Car Where Car.id > 200 and Car.speed < 300"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/defaultSpringProjectWithDifferentTypeOfFiles"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void openFileTest() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - notificationsPopupPanel.waitProgressPopupPanelClose(); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_FOR_EXPAND + "/AppController.java"); - editor.waitActive(); - editor.closeFileByNameWithSaving("AppController"); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - editor.closeFileByNameWithSaving("index.jsp"); - - openFileFromContextMenu(PATH_TO_JAVA_CLASS, NAME_JAVA_CLASS, APP_CONTROLLER_TEXT); - - openFileFromContextMenu(PATH_TO_JSP, NAME_JSP, JSP_TEXT); - - openFileFromContextMenu(PATH_TO_CSS, NAME_CSS, CSS_TEST); - - openFileFromContextMenu(PATH_TO_XML, NAME_XML, XML_TEXT); - - openFileFromContextMenu(PATH_TO_LESS, NAME_LESS, LESS_TEXT); - - openFileFromContextMenu(PATH_TO_HTML, NAME_HTML, HTML_TEXT); - - openFileFromContextMenu(PATH_TO_SIMPLE_FILE, NAME_FILE, ANOTHER_FILE_TEXT); - - openFileFromContextMenu(PATH_TO_SQL, NAME_SQL, SQL_TEXT); - } - - private void openFileFromContextMenu(String pathToFile, String fileName, String expectedContent) { - - loader.waitOnClosed(); - projectExplorer.waitItem(pathToFile); - projectExplorer.openContextMenuByPathSelectedItem(pathToFile); - projectExplorer.clickOnNewContextMenuItem(EDIT); - loader.waitOnClosed(); - editor.waitTabIsPresent(fileName); - loader.waitOnClosed(); - editor.waitActive(); - editor.waitTextIntoEditor(expectedContent); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/PreviewHtmlFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/PreviewHtmlFileTest.java deleted file mode 100644 index 4a90c422495..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/PreviewHtmlFileTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.PREVIEW; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.LOADER_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Random; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.By; -import org.openqa.selenium.Keys; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class PreviewHtmlFileTest { - private static final String PROJECT_NAME = "PreviewHtmlFile" + new Random().nextInt(999); - private static final String H2_CONTENT = "

Test content

"; - private static final String BODY_CONTENT = " Content of file"; - private String currentWindow; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Loader loader; - @Inject private Consoles consoles; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/console-java-with-html-file"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkPreviewHtmlFile() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - currentWindow = seleniumWebDriver.getWindowHandle(); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/file.html"); - projectExplorer.clickOnItemInContextMenu(PREVIEW); - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - checkWebElementsHtmlFile("//h1[text()='Hello, this is check!']"); - seleniumWebDriver.close(); - seleniumWebDriver.switchTo().window(currentWindow); - - // type a content into editor and check it by preview feature - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME + "/file.html"); - projectExplorer.openItemByPath(PROJECT_NAME + "/file.html"); - editor.waitActive(); - editor.setCursorToLine(19); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ARROW_UP.toString()); - editor.typeTextIntoEditor(H2_CONTENT); - editor.waitTextIntoEditor(H2_CONTENT); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/file.html"); - projectExplorer.clickOnItemInContextMenu(PREVIEW); - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - checkWebElementsHtmlFile("//h2[@style='color:red' and text()='Test content']"); - seleniumWebDriver.switchTo().window(currentWindow); - editor.setCursorToLine(19); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.typeTextIntoEditor(Keys.ARROW_UP.toString()); - editor.typeTextIntoEditor(BODY_CONTENT); - editor.waitTextIntoEditor(BODY_CONTENT); - seleniumWebDriverHelper.switchToNextWindow(currentWindow); - loader.waitOnClosed(); - checkWebElementsHtmlFile("//h2[@style='color:red' and text()='Test content']"); - loader.waitOnClosed(); - seleniumWebDriver.navigate().refresh(); - checkWebElementsHtmlFile("//b[text()='Content of file']"); - } - - public void checkWebElementsHtmlFile(String locator) { - new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC) - .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameJustCreatedNotJavaFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameJustCreatedNotJavaFileTest.java deleted file mode 100644 index f7f2864daf3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameJustCreatedNotJavaFileTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class RenameJustCreatedNotJavaFileTest { - - private static final String PROJECT_NAME = "RenameProject2"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_FILE = PROJECT_NAME + "/src/main/webapp/newFile.jsp"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Menu menu; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void renameWhenFileIsOpenedIntoEditor() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_WEB_APP + "/index.jsp"); - editor.waitActive(); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/webapp"); - - // create new jsp file - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FILE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText("newFile.jsp"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName("newFile.jsp"); - editor.waitActive(); - editor.waitTabIsPresent("newFile.jsp"); - - // rename file - renameFile(PATH_TO_FILE); - } - - private void renameFile(String pathToFile) { - projectExplorer.waitAndSelectItem(pathToFile); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clearInput(); - askForValueDialog.typeAndWaitText("Renamed.jsp"); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - editor.waitTabIsPresent("Renamed.jsp"); - projectExplorer.waitVisibilityByName("Renamed.jsp"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameProjectTest.java deleted file mode 100644 index 036678551f3..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenameProjectTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.RENAME; -import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.PROJECT_FOLDER; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Edit; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -@Test(groups = UNDER_REPAIR) -public class RenameProjectTest { - private static final String PROJECT_NAME = generate("project", 5); - private static final String NEW_PROJECT_NAME = generate("new-project", 5); - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private AskForValueDialog askForValueDialog; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestWorkspace testWorkspace; - @Inject private Menu menu; - @Inject private Ide ide; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - // create project - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - // open workspace and wait LS initialization - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - } - - @Test - public void renameProjectTest() { - // Rename project from context menu - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clearInput(); - askForValueDialog.typeAndWaitText(NEW_PROJECT_NAME); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - - // Wait that project renamed and folder has project type - projectExplorer.waitItem(NEW_PROJECT_NAME); - - // For ensuring of #12000 bug checking, folder with old name does nor appear immediately - WaitUtils.sleepQuietly(20); - - try { - projectExplorer.waitItemInvisibility(PROJECT_NAME); - } catch (TimeoutException ex) { - fail("Known permanent issue: https://github.com/eclipse/che/issues/12000"); - } - projectExplorer.waitDefinedTypeOfFolder(NEW_PROJECT_NAME, PROJECT_FOLDER); - - // Test that the Rename project dialog is started from menu - projectExplorer.waitAndSelectItem(NEW_PROJECT_NAME); - menu.runCommand(Edit.EDIT, Edit.RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - - // Test that the Rename project dialog is started by SHIFT + F6 keys - projectExplorer.waitAndSelectItem(NEW_PROJECT_NAME); - askForValueDialog.launchFindFormByKeyboard(); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clickCancelBtn(); - askForValueDialog.waitFormToClose(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenamedAlreadyCreatedNotJavaFileTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenamedAlreadyCreatedNotJavaFileTest.java deleted file mode 100644 index 47bd96c68b6..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/RenamedAlreadyCreatedNotJavaFileTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class RenamedAlreadyCreatedNotJavaFileTest { - - private static final String PROJECT_NAME = generate("RenameProject1", 4); - private static final String INDEX_FILE = "index.jsp"; - private static final String RENAMED_FILE = "Renamed.jsp"; - private static final String PATH_TO_WEB_APP = PROJECT_NAME + "/src/main/webapp"; - private static final String PATH_TO_FILE = PATH_TO_WEB_APP + "/" + INDEX_FILE; - private static final String PATH_TO_RENAMED_FILE = PATH_TO_WEB_APP + "/" + RENAMED_FILE; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private AskForValueDialog askForValueDialog; - @Inject private Menu menu; - @Inject private Loader loader; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void renameWhenFileIsOpenedIntoEditor() throws Exception { - // preparation - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - - // open file and check editor tab appears - projectExplorer.openItemByPath(PATH_TO_FILE); - editor.waitTabIsPresent(INDEX_FILE); - editor.waitTabSelection(0, INDEX_FILE); - editor.waitActive(); - - renameFile(PATH_TO_FILE); - - // check renaming - projectExplorer.waitItem(PATH_TO_RENAMED_FILE, ELEMENT_TIMEOUT_SEC); - editor.waitTabIsPresent(RENAMED_FILE); - } - - private void renameFile(String pathToFile) { - projectExplorer.waitAndSelectItem(pathToFile); - menu.runCommand(TestMenuCommandsConstants.Edit.EDIT, TestMenuCommandsConstants.Edit.RENAME); - askForValueDialog.waitFormToOpen(); - askForValueDialog.clearInput(); - askForValueDialog.typeAndWaitText(RENAMED_FILE); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ShowFileReferenceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ShowFileReferenceTest.java deleted file mode 100644 index 37befa2978d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/ShowFileReferenceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.SHOW_REFERENCES; - -import com.google.inject.Inject; -import java.io.IOException; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Random; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.ShowReference; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Dmitry Shnurenko */ -public class ShowFileReferenceTest { - private static final String PROJECT_NAME = - NavigationByKeyboardTest.class.getSimpleName() + new Random().nextInt(9999); - private static final String FILE_FQN = "org.eclipse.qa.examples.AppController"; - private static final String FILE_PATH = - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"; - private static final String PATH_FOR_EXPAND = - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private ShowReference showReference; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.expandPathInProjectExplorerAndOpenFile(PATH_FOR_EXPAND, "AppController.java"); - projectExplorer.openContextMenuByPathSelectedItem(FILE_PATH); - - projectExplorer.clickOnItemInContextMenu(SHOW_REFERENCES); - } - - @Test - public void dialogWithPathAndFqnShouldBeDisplayed() throws IOException { - showReference.checkFqnFieldValue(FILE_FQN); - showReference.checkPathFieldValue(FILE_PATH); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/UploadIntoProjectTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/UploadIntoProjectTest.java deleted file mode 100644 index 68938dcb76b..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/UploadIntoProjectTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer; - -import static java.lang.String.format; -import static java.nio.file.Paths.get; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.PROJECT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.UPLOAD_FILE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Project.UPLOAD_FOLDER; - -import com.google.inject.Inject; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Path; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Wizard; -import org.eclipse.che.selenium.pageobject.upload.UploadDirectoryDialogPage; -import org.eclipse.che.selenium.pageobject.upload.UploadFileDialogPage; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -public class UploadIntoProjectTest { - private static final String PROJECT_NAME = "TestProject"; - private static final URL PROJECT_SOURCES = - UploadIntoProjectTest.class.getResource("/projects/default-spring-project"); - private static final URL FOLDER_SOURCES = - UploadIntoProjectTest.class.getResource("/projects/git-pull-test"); - public static final String TEXT_TO_INSERT = NameGenerator.generate("", 10); - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Wizard projectWizard; - @Inject private Menu menu; - @Inject private Events eventsPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private UploadFileDialogPage uploadFileDialogPage; - @Inject private UploadDirectoryDialogPage uploadDirectoryDialogPage; - @Inject private NotificationsPopupPanel notificationPopup; - @Inject private CodenvyEditor editor; - @Inject private Consoles consoles; - - @BeforeClass - public void setup() throws Exception { - testProjectServiceClient.importProject( - testWorkspace.getId(), - get(PROJECT_SOURCES.toURI()), - PROJECT_NAME, - ProjectTemplates.PLAIN_JAVA); - - ide.open(testWorkspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitVisibleItem(PROJECT_NAME); - } - - @BeforeMethod - public void selectProjectItem() { - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - } - - @Test - public void shouldUploadFileWithDefaultOptions() throws URISyntaxException, IOException { - // given - final String uploadingFileName = "Aclass.java"; - final String uploadingTabTitle = "Aclass"; - final String pathToUploadingFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingFileName); - final Path localPathToFileToUpload = - get(PROJECT_SOURCES.getPath()) - .resolve("src/main/java/che/eclipse/sample") - .resolve(uploadingFileName); - - // open upload file window - openFormAndSelectUploadFile(localPathToFileToUpload); - uploadFileDialogPage.clickOnUploadButton(); - - // then - uploadFileDialogPage.waitOnClose(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage( - format("File '%s' has uploaded successfully", uploadingFileName)); - projectExplorer.waitVisibleItem(format("%s/%s", PROJECT_NAME, uploadingFileName)); - - // Check that uploading file doesn't overwrite existed one - // when change the file - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitEditorReadiness(uploadingTabTitle); - editor.typeTextIntoEditor(TEXT_TO_INSERT); - - // when re-upload the file - projectExplorer.waitAndSelectItem(PROJECT_NAME); - openFormAndSelectUploadFile(localPathToFileToUpload); - uploadFileDialogPage.clickOnUploadButton(); - - // then there is changes remained after uploading - uploadFileDialogPage.waitOnClose(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage( - format("File '%s' has uploaded successfully", uploadingFileName)); - projectExplorer.waitVisibleItem(pathToUploadingFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitTextIntoEditor(TEXT_TO_INSERT); - } - - @Test - public void shouldUploadFileWithOverwriting() throws IOException { - // given - final String uploadingFileName = "AppController.java"; - final String uploadingTabTitle = "AppController"; - final String pathToUploadingFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingFileName); - final Path localPathToFileToUpload = - get(PROJECT_SOURCES.getPath()) - .resolve("src/main/java/org/eclipse/qa/examples") - .resolve(uploadingFileName); - - // open upload file window - openFormAndSelectUploadFile(localPathToFileToUpload); - uploadFileDialogPage.clickOnUploadButton(); - - // then - uploadFileDialogPage.waitOnClose(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage( - format("File '%s' has uploaded successfully", uploadingFileName)); - projectExplorer.waitVisibleItem(format("%s/%s", PROJECT_NAME, uploadingFileName)); - - // Check that uploading file overwrites existed one - // when change the file - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitEditorReadiness(uploadingTabTitle); - editor.typeTextIntoEditor(TEXT_TO_INSERT); - - // when re-upload the file - projectExplorer.waitAndSelectItem(PROJECT_NAME); - openFormAndSelectUploadFile(localPathToFileToUpload); - - // then - uploadFileDialogPage.selectOverwriteIfFileExistsCheckbox(); - uploadFileDialogPage.clickOnUploadButton(); - - // then there are no changes remained after uploading - uploadFileDialogPage.waitOnClose(); - eventsPanel.clickEventLogBtn(); - eventsPanel.waitExpectedMessage(format("File '%s' is updated", uploadingFileName)); - projectExplorer.waitVisibleItem(pathToUploadingFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitTextNotPresentIntoEditor(TEXT_TO_INSERT); - } - - @Test - public void shouldUploadDirectoryWithDefaultOptions() throws IOException { - // given - final String uploadingFileName = "index.jsp"; - final String pathToUploadingFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingFileName); - final Path localPathToFolderToUpload = - get(PROJECT_SOURCES.getPath()).resolve("src/main/webapp"); - - // open upload directory window - openFormAndUploadFolder(localPathToFolderToUpload); - uploadDirectoryDialogPage.clickOnUploadButton(); - - // then - projectExplorer.quickRevealToItemWithJavaScript(pathToUploadingFileInsideTheProject); - projectExplorer.waitVisibleItem(pathToUploadingFileInsideTheProject); - - // Check that uploading directory doesn't overwrite existed one - // when change the directory - when change the file - projectExplorer.waitAndSelectItem(pathToUploadingFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitEditorReadiness(uploadingFileName); - editor.typeTextIntoEditor(TEXT_TO_INSERT); - - // when re-upload the directory - projectExplorer.waitAndSelectItem(PROJECT_NAME); - openFormAndUploadFolder(localPathToFolderToUpload); - uploadDirectoryDialogPage.clickOnUploadButton(); - - // then there is changes remained after uploading - uploadFileDialogPage.waitOnClose(); - projectExplorer.quickRevealToItemWithJavaScript( - get(pathToUploadingFileInsideTheProject).getParent().toString()); - projectExplorer.openItemByPath(pathToUploadingFileInsideTheProject); - editor.waitTextIntoEditor(TEXT_TO_INSERT); - } - - @Test - public void shouldUploadDirectoryWithOverwriting() throws IOException { - // given - final String uploadingHtmlFileName = "file.html"; - final String uploadingTextFileName = "readme-txt"; - final String uploadingTextFilePath = "plain-files/" + uploadingTextFileName; - final String pathToUploadingHtmlFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingHtmlFileName); - final String pathToUploadingTextFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingTextFilePath); - - final Path localPathToFolderToUpload = get(FOLDER_SOURCES.getPath()); - - // open upload directory window - openFormAndUploadFolder(localPathToFolderToUpload); - uploadDirectoryDialogPage.clickOnUploadButton(); - - // then - projectExplorer.quickRevealToItemWithJavaScript(pathToUploadingTextFileInsideTheProject); - projectExplorer.waitVisibleItem(pathToUploadingHtmlFileInsideTheProject); - projectExplorer.waitVisibleItem(pathToUploadingTextFileInsideTheProject); - - // Check that uploading directory overwrites existed one - // when change the directory - when change the files - projectExplorer.waitAndSelectItem(pathToUploadingHtmlFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingHtmlFileInsideTheProject); - editor.waitEditorReadiness(uploadingHtmlFileName); - editor.typeTextIntoEditor(TEXT_TO_INSERT); - - projectExplorer.waitAndSelectItem(pathToUploadingTextFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingTextFileInsideTheProject); - editor.waitEditorReadiness(uploadingTextFileName); - editor.typeTextIntoEditor(TEXT_TO_INSERT); - - // when re-upload the directory with overwriting - projectExplorer.waitAndSelectItem(PROJECT_NAME); - openFormAndUploadFolder(localPathToFolderToUpload); - - // then - uploadDirectoryDialogPage.selectOverwriteIfFileExistsCheckbox(); - uploadDirectoryDialogPage.clickOnUploadButton(); - - // then there are no changes remained after uploading - uploadFileDialogPage.waitOnClose(); - projectExplorer.quickRevealToItemWithJavaScript(pathToUploadingTextFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingTextFileInsideTheProject); - editor.waitTextNotPresentIntoEditor(TEXT_TO_INSERT); - projectExplorer.waitVisibleItem(pathToUploadingHtmlFileInsideTheProject); - projectExplorer.openItemByPath(pathToUploadingHtmlFileInsideTheProject); - editor.waitTextNotPresentIntoEditor(TEXT_TO_INSERT); - } - - @Test - public void shouldUploadDirectorySkippingRoot() throws IOException { - // given - final String uploadingFileName = "AppController.java"; - final String uploadingFilePath = "examples/" + uploadingFileName; - final String pathToUploadingFileInsideTheProject = - format("%s/%s", PROJECT_NAME, uploadingFilePath); - final Path localPathToFolderToUpload = - get(PROJECT_SOURCES.getPath()).resolve("src/main/java/org/eclipse"); - - // open upload directory window - openFormAndUploadFolder(localPathToFolderToUpload); - - // then - uploadDirectoryDialogPage.selectSkipRootFolderCheckbox(); - uploadDirectoryDialogPage.clickOnUploadButton(); - - // then - projectExplorer.quickRevealToItemWithJavaScript(pathToUploadingFileInsideTheProject); - projectExplorer.waitVisibleItem(pathToUploadingFileInsideTheProject); - } - - private void openFormAndSelectUploadFile(Path pathToUploadFile) throws IOException { - menu.runCommand(PROJECT, UPLOAD_FILE); - uploadFileDialogPage.waitOnOpen(); - uploadFileDialogPage.selectResourceToUpload(pathToUploadFile); - } - - private void openFormAndUploadFolder(Path pathToUploadFolder) throws IOException { - menu.runCommand(PROJECT, UPLOAD_FOLDER); - uploadDirectoryDialogPage.waitOnOpen(); - uploadDirectoryDialogPage.selectResourceToUpload(pathToUploadFolder); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/OpenExternalLibraryFileAfterRefreshTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/OpenExternalLibraryFileAfterRefreshTest.java deleted file mode 100644 index a879a86bb02..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/OpenExternalLibraryFileAfterRefreshTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer.dependencies; - -import static org.testng.AssertJUnit.assertTrue; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class OpenExternalLibraryFileAfterRefreshTest { - private static final String PROJECT_NAME = NameGenerator.generate("ExternalFileTest", 4); - private static final String CHECKING_FILE_NAME = "Filter"; - - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void shouldOpenTheSameFileAfterRefreshBrowser() { - // prepare - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - - // open file from external library and check displayed text in editor - projectExplorer.openItemByPath(PROJECT_NAME); - openFileFromExternalLibraryAndCheckDisplayedText(); - - seleniumWebDriver.navigate().refresh(); - - // check that after browser refresh it is still possible to open the same file - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - openFileFromExternalLibraryAndCheckDisplayedText(); - } - - private void openFileFromExternalLibraryAndCheckDisplayedText() { - projectExplorer.waitVisibilitySeveralItemsByName("README.md", "pom.xml", "External Libraries"); - - projectExplorer.openSeveralItemsByVisibleNameInExplorer( - "External Libraries", "servlet-api-2.5.jar", "javax.servlet", CHECKING_FILE_NAME); - - editor.waitActive(); - editor.waitTabIsPresent(CHECKING_FILE_NAME); - assertTrue(editor.getVisibleTextFromEditor().contains("package javax.servlet")); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/TransitiveDependencyTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/TransitiveDependencyTest.java deleted file mode 100644 index f87882a74d7..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/TransitiveDependencyTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer.dependencies; - -import static org.openqa.selenium.Keys.DELETE; -import static org.openqa.selenium.Keys.DOWN; -import static org.openqa.selenium.Keys.SHIFT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Random; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.PopupDialogsBrowser; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class TransitiveDependencyTest { - - private static final String PROJECT_NAME = - TransitiveDependencyTest.class.getSimpleName() + new Random().nextInt(10); - private static final String LIB_FOLDER = "External Libraries"; - private static final String MAIN_LIBRARY = "spring-webmvc-3.0.5.RELEASE.jar"; - private static final String TRANSITIVE_DEPENDENCY_FOR_MAIN_LIBRARY = - "spring-core-3.0.5.RELEASE.jar"; - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Loader loader; - @Inject private PopupDialogsBrowser popupDialogsBrowser; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - } - - @Test - public void transitiveDependencyTest() throws Exception { - projectExplorer.waitItem(PROJECT_NAME); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.openItemByPath(PROJECT_NAME); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/pom.xml"); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - editor.waitActive(); - - projectExplorer.openItemByVisibleNameInExplorer(LIB_FOLDER); - projectExplorer.waitLibraryIsPresent(MAIN_LIBRARY); - projectExplorer.waitLibraryIsPresent(TRANSITIVE_DEPENDENCY_FOR_MAIN_LIBRARY); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - loader.waitOnClosed(); - editor.waitActive(); - - deleteDependency(); - - popupDialogsBrowser.waitAlertClose(); - projectExplorer.waitLibraryIsNotPresent(MAIN_LIBRARY); - projectExplorer.waitLibraryIsNotPresent(TRANSITIVE_DEPENDENCY_FOR_MAIN_LIBRARY); - } - - private void deleteDependency() { - editor.waitActive(); - editor.setCursorToLine(34); - seleniumWebDriverHelper - .getAction() - .keyDown(SHIFT) - .sendKeys(DOWN, DOWN, DOWN, DOWN, DOWN) - .keyUp(SHIFT) - .sendKeys(DELETE) - .perform(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/UpdateListOfLibraryTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/UpdateListOfLibraryTest.java deleted file mode 100644 index a71f0b41554..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/projectexplorer/dependencies/UpdateListOfLibraryTest.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.projectexplorer.dependencies; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.MAVEN; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.REIMPORT; -import static org.openqa.selenium.Keys.DELETE; -import static org.openqa.selenium.Keys.DOWN; -import static org.openqa.selenium.Keys.SHIFT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.MavenPluginStatusBar; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * @author Andrienko Alexander - * @author Andrey Chizhikov - */ -public class UpdateListOfLibraryTest { - - private static final String PROJECT_NAME = UpdateListOfLibraryTest.class.getSimpleName(); - private static final String LIB_FOLDER = "External Libraries"; - private static final String MAVEN_DEPENDENCY_EXAMPLE = - "\n" - + "com.fasterxml.jackson.core\n" - + "jackson-core\n" - + "2.4.3\n" - + ""; - private static final List LIST_OF_LIBRARY = - Arrays.asList( - "rt.jar", - "sunjce_provider.jar", - "dnsns.jar", - "sunpkcs11.jar", - "sunec.jar", - "localedata.jar", - "zipfs.jar", - "spring-web-3.0.5.RELEASE.jar", - "aopalliance-1.0.jar", - "servlet-api-2.5.jar", - "spring-webmvc-3.0.5.RELEASE.jar", - "spring-expression-3.0.5.RELEASE.jar", - "spring-aop-3.0.5.RELEASE.jar", - "spring-context-3.0.5.RELEASE.jar", - "commons-logging-1.1.1.jar", - "spring-context-support-3.0.5.RELEASE.jar", - "commons-logging-1.1.1.jar", - "spring-context-support-3.0.5.RELEASE.jar", - "spring-core-3.0.5.RELEASE.jar", - "spring-beans-3.0.5.RELEASE.jar", - "spring-asm-3.0.5.RELEASE.jar", - "junit-4.12.jar"); - - @Inject private TestWorkspace testWorkspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Loader loader; - @Inject private MavenPluginStatusBar mavenPluginStatusBar; - @Inject private DefaultTestUser defaultTestUser; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private SeleniumWebDriverHelper seleniumWebDriverHelper; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - testWorkspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(testWorkspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkUpdateLibraryAfterChangingDependencyTest() throws Exception { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - - projectExplorer.expandPathInProjectExplorerAndOpenFile( - PROJECT_NAME + "/src/main/java/org.eclipse.qa.examples", "AppController.java"); - - projectExplorer.waitItem(PROJECT_NAME + "/pom.xml"); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - - mavenPluginStatusBar.waitClosingInfoPanel(); - checkLibraries(); - - loader.waitOnClosed(); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - loader.waitOnClosed(); - editor.waitActive(); - - addNewDependency(); - - mavenPluginStatusBar.waitClosingInfoPanel(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(MAVEN); - projectExplorer.clickOnItemInContextMenu(REIMPORT); - projectExplorer.waitLibraryIsPresent("jackson-core-2.4.3.jar"); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME + "/pom.xml"); - projectExplorer.openItemByPath(PROJECT_NAME + "/pom.xml"); - - deleteDependency(); - - mavenPluginStatusBar.waitClosingInfoPanel(); - projectExplorer.waitAndSelectItem(PROJECT_NAME); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); - projectExplorer.waitContextMenu(); - projectExplorer.clickOnItemInContextMenu(MAVEN); - projectExplorer.clickOnItemInContextMenu(REIMPORT); - projectExplorer.waitLibraryIsNotPresent("servlet-api-2.5.jar"); - } - - private void addNewDependency() { - editor.waitActive(); - loader.waitOnClosed(); - editor.setCursorToLine(44); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - - editor.typeTextIntoEditor(MAVEN_DEPENDENCY_EXAMPLE); - - editor.typeTextIntoEditor(Keys.SPACE.toString()); - } - - private void deleteDependency() { - editor.waitActive(); - editor.setCursorToLine(28); - seleniumWebDriverHelper - .getAction() - .keyDown(SHIFT) - .sendKeys(DOWN, DOWN, DOWN, DOWN, DOWN, DOWN) - .keyUp(SHIFT) - .sendKeys(DELETE) - .perform(); - } - - private void checkLibraries() { - projectExplorer.openItemByVisibleNameInExplorer(LIB_FOLDER); - LIST_OF_LIBRARY.forEach(projectExplorer::waitLibraryIsPresent); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailNotPrivateFieldTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailNotPrivateFieldTest.java deleted file mode 100644 index cf1edcee6da..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailNotPrivateFieldTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.fields; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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; - -/** @author Aleksandr Shmaraev on 16.11.15 */ -public class FailNotPrivateFieldTest { - private static final String PROJECT_NAME = - NameGenerator.generate("FailNotPrivateFieldProject", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-non-private-field"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void testFail0() throws Exception { - setFieldsForTest("testfail0"); - projectExplorer.scrollToItemByPath(PROJECT_NAME + "/src/main/webapp"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.waitTextInErrorMessage("A field with this name is already defined."); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail3() throws Exception { - setFieldsForTest("testfail3"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.waitTextInErrorMessage("A field with this name is already defined."); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail7() throws Exception { - setFieldsForTest("testfail7"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "Problem in 'A.java'. Another name will shadow access to the renamed element"); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail10() throws Exception { - setFieldsForTest("testfail10"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "Problem in 'A.java'. Another name will shadow access to the renamed element"); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail14() throws Exception { - setFieldsForTest("testfail14"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "Problem in 'A.java'. Another name will shadow access to the renamed element"); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resources = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/none-private/" - + nameCurrentTest - + "/in/A.java"); - List listWithAllLines = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - contentFromInA = ""; - for (String buffer : listWithAllLines) { - contentFromInA += buffer + '\n'; - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailPrivateFieldTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailPrivateFieldTest.java deleted file mode 100644 index fc015d1102a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/FailPrivateFieldTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.fields; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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; - -/** @author Aleksandr Shmaraev on 18.11.15 */ -public class FailPrivateFieldTest { - private static final String PROJECT_NAME = NameGenerator.generate("FailPrivateFieldProject", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-private-field"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void testFail0() throws Exception { - setFieldsForTest("testfail0"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.waitTextInErrorMessage("A field with this name is already defined."); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail4() throws Exception { - setFieldsForTest("testfail4"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.waitTextInErrorMessage("A field with this name is already defined."); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail6() throws Exception { - setFieldsForTest("testfail6"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "After renaming, the field 'f' will be hidden" - + " in the scope of the field 'g' declared in type 'testfail6.A.B'"); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void testFail7() throws Exception { - setFieldsForTest("testfail7"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "Problem in 'A.java'. Another name will shadow access to the renamed element"); - refactor.waitRenameFieldFormIsClosed(); - editor.closeFileByNameWithSaving("A"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resources = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/private/" - + nameCurrentTest - + "/in/A.java"); - List listWithAllLines = - Files.readAllLines(Paths.get(resources.toURI()), Charset.forName("UTF-8")); - contentFromInA = ""; - for (String buffer : listWithAllLines) { - contentFromInA += buffer + '\n'; - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenameNotPrivateFieldTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenameNotPrivateFieldTest.java deleted file mode 100644 index 29c4e158358..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenameNotPrivateFieldTest.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.fields; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -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; - -/** @author Aleksandr Shmaraev on 12.11.15 */ -public class RenameNotPrivateFieldTest { - private static final String PROJECT_NAME = - NameGenerator.generate("RenameNotPrivateFieldProject", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-non-private-field"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void checkRenameNotPrivateField0() throws Exception { - setFieldsForTest("test0"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - loader.waitOnClosed(); - editor.setCursorToLine(22); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField1() throws Exception { - setFieldsForTest("test1"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - loader.waitOnClosed(); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField2() throws Exception { - setFieldsForTest("test2"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 9); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField3() throws Exception { - setFieldsForTest("test3"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(20); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField4() throws Exception { - setFieldsForTest("test4"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField5() throws Exception { - setFieldsForTest("test5"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField6() throws Exception { - setFieldsForTest("test6"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField7() throws Exception { - setFieldsForTest("test7"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField8() throws Exception { - setFieldsForTest("test8"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField9() throws Exception { - setFieldsForTest("test9"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameNotPrivateField10() throws Exception { - setFieldsForTest("test10"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameAnnotation24() throws Exception { - setFieldsForTest("test24"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 9); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("ZORRO"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameAnnotation25() throws Exception { - setFieldsForTest("test25"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(17, 14); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("ZORRO"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkBugFiveEightTwoOne26() throws Exception { - setFieldsForTest("test26"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 17); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("test1"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameDelegate28() throws Exception { - setFieldsForTest("test28"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(16); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameEnumField31() throws Exception { - setFieldsForTest("test31"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(16); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("other"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameGenerics32() throws Exception { - setFieldsForTest("test32"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(15); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameGenerics33() throws Exception { - setFieldsForTest("test33"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(15); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameGenerics36() throws Exception { - setFieldsForTest("test36"); - projectExplorer.scrollAndSelectItem(pathToCurrentPackage); - projectExplorer.waitVisibleItem(pathToCurrentPackage + "/A.java"); - projectExplorer.sendToItemDownArrowKey(); - projectExplorer.sendToItemEnterKey(); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(17); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("g"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/none-private/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/none-private/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldSmokeTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldSmokeTest.java deleted file mode 100644 index dab496cdef1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldSmokeTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.fields; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev 06.12.15 */ -public class RenamePrivateFieldSmokeTest { - private static final String PROJECT_NAME = - NameGenerator.generate("CheckRenamePrivateFieldProject", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private Loader loader; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-private-field"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @Test - public void checkRenamePrivateField0() throws Exception { - setFieldsForTest("test0"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName("g"); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/private/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/private/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldTest.java deleted file mode 100644 index 5b25431fb58..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/fields/RenamePrivateFieldTest.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.fields; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -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; - -/** @author Aleksandr Shmaraev on 08.11.15 */ -public class RenamePrivateFieldTest { - private static final String PROJECT_NAME = - NameGenerator.generate("CheckRenamePrivateFieldProject", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-private-field"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void checkRenamePrivateField0() throws Exception { - setFieldsForTest("test0"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField1() throws Exception { - setFieldsForTest("test1"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField2() throws Exception { - setFieldsForTest("test2"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(15); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(false); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField3() throws Exception { - setFieldsForTest("test3"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("gg"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateCommentsAndStringsCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField4() throws Exception { - setFieldsForTest("test4"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(19); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("fYou"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateCommentsAndStringsCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField5() throws Exception { - setFieldsForTest("test5"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("fYou"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField6() throws Exception { - setFieldsForTest("test6"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("fYou"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField7() throws Exception { - setFieldsForTest("test7"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("fSmall"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField8() throws Exception { - setFieldsForTest("test8"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("g"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField9() throws Exception { - setFieldsForTest("test9"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(14); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("fSmall"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField10() throws Exception { - setFieldsForTest("test10"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(20); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - loader.waitOnClosed(); - typeAndWaitNewName("fElements"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenamePrivateField11() throws Exception { - setFieldsForTest("test11"); - consoles.closeProcessesArea(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(22); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - loader.waitOnClosed(); - typeAndWaitNewName("fElements"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText( - "Code modification may not be accurate as affected resource 'qa-spring-sample/src/main/java/test11/A.java' has compile errors."); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameUnicode12() throws Exception { - setFieldsForTest("test12"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.setCursorToLine(15); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchRefactorForm(); - refactor.waitRenameFieldFormIsOpen(); - typeAndWaitNewName("feel"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameFieldFormIsClosed(); - loader.waitOnClosed(); - waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/private/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/fields/private/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } - - private void typeAndWaitNewName(String newName) { - refactor.typeAndWaitNewName(newName); - } - - private void waitTextIntoEditor(String expectedText) { - editor.waitTextIntoEditor(expectedText); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameMethodInInterfaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameMethodInInterfaceTest.java deleted file mode 100644 index ae155fb2ab9..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameMethodInInterfaceTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.methods; - -import com.google.inject.Inject; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -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; - -/** @author Musienko Maxim */ -public class RenameMethodInInterfaceTest { - private static final Logger LOG = LoggerFactory.getLogger(RenameMethodInInterfaceTest.class); - private static final String nameOfProject = - NameGenerator.generate(RenameMethodInInterfaceTest.class.getSimpleName(), 3); - private static final String pathToPackageInChePrefix = - nameOfProject + "/src" + "/main" + "/java" + "/renameMethodsInInterface"; - private static final String expectedWarnMessForFail5 = - "A related type declares a method with the new name (and same number of parameters)"; - private static final String expectedWarnMessForFail12 = - "Hierarchy declares a method 'k' with the same number of parameters and the same parameter type names."; - private static final String expectedErrMessForFail33 = - "Cannot rename this method because it is a special case (see the language specification section 9.2 for details)"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/RenameMethodsInInterface"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - nameOfProject, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(nameOfProject); - projectExplorer.waitVisibleItem(nameOfProject); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @BeforeMethod - public void expandTreeOfProject(Method testName) { - try { - setFieldsForTest(testName.getName()); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @AfterMethod - public void closeForm() { - try { - if (refactor.isWidgetOpened()) refactor.clickCancelButtonRefactorForm(); - editor.closeAllTabs(); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void test0() { - doRefactoringWithKeys(18, 10, "k"); - } - - @Test(priority = 1) - public void test12() { - doRefactoringWithKeys(14, 6, "k"); - } - - @Test(priority = 2) - public void test20() { - doRefactoringWithKeys(14, 10, "k"); - } - - @Test(priority = 3) - public void test31() { - doRefactoringWithKeys(14, 6, "k"); - } - - @Test(priority = 4) - public void test44() { - doRefactoringWithKeys(14, 10, "k"); - } - - @Test(priority = 5) - public void testAnnotation1() { - doRefactorByWizard(24, 8, "number"); - editor.waitTextIntoEditor(contentFromOutA); - } - - @Test(priority = 6) - public void testFail5() { - doRefactorByWizardWithExpectedWarningMessage(14, 10, "k", expectedWarnMessForFail5); - } - - @Test(priority = 7) - public void testFail12() { - doRefactorByWizardWithExpectedWarningMessage(15, 17, "k", expectedWarnMessForFail12); - } - - @Test(priority = 8) - public void testFail33() { - doRefactorByWizardWithExpectedWarningMessage(14, 12, "toString", expectedErrMessForFail33); - } - - @Test(priority = 9) - public void testGenerics01() { - doRefactoringWithKeys(19, 24, "zYXteg"); - - editor.waitTextIntoEditor(contentFromOutA); - } - - private void doRefactoringWithKeys( - int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor(newName); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - editor.waitTextIntoEditor(contentFromOutA); - } - - private void doRefactorByWizard(int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenameMethodFormIsClosed(); - loader.waitOnClosed(); - editor.waitTextIntoEditor(contentFromOutA); - } - - private void doRefactorByWizardWithExpectedWarningMessage( - int cursorPositionLine, - int cursorPositionChar, - String newName, - String expectedWarningMessage) { - - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - WaitUtils.sleepQuietly(1); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - WaitUtils.sleepQuietly(1); - refactor.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.containsText(expectedWarningMessage); - askDialog.clickCancelBtn(); - askDialog.waitFormToClose(); - refactor.clickCancelButtonRefactorForm(); - } - - private void prepareProjectForRefactor(int cursorPositionLine, int cursorPositionChar) { - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(cursorPositionLine, cursorPositionChar); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/interface/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/interface/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenamePrivateMethodTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenamePrivateMethodTest.java deleted file mode 100644 index 6ac9ed73111..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenamePrivateMethodTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.methods; - -import com.google.inject.Inject; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import java.util.Random; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -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; - -/** @author Musienko Maxim */ -public class RenamePrivateMethodTest { - private static final Logger LOG = LoggerFactory.getLogger(RenamePrivateMethodTest.class); - private static final String nameOfProject = - RenamePrivateMethodTest.class.getSimpleName() + new Random().nextInt(9999); - private static final String pathToPackageInChePrefix = - nameOfProject + "/src" + "/main" + "/java" + "/renamePrivateMethods"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/RenameMethods"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - nameOfProject, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(nameOfProject); - projectExplorer.waitVisibleItem(nameOfProject); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @BeforeMethod - public void expandTreeOfProject(Method testName) { - try { - setFieldsForTest(testName.getName()); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @AfterMethod - public void closeForm() { - try { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - editor.closeAllTabs(); - - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void test0() { - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void test2() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("fred"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void test10() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void test11() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void test12() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void test23() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void testAnon0() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void testFail5() { - projectExplorer.waitProjectExplorer(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(14, 18); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName("k"); - refactor.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.containsText( - "Problem in 'A.java'. Another name will shadow access to the renamed element"); - askDialog.clickCancelBtn(); - askDialog.waitFormToClose(); - refactor.clickCancelButtonRefactorForm(); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/private/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/private/" - + nameCurrentTest - + "/out/B.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutB = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameStaticMethodsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameStaticMethodsTest.java deleted file mode 100644 index 56aa4594c86..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameStaticMethodsTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.methods; - -import com.google.inject.Inject; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -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; - -/** @author Musienko Maxim */ -public class RenameStaticMethodsTest { - private static final Logger LOG = LoggerFactory.getLogger(RenameStaticMethodsTest.class); - private static final String NAME_OFP_ROJECT = - NameGenerator.generate(RenameStaticMethodsTest.class.getSimpleName(), 3); - private static final String pathToPackageInChePrefix = - NAME_OFP_ROJECT + "/src" + "/main" + "/java" + "/renameStaticMethods"; - private static final String testsFail5ErrorMess = - "Renaming native methods will cause an unsatisfied link error on runtime."; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutB; - private URL resourcesInA; - private URL resourcesOutB; - private URL resourceOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/RenameStaticMethods"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - NAME_OFP_ROJECT, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - projectExplorer.waitItem(NAME_OFP_ROJECT); - projectExplorer.quickExpandWithJavaScript(); - consoles.waitJDTLSProjectResolveFinishedMessage(NAME_OFP_ROJECT); - consoles.closeProcessesArea(); - } - - @BeforeMethod - public void expandTreeOfProject(Method testName) { - try { - loader.waitOnClosed(); - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - setFieldsForTest(testName.getName()); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @AfterMethod - public void closeForm() { - try { - if (refactor.isWidgetOpened()) { - loader.waitOnClosed(); - refactor.clickCancelButtonRefactorForm(); - } - editor.closeAllTabs(); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void test0() { - doRefactoringWithKeys(14, 14, "k"); - } - - @Test - public void test2() { - doRefactoringWithKeys(14, 17, "k"); - } - - @Test - public void test8() { - doRefactorByWizard(14, 17, "k"); - editor.waitTextIntoEditor(contentFromOutB); - } - - @Test - public void testFail5() { - doRefactorByWizardWithExpectedWarningMessage(15, 24, "k", testsFail5ErrorMess); - } - - @Test - public void test11() throws Exception { - contentFromOutB = getTextFromFile(resourcesOutB); - - String contentFromOutA = getTextFromFile(resourceOutA); - doRefactorByWizard(16, 23, "fred"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.openItemByPath(pathToCurrentPackage + "/B.java"); - editor.waitTextIntoEditor(contentFromOutB); - } - - private void doRefactoringWithKeys( - int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutB); - } - - private void doRefactorByWizard(int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameMethodFormIsClosed(); - } - - private void doRefactorByWizardWithExpectedWarningMessage( - int cursorPositionLine, - int cursorPositionChar, - String newName, - String expectedWarningMessage) { - - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - refactor.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.containsText(expectedWarningMessage); - askDialog.clickCancelBtn(); - askDialog.waitFormToClose(); - refactor.clickCancelButtonRefactorForm(); - } - - private void prepareProjectForRefactor(int cursorPositionLine, int cursorPositionChar) { - projectExplorer.waitItem(pathToPackageInChePrefix); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(cursorPositionLine, cursorPositionChar); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/static/" - + nameCurrentTest - + "/in/A.java"); - resourcesOutB = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/static/" - + nameCurrentTest - + "/out/B.java"); - resourceOutA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/static/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesInA); - contentFromOutB = getTextFromFile(resourcesOutB); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameVirtualMethodsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameVirtualMethodsTest.java deleted file mode 100644 index b5e27abf16f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/methods/RenameVirtualMethodsTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.methods; - -import com.google.inject.Inject; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import java.util.Random; -import org.eclipse.che.selenium.core.SeleniumWebDriver; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.utils.WaitUtils; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -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; - -/** @author Musienko Maxim */ -public class RenameVirtualMethodsTest { - private static final Logger LOG = LoggerFactory.getLogger(RenameVirtualMethodsTest.class); - private static final String nameOfProject = - RenameVirtualMethodsTest.class.getSimpleName() + new Random().nextInt(9999); - private static final String pathToPackageInChePrefix = - nameOfProject + "/src" + "/main" + "/java" + "/renameVirtualMethods"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private SeleniumWebDriver seleniumWebDriver; - @Inject private Consoles consoles; - - @BeforeClass - public void setup() throws Exception { - URL resource = getClass().getResource("/projects/RenameVirtualMethods"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - nameOfProject, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(nameOfProject); - projectExplorer.waitItem(nameOfProject); - projectExplorer.quickExpandWithJavaScript(); - } - - @BeforeMethod - public void expandTreeOfProject(Method testName) { - try { - setFieldsForTest(testName.getName()); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @AfterMethod - public void closeForm() { - try { - if (refactor.isWidgetOpened()) { - loader.waitOnClosed(); - try { - refactor.clickCancelButtonRefactorForm(); - } catch (Exception ex) { - LOG.warn(ex.getLocalizedMessage()); - seleniumWebDriver.navigate().refresh(); - } - } - editor.closeAllTabs(); - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void test1() { - doRefactoringWithKeys(14, 19, "k"); - } - - @Test - public void test11() { - doRefactoringWithKeys(15, 10, "k"); - } - - @Test - public void test25() { - doRefactorByWizard(14, 10, "k"); - } - - @Test - public void testEnum2() { - doRefactoringWithKeys(30, 20, "get2ndPower"); - } - - @Test - public void testFail35() { - doRefactorByWizardWithClosingWarnMess(14, 10, "k"); - } - - @Test - public void testGeneric2() { - doRefactorByWizard(20, 20, "addIfPositive"); - editor.waitTextIntoEditor(contentFromOutA); - } - - @Test - public void testVarArgs1() { - doRefactorByWizard(26, 74, "runThes"); - editor.waitTextIntoEditor(contentFromOutA); - } - - private void doRefactoringWithKeys( - int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor(newName); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - editor.waitTextIntoEditor(contentFromOutA); - } - - private void doRefactorByWizard(int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactor.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - // need for validation on server side - WaitUtils.sleepQuietly(2); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameMethodFormIsClosed(); - } - - private void doRefactorByWizardWithClosingWarnMess( - int cursorPositionLine, int cursorPositionChar, String newName) { - prepareProjectForRefactor(cursorPositionLine, cursorPositionChar); - editor.launchRefactorForm(); - refactor.waitRenameMethodFormIsOpen(); - refactor.typeAndWaitNewName(newName); - refactor.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - refactor.waitRenameMethodFormIsClosed(); - } - - private void prepareProjectForRefactor(int cursorPositionLine, int cursorPositionChar) { - projectExplorer.waitItem(pathToPackageInChePrefix); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(cursorPositionLine, cursorPositionChar); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/virtual/" - + nameCurrentTest - + "/in/A.java"); - URL resourcesOut = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/methods/virtual/" - + nameCurrentTest - + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/CodeAssistAfterMoveItemTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/CodeAssistAfterMoveItemTest.java deleted file mode 100644 index 3f3cb5bc3e8..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/CodeAssistAfterMoveItemTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.move; - -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 com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class CodeAssistAfterMoveItemTest { - - private static final String APPLY_WORKSPACE_CHANGES = "Apply Workspace Changes\nDone"; - private static final String PROJECT_NAME = NameGenerator.generate("CodeAssistAfterMoveItem-", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private Events events; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/move-items-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @Test - public void checkCodeAssistAfterMoveItem() { - projectExplorer.openItemByPath( - pathToPackageInChePrefix + "/org/eclipse/qa/examples/AppController.java"); - loader.waitOnClosed(); - editor.waitActive(); - editor.setCursorToLine(32); - editor.typeTextIntoEditor(Keys.TAB.toString()); - loader.waitOnClosed(); - editor.typeTextIntoEditor("A5 a = new A5();"); - loader.waitOnClosed(); - editor.waitTextIntoEditor("A5 a = new A5();"); - editor.waitMarkerInPosition(ERROR, 32); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.launchPropositionAssistPanel(); - loader.waitOnClosed(); - editor.waitTextIntoFixErrorProposition("Import 'A5' (r)"); - editor.enterTextIntoFixErrorPropByDoubleClick("Import 'A5' (r)"); - loader.waitOnClosed(); - editor.waitTextIntoEditor("import r.A5;"); - editor.waitMarkerInPosition(WARNING, 34); - events.clickEventLogBtn(); - - // move item 'A5' into package 'p1' - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A5.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.waitItem(pathToPackageInChePrefix + "/p1/A5.java"); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A5.java"); - editor.waitTextIntoEditor("import p1.A5;"); - editor.setCursorToLine(17); - editor.deleteCurrentLine(); - loader.waitOnClosed(); - editor.waitMarkerInPosition(ERROR, 33); - editor.goToCursorPositionVisible(33, 5); - editor.launchPropositionAssistPanel(); - loader.waitOnClosed(); - editor.waitTextIntoFixErrorProposition("Import 'A5' (p1)"); - editor.enterTextIntoFixErrorPropByEnter("Import 'A5' (p1)"); - editor.waitTextIntoEditor("import p1.A5;"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/FailMoveItemTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/FailMoveItemTest.java deleted file mode 100644 index 181e5c5ca6d..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/FailMoveItemTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.move; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.common.base.Joiner; -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 05.01.16 */ -public class FailMoveItemTest { - private static final String APPLY_WORKSPACE_CHANGES = "Apply Workspace Changes\nDone"; - private static final String PROJECT_NAME = NameGenerator.generate("FailMoveItemProject-", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src" + "/main" + "/java"; - - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CheTerminal terminal; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private Events events; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/move-items-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - terminal.waitFirstTerminalTab(); - projectExplorer.waitVisibleItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - events.clickEventLogBtn(); - } - - @AfterMethod(alwaysRun = true) - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - editor.closeAllTabs(); - } - } - - @Test - public void checkFailMoveItem17() throws Exception { - setFieldsForTest("testfail17"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A17.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A17.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.setAndWaitStateUpdateReferencesCheckbox(false); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitMoveItemFormIsClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.clickOnSelectedElementInEditor("r.A17"); - editor.waitMarkerInPosition(ERROR, 14); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A17.java"); - editor.closeFileByNameWithSaving("A17"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - URL resource = getClass().getResource(nameCurrentTest + "/" + "in/A.java"); - List content = Files.readAllLines(Paths.get(resource.toURI())); - contentFromInA = Joiner.on('\n').join(content); - - resource = getClass().getResource(nameCurrentTest + "/" + "out/A.java"); - content = Files.readAllLines(Paths.get(resource.toURI())); - contentFromOutA = Joiner.on('\n').join(content); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveItemsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveItemsTest.java deleted file mode 100644 index 1765e5d8e50..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveItemsTest.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.move; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -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; - -/** @author Aleksandr Shmaraev on 18.12.15 */ -public class MoveItemsTest { - private static final Logger LOG = LoggerFactory.getLogger(MoveItemsTest.class); - private static final String PROJECT_NAME = NameGenerator.generate("MoveItemsProject-", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - private static final String APPLY_WORKSPACE_CHANGES = "Apply Workspace Changes\nDone"; - - private String contentFromInA, contentFromInB; - private String contentFromOutA, contentFromOutB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private Events events; - @Inject private NotificationsPopupPanel notifications; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/move-items-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - events.clickEventLogBtn(); - } - - @BeforeMethod - public void setUp() throws Exception { - events.clearAllMessages(); - } - - @AfterMethod - public void closeForm() { - try { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void checkMoveItem0() throws Exception { - setFieldsForTest("test0"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A0.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItemByName("A0.java"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.MOVE); - - refactor.waitMoveItemFormIsOpen(); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenameFieldFormIsClosed(); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.MOVE); - - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A0.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A0.java"); - } - - @Test - public void checkMoveItem1() throws Exception { - setFieldsForTest("test1"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A1.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A1.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A1.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A1.java"); - } - - @Test - public void checkMoveItem2() throws Exception { - setFieldsForTest("test2"); - setFieldsForTestB("test2"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A2.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/fred2/B2.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInB); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A2.java"); - editor.closeFileByNameWithSaving("B2"); - editor.closeFileByNameWithSaving("A2"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.MOVE); - - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A2.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/fred2/B2.java"); - editor.waitTextIntoEditor(contentFromOutB); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A2.java"); - } - - @Test - public void checkMoveItem3() throws Exception { - setFieldsForTest("test5"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A5.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A5.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.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A5.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A5.java"); - } - - @Test - public void checkMoveItem5() throws Exception { - setFieldsForTest("test3"); - setFieldsForTestB("test3"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/r/A3.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.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutB); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A3.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/r/A3.java"); - } - - @Test - public void checkMoveItem6() throws Exception { - setFieldsForTest("test6"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A6.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A6.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A6.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A6.java"); - } - - @Test - public void checkMoveItem7() throws Exception { - setFieldsForTest("test7"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A7.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A7.java"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.MOVE); - - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("(default package)"); - refactor.waitTextInMoveForm("Java references will not be updated."); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/A7.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A7.java"); - } - - @Test - public void checkMoveItem8() throws Exception { - setFieldsForTest("test8"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/java/lang/reflect/Klass.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/java/lang/reflect/Klass.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/Klass.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath( - pathToPackageInChePrefix + "/java/lang/reflect/Klass.java"); - } - - @Test - public void checkMoveItem9() throws Exception { - setFieldsForTest("test9"); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/r/A9.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToPackageInChePrefix + "/r/A9.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("p1"); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.openItemByPath(pathToPackageInChePrefix + "/p1/A9.java"); - editor.waitTextIntoEditor(contentFromOutA); - projectExplorer.waitDisappearItemByPath(pathToPackageInChePrefix + "/r/A9.java"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - URL resourcesIn = getClass().getResource(nameCurrentTest + "/in/A.java"); - URL resourcesOut = getClass().getResource(nameCurrentTest + "/out/A.java"); - - contentFromInA = getTextFromFile(resourcesIn); - contentFromOutA = getTextFromFile(resourcesOut); - } - - private void setFieldsForTestB(String nameCurrentTest) throws Exception { - URL resourcesIn = getClass().getResource(nameCurrentTest + "/in/B.java"); - URL resourcesOut = getClass().getResource(nameCurrentTest + "/out/B.java"); - - contentFromInB = getTextFromFile(resourcesIn); - contentFromOutB = getTextFromFile(resourcesOut); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaClassToSubpackageTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaClassToSubpackageTest.java deleted file mode 100644 index db08ab3179a..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaClassToSubpackageTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.move; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class MoveJavaClassToSubpackageTest { - private static final String APPLY_WORKSPACE_CHANGES = "Apply Workspace Changes\nDone"; - private static final String PROJECT_NAME = - NameGenerator.generate("MoveJavaClassToSubpackageProject-", 4); - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Refactor refactor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - @Inject private Events events; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - events.clickEventLogBtn(); - } - - @Test - public void checkProjectTreeAfterMoveJavaFile() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.waitAndSelectItem( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/src/main/java"); - refactor.chooseDestinationForItem("org.eclipse.qa"); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/AppController.java"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaFileInNewSourceFolderTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaFileInNewSourceFolderTest.java deleted file mode 100644 index c2f66ac0690..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/move/MoveJavaFileInNewSourceFolderTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.move; - -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.BUILD_PATH; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.NEW; -import static org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants.SubMenuBuildPath.USE_AS_SOURCE_FOLDER; -import static org.eclipse.che.selenium.pageobject.ProjectExplorer.FolderTypes.JAVA_SOURCE_FOLDER; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Random; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.constant.TestProjectExplorerContextMenuConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskForValueDialog; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev */ -public class MoveJavaFileInNewSourceFolderTest { - - private static final String PROJECT_NAME = - "MoveJavaFileInNewSourceFolder" + new Random().nextInt(999); - private static final String PATH_TO_FILE = PROJECT_NAME + "/src/com/company/nba/ATest.java"; - private static final String NEW_FOLDER_NAME = "test"; - private static final String NEW_SOURCE_FOLDER = "java"; - private static final String PATH_NEW_SOURCE_FOLDER = PROJECT_NAME + "/test/java"; - private static final String NEW_PACKAGE_NAME = "com.org.ltd"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private Refactor refactor; - @Inject private Menu menu; - @Inject private AskForValueDialog askForValueDialog; - @Inject private ToastLoader toastLoader; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/plain-java-project"); - testProjectServiceClient.importProject( - workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, ProjectTemplates.PLAIN_JAVA); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkMoveJavaClassInNewSourceFolder() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - projectExplorer.openItemByPath(PATH_TO_FILE); - - // create new folder and configure as source - projectExplorer.waitAndSelectItem(PROJECT_NAME); - createNewFolder(NEW_FOLDER_NAME); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); - createNewFolder(NEW_SOURCE_FOLDER); - projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); - projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/test/" + NEW_SOURCE_FOLDER); - projectExplorer.clickOnItemInContextMenu(BUILD_PATH); - projectExplorer.clickOnItemInContextMenu(USE_AS_SOURCE_FOLDER); - projectExplorer.waitDefinedTypeOfFolder(PATH_NEW_SOURCE_FOLDER, JAVA_SOURCE_FOLDER); - projectExplorer.waitAndSelectItem(PATH_NEW_SOURCE_FOLDER); - projectExplorer.openContextMenuByPathSelectedItem(PATH_NEW_SOURCE_FOLDER); - createPackage(); - - // move java file into new source folder - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.waitAndSelectItem(PATH_TO_FILE); - projectExplorer.launchRefactorMoveByKeyboard(); - refactor.waitMoveItemFormIsOpen(); - refactor.clickOnExpandIconTree(PROJECT_NAME); - refactor.clickOnExpandIconTree("/test/java"); - loader.waitOnClosed(); - refactor.chooseDestinationForItem(NEW_PACKAGE_NAME); - refactor.clickOkButtonRefactorForm(); - refactor.waitMoveItemFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/test/java/com/org/ltd/ATest.java"); - } - - private void createNewFolder(String folderName) { - menu.runCommand( - TestMenuCommandsConstants.Project.PROJECT, - TestMenuCommandsConstants.Project.New.NEW, - TestMenuCommandsConstants.Project.New.FOLDER); - - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(folderName); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - } - - private void createPackage() { - loader.waitOnClosed(); - projectExplorer.clickOnItemInContextMenu(NEW); - projectExplorer.clickOnNewContextMenuItem( - TestProjectExplorerContextMenuConstants.SubMenuNew.JAVA_PACKAGE); - askForValueDialog.waitFormToOpen(); - askForValueDialog.typeAndWaitText(NEW_PACKAGE_NAME); - askForValueDialog.clickOkBtn(); - askForValueDialog.waitFormToClose(); - projectExplorer.waitVisibilityByName(NEW_PACKAGE_NAME); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSmokeTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSmokeTest.java deleted file mode 100644 index ff855db2bfe..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSmokeTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.packages; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 06.12.15 */ -public class RenamePackageSmokeTest { - private static final String PROJECT_NAME = - NameGenerator.generate("CheckRenamePackageProject-", 4); - private static final String TEST0_P1_OUT = - "package test0.p1;\n" - + "/**\n" - + " * This is in test0.r.\n" - + " * @see test0.p1\n" - + " * @see test0.p1.A\n" - + " * @see test0.p1.A#A()\n" - + " */\n" - + "public class A {\n" - + "}\n"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-package"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkTest0() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test0/r/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST0_P1_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test0/r"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - loader.waitOnClosed(); - refactor.typeAndWaitNewName("test0.p1"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test0/r/A.java"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test0/p1/A.java"); - editor.waitTextIntoEditor(TEST0_P1_OUT); - editor.closeFileByNameWithSaving("A"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSpringTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSpringTest.java deleted file mode 100644 index 7ba31be7c81..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageSpringTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.packages; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev 22.01.16 */ -public class RenamePackageSpringTest { - private static final String PROJECT_NAME_1 = - NameGenerator.generate("CheckRenamePackageSpringApp-", 4); - private static final String PROJECT_NAME_2 = - NameGenerator.generate("RenamePackageWithMainMethod-", 4); - - private static final String NEW_NAME_PACKAGE = "org.eclipse.dev.examples"; - private static final String OLD_NAME_PACKAGE = "org.eclipse.qa.examples"; - - private static final String WARNING_TEXT = - "Type org.eclipse.qa.examples.HelloWorld contains a main method - some " - + "applications (such as scripts) may not work after refactoring."; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private Menu menu; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/default-spring-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME_1, - ProjectTemplates.MAVEN_SPRING); - - resource = getClass().getResource("/projects/spring-project-with-main-method"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME_2, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME_2); - } - - @Test(priority = 1) - public void checkRenamePackageSpringApp() { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME_1); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - - // check the project tree is not wrap after renaming the package - projectExplorer.waitAndSelectItem(PROJECT_NAME_1 + "/src/main/java/org/eclipse/qa/examples"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.sendKeysIntoField(NEW_NAME_PACKAGE); - refactor.waitTextIntoNewNameField(NEW_NAME_PACKAGE); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.openItemByPath( - PROJECT_NAME_1 + "/src/main/java/org/eclipse/dev/examples/AppController.java"); - editor.waitTextIntoEditor(NEW_NAME_PACKAGE); - projectExplorer.waitAndSelectItem(PROJECT_NAME_1 + "/src/main/java/org/eclipse/dev/examples"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.sendKeysIntoField(OLD_NAME_PACKAGE); - refactor.waitTextIntoNewNameField(OLD_NAME_PACKAGE); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItem(PROJECT_NAME_1 + "/src/main/java/org/eclipse/qa/examples"); - } - - @Test(priority = 2) - public void checkRenamePackageWithMainMethod() { - // check the warning dialog for static main method - projectExplorer.waitItem(PROJECT_NAME_2); - notificationsPopupPanel.waitProgressPopupPanelClose(); - projectExplorer.waitAndSelectItem(PROJECT_NAME_2 + "/src/main/java/org/eclipse/qa/examples"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - loader.waitOnClosed(); - refactor.sendKeysIntoField("org.eclipse.dev.examples"); - refactor.waitTextIntoNewNameField(NEW_NAME_PACKAGE); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText(WARNING_TEXT); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItem(PROJECT_NAME_2 + "/src/main/java/org/eclipse/dev/examples"); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageTest.java deleted file mode 100644 index 1ccac8f508e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/packages/RenamePackageTest.java +++ /dev/null @@ -1,699 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.packages; - -import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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; - -/** @author Aleksandr Shmaraev */ -public class RenamePackageTest { - - private static String PROJECT_NAME = NameGenerator.generate("CheckRenamePackageProject-", 4); - - // TODO move all data from this fields into resources. See Utils.readContentFromFile, for example - // RenameMethodInInterfaceTest - private static String TEST0_P1_OUT = - "package test0.p1;\n" - + "/**\n" - + " * This is in test0.r.\n" - + " * @see test0.p1\n" - + " * @see test0.p1.A\n" - + " * @see test0.p1.A#A()\n" - + " */\n" - + "public class A {\n" - + "}\n"; - - private static String TEST1_P1_OUT = - "package test1.p1;\n" + "public class A {\n" + " test1.p1.A a;\n" + "}\n"; - - private static String TEST2_FRED_OUT = - "package test2.fred;\n" - + "import test2.p1.*;\n" - + "class A {\n" - + " test2.p1.A a;\n" - + " A a1;\n" - + "}\n"; - - private static String TEST3_R_OUT = - "package test3.r;\n" - + "import test3.r.r.*;\n" - + "class A {\n" - + " test3.r.r.B a;\n" - + " A a1;\n" - + "}\n"; - - private static String TEST3_R_R_OUT = - "package test3.r.r;\n" + "public class B {\n" + " test3.r.r.B a;\n" + "}\n"; - - private static String TEST4_Q_OUT = "package test4.q;\n" + "public class A {\n" + "}\n"; - - private static String TEST4_FILE_OUT = - "test4.q.B\n" - + "test4.q.B.Q\n" - + "test4.q.Bla\n" - + "test4.q.q\n" - + "\"test4.q.B\"\n" - + "test4.q\n" - + "test4.q.\n" - + "\n" - + "a.test4.r.p1.B\n" - + "test4.rr.p1.B\n" - + ".test4.r.p1.B\n" - + "test4.r.p1p.B\n"; - - private static String TEST5_P1_OUT = - "//no ref update\n" + "package test5.p1;\n" + "class A {\n" + " test5.r.A d;\n" + "}\n"; - - private static String TEST6_P1_OUT = - "//no ref update but update of textual match to test6.p1 and \"test6.p1\"\n" - + "package test6.p1;\n" - + "class A {\n" - + " test6.r.A d;\n" - + "}\n"; - - private static String TEST7_R_IN = "package test7.r;\n" + "class A {\n" + "}\n"; - - private static String TEST7_Q_OUT = "package test7.q;\n" + "class A {\n" + "}\n"; - - private static String TEST7_R_S_IN = "package test7.r.s;\n" + "public class B {\n" + "}\n"; - - private static String TEST7_Q_S_OUT = "package test7.q.s;\n" + "public class B {\n" + "}\n"; - - private static String TEST8_IN = - "package java.lang.reflect;\n" - + "\n" - + "public class Klass extends AccessibleObject implements Type {\n" - + " Field f;\n" - + "}\n"; - - private static String TEST8_OUT = - "package nonjava;\n" - + "\n" - + "import java.lang.reflect.AccessibleObject;\n" - + "import java.lang.reflect.Field;\n" - + "import java.lang.reflect.Type;\n" - + "\n" - + "public class Klass extends AccessibleObject implements Type {\n" - + " Field f;\n" - + "}\n"; - - private static String TEST9_HIERAR_IN = - "package my;\n" - + "\n" - + "import my.a.ATest;\n" - + "import my.b.B;\n" - + "\n" - + "public class MyA {\n" - + "}\n"; - - private static String TEST9_HIERAR_OUT = - "package your;\n" - + "\n" - + "import your.a.ATest;\n" - + "import your.b.B;\n" - + "\n" - + "public class MyA {\n" - + "}\n"; - - private static String TEST10_HIERAR_IN = - "package m_y.pack;\n" - + "\n" - + "public class C {\n" - + "/*\n" - + "m_y.pack\n" - + "m_y.pack.subpack\n" - + "m_y.pack2\n" - + "m_y.pack2.subpack\n" - + "not.m_y.pack.subpack\n" - + "notm_y.pack.subpack\n" - + "notm_y.pack2.subpack\n" - + "M_y.pack\n" - + "*/\n" - + "}\n"; - - private static String TEST10_HIERAR_OUT = - "package yo_ur.pack;\n" - + "\n" - + "public class C {\n" - + "/*\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" - + "notm_y.pack.subpack\n" - + "notm_y.pack2.subpack\n" - + "M_y.pack\n" - + "*/\n" - + "}\n"; - - private static String TEST11_DISABLED_IMPORT_IN = - "package my_.pack;\n" - + "\n" - + "import my_.pack.C;\n" - + "//import my_.Other;\n" - + "\n" - + "public class C {\n" - + "}\n"; - - private static String TEST11_DISABLED_IMPORT_OUT = - "package your_.pack;\n" - + "\n" - + "import your_.pack.C;\n" - + "\n" - + "public class C {\n" - + "}\n"; - - private static String TEST12_RENAME_WITH_RESOURCE_IN = - "mine.pack\n" - + "mine.pack.\n" - + "mine.pack.subpack\n" - + "mine.pack2\n" - + "mine.pack2.subpack\n" - + "not.mine.pack.subpack\n" - + "notmine.pack.subpack\n" - + "notmine.pack2.subpack\n" - + "Mine.pack\n"; - - private static String TEST12_RENAME_WITH_RESOURCE_OUT = - "main\n" - + "main.\n" - + "main.subpack\n" - + "mine.pack2\n" - + "mine.pack2.subpack\n" - + "not.mine.pack.subpack\n" - + "notmine.pack.subpack\n" - + "notmine.pack2.subpack\n" - + "Mine.pack\n"; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private Menu menu; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CheTerminal terminal; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-package"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - terminal.waitFirstTerminalTab(); - expandTestProject(PROJECT_NAME); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void checkRenamePackageForm00() { - // check the 'Cancel' button - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples"); - loader.waitOnClosed(); - projectExplorer.launchRefactorByKeyboard(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.clickCancelButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - loader.waitOnClosed(); - } - - @Test - public void checkTest0() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test0/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test0/r/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST0_P1_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test0/r"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("test0.p1"); - refactor.waitTextIntoNewNameField("test0.p1"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test0/r/A.java"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test0/p1/A.java"); - editor.waitTextIntoEditor(TEST0_P1_OUT); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkTest1() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test1/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test1/r/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST1_P1_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test1/r"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - refactor.sendKeysIntoField("test1.p1"); - refactor.waitTextIntoNewNameField("test1.p1"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test1/r/A.java"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test1/p1/A.java"); - editor.waitTextIntoEditor(TEST1_P1_OUT); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkTest2() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test2"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test2/fred"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test2/fred/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST2_FRED_OUT); - editor.closeFileByNameWithSaving("A"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test2/r"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test2/r"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("test2.p1"); - refactor.waitTextIntoNewNameField("test2.p1"); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test2/r"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test2/p1"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test2/fred/A.java"); - loader.waitOnClosed(); - editor.waitTextIntoEditor(TEST2_FRED_OUT); - editor.closeFileByNameWithSaving("A"); - } - - @Test(groups = UNDER_REPAIR) - public void checkTest3() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/mine/pack"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/mine/pack/Textfile.txt"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST12_RENAME_WITH_RESOURCE_IN); - editor.closeFileByNameWithSaving("Textfile.txt"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/mine/pack"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("main"); - refactor.waitTextIntoNewNameField("main"); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(true); - refactor.typeAndWaitFileNamePatterns("*.txt"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - loader.waitOnClosed(); - 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"); - } - - @Test - public void checkTest4() { - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test4"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/Textfile.txt"); - editor.waitTextNotPresentIntoEditor(TEST4_FILE_OUT); - editor.closeFileByNameWithSaving("Textfile.txt"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/r/p1"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/r/p1/A.java"); - editor.waitTextNotPresentIntoEditor(TEST4_Q_OUT); - editor.closeFileByNameWithSaving("A"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test4/r/p1"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(true); - refactor.clearFieldAndSendKeys("test4.q"); - refactor.waitTextIntoNewNameField("test4.q"); - loader.waitOnClosed(); - refactor.typeAndWaitFileNamePatterns("*.txt"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenamePackageFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test4/r"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test4/q"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test4/r"); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test4/r/p1"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/q/A.java"); - loader.waitOnClosed(); - editor.waitTextIntoEditor(TEST4_Q_OUT); - editor.closeFileByNameWithSaving("A"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test4/Textfile.txt"); - editor.waitTextIntoEditor(TEST4_FILE_OUT); - editor.closeFileByNameWithSaving("Textfile.txt"); - } - - @Test - public void checkTest5() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test5/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test5/r/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST5_P1_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test5/r"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("test5.p1"); - refactor.waitTextIntoNewNameField("test5.p1"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.setAndWaitStateUpdateReferencesCheckbox(false); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - editor.waitTextIntoEditor(TEST5_P1_OUT); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkTest6() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test6/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test6/r/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST6_P1_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test6/r"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("test6.p1"); - refactor.waitTextIntoNewNameField("test6.p1"); - refactor.setAndWaitStateUpdateReferencesCheckbox(false); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.setAndWaitStateCommentsAndStringsCheckbox(true); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - editor.waitTextIntoEditor(TEST6_P1_OUT); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkTest7() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/r/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST7_R_IN); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/r/s"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/r/s/B.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST7_R_S_IN); - editor.closeFileByNameWithSaving("A"); - editor.closeFileByNameWithSaving("B"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test7/r"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - loader.waitOnClosed(); - refactor.clearFieldAndSendKeys("test7.q"); - refactor.waitTextIntoNewNameField("test7.q"); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test7/q"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/q/A.java"); - editor.waitTextIntoEditor(TEST7_Q_OUT); - editor.closeFileByNameWithSaving("A"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test7/q/s"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/q/s"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test7/q/s/B.java"); - editor.waitTextIntoEditor(TEST7_Q_S_OUT); - editor.closeFileByNameWithSaving("B"); - } - - @Test - public void checkTest8() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/java/lang/reflect"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/java/lang/reflect/Klass.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST8_IN); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/java/lang/reflect"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - - refactor.sendKeysIntoField("nonjava"); - refactor.waitTextIntoNewNameField("nonjava"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.clickPreviewButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRefactorPreviewFormIsOpened(); - loader.waitOnClosed(); - refactor.clickOkButtonPreviewForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/nonjava"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/nonjava/Klass.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST8_OUT); - editor.closeFileByNameWithSaving("Klass"); - } - - @Test - public void checkTestHierarchical9_1() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/my"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/my/MyA.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST9_HIERAR_IN); - editor.closeFileByNameWithSaving("MyA"); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/my"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - refactor.sendKeysIntoField("your"); - refactor.waitTextIntoNewNameField("your"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - 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"); - } - - @Test(groups = UNDER_REPAIR) - public void checkTestHierarchical10() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/m_y/pack"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/m_y/pack/C.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST10_HIERAR_IN); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/m_y/pack"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - refactor.setAndWaitStateCommentsAndStringsCheckbox(true); - loader.waitOnClosed(); - 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/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"); - } - - @Test(groups = UNDER_REPAIR) - public void checkTestDisableImport11() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/my_/pack"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/my_/pack/C.java"); - editor.waitActive(); - editor.waitTextIntoEditor(TEST11_DISABLED_IMPORT_IN); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/my_/pack"); - menu.runCommand( - TestMenuCommandsConstants.Assistant.ASSISTANT, - TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING, - TestMenuCommandsConstants.Assistant.Refactoring.RENAME); - - refactor.waitRenamePackageFormIsOpen(); - loader.waitOnClosed(); - refactor.sendKeysIntoField("your_.pack"); - refactor.waitTextIntoNewNameField("your_.pack"); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(true); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - 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"); - } - - @Test - public void checkTest12() { - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test3"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test3/fred"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test3/fred/A.java"); - editor.waitActive(); - editor.waitTextNotPresentIntoEditor(TEST3_R_OUT); - projectExplorer.waitAndSelectItem(PROJECT_NAME + "/src/main/java/test3/fred"); - projectExplorer.launchRefactorByKeyboard(); - refactor.waitRenamePackageFormIsOpen(); - refactor.sendKeysIntoField("test3.r"); - refactor.waitTextIntoNewNameField("test3.r"); - loader.waitOnClosed(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.setAndWaitStateRenameSubpackagesCheckbox(false); - refactor.setAndWaitStateUpdateNonJavaFilesCheckbox(false); - loader.waitOnClosed(); - refactor.clickOkButtonRefactorForm(); - loader.waitOnClosed(); - refactor.waitRenamePackageFormIsClosed(); - projectExplorer.waitItemInvisibility(PROJECT_NAME + "/src/main/java/test3/fred"); - projectExplorer.waitItem(PROJECT_NAME + "/src/main/java/test3/r"); - editor.waitTextIntoEditor(TEST3_R_OUT); - editor.closeFileByNameWithSaving("A"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test3/r/r"); - projectExplorer.openItemByPath(PROJECT_NAME + "/src/main/java/test3/r/r/B.java"); - editor.waitTextIntoEditor(TEST3_R_R_OUT); - editor.closeFileByNameWithSaving("B"); - } - - private void expandTestProject(String projectName) { - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.openItemByPath(PROJECT_NAME); - projectExplorer.openItemByPath(projectName + "/src"); - projectExplorer.waitItem(projectName + "/src/main"); - projectExplorer.openItemByPath(projectName + "/src/main"); - projectExplorer.waitItem(projectName + "/src/main/java"); - projectExplorer.openItemByPath(projectName + "/src/main/java"); - projectExplorer.waitItem(projectName + "/src/main/java/org/eclipse/qa/examples"); - loader.waitOnClosed(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/FailParametersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/FailParametersTest.java deleted file mode 100644 index cfffc80f0b4..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/FailParametersTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.parameters; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 23.11.15 */ -public class FailParametersTest { - private static final String PROJECT_NAME = NameGenerator.generate("FailParametersProject-", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - - private String pathToCurrentPackage; - private String contentFromInA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void prepare() throws Exception { - URL resource = getClass().getResource("/projects/rename-parameters"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - consoles.closeProcessesArea(); - projectExplorer.scrollToItemByPath(PROJECT_NAME + "/src/main/webapp"); - } - - @AfterMethod - public void closeCurrentTab() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - editor.closeAllTabs(); - } - - @Test(dataProvider = "checkRefactoringDataWthConfirmBtnClick") - public void testFail2(TestParams params) throws Exception { - checkRefactoring(params); - } - - private void checkRefactoring(TestParams testParamObj) throws Exception { - setFieldsForTest(testParamObj.getNameTest()); - projectExplorer.openItemByPath(pathToCurrentPackage); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible( - testParamObj.getStrCursorPosition(), testParamObj.getLineCursorPosition()); - editor.launchRefactorForm(); - refactor.waitRenameParametersFormIsOpen(); - refactor.waitUpdateReferencesIsSelected(); - refactor.typeAndWaitNewName(testParamObj.getRefactorValue()); - if (testParamObj.isHandleRefactorWithConfirming()) { - refactor.clickOkButtonRefactorForm(); - askDialog.acceptDialogWithText(testParamObj.getExpectedDialogTextInRefactorWidget()); - } else { - refactor.waitTextInErrorMessage(testParamObj.getExpectedDialogTextInRefactorWidget()); - refactor.clickCancelButtonRefactorForm(); - } - refactor.waitRenameParametersFormIsClosed(); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest + "/A.java"; - URL resourcesIn = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/parameters/" + nameCurrentTest + "/in/A.java"); - contentFromInA = getTextFromFile(resourcesIn); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } - - private static class TestParams { - private String nameTest; - private int strCursorPosition; - private int lineCursorPosition; - - private boolean handleRefactorWithConfirming; - - private String refactorValue; - private String expectedDialogTextInRefactorWidget; - - public TestParams( - String nameTest, - int strCursorPosition, - int lineCursorPosition, - String refactorValue, - String expectedDialogTextInRefactorWidget, - boolean handleRefactorWithConfirming) { - this.nameTest = nameTest; - this.strCursorPosition = strCursorPosition; - this.lineCursorPosition = lineCursorPosition; - this.refactorValue = refactorValue; - this.expectedDialogTextInRefactorWidget = expectedDialogTextInRefactorWidget; - this.handleRefactorWithConfirming = handleRefactorWithConfirming; - } - - public String getNameTest() { - return nameTest; - } - - public boolean isHandleRefactorWithConfirming() { - return handleRefactorWithConfirming; - } - - public int getStrCursorPosition() { - return strCursorPosition; - } - - public int getLineCursorPosition() { - return lineCursorPosition; - } - - public String getRefactorValue() { - return refactorValue; - } - - public String getExpectedDialogTextInRefactorWidget() { - return expectedDialogTextInRefactorWidget; - } - } - - @DataProvider(name = "checkRefactoringDataWthConfirmBtnClick") - private Object[][] refactorParameters() { - return new Object[][] { - {new TestParams("testfail2", 15, 23, "i", "Duplicate parameter i", true)}, - {new TestParams("testfail3", 15, 15, "9", "'9' is not a valid Java identifier", false)}, - {new TestParams("testfail7", 18, 16, "j", "Name collision with name 'j'", true)}, - {new TestParams("testfail11", 15, 16, "j", "Duplicate parameter j", true)}, - {new TestParams("testfail14", 19, 15, "j", "Name collision with name 'j'", true)}, - {new TestParams("testfail17", 15, 17, "j", "Duplicate parameter j", true)}, - {new TestParams("testfail20", 18, 17, "j", "Name collision with name 'j'", true)} - }; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/RenameParametersTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/RenameParametersTest.java deleted file mode 100644 index b3c50833561..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/parameters/RenameParametersTest.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.parameters; - -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.DEFAULT_TIMEOUT; -import static org.eclipse.che.selenium.pageobject.CodenvyEditor.MarkerLocator.ERROR; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.IoUtil; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Events; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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.BeforeMethod; -import org.testng.annotations.Test; - -/** @author Aleksandr Shmaraev on 19.11.15 */ -public class RenameParametersTest { - private static final String PROJECT_NAME = NameGenerator.generate("ParametersProject-", 4); - private static final String pathToPackageInChePrefix = PROJECT_NAME + "/src/main/java"; - private static final String APPLY_WORKSPACE_CHANGES = "Apply Workspace Changes\nDone"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactor; - @Inject private AskDialog askDialog; - @Inject private Consoles consoles; - @Inject private Events events; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void prepare() throws Exception { - URL resource = RenameParametersTest.this.getClass().getResource("/projects/rename-parameters"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - events.clickEventLogBtn(); - } - - @BeforeMethod - public void setUp() throws Exception { - events.clearAllMessages(); - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void checkRenameParameters0() throws Exception { - setFieldsForTest("test0"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 17); - editor.launchRefactorForm(); - refactor.waitRenameParametersFormIsOpen(); - refactor.typeAndWaitNewName("j"); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameParametersFormIsClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters3() throws Exception { - setFieldsForTest("test3"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 15); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - loader.waitOnClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.goToCursorPositionVisible(15, 23); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j1"); - loader.waitOnClosed(); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters6() throws Exception { - setFieldsForTest("test6"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 17); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("k"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters9() throws Exception { - setFieldsForTest("test9"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 17); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters12() throws Exception { - setFieldsForTest("test12"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 23); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters15() throws Exception { - // preparations - setFieldsForTest("test15"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 15); - - // rename the 'i' parameter to the 'j' - renameLocalVariableByRefactorForm("j"); - - // accept the ask dialog about duplicate parameters - askDialog.acceptDialogWithText("Duplicate parameter j"); - - loader.waitOnClosed(); - refactor.waitRenameParametersFormIsClosed(); - events.clearAllMessages(); - editor.waitActive(); - editor.goToCursorPositionVisible(15, 23); - - // rename the 'j' parameter to the 'i' - renameLocalVariableByRefactorForm("i"); - refactor.waitRenameParametersFormIsClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitMarkerInvisibility(ERROR, 15); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters18() throws Exception { - setFieldsForTest("test18"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 20); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters21() throws Exception { - setFieldsForTest("test21"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 17); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters25() throws Exception { - setFieldsForTest("test25"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(16, 16); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters28() throws Exception { - setFieldsForTest("test28"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 18); - editor.typeTextIntoEditor(Keys.END.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.typeTextIntoEditor(Keys.ARROW_LEFT.toString()); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("j"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters31() throws Exception { - setFieldsForTest("test31"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(15, 30); - editor.launchLocalRefactor(); - editor.typeTextIntoEditor("kk"); - editor.typeTextIntoEditor(Keys.ENTER.toString()); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - @Test - public void checkRenameParameters33() throws Exception { - setFieldsForTest("test33"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - editor.waitTextIntoEditor(contentFromInA); - editor.goToCursorPositionVisible(16, 12); - editor.launchRefactorForm(); - refactor.waitRenameParametersFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(false); - refactor.typeAndWaitNewName("b"); - refactor.clickOkButtonRefactorForm(); - refactor.waitRenameParametersFormIsClosed(); - events.waitExpectedMessage(APPLY_WORKSPACE_CHANGES, DEFAULT_TIMEOUT); - editor.waitTextIntoEditor(contentFromOutA); - editor.closeFileByNameWithSaving("A"); - } - - private void renameLocalVariableByRefactorForm(String newValue) { - editor.launchRefactorForm(); - refactor.waitRenameParametersFormIsOpen(); - refactor.setAndWaitStateUpdateReferencesCheckbox(true); - refactor.typeAndWaitNewName(newValue); - refactor.clickOkButtonRefactorForm(); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = pathToPackageInChePrefix + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/parameters/" + nameCurrentTest + "/in/A.java"); - URL resourcesOutA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/parameters/" + nameCurrentTest + "/out/A.java"); - - contentFromInA = IoUtil.readAndCloseQuietly(resourcesInA.openStream()); - contentFromOutA = IoUtil.readAndCloseQuietly(resourcesOutA.openStream()); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/CheckTreeInRefactorPanelTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/CheckTreeInRefactorPanelTest.java deleted file mode 100644 index 3a4b480ecb2..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/CheckTreeInRefactorPanelTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.preview; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckTreeInRefactorPanelTest { - - private static final String PROJECT_NAME = CheckTreeInRefactorPanelTest.class.getSimpleName(); - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = - CheckTreeInRefactorPanelTest.this.getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void previewChangeTest() { - projectExplorer.waitProjectExplorer(); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - projectExplorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(27, 17); - editor.launchRefactorForm(); - refactorPanel.waitRenameParametersFormIsOpen(); - refactorPanel.typeAndWaitNewName("a3"); - refactorPanel.clickPreviewButtonRefactorForm(); - refactorPanel.clickOnItemByNameAndPosition("AppController.java", 0); - loader.waitOnClosed(); - refactorPanel.clickOnExpandItemByNameAndPosition("AppController", 0); - refactorPanel.setFlagItemByNameAndPosition("AppController", 0); - Assert.assertFalse( - refactorPanel.itemIsSelectedByNameAndPosition("Textual change", 0), - "This item in tree mustn't be selected."); - Assert.assertFalse( - refactorPanel.itemIsSelectedByNameAndPosition("Textual change", 1), - "This item in tree mustn't be selected."); - Assert.assertFalse( - refactorPanel.itemIsSelectedByNameAndPosition("Textual change", 2), - "This item in tree mustn't be selected."); - Assert.assertFalse( - refactorPanel.itemIsSelectedByNameAndPosition("Textual change", 3), - "This item in tree mustn't be selected."); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/PreviewRefactoringTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/PreviewRefactoringTest.java deleted file mode 100644 index 059661bc66e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/preview/PreviewRefactoringTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.preview; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.commons.lang.NameGenerator; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class PreviewRefactoringTest { - private static final String PROJECT_NAME = - NameGenerator.generate(PreviewRefactoringTest.class.getSimpleName(), 3); - - private static final String EXPECTED_TEXT_BEFORE_CHANGE = - "import javax.servlet.http.HttpServletResponse;\n" - + " public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + " @Override \n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String a = request.getParameter(\"numGuess\");\n" - + " String result = \"\"; \n" - + " if (a != null && a.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " else if (a != null) { \n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " } \n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);"; - - private static final String EXPECTED_TEXT_BEFORE_FIRST_SELECT_CHANGE = - " @Override \n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\"; \n" - + " if (a != null && numGuessByUser.equals(secretNum)) {\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " } \n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view; \n" - + " } \n" - + "} "; - - private static final String EXPECTED_TEXT_BEFORE_SECOND_SELECT_CHANGE = - " @Override \n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\"; \n" - + " if (numGuessByUser != null && \n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";\n" - + " } \n" - + " ModelAndView view = new ModelAndView(\"guess_num\");\n" - + " view.addObject(\"num\", result);\n" - + " return view; \n" - + " } \n" - + "}"; - - private static final String EXPECTED_TEXT_IN_LEFT_EDITOR = - "import javax.servlet.http.HttpServletResponse;\n" - + " public class AppController implements Controller {\n" - + " private static final String secretNum = Integer.toString(new Random().nextInt(10));\n" - + " @Override \n" - + " public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {\n" - + " String numGuessByUser = request.getParameter(\"numGuess\");\n" - + " String result = \"\"; \n" - + " if (numGuessByUser != null && numGuessByUser\n" - + " result = \"Congrats! The number is \" + secretNum;\n" - + " } \n" - + " else if (numGuessByUser != null) {\n" - + " result = \"Sorry, you failed. Try again later!\";"; - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer explorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private ProjectExplorer projectExplorer; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setUp() throws Exception { - URL resource = getClass().getResource("/projects/guess-project"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SPRING); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void checkPreviewRefreshTest() { - explorer.waitProjectExplorer(); - loader.waitOnClosed(); - explorer.waitItem(PROJECT_NAME); - loader.waitOnClosed(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - explorer.openItemByPath( - PROJECT_NAME + "/src/main/java/org/eclipse/qa/examples/AppController.java"); - editor.waitActive(); - editor.goToCursorPositionVisible(27, 17); - editor.launchRefactorForm(); - refactorPanel.waitRenameParametersFormIsOpen(); - refactorPanel.typeAndWaitNewName("a"); - refactorPanel.clickPreviewButtonRefactorForm(); - refactorPanel.clickOnItemByNameAndPosition("AppController.java", 0); - loader.waitOnClosed(); - refactorPanel.checkTextFromLeftEditor(EXPECTED_TEXT_IN_LEFT_EDITOR); - refactorPanel.checkTextFromRightEditor(EXPECTED_TEXT_BEFORE_CHANGE); - Assert.assertEquals(refactorPanel.getQuantityLeasedLineInLeftEditor(), 3); - Assert.assertEquals(refactorPanel.getQuantityLeasedLineInRightEditor(), 3); - refactorPanel.clickOnExpandItemByNameAndPosition("AppController", 0); - refactorPanel.clickOnItemByNameAndPosition("Textual change", 1); - loader.waitOnClosed(); - refactorPanel.checkTextFromRightEditor(EXPECTED_TEXT_BEFORE_FIRST_SELECT_CHANGE); - refactorPanel.clickOnItemByNameAndPosition("Textual change", 2); - loader.waitOnClosed(); - refactorPanel.checkTextFromRightEditor(EXPECTED_TEXT_BEFORE_SECOND_SELECT_CHANGE); - Assert.assertEquals(refactorPanel.getQuantityLeasedLineInLeftEditor(), 1); - Assert.assertEquals(refactorPanel.getQuantityLeasedLineInRightEditor(), 1); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/GenericsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/GenericsTest.java deleted file mode 100644 index f85d525b4d2..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/GenericsTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -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.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * // - * - * @author Musienko Maxim - */ -public class GenericsTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setup() throws Exception { - URL resource = GenericsTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void testGenerics2() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - setFieldsForTest("testGenerics2"); - - projectExplorer.quickRevealToItemWithJavaScript(pathToCurrentPackage + "/A.java"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - assertEquals(editor.getVisibleTextFromEditor(), contentFromInA); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToCurrentPackage + "/A.java"); - menu.runCommand(ASSISTANT, REFACTORING, RENAME); - - refactorPanel.typeAndWaitNewName("B.java"); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.acceptDialogWithText( - "Found potential matches. Please review changes on the preview page."); - askDialog.waitFormToClose(); - projectExplorer.waitItem(pathToCurrentPackage + "/B.java"); - assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB); - editor.waitTextIntoEditor(contentFromOutB); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/in/A.java"); - URL resourcesOutA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/out/B.java"); - - contentFromInA = getTextFromFile(resourcesInA); - contentFromOutB = getTextFromFile(resourcesOutA); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/IllegalTypeNameTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/IllegalTypeNameTest.java deleted file mode 100644 index 78671fac72c..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/IllegalTypeNameTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * // - * - * @author Musienko Maxim - */ -public class IllegalTypeNameTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String pathToCurrentPackage; - private String contentFromInA; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setup() throws Exception { - URL resource = IllegalTypeNameTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void illegalTypeName4() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - - projectExplorer.scrollToItemByPath(PROJECT_NAME + "/pom.xml"); - loader.waitOnClosed(); - setFieldsForTest("testIllegalTypeName4"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - assertEquals(editor.getVisibleTextFromEditor(), contentFromInA); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItemByName("A.java"); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "//A.java"); - contentFromInA = getTextFromFile(resourcesInA); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/RenameTypeTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/RenameTypeTest.java deleted file mode 100644 index 2f977ef63ec..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/RenameTypeTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME; -import static org.eclipse.che.selenium.core.constant.TestTimeoutsConstants.ELEMENT_TIMEOUT_SEC; - -import com.google.inject.Inject; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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.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; - -/** @author Musienko Maxim */ -public class RenameTypeTest { - private static final Logger LOG = LoggerFactory.getLogger(RenameTypeTest.class); - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = RenameTypeTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - loader.waitOnClosed(); - } - - @BeforeMethod - public void setCurrentFieldForTest(Method method) throws IOException, URISyntaxException { - setFieldsForTest(method.getName()); - } - - @AfterMethod - public void closeForm() { - try { - if (refactorPanel.isWidgetOpened()) { - loader.waitOnClosed(); - refactorPanel.clickCancelButtonRefactorForm(); - } - editor.closeAllTabs(); - } catch (WebDriverException e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @Test - public void test0() { - testCase(); - } - - @Test - public void test1() { - testCase(); - } - - @Test - public void test2() { - testCase(); - } - - @Test - public void test3() { - testCase(); - } - - @Test - public void test4() { - testCase(); - } - - @Test - public void test5() { - testCase(); - } - - @Test - public void test6() { - testCase(); - } - - @Test - public void test7() { - testCase(); - } - - @Test - public void test8() { - testCase(); - } - - @Test - public void test9() { - testCase(); - } - - private void setFieldsForTest(String nameCurrentTest) throws URISyntaxException, IOException { - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/in/A.java"); - URL resourcesOutA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/out/B.java"); - - contentFromInA = getTextFromFile(resourcesInA); - contentFromOutB = getTextFromFile(resourcesOutA); - } - - private String getTextFromFile(URL url) throws URISyntaxException, IOException { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } - - private void testCase() { - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToCurrentPackage + "/A.java"); - menu.runCommand(ASSISTANT, REFACTORING, RENAME); - - refactorPanel.typeAndWaitNewName("B.java"); - refactorPanel.clickOkButtonRefactorForm(); - - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - refactorPanel.waitRefactorPreviewFormIsClosed(); - loader.waitOnClosed(); - projectExplorer.waitAndSelectItem(pathToCurrentPackage + "/B.java"); - projectExplorer.clickOnRefreshTreeButton(); - projectExplorer.waitItem(pathToCurrentPackage + "/B.java", ELEMENT_TIMEOUT_SEC); - projectExplorer.openItemByPath(pathToCurrentPackage + "/B.java"); - editor.waitTextIntoEditor(contentFromOutB); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestAnnotationsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestAnnotationsTest.java deleted file mode 100644 index 405e27a53de..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestAnnotationsTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static java.lang.String.format; -import static java.nio.charset.Charset.forName; -import static java.nio.file.Files.readAllLines; -import static java.nio.file.Paths.get; -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME; - -import com.google.common.base.Joiner; -import com.google.inject.Inject; -import java.net.URL; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -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.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class TestAnnotationsTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromInB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private Consoles consoles; - - @BeforeClass - public void setup() throws Exception { - URL resource = TestAnnotationsTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), get(resource.toURI()), PROJECT_NAME, ProjectTemplates.MAVEN_SIMPLE); - - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void testAnnotation1() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - projectExplorer.quickExpandWithJavaScript(); - - setFieldsForTest("testAnnotation1"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToCurrentPackage + "/A.java"); - menu.runCommand(ASSISTANT, REFACTORING, RENAME); - - refactorPanel.typeAndWaitNewName("B.java"); - try { - refactorPanel.clickOkButtonRefactorForm(); - } catch (org.openqa.selenium.TimeoutException ex) { - refactorPanel.typeAndWaitNewName("B.java"); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.clickOkButtonRefactorForm(); - } - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - projectExplorer.waitItem(pathToCurrentPackage + "/B.java"); - editor.waitTextIntoEditor(contentFromInB); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - format("/org/eclipse/che/selenium/refactor/types/%s/in/A.java", nameCurrentTest)); - URL resourcesOutA = - getClass() - .getResource( - format("/org/eclipse/che/selenium/refactor/types/%s/out/B.java", nameCurrentTest)); - - contentFromInA = getTextFromFile(resourcesInA); - contentFromInB = getTextFromFile(resourcesOutA); - } - - private String getTextFromFile(URL url) throws Exception { - return Joiner.on("\n").join(readAllLines(get(url.toURI()), forName("UTF-8"))); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestEnumerationsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestEnumerationsTest.java deleted file mode 100644 index 146ab0d3f46..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestEnumerationsTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.ASSISTANT; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.REFACTORING; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Assistant.Refactoring.RENAME; -import static org.testng.Assert.assertEquals; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -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.Keys; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -public class TestEnumerationsTest { - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String pathToCurrentPackage; - private String contentFromInA; - private String contentFromOutB; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private Consoles consoles; - @Inject private Menu menu; - @Inject private AskDialog askDialog; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = TestEnumerationsTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - ide.open(workspace); - ide.waitOpenedWorkspaceIsReadyToUse(); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - } - - @Test - public void testEnum1() throws Exception { - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - - setFieldsForTest("testEnum1"); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitTextIntoEditor(contentFromInA); - projectExplorer.waitAndSelectItem(pathToCurrentPackage + "/A.java"); - menu.runCommand(ASSISTANT, REFACTORING, RENAME); - - refactorPanel.typeAndWaitNewName("B.java"); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.clickOkButtonRefactorForm(); - askDialog.waitFormToOpen(); - askDialog.clickOkBtn(); - askDialog.waitFormToClose(); - projectExplorer.waitItem(pathToCurrentPackage + "/B.java"); - assertEquals(editor.getVisibleTextFromEditor(), contentFromOutB); - editor.waitTextIntoEditor(contentFromOutB); - } - - private void setFieldsForTest(String nameCurrentTest) throws Exception { - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - - URL resourcesInA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/in/A.java"); - URL resourcesOutA = - getClass() - .getResource( - "/org/eclipse/che/selenium/refactor/types/" + nameCurrentTest + "/out/B.java"); - - contentFromInA = getTextFromFile(resourcesInA); - contentFromOutB = getTextFromFile(resourcesOutA); - } - - private String getTextFromFile(URL url) throws Exception { - String result = ""; - List listWithAllLines = - Files.readAllLines(Paths.get(url.toURI()), Charset.forName("UTF-8")); - for (String buffer : listWithAllLines) { - result += buffer + '\n'; - } - - return result; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestFailTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestFailTest.java deleted file mode 100644 index 95f7b9ebb3e..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/refactor/types/TestFailTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.refactor.types; - -import static org.eclipse.che.commons.lang.NameGenerator.generate; - -import com.google.inject.Inject; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.AskDialog; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.Refactor; -import org.openqa.selenium.Keys; -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; - -/** @author Musienko Maxim */ -public class TestFailTest { - private static final Logger LOG = LoggerFactory.getLogger(TestEnumerationsTest.class); - private static final String PROJECT_NAME = generate("project", 4); - private static final String PATH_TO_PACKAGE_IN_CHE_PREFIX = - PROJECT_NAME + "/src/main/java/renametype"; - - private String renameItem = "B.java"; - private String pathToCurrentPackage; - - @Inject private TestWorkspace workspace; - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private CodenvyEditor editor; - @Inject private Refactor refactorPanel; - @Inject private Consoles consoles; - @Inject private AskDialog askDialog; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private Refactor refactor; - @Inject private TestProjectServiceClient testProjectServiceClient; - - @BeforeClass - public void setup() throws Exception { - URL resource = TestFailTest.this.getClass().getResource("/projects/RenameType"); - testProjectServiceClient.importProject( - workspace.getId(), - Paths.get(resource.toURI()), - PROJECT_NAME, - ProjectTemplates.MAVEN_SIMPLE); - - ide.open(workspace); - consoles.waitJDTLSProjectResolveFinishedMessage(PROJECT_NAME); - - projectExplorer.waitProjectExplorer(); - projectExplorer.waitItem(PROJECT_NAME); - consoles.closeProcessesArea(); - projectExplorer.quickExpandWithJavaScript(); - } - - @BeforeMethod - public void setFieldsForTest(Method method) { - try { - String nameCurrentTest = method.getName(); - pathToCurrentPackage = PATH_TO_PACKAGE_IN_CHE_PREFIX + "/" + nameCurrentTest; - } catch (Exception e) { - LOG.error(e.getLocalizedMessage(), e); - } - } - - @AfterMethod - public void closeForm() { - if (refactor.isWidgetOpened()) { - refactor.clickCancelButtonRefactorForm(); - } - if (editor.isAnyTabsOpened()) { - editor.closeAllTabs(); - } - } - - @Test - public void testFail26() { - loader.waitOnClosed(); - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - refactor.invokeRefactorWizardForProjectExplorerItem(pathToCurrentPackage + "/A.java"); - doRefactorWithWidget(renameItem); - refactorPanel.waitTextInErrorMessage("Compilation unit 'B.java' already exists"); - refactorPanel.clickCancelButtonRefactorForm(); - } - - @Test(priority = 1) - public void testFail35() { - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - refactor.invokeRefactorWizardForProjectExplorerItem(pathToCurrentPackage + "/A.java"); - doRefactorWithWidget(renameItem); - askDialog.waitFormToOpen(); - askDialog.acceptDialogWithText( - "Found potential matches. Please review changes on the preview page."); - askDialog.waitFormToClose(); - } - - @Test(priority = 2) - public void testFail80() { - projectExplorer.openItemByPath(pathToCurrentPackage + "/A.java"); - editor.waitActive(); - refactor.invokeRefactorWizardForProjectExplorerItem(pathToCurrentPackage + "/A.java"); - doRefactorWithWidget(renameItem); - askDialog.waitFormToOpen(); - askDialog.acceptDialogWithText( - "Local Type declared inside 'renametype.testFail80.A' is named B"); - askDialog.waitFormToClose(); - } - - /** - * type new class into field of the refactoring widget and clickOkBtn - * - * @param newClassName the new class for refactoring - */ - private void doRefactorWithWidget(String newClassName) { - try { - refactorPanel.typeAndWaitNewName(newClassName); - refactorPanel.clickOkButtonRefactorForm(); - } catch (WebDriverException ex) { - LOG.warn(ex.getLocalizedMessage()); - refactorPanel.typeAndWaitNewName(newClassName); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.sendKeysIntoField(Keys.ARROW_LEFT.toString()); - refactorPanel.clickOkButtonRefactorForm(); - } - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/swagger/SwaggerTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/swagger/SwaggerTest.java index 1cbabe6ad9c..6bbeb0a450a 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/swagger/SwaggerTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/swagger/SwaggerTest.java @@ -11,15 +11,12 @@ */ package org.eclipse.che.selenium.swagger; -import static org.testng.Assert.assertTrue; +import static org.testng.Assert.assertEquals; import com.google.inject.Inject; import org.eclipse.che.selenium.core.SeleniumWebDriver; import org.eclipse.che.selenium.core.provider.TestIdeUrlProvider; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Ide; import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Swagger; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -27,10 +24,7 @@ public class SwaggerTest { @Inject private TestIdeUrlProvider ideUrlProvider; - @Inject private Ide ide; - @Inject private TestWorkspace workspace; @Inject private Loader loader; - @Inject private Swagger swagger; @Inject private SeleniumWebDriver driver; private String swaggerUrl; @@ -38,13 +32,11 @@ public class SwaggerTest { @BeforeClass public void setUp() throws Exception { swaggerUrl = ideUrlProvider.get() + "swagger/"; - ide.open(workspace); } @Test - public void checkNameProjectTest() throws Exception { + public void checkNameProjectTest() { driver.navigate().to(swaggerUrl); - - assertTrue(swagger.getWsNamesFromWorkspacePage().contains(workspace.getName())); + assertEquals(driver.getCurrentUrl(), swaggerUrl); } } diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/CompileCommand.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/CompileCommand.java deleted file mode 100644 index 51900699f04..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/CompileCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.testrunner; - -import static org.eclipse.che.selenium.core.constant.TestGoalsConstants.TEST; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.che.api.core.model.workspace.config.Command; - -/** @author Vitalii Parfonov */ -public class CompileCommand implements Command { - - private final String name; - private final String type; - private final String commandLine; - private final Map attribute; - - public CompileCommand( - String name, String type, String commandLine, Map attribute) { - this.name = name; - this.type = type; - this.commandLine = commandLine; - this.attribute = attribute; - } - - public CompileCommand() { - name = "test-compile"; - type = "mvn"; - commandLine = "mvn test-compile -f ${current.project.path}"; - attribute = new HashMap<>(); - attribute.put("goal", TEST); - } - - @Override - public String getName() { - return name; - } - - @Override - public String getCommandLine() { - return commandLine; - } - - @Override - public String getType() { - return type; - } - - @Override - public Map getAttributes() { - return attribute; - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4CheckRunSuitesAndScopesTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4CheckRunSuitesAndScopesTest.java deleted file mode 100644 index 39d6be6a027..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4CheckRunSuitesAndScopesTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.testrunner; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.server.DtoConverter; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Musienko Maxim */ -@Test(groups = FLAKY) -public class JavaTestPluginJunit4CheckRunSuitesAndScopesTest { - private static final String JUNIT4_PROJECT = "junit4-tests-with-separeted-suites"; - - private static final String PATH_TO_JUNIT4_TEST_CLASSES = - JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/tests/AppOneTest.java"; - - private static final int VALUE_OF_SHIFTING_CONSOLES_ALONG_X_AXIS = -100; - - @Inject private JavaTestRunnerPluginConsole pluginConsole; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - - @Inject private TestWorkspace ws; - - @Inject private Ide ide; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private TestProjectServiceClient projectServiceClient; - - @BeforeClass - public void prepareTestProject() throws Exception { - CompileCommand compileCommand = new CompileCommand(); - testCommandServiceClient.createCommand(DtoConverter.asDto(compileCommand), ws.getId()); - projectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass() - .getResource("/projects/plugins/JavaTestRunnerPlugin/" + JUNIT4_PROJECT) - .toURI()), - JUNIT4_PROJECT, - ProjectTemplates.CONSOLE_JAVA_SIMPLE); - ide.open(ws); - loader.waitOnClosed(); - projectExplorer.waitItem(JUNIT4_PROJECT); - - try { - runCompileCommandByPallete(compileCommand); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/12220"); - } - - notifications.waitProgressPopupPanelClose(); - consoles.dragConsolesInDefinePosition(VALUE_OF_SHIFTING_CONSOLES_ALONG_X_AXIS); - } - - @Test - public void shouldExecuteJUnit4TestClassWithDifferentStatuses() throws InterruptedException { - // given - String expectedResultAfterFirstLaunch = - "Default Suite\n" - + "org.eclipse.che.tests.AppOneTest\n" - + "shouldBeIgnoredOfAppOne\n" - + "shouldSuccessOfAppOne\n" - + "shouldFailOfAppOne\n" - + "org.eclipse.che.suite.Junit4TestSuite\n" - + "org.eclipse.che.tests.AppAnotherTest\n" - + "shouldFailOfAppAnother\n" - + "shouldSuccessOfAppAnother\n" - + "org.eclipse.che.tests.AppAnotherTest\n" - + "shouldFailOfAppAnother\n" - + "shouldSuccessOfAppAnother\n" - + "org.eclipse.che.tests.AppAnotherTest\n" - + "shouldFailOfAppAnother\n" - + "shouldSuccessOfAppAnother"; - - String expectedExceptionForFailedTest = - "java.lang.AssertionError\n" - + " at org.junit.Assert.fail(Assert.java:86)\n" - + " at org.junit.Assert.assertTrue(Assert.java:41)"; - - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_JUNIT4_TEST_CLASSES); - projectExplorer.waitAndSelectItem(JUNIT4_PROJECT); - // when - menu.runCommand( - TestMenuCommandsConstants.Run.RUN_MENU, - TestMenuCommandsConstants.Run.TEST, - TestMenuCommandsConstants.JUNIT_TEST_DROP_DAWN_ITEM); - - // then - notifications.waitExpectedMessageOnProgressPanelAndClose("Test runner executed successfully."); - pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.tests.AppAnotherTest"); - assertTrue(pluginConsole.getTextFromResultTree().equals(expectedResultAfterFirstLaunch)); - pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.tests.AppOneTest"); - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); - pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppOne"); - pluginConsole.selectMethodWithDefinedStatus(FAILED, "shouldFailOfAppAnother"); - assertTrue(pluginConsole.getTestErrorMessage().startsWith(expectedExceptionForFailedTest)); - } - - private void runCompileCommandByPallete(CompileCommand compileCommand) { - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(compileCommand.getName()); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4Test.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4Test.java deleted file mode 100644 index a25f1b1cb5f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginJunit4Test.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.testrunner; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.TEST; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.TEST_DROP_DAWN_ITEM; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.IGNORED; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.PASSED; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.server.DtoConverter; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -@Test(groups = FLAKY) -public class JavaTestPluginJunit4Test { - - private static final String JUNIT4_PROJECT = "junit4-tests"; - private static final String PATH_TO_JUNIT4_TEST_CLASS = - JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/AppOneTest.java"; - private static final String PATH_TO_JUNIT4_ANOTHER_TEST = - JUNIT4_PROJECT + "/src/test/java/org/eclipse/che/examples/AppAnotherTest.java"; - - public static final String APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE = - "java.lang.AssertionError\n" - + " at org.junit.Assert.fail(Assert.java:86)\n" - + " at org.junit.Assert.assertTrue(Assert.java:41)\n" - + " at org.junit.Assert.assertFalse(Assert.java:64)\n" - + " at org.junit.Assert.assertFalse(Assert.java:74)\n" - + " at org.eclipse.che.examples.AppOneTest.shouldFailOfAppOne(AppOneTest.java:34)"; - - public static final String APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE = - "java.lang.AssertionError\n" - + " at org.junit.Assert.fail(Assert.java:86)\n" - + " at org.junit.Assert.assertTrue(Assert.java:41)\n" - + " at org.junit.Assert.assertFalse(Assert.java:64)\n" - + " at org.junit.Assert.assertFalse(Assert.java:74)\n" - + " at org.eclipse.che.examples.AppAnotherTest.shouldFailOfAppAnother(AppAnotherTest.java:35)"; - - @Inject private JavaTestRunnerPluginConsole pluginConsole; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - @Inject private TestWorkspace ws; - @Inject private Ide ide; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private TestProjectServiceClient projectServiceClient; - - @BeforeClass - public void prepareTestProject() throws Exception { - CompileCommand compileCommand = new CompileCommand(); - testCommandServiceClient.createCommand(DtoConverter.asDto(compileCommand), ws.getId()); - projectServiceClient.importProject( - ws.getId(), - Paths.get( - getClass() - .getResource("/projects/plugins/JavaTestRunnerPlugin/" + JUNIT4_PROJECT) - .toURI()), - JUNIT4_PROJECT, - ProjectTemplates.CONSOLE_JAVA_SIMPLE); - - ide.open(ws); - ide.waitOpenedWorkspaceIsReadyToUse(); - - projectExplorer.waitItem(JUNIT4_PROJECT); - consoles.waitJDTLSProjectResolveFinishedMessage(JUNIT4_PROJECT); - notifications.waitProgressPopupPanelClose(); - projectExplorer.quickExpandWithJavaScript(); - - try { - runCompileCommandByPallete(compileCommand); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/12220"); - } - } - - private void runCompileCommandByPallete(CompileCommand compileCommand) { - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(compileCommand.getName()); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - } - - @Test - public void shouldExecuteJUnit4TestClassWithDifferentStatuses() throws InterruptedException { - // given - projectExplorer.openItemByPath(PATH_TO_JUNIT4_TEST_CLASS); - - // when - menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM); - - // then - notifications.waitExpectedMessageOnProgressPanelAndClose("Test runner executed successfully."); - - pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.examples.AppOneTest"); - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); - pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppOne"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(IGNORED).size() == 1); - String testErrorMessage = pluginConsole.getTestErrorMessage(); - assertTrue( - testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), - "Actual message was: " + testErrorMessage); - } - - @Test(priority = 1) - public void shouldExecuteJUnit4MethodWithDifferentStatuses() throws InterruptedException { - // given - projectExplorer.openItemByPath(PATH_TO_JUNIT4_ANOTHER_TEST); - editor.waitActive(); - - editor.goToCursorPositionVisible(28, 5); - - // when - menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM); - notifications.waitExpectedMessageOnProgressPanelAndClose("Test runner executed successfully."); - - // then - pluginConsole.waitFqnOfTesClassInResultTree("org.eclipse.che.examples.AppAnotherTest"); - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); - // then - - editor.goToCursorPositionVisible(33, 5); - menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM); - notifications.waitExpectedMessageOnProgressPanelAndClose("Test runner executed successfully."); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); - String testErrorMessage = pluginConsole.getTestErrorMessage(); - assertTrue( - testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), - "Actual message was: " + testErrorMessage); - - editor.goToCursorPositionVisible(39, 5); - menu.runCommand(RUN_MENU, TEST, TEST_DROP_DAWN_ITEM); - notifications.waitExpectedMessageOnProgressPanelAndClose("Test runner executed successfully."); - pluginConsole.waitMethodMarkedAsIgnored("shouldBeIgnoredOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(IGNORED).size() == 1); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java deleted file mode 100644 index 9d0f6b7db80..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/testrunner/JavaTestPluginTestNgTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.testrunner; - -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.RUN_MENU; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Run.TEST; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.TEST_NG_TEST_DROP_DAWN_ITEM; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.FAILED; -import static org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole.JunitMethodsState.PASSED; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import com.google.inject.Inject; -import java.net.URL; -import java.nio.file.Paths; -import org.eclipse.che.api.workspace.server.DtoConverter; -import org.eclipse.che.selenium.core.client.TestCommandServiceClient; -import org.eclipse.che.selenium.core.client.TestProjectServiceClient; -import org.eclipse.che.selenium.core.constant.TestBuildConstants; -import org.eclipse.che.selenium.core.project.ProjectTemplates; -import org.eclipse.che.selenium.core.user.DefaultTestUser; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CodenvyEditor; -import org.eclipse.che.selenium.pageobject.Consoles; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Loader; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.intelligent.CommandsPalette; -import org.eclipse.che.selenium.pageobject.plugins.JavaTestRunnerPluginConsole; -import org.openqa.selenium.TimeoutException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Dmytro Nochevnov */ -@Test(groups = FLAKY) -public class JavaTestPluginTestNgTest { - - private static final String PROJECT = "testng-tests"; - - private static final String PATH_TO_TEST_CLASS = - PROJECT + "/src/test/java/org/eclipse/che/examples/AppOneTest.java"; - private static final String PATH_TO_ANOTHER_TEST_CLASS = - PROJECT + "/src/test/java/org/eclipse/che/examples/AppAnotherTest.java"; - - public static final String APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE = - "[TestNG] Running: /home/user/che/ws-agent/temp/che-testng-suite.xmlexpected [false] but found [true]\n" - + "java.lang.AssertionError: expected [false] but found [true]\n" - + " at org.testng.Assert.fail(Assert.java:94)\n" - + " at org.testng.Assert.failNotEquals(Assert.java:494)\n" - + " at org.testng.Assert.assertFalse(Assert.java:63)\n" - + " at org.testng.Assert.assertFalse(Assert.java:73)\n" - + " at org.eclipse.che.examples.AppOneTest.shouldFailOfAppOne(AppOneTest.java:32)"; - - public static final String APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE = - "[TestNG] Running: /home/user/che/ws-agent/temp/che-testng-suite.xmlexpected [false] but found [true]\n" - + "java.lang.AssertionError: expected [false] but found [true]\n" - + " at org.testng.Assert.fail(Assert.java:94)\n" - + " at org.testng.Assert.failNotEquals(Assert.java:494)\n" - + " at org.testng.Assert.assertFalse(Assert.java:63)\n" - + " at org.testng.Assert.assertFalse(Assert.java:73)"; - - public static final String END_OF_FAILED_TEST = - "===============================================Default SuiteTotal tests run: 1, Failures: 1, Skips: 0==============================================="; - - @InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU_JDK8) - private TestWorkspace ws; - - @Inject private Ide ide; - @Inject private DefaultTestUser user; - - @Inject private JavaTestRunnerPluginConsole pluginConsole; - @Inject private ProjectExplorer projectExplorer; - @Inject private Loader loader; - @Inject private NotificationsPopupPanel notifications; - @Inject private Menu menu; - @Inject private TestCommandServiceClient testCommandServiceClient; - @Inject private TestProjectServiceClient testProjectServiceClient; - @Inject private CommandsPalette commandsPalette; - @Inject private Consoles consoles; - @Inject private CodenvyEditor editor; - - @BeforeClass - public void prepareTestProject() throws Exception { - URL resource = getClass().getResource("/projects/plugins/JavaTestRunnerPlugin/testng-tests"); - - CompileCommand compileCommand = new CompileCommand(); - testCommandServiceClient.createCommand(DtoConverter.asDto(compileCommand), ws.getId()); - testProjectServiceClient.importProject( - ws.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.CONSOLE_JAVA_SIMPLE); - - ide.open(ws); - loader.waitOnClosed(); - projectExplorer.waitItem(PROJECT); - notifications.waitProgressPopupPanelClose(); - - try { - runCompileCommandByPallete(compileCommand); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/12220"); - } - } - - @Test - public void shouldExecuteTestClassSuccessfully() { - // given - projectExplorer.quickRevealToItemWithJavaScript(PATH_TO_ANOTHER_TEST_CLASS); - projectExplorer.openItemByPath(PATH_TO_TEST_CLASS); - // when - - editor.waitActive(); - menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - - // then - try { - notifications.waitExpectedMessageOnProgressPanelAndClose( - "Test runner executed successfully."); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppOne"); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppOne"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); - String testErrorMessage = pluginConsole.getTestErrorMessage(); - assertTrue( - testErrorMessage.startsWith(APP_TEST_ONE_FAIL_OUTPUT_TEMPLATE), - "Actual message was: " + testErrorMessage); - } - - @Test(priority = 1) - public void shouldExecuteTestMethodsSuccessfully() { - // given - projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); - - // then - editor.waitActive(); - editor.goToCursorPositionVisible(26, 17); - menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - - try { - notifications.waitExpectedMessageOnProgressPanelAndClose( - "Test runner executed successfully."); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); - editor.goToCursorPositionVisible(31, 17); - menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); - - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); - String testErrorMessage = pluginConsole.getTestErrorMessage(); - assertTrue( - testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), - "Actual message was: " + testErrorMessage); - assertTrue( - testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); - } - - @Test(priority = 2) - public void shouldExecuteAllTests() { - // given - projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); - - // then - editor.waitActive(); - editor.goToCursorPositionVisible(26, 17); - menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - - try { - notifications.waitExpectedMessageOnProgressPanelAndClose( - "Test runner executed successfully."); - } catch (TimeoutException ex) { - // remove try-catch block after issue has been resolved - fail("Known random failure https://github.com/eclipse/che/issues/10728"); - } - - pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); - editor.goToCursorPositionVisible(31, 17); - menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); - pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); - assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); - String testErrorMessage = pluginConsole.getTestErrorMessage(); - assertTrue( - testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), - "Actual message was: " + testErrorMessage); - assertTrue( - testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); - } - - private void runCompileCommandByPallete(CompileCommand compileCommand) { - commandsPalette.openCommandPalette(); - commandsPalette.startCommandByDoubleClick(compileCommand.getName()); - consoles.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java index 9b6475ebecb..14ae5af0048 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/theia/TheiaBuildPluginTest.java @@ -42,6 +42,7 @@ import org.testng.annotations.Test; @Test(groups = {OPENSHIFT, UNDER_REPAIR}) +/** TODO the test looks outdated */ public class TheiaBuildPluginTest { private static final String WORKSPACE_NAME = NameGenerator.generate("wksp-", 5); private static final String EXPECTED_DEVELOPMENT_HOST_TITLE = "Development Host"; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStopStartWsTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStopStartWsTest.java deleted file mode 100644 index 52c5e7b0ca1..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStopStartWsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.workspaces; - -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.STOP_WORKSPACE; -import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.Menu; -import org.eclipse.che.selenium.pageobject.NotificationsPopupPanel; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** @author Andrey Chizhikov */ -public class CheckStopStartWsTest { - @Inject private TestWorkspace testWorkspace; - @Inject private NotificationsPopupPanel notificationsPopupPanel; - @Inject private ToastLoader toastLoader; - @Inject private Menu menu; - @Inject private Ide ide; - - @BeforeClass - public void setUp() throws Exception { - ide.open(testWorkspace); - } - - @Test - public void checkStopStartWorkspaceTest() { - ide.waitOpenedWorkspaceIsReadyToUse(); - notificationsPopupPanel.waitPopupPanelsAreClosed(); - - menu.runCommand(WORKSPACE, STOP_WORKSPACE); - toastLoader.waitExpectedTextInToastLoader("Workspace is not running"); - - toastLoader.clickOnToastLoaderButton("Start"); - ide.waitOpenedWorkspaceIsReadyToUse(); - } -} diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStoppingWsByTimeoutTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStoppingWsByTimeoutTest.java index e8a1a1f409b..ef5ceaf7387 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStoppingWsByTimeoutTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CheckStoppingWsByTimeoutTest.java @@ -13,6 +13,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.STOPPED; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.core.utils.WaitUtils.sleepQuietly; import static org.testng.Assert.assertEquals; @@ -30,6 +31,8 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class CheckStoppingWsByTimeoutTest { private static int TOASTLOADER_WIDGET_LATENCY_TIMEOUT_IN_MILLISEC = 20000; diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CreateWorkspaceOnDashboardTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CreateWorkspaceOnDashboardTest.java index de943fd35e6..c4050f55200 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CreateWorkspaceOnDashboardTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/CreateWorkspaceOnDashboardTest.java @@ -94,8 +94,8 @@ public void createWorkspaceOnDashboardTest() { theiaIde.pressKeyCombination(Keys.LEFT_CONTROL, Keys.LEFT_SHIFT, "p"); theiaProposalForm.waitForm(); theiaProposalForm.enterTextToSearchField(">clo"); - theiaProposalForm.waitProposal("Git: Clone..."); - theiaProposalForm.clickOnProposal("Git: Clone..."); + theiaProposalForm.waitProposal("Git: Clone"); + theiaProposalForm.clickOnProposal("Git: Clone"); theiaProposalForm.enterTextToSearchField(WEB_JAVA_SPRING_SAMPLE_URL); seleniumWebDriverHelper.pressEnter(); theiaProjectTree.waitItem(PROJECT_NAME); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRefreshTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRefreshTest.java index b2e347c9dff..ab3b55c944f 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRefreshTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRefreshTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.workspaces; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; import com.google.inject.Inject; @@ -27,7 +28,8 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -/** @author Andrey chizhikov */ +/** @author Andrey chizhikov TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class ProjectStateAfterRefreshTest { private static final String PROJECT_NAME = NameGenerator.generate("project", 5); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRenameWorkspaceTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRenameWorkspaceTest.java index 97fdca925f9..149a2244abd 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRenameWorkspaceTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterRenameWorkspaceTest.java @@ -11,6 +11,7 @@ */ package org.eclipse.che.selenium.workspaces; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; import com.google.inject.Inject; @@ -33,6 +34,8 @@ import org.testng.annotations.Test; /** @author Aleksandr Shmaraev */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class ProjectStateAfterRenameWorkspaceTest { private static final String PROJECT_NAME = NameGenerator.generate("project", 4); private static final String WORKSPACE_NEW_NAME = NameGenerator.generate("rename_ws", 4); diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterWorkspaceRestartTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterWorkspaceRestartTest.java index d32f855e0e1..dabcce93807 100644 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterWorkspaceRestartTest.java +++ b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/ProjectStateAfterWorkspaceRestartTest.java @@ -11,7 +11,7 @@ */ package org.eclipse.che.selenium.workspaces; -import static org.eclipse.che.selenium.core.TestGroup.FLAKY; +import static org.eclipse.che.selenium.core.TestGroup.UNDER_REPAIR; import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.STOP_WORKSPACE; import static org.eclipse.che.selenium.core.constant.TestMenuCommandsConstants.Workspace.WORKSPACE; import static org.eclipse.che.selenium.core.project.ProjectTemplates.MAVEN_SPRING; @@ -33,8 +33,9 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -/** @author Aleksandr Shmaraev on 10.03.16 */ -@Test(groups = FLAKY) +/** @author Aleksandr Shmaraev on 10.03.16 * */ +/** TODO rewrite to use che7 workspace */ +@Test(groups = UNDER_REPAIR) public class ProjectStateAfterWorkspaceRestartTest { private static final String PROJECT_NAME = NameGenerator.generate("project", 4); private static final String EXP_TEXT_NOT_PRESENT = diff --git a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/WorkspaceFromOfficialUbuntuImageStartTest.java b/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/WorkspaceFromOfficialUbuntuImageStartTest.java deleted file mode 100644 index 52ebbaedc6f..00000000000 --- a/selenium/che-selenium-test/src/test/java/org/eclipse/che/selenium/workspaces/WorkspaceFromOfficialUbuntuImageStartTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2012-2018 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package org.eclipse.che.selenium.workspaces; - -import com.google.inject.Inject; -import org.eclipse.che.selenium.core.TestGroup; -import org.eclipse.che.selenium.core.workspace.InjectTestWorkspace; -import org.eclipse.che.selenium.core.workspace.TestWorkspace; -import org.eclipse.che.selenium.core.workspace.WorkspaceTemplate; -import org.eclipse.che.selenium.pageobject.CheTerminal; -import org.eclipse.che.selenium.pageobject.Ide; -import org.eclipse.che.selenium.pageobject.ProjectExplorer; -import org.eclipse.che.selenium.pageobject.ToastLoader; -import org.testng.annotations.Test; - -/** @author Alexander Garagatyi */ -@Test(groups = {TestGroup.DOCKER}) -public class WorkspaceFromOfficialUbuntuImageStartTest { - @InjectTestWorkspace(template = WorkspaceTemplate.UBUNTU) - private TestWorkspace testWorkspace; - - @Inject private Ide ide; - @Inject private ProjectExplorer projectExplorer; - @Inject private ToastLoader toastLoader; - @Inject private CheTerminal terminal; - - public void ensureWorkspaceStartsFromOfficialUbuntuImage() throws Exception { - ide.open(testWorkspace); - projectExplorer.waitProjectExplorer(); - terminal.waitFirstTerminalTab(); - } -} diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml index 970b9cd5d16..ad81f507ddc 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml @@ -32,13 +32,9 @@ - - - - - + diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheProdPreviewSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheProdPreviewSuite.xml index fa9d7db2f13..9bd51ba910b 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheProdPreviewSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheProdPreviewSuite.xml @@ -18,20 +18,11 @@ thread-count="1"> - - - - - - - - - diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml index 25f9d10bcea..f4d8810023f 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml @@ -19,223 +19,29 @@ - - - - - - - - - - - - - - - + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - diff --git a/selenium/che-selenium-test/src/test/resources/suites/SmokeTestsSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/SmokeTestsSuite.xml index 2e602eea2ae..93cd60389b8 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/SmokeTestsSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/SmokeTestsSuite.xml @@ -18,37 +18,6 @@ thread-count="4"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -