@Test public void quickOutline() throws Exception { IDE.LOADER.waitClosed(); IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(projectName); IDE.LOADER.waitClosed(); IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(projectName); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("src/main/java"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("src/main/java"); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("helloworld"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("helloworld"); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(FILE_NAME); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick(FILE_NAME); IDE.CODE_ASSISTANT_JAVA.waitForJavaToolingInitialized(FILE_NAME); IDE.GOTOLINE.goToLine(24); IDE.JAVAEDITOR.typeTextIntoJavaEditor(Keys.chord(Keys.CONTROL, "o")); waitForQuickOutlineOpened(); assertElementPresent("helloworld"); assertElementPresent("GreetingController"); assertElementPresent("handleRequest(HttpServletRequest, HttpServletResponse)"); selectItem("GreetingController"); waitForQuickOutlineClosed(); IDE.STATUSBAR.waitCursorPositionAt("12 : 1"); }
@Test public void renameAndDeleteRemoteBranchTest() throws Exception { IDE.GET_STARTED_WIZARD.waitAndCloseWizard(); IDE.EXPLORER.waitOpened(); // Clone test repository again with specific remote name. IDE.MENU.runCommand(MenuCommands.Git.GIT, MenuCommands.Git.CLONE_REPOSITORY); IDE.GIT.waitGitCloneForm(); IDE.GIT.typeRemoteGitRepositoryURI(REPO_URL); IDE.GIT.clickCloneButtonOnCloneRemoteRepositoryForm(); IDE.LOADER.waitClosed(); IDE.OUTPUT.waitOpened(); IDE.OUTPUT.waitForSubTextPresent(REPO_URL + " was successfully cloned."); IDE.OUTPUT.waitForSubTextPresent("[INFO] Project preparing successful."); IDE.LOADER.waitClosed(); IDE.INVITE_FORM.waitInviteDevelopersOpened(); IDE.INVITE_FORM.clickOnCancelButton(); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(PROJECT); // Open "Branches" window. IDE.MENU.runCommand(MenuCommands.Git.GIT, MenuCommands.Git.BRANCHES); IDE.GIT.waitBranhesOpened(); IDE.GIT.waitFieldWithNewNameBranchForm("origin/master"); IDE.GIT.waitFieldWithNewNameBranchForm("master"); IDE.GIT.selectBranchInList("origin/master"); // Checkout to the master remote branch. IDE.GIT.clickCheckOutBtn(); IDE.LOADER.waitClosed(); IDE.GIT.clickCloseBranchBtn(); IDE.OUTPUT.waitOpened(); IDE.OUTPUT.waitForSubTextPresent("fatal: A branch named 'master' already exists"); }
@Test public void gitInitCommand() throws Exception { IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(PROJECT); IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.SHELL.setIDEWindowHandle(driver.getWindowHandle()); IDE.SHELL.callShellFromIde(); IDE.SHELL.waitContainsTextInShell("Welcome to Codenvy Shell"); IDE.SHELL.waitContainsTextInShell(PROJECT + "$"); IDE.SHELL.typeAndExecuteCommand("git status"); IDE.SHELL.waitContainsTextInShell(gitStMess); IDE.SHELL.switchToIDE(); }
@Test public void testCodeOutlineJSP() throws Exception { IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(PROJECT); IDE.EXPLORER.waitForItem(PROJECT + "/" + FILE_NAME); IDE.LOADER.waitClosed(); IDE.EXPLORER.openItem(PROJECT + "/" + FILE_NAME); IDE.EDITOR.waitActiveFile(); // TODO Pause for build outline tree // after implementation method for check ready state, should be remove Thread.sleep(2000); IDE.TOOLBAR.runCommand(ToolbarCommands.View.SHOW_OUTLINE); IDE.OUTLINE.waitOpened(); IDE.OUTLINE.waitOutlineTreeVisible(); checkTreeCorrectlyCreated(); checkClickOnTreeElements(); IDE.EDITOR.closeFile(FILE_NAME); IDE.EDITOR.waitTabNotPresent(FILE_NAME); }
@Test public void checkFactoryURLWithPHPProjectTypeTest() throws Exception { PROJECT = "php"; driver.get(LOGIN_URL); waitIdeLoginPage(); IDE.LOGIN.waitTenantAllLoginPage(); IDE.LOGIN.tenantLogin(USER_NAME, USER_PASSWORD); IDE.GET_STARTED_WIZARD.waitAndCloseWizard(); IDE.WELCOME_PAGE.clickCreateNewProjectFromScratch(); IDE.CREATE_PROJECT_FROM_SCRATHC.waitCreateProjectFromScratch(); IDE.CREATE_PROJECT_FROM_SCRATHC.typeProjectName(PROJECT); IDE.CREATE_PROJECT_FROM_SCRATHC.selectPHPTechnology(); IDE.CREATE_PROJECT_FROM_SCRATHC.clickNextButton(); IDE.CREATE_PROJECT_FROM_SCRATHC.waitProjectTemplateForm(); IDE.CREATE_PROJECT_FROM_SCRATHC.selectProjectTemplate("Simple PHP project."); IDE.CREATE_PROJECT_FROM_SCRATHC.clickFinishButton(); IDE.LOADER.waitClosed(); IDE.EXPLORER.waitForItem(PROJECT); IDE.MENU.runCommand(MenuCommands.Share.SHARE, MenuCommands.Share.FACTORY_URL); IDE.FACTORY_URL.waitFactoryURLFormOpened(); IDE.FACTORY_URL.clickOnNextFactoryButton(); IDE.FACTORY_URL.waitForFinishCreationPage(); String factoryURL = IDE.FACTORY_URL.getDirectSharingURL(); IDE.FACTORY_URL.clickOnFinishButtonInFactoryURLForm(); IDE.LOGIN.logout(); driver.get(factoryURL); IDE.FACTORY_URL.waitWelcomeIframe(); IDE.selectMainFrame(); IDE.EXPLORER.waitForItem(PROJECT); IDE.MENU.runCommand(MenuCommands.Project.PROJECT, MenuCommands.Project.PROJECT_PROPERTIES); IDE.PROPERTIES.waitProjectPropertiesOpened(); assertTrue(IDE.PROPERTIES.getAllTextFromProjectProperties().contains("Project Type\n" + "PHP")); }
@Test public void checkNewPackageInExplorers() throws Exception { // step one run two browsers. In first browser (owner tenant) wait package explorer and expand // main items initSecondBrowser(); IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(PROJECT); IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.MENU.runCommand( MenuCommands.Project.PROJECT, MenuCommands.Project.ENABLE_COLLABORATION_MODE); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("src/main/java"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("src"); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("pom.xml"); expandMainItemsInPackageExplorer(); // step two In second (ivited user browser) wait project explorer and expand main nodes IDE2.EXPLORER.waitOpened(); IDE2.OPEN.openProject(PROJECT); IDE2.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE2.MENU.waitForMenuItemPresent( MenuCommands.Project.PROJECT, MenuCommands.Project.DISABLE_COLLABORATION_MODE); IDE2.PACKAGE_EXPLORER.closePackageExplorer(); IDE2.PACKAGE_EXPLORER.waitPackageExplorerClosed(); IDE2.EXPLORER.waitForItem(PROJECT + "/src"); IDE2.EXPLORER.waitForItem(PROJECT + "/pom.xml"); expandProjectInInviteBrowser(); // step three, create new package in owner browser and check creation in two browsers IDE.PACKAGE_EXPLORER.selectItemInPackageExplorer("src/main/java"); IDE.MENU.runCommand(MenuCommands.File.FILE, MenuCommands.New.NEW, MenuCommands.New.PACKAGE); IDE.LOADER.waitClosed(); IDE.PACKAGE_EXPLORER.waitCreateNewPackageForm(); IDE.PACKAGE_EXPLORER.typeNewPackageName(PACKAGE_NAME); IDE.PACKAGE_EXPLORER.clickCreateNewPackageButton(); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(PACKAGE_NAME); // checking creation in the browser by invited user IDE2.EXPLORER.waitForItem(PROJECT + "/src/main/java/org"); IDE2.EXPLORER.openItem(PROJECT + "/src/main/java/org"); IDE2.EXPLORER.waitForItem(PROJECT + "/src/main/java/org/ua"); IDE2.EXPLORER.openItem(PROJECT + "/src/main/java/org/ua"); IDE2.EXPLORER.waitForItem(PROJECT + "/src/main/java/org/ua/codenvy"); IDE2.EXPLORER.selectItem(PROJECT + "/src/main/java/org/ua/codenvy"); // step four create new class in the browser by invited use and check in the two browsers IDE2.TOOLBAR.runCommandFromNewPopupMenu(MenuCommands.New.JAVA_CLASS); IDE2.CREATE_NEW_CLASS.waitCreateFormIsPresent(); IDE2.CREATE_NEW_CLASS.waitItemIsPresentInKindList("Class"); IDE2.CREATE_NEW_CLASS.waitItemIsPresentInPackageList("sumcontroller"); IDE2.CREATE_NEW_CLASS.waitItemIsPresentInSourceFolderList("src/main/java"); IDE2.CREATE_NEW_CLASS.typeClassName(NEW_CLASS_NAME); IDE2.CREATE_NEW_CLASS.waitCreateButtonIsEnabled(); IDE2.CREATE_NEW_CLASS.clickCreateBtn(); IDE2.CREATE_NEW_CLASS.waitFormIsClosed(); IDE2.EXPLORER.waitForItem(PROJECT + "/src/main/java/org/ua/codenvy/" + "CollabCheck.java"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("org.ua.codenvy"); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(NEW_CLASS_NAME + ".java"); // delete calc file by owner and check in two browsers IDE.PACKAGE_EXPLORER.selectItemInPackageExplorer("calc.jsp"); IDE.TOOLBAR.runCommand(ToolbarCommands.File.DELETE); IDE.DELETE.waitOpened(); IDE.DELETE.clickOkButton(); IDE.DELETE.waitClosed(); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorerIsNotPresent("calc.jsp"); IDE2.EXPLORER.waitItemNotPresent(PROJECT + "/src" + "/main" + "/webapp" + "/calc.jsp"); }
@Test public void testDeleteFileAndOpenFromOneFolder() throws Exception { // open project and check IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(PROJECT); IDE.LOADER.waitClosed(); IDE.EXPLORER.waitForItem(PROJECT + "/" + folderName); IDE.EXPLORER.selectItem(PROJECT + "/" + folderName); // close welcome tab for easy numbered tabs and editors IDE.EDITOR.clickCloseEditorButton(0); IDE.LOADER.waitClosed(); IDE.EDITOR.waitTabNotPresent(0); // create txt file. Change content IDE.TOOLBAR.runCommandFromNewPopupMenu(MenuCommands.New.TEXT_FILE); IDE.FILE.waitCreateNewFileWindow(); IDE.FILE.typeNewFileName(file1Name); IDE.FILE.clickCreateButton(); IDE.EDITOR.waitTabPresent(0); IDE.EDITOR.waitActiveFile(); IDE.EDITOR.typeTextIntoEditor(file1Content); IDE.TOOLBAR.runCommand(ToolbarCommands.File.SAVE); IDE.LOADER.waitClosed(); IDE.EXPLORER.waitForItem(PROJECT + "/" + folderName + "/" + file1Name); IDE.EDITOR.closeFile(file1Name); // create html file. Change content IDE.TOOLBAR.runCommandFromNewPopupMenu(MenuCommands.New.HTML_FILE); IDE.FILE.waitCreateNewFileWindow(); IDE.FILE.typeNewFileName(file2Name); IDE.FILE.clickCreateButton(); IDE.EDITOR.waitTabPresent(0); IDE.EXPLORER.waitForItem(PROJECT + "/" + folderName + "/" + file2Name); IDE.EDITOR.closeFile(0); // Delete second file and check IDE.EXPLORER.selectItem(PROJECT + "/" + folderName + "/" + file2Name); IDE.TOOLBAR.runCommand("Delete Item(s)..."); IDE.DELETE.waitOpened(); IDE.DELETE.clickOkButton(); IDE.DELETE.waitClosed(); IDE.EXPLORER.waitForItemNotPresent(PROJECT + "/" + folderName + "/" + file2Name); // open first file and check the saved content IDE.EXPLORER.openItem(PROJECT + "/" + folderName + "/" + file1Name); IDE.EDITOR.waitActiveFile(); assertEquals(file1Content, IDE.EDITOR.getTextFromCodeEditor()); IDE.EDITOR.closeFile(0); // delete first file, delete folder and check deleting IDE.EXPLORER.selectItem(PROJECT + "/" + folderName); IDE.TOOLBAR.runCommand("Delete Item(s)..."); IDE.DELETE.waitOpened(); IDE.DELETE.clickOkButton(); IDE.DELETE.waitClosed(); IDE.EXPLORER.waitForItemNotPresent(PROJECT + "/" + folderName); IDE.EXPLORER.waitItemPresent(PROJECT); }
@Test public void сopyToMyWorkspaceWithChangesTest() throws Exception { IDE.EXPLORER.waitOpened(); IDE.OPEN.openProject(PROJECT); IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.MENU.runCommand(MenuCommands.Share.SHARE, MenuCommands.Share.FACTORY_URL); IDE.FACTORY_URL.waitFactoryURLFormOpened(); IDE.FACTORY_URL.clickOnNextFactoryButton(); IDE.FACTORY_URL.waitForFinishCreationPage(); String factoryURL = IDE.FACTORY_URL.getDirectSharingURL(); IDE.FACTORY_URL.clickOnFinishButtonInFactoryURLForm(); IDE.LOGIN.logout(); driver.get(LOGIN_URL); Thread.sleep(1000); waitIdeLoginPage(); IDE.LOGIN.waitTenantAllLoginPage(); IDE.LOGIN.tenantLogin(NOT_ROOT_USER_NAME, USER_PASSWORD); if (IDE.SELECT_WORKSPACE.isSelectWorkspacePageOpened() == true) { IDE.SELECT_WORKSPACE.waitWorkspaceInSelectWorkspacePage(TENANT_NAME); IDE.SELECT_WORKSPACE.clickOnWorkspaceName(TENANT_NAME); } driver.get(factoryURL); IDE.LOADER.waitClosed(); IDE.FACTORY_URL.waitWelcomeIframe(); IDE.selectMainFrame(); // do some changes IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(PROJECT); IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.PACKAGE_EXPLORER.selectItemInPackageExplorer(PROJECT); IDE.RENAME.rename(NEW_PRJ_NAME); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(NEW_PRJ_NAME); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("pom.xml"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("pom.xml"); IDE.EDITOR.waitActiveFile(); IDE.EDITOR.typeTextIntoEditor(Keys.CONTROL.toString() + Keys.END.toString()); IDE.EDITOR.typeTextIntoEditor("<!-- thisIsChange -->"); IDE.EDITOR.waitFileContentModificationMark("pom.xml"); // check copy to my WS with not saved files IDE.FACTORY_URL.waitCopyToMyWorkspaceButton(); IDE.FACTORY_URL.clickOnCopyToMyWorkspaceButton(); IDE.INFORMATION_DIALOG.waitOpened(); IDE.INFORMATION_DIALOG.waitMessage("Please, save all changes before copying projects."); IDE.INFORMATION_DIALOG.clickOk(); IDE.TOOLBAR.runCommand(ToolbarCommands.File.SAVE); IDE.LOADER.waitClosed(); IDE.EDITOR.waitNoContentModificationMark("pom.xml"); // deleting project on regular WS VirtualFileSystemUtils.delete(PROJECT); // check that project was deleted assertTrue( VirtualFileSystemUtils.get(REST_URL + "itembypath/" + PROJECT).getStatusCode() == 404); IDE.FACTORY_URL.waitCopyToMyWorkspaceButton(); IDE.FACTORY_URL.clickOnCopyToMyWorkspaceButton(); if (IDE.SELECT_WORKSPACE.isSelectWorkspacePageOpened() == true) { IDE.SELECT_WORKSPACE.waitWorkspaceInSelectWorkspacePage(TENANT_NAME); IDE.SELECT_WORKSPACE.clickOnWorkspaceName(TENANT_NAME); } IDE.PACKAGE_EXPLORER.waitPackageExplorerOpened(); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer(NEW_PRJ_NAME); Assert.assertTrue(driver.getCurrentUrl().equals(WORKSPACE_URL)); IDE.PACKAGE_EXPLORER.waitItemInPackageExplorer("pom.xml"); IDE.PACKAGE_EXPLORER.openItemWithDoubleClick("pom.xml"); IDE.EDITOR.waitActiveFile(); IDE.EDITOR.waitContentIsPresent("<!-- thisIsChange -->"); }