private void waitForQuickOutlineOpened() { (new WebDriverWait(IDE.driver(), 30)) .until( new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver d) { return d.findElement(By.id(QUICK_OUTLINE_PANEL)) != null; } }); }
private void waitForQuickOutlineClosed() { (new WebDriverWait(IDE.driver(), 30)) .until( new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver d) { try { driver.findElement(By.id(QUICK_OUTLINE_PANEL)); return false; } catch (NoSuchElementException e) { return true; } } }); }
@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")); }
/** @param name */ private void assertElementPresent(String name) { assertNotNull( IDE.driver() .findElement( By.xpath("//div[@id='ideQuickOutlineTree']//span[text()='" + name + "']"))); }
@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 -->"); }