public void confirmShellShareProjectFiles(String project, String[] files, JID[] jids) { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_SHARE_PROJECT); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); selectProjectFiles(tree, project, files); shell.bot().button(NEXT).click(); // wait for tree update bot.sleep(500); tree = shell.bot().tree(); for (SWTBotTreeItem item : tree.getAllItems()) while (item.isChecked()) item.uncheck(); for (JID jid : jids) WidgetUtil.getTreeItemWithRegex(tree, Pattern.quote(jid.getBase()) + ".*").check(); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellAddProjects(String projectName, TypeOfCreateProject usingWhichProject) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_PROJECTS), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS); switch (usingWhichProject) { case NEW_PROJECT: shell.bot().radio(RADIO_CREATE_NEW_PROJECT).click(); break; case EXIST_PROJECT: shell.bot().radio(RADIO_USING_EXISTING_PROJECT).click(); shell.bot().textWithLabel("Project name", 1).setText(projectName); break; case EXIST_PROJECT_WITH_COPY: shell.bot().radio("Use existing project").click(); shell.bot().checkBox("Create copy for working distributed. New project name:").click(); break; } shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Test public void testDeleteMultipleBranches() throws Exception { // expand first level SWTBotTree tree = getOrOpenView().bot().tree(); refreshAndWait(); // open a branch (checkout) SWTBotTreeItem localBranchesItem = myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile).expand(); SWTBotTreeItem masterNode = localBranchesItem.getNode("master"); // create first branch (abc) masterNode.select(); ContextMenuHelper.clickContextMenu(tree, "Create Branch..."); SWTBotShell createBranchShell = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); createBranchShell.bot().textWithId("BranchName").setText("abc"); createBranchShell.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).deselect(); createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click(); // create second branch (123) ContextMenuHelper.clickContextMenu(tree, "Create Branch..."); createBranchShell = bot.shell(UIText.CreateBranchWizard_NewBranchTitle); createBranchShell.bot().textWithId("BranchName").setText("123"); createBranchShell.bot().checkBox(UIText.CreateBranchPage_CheckoutButton).deselect(); createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click(); refreshAndWait(); localBranchesItem = myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile).expand(); // delete both localBranchesItem.select("abc", "123"); ContextMenuHelper.clickContextMenuSync( tree, myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label")); refreshAndWait(); SWTBotTreeItem[] items = myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile).getItems(); assertEquals("Wrong number of branches", 2, items.length); assertEquals("master", items[0].getText()); assertEquals("stable", items[1].getText()); }
private void testFetchFromOrigin(boolean useRemote) throws Exception { Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile); Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile2); Repository repository = lookupRepository(clonedRepositoryFile2); // add the configuration for push from cloned2 repository.getConfig().setString("remote", "origin", "push", "refs/heads/*:refs/heads/*"); repository.getConfig().save(); SWTBotTree tree = getOrOpenView().bot().tree(); String destinationString = clonedRepositoryFile.getParentFile().getName() + " - " + "origin"; String dialogTitle = NLS.bind(UIText.FetchResultDialog_title, destinationString); selectNode(tree, useRemote, true); runFetch(tree); SWTBotShell confirm = bot.shell(dialogTitle); assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount()); confirm.close(); deleteAllProjects(); shareProjects(clonedRepositoryFile2); String objid = repository.getRef("refs/heads/master").getTarget().getObjectId().name(); objid = objid.substring(0, 7); touchAndSubmit(null); // push from other repository PushOperationUI op = new PushOperationUI(repository, "origin", false); op.start(); String pushdialogTitle = NLS.bind(UIText.PushResultDialog_title, op.getDestinationString()); bot.shell(pushdialogTitle).close(); deleteAllProjects(); refreshAndWait(); selectNode(tree, useRemote, true); runFetch(tree); confirm = bot.shell(dialogTitle); SWTBotTreeItem[] treeItems = confirm.bot().tree().getAllItems(); boolean found = false; for (SWTBotTreeItem item : treeItems) { found = item.getText().contains(objid); if (found) break; } assertTrue(found); confirm.close(); selectNode(tree, useRemote, true); runFetch(tree); confirm = bot.shell(dialogTitle); assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount()); }
@Override public void confirmShellNeedBased(String decsision, boolean remember) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_NEED_BASED_SYNC); shell.activate(); if (remember) shell.bot().checkBox("Remember my decision.").click(); shell.bot().button(decsision).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Test public void shareProjectWithExternalRepo() throws Exception { String repoName = "ExternalRepositoryForShare"; createProject(projectName0); String location1 = createProject(projectName1); String location2 = createProject(projectName2); createProject(projectName3); ExistingOrNewPage existingOrNewPage = sharingWizard.openWizard(projectName1, projectName2); SWTBotShell createRepoDialog = existingOrNewPage.clickCreateRepository(); String repoDir = Activator.getDefault().getPreferenceStore().getString(UIPreferences.DEFAULT_REPO_DIR); File repoFolder = new File(repoDir, repoName); createRepoDialog .bot() .textWithLabel(UIText.CreateRepositoryPage_DirectoryLabel) .setText(repoFolder.getAbsolutePath()); createRepoDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); SWTBotCombo combo = bot.comboBoxWithLabel(UIText.ExistingOrNewPage_ExistingRepositoryLabel); assertTrue(combo.getText().startsWith(repoName)); Repository targetRepo = lookupRepository(new File(repoFolder, Constants.DOT_GIT)); assertTrue(combo.getText().endsWith(targetRepo.getDirectory().getPath())); assertEquals( targetRepo.getWorkTree().getPath(), bot.textWithLabel(UIText.ExistingOrNewPage_WorkingDirectoryLabel).getText()); String[][] contents = new String[2][3]; contents[0][0] = projectName1; contents[0][1] = new Path(location1).toString(); contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName1).toString(); contents[1][0] = projectName2; contents[1][1] = new Path(location2).toString(); contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append(projectName2).toString(); existingOrNewPage.assertTableContents(contents); existingOrNewPage.setRelativePath("a/b"); contents[0][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName1).toString(); contents[1][2] = new Path(targetRepo.getWorkTree().getPath()).append("a/b").append(projectName2).toString(); existingOrNewPage.assertTableContents(contents); bot.button(IDialogConstants.FINISH_LABEL).click(); Thread.sleep(1000); String location1Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName1).getLocation().toString(); assertEquals(contents[0][2], location1Path); String location2Path = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName2).getLocation().toString(); assertEquals(contents[1][2], location2Path); }
@Override public void confirmShellEditXMPPAccount(String xmppJabberID, String newPassword) throws RemoteException { SWTBotShell shell = new SWTBot().shell(SHELL_EDIT_XMPP_JABBER_ACCOUNT); shell.activate(); shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(xmppJabberID); shell.bot().textWithLabel(LABEL_PASSWORD).setText(newPassword); shell.bot().button(FINISH).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); }
private void createTag(String name, String message) throws Exception { SWTBotTree tree = getOrOpenView().bot().tree(); myRepoViewUtil.getTagsItem(tree, repositoryFile).select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("CreateTagCommand")); String shellTitle = UIText.CreateTagDialog_NewTag; SWTBotShell createDialog = bot.shell(shellTitle).activate(); TestUtil.joinJobs(JobFamilies.FILL_TAG_LIST); createDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText(name); createDialog.bot().styledTextWithLabel(UIText.CreateTagDialog_tagMessage).setText(message); createDialog.bot().button(IDialogConstants.OK_LABEL).click(); TestUtil.joinJobs(JobFamilies.TAG); }
@BeforeClass public static void beforeClass() { openPerspective("Seam (default)"); bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.NEW).menu(IDELabel.Menu.OTHER).click(); SWTBotShell shell = bot.shell("New"); shell.bot().tree(0).expandNode("General").select("Project"); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().textWithLabel("Project name:").setText(TEMP_PROJECT); open.finish(shell.bot()); setupConnection(); }
@Test public void createSeamProject() { eclipse.maximizeActiveShell(); bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.NEW).menu(IDELabel.Menu.OTHER).click(); SWTBotShell shell = bot.shell("New"); shell.bot().tree(0).expandNode("Seam").select("Seam Web Project"); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().textWithLabel("Project name:").setText(Properties.SEAM_PROJECT_NAME); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().button(IDELabel.Button.NEXT).click(); shell.bot().comboBoxWithLabel("Database Type:").setSelection("Teiid"); shell .bot() .comboBoxWithLabel("Connection profile:") .setSelection(Properties.SEAM_CONNPROFILE_NAME); shell.bot().checkBoxWithLabel("Create Test Project:").deselect(); open.finish(shell.bot()); bot.sleep(TIME_10S); assertTrue(SWTTestExt.projectExplorer.existsResource(Properties.SEAM_PROJECT_NAME)); }
@Override public void confirmShellAddProjectWithNewProject(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_PROJECT), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECT); shell.activate(); shell.bot().radio(RADIO_CREATE_NEW_PROJECT).click(); shell.bot().textWithLabel("Project name", 0).setText(projectName); shell.bot().button(FINISH).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellAddXMPPAccount(JID jid, String password) throws RemoteException { SWTBotShell shell = new SWTBot().shell(SHELL_ADD_XMPP_JABBER_ACCOUNT); shell.activate(); /* * FIXME with comboBoxInGroup(GROUP_EXISTING_ACCOUNT) you wil get * WidgetNoFoundException. */ shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(jid.getBase()); shell.bot().textWithLabel(LABEL_PASSWORD).setText(password); shell.bot().button(FINISH).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellAddProjectUsingExistProjectWithCopy(String projectName) throws RemoteException { SWTBot bot = new SWTBot(); bot.waitUntil( Conditions.shellIsActive(SHELL_ADD_PROJECT), SarosSWTBotPreferences.SAROS_LONG_TIMEOUT); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECT); shell.activate(); shell.bot().radio("Use existing project").click(); shell.bot().checkBox("Create copy for working distributed. New project name:").click(); shell.bot().button(FINISH).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); }
@Test public void testResetToTag() throws Exception { SWTBotTree tree = getOrOpenView().bot().tree(); String initialContent = getTestFileContent(); createTag("ResetToFirst", "The first tag"); touchAndSubmit(null); String newContent = getTestFileContent(); assertFalse("Wrong content", initialContent.equals(newContent)); createTag("ResetToSecond", "The second tag"); refreshAndWait(); myRepoViewUtil.getTagsItem(tree, repositoryFile).expand().getNode("ResetToFirst").select(); ContextMenuHelper.clickContextMenu(tree, myUtil.getPluginLocalizedValue("ResetCommand")); SWTBotShell resetDialog = bot.shell(UIText.ResetCommand_WizardTitle); resetDialog.bot().radio(UIText.ResetTargetSelectionDialog_ResetTypeHardButton).click(); resetDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); TestUtil.joinJobs(JobFamilies.RESET); bot.shell(UIText.ResetTargetSelectionDialog_ResetQuestion) .bot() .button(IDialogConstants.YES_LABEL) .click(); Job.getJobManager().join(JobFamilies.RESET, null); ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null); assertEquals("Wrong content", initialContent, getTestFileContent()); }
@Override public void confirmShellNewSharedFile(String decision) { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_NEW_FILE_SHARED); shell.activate(); shell.bot().button(decision).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellAddProjectsToSession(String... projectNames) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); for (String projectName : projectNames) tree.getTreeItem(projectName).check(); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellAddProjectToSession(String project, String[] files) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_PROJECTS_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); selectProjectFiles(tree, project, files); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); }
@Override public void confirmShellClosingTheSession() throws RemoteException { SWTBotShell shell = new SWTBot().shell(SHELL_CLOSING_THE_SESSION); shell.activate(); shell.bot().button(OK).click(); shell.bot().waitUntil(Conditions.shellCloses(shell)); // wait for tree update in the saros session view new SWTBot().sleep(500); }
/** * Closes Subclipse Report Usage Window * * @param shell * @param report */ private static void closeSubclipseUsageWindow(SWTBotShell shell, boolean report) { SWTBot shellBot = shell.bot(); SWTBotCheckBox chbReportUsage = shellBot.checkBox(IDELabel.SubclipseUsageDialog.REPORT_USAGE_CHECK_BOX); if ((report && (!chbReportUsage.isChecked())) || ((!report) && chbReportUsage.isChecked())) { chbReportUsage.click(); } shellBot.button(IDELabel.Button.OK).click(); log.info("Sublcipse Report Usage window closed"); }
private void checkoutWithDoubleClick(SWTBotTree tree, String branch) throws Exception { myRepoViewUtil .getLocalBranchesItem(tree, repositoryFile) .expand() .getNode(branch) .doubleClick(); SWTBotShell shell = bot.shell(UIText.RepositoriesView_CheckoutConfirmationTitle); shell.bot().button(IDialogConstants.OK_LABEL).click(); refreshAndWait(); }
@Test // (Test Cases for 1.8) test case 5 public void testInvalidCacheSizeOKToLeave() throws Exception { Utility.createProject(Messages.projCache); SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1); wabot.checkBox().select(); /* * To avoid missing storage account error, * type some value. Requires typeText only. */ wabot.textWithLabel(Messages.keyLbl).typeText("a"); wabot.textWithLabel(Messages.nameLbl).typeText("a"); // Cache size = 0 wabot.textWithLabel(Messages.cachScaleLbl).setText(""); wabot.textWithLabel(Messages.cachScaleLbl).typeText("0"); SWTBotTree properties = propShell.bot().tree(); properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select(); SWTBotShell errorShell = wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate(); Boolean zeroErr = errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " ")); wabot.button("OK").click(); // Cache size < 0 i.e. Negative wabot.textWithLabel(Messages.cachScaleLbl).setText(""); wabot.textWithLabel(Messages.cachScaleLbl).typeText("-2"); properties = propShell.bot().tree(); properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select(); errorShell = wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate(); Boolean negErr = errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " ")); wabot.button("OK").click(); // Cache size > 100 wabot.textWithLabel(Messages.cachScaleLbl).setText(""); wabot.textWithLabel(Messages.cachScaleLbl).typeText("105%"); properties = propShell.bot().tree(); properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select(); errorShell = wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate(); Boolean grtErr = errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " ")); wabot.button("OK").click(); assertTrue("testInvalidCacheSizeOKToLeave", zeroErr && negErr && grtErr); propShell.close(); }
@Test public void testImportWizardGeneralProjectWithWorkingSet() throws Exception { deleteAllProjects(); assertProjectExistence(PROJ1, false); String workingSetName = "myWorkingSet"; removeWorkingSet(workingSetName); SWTBotTree tree = getOrOpenView().bot().tree(); String wizardTitle = NLS.bind(UIText.GitCreateProjectViaWizardWizard_WizardTitle, repositoryFile.getPath()); // start wizard from PROJ1 myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(PROJ1).select(); ContextMenuHelper.clickContextMenu( tree, myUtil.getPluginLocalizedValue("ImportProjectsCommand")); SWTBotShell shell = bot.shell(wizardTitle); shell = bot.shell(wizardTitle); // try import existing project first bot.radio(UIText.GitSelectWizardPage_ImportExistingButton).click(); SWTBotButton button = shell.bot().button(IDialogConstants.NEXT_LABEL); // Set focus on the next button. If this is not done, Wizard Framework restores // the focus to the "Import as &General Project" radio button. Setting the focus on // the radio button selects the button and causes the test to fail. // See also SWTBot Bug 337465 button.setFocus(); button.click(); shell.bot().text(UIText.WizardProjectsImportPage_ImportProjectsDescription); shell.bot().tree().getAllItems()[0].check(); // add to working set shell.bot().checkBox("Add project to working sets").select(); // create new working set shell.bot().button("Select...").click(); SWTBotShell workingSetDialog = bot.shell("Select Working Sets"); workingSetDialog.bot().button("New...").click(); SWTBotShell newDialog = bot.shell("New Working Set"); newDialog.bot().table().select("Java"); newDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); newDialog.bot().text(0).setText(workingSetName); newDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); workingSetDialog.bot().table().getTableItem(workingSetName).check(); workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); bot.waitUntil(Conditions.shellCloses(shell)); assertProjectExistence(PROJ1, true); assertProjectInWorkingSet(workingSetName, PROJ1); assertProjectIsShared(PROJ1, true); removeWorkingSet(workingSetName); }
public static void init(String projectName) throws Exception { SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Utilities.getDefault().buildProject(projectName); bot = new SWTBot(); SWTBotShell executableShell = null; for (int i = 0, attempts = 100; i < attempts; i++) { for (SWTBotShell shell : bot.shells()) { if (shell.getText().contains("Debug New Executable")) { executableShell = shell; shell.setFocus(); break; } } if (executableShell != null) break; bot.sleep(10); } IPath executablePath = Utilities.getDefault().getProjectPath(projectName).append("a.out"); // $NON-NLS-1$ executableShell.bot().textWithLabel("Binary: ").typeText(executablePath.toOSString()); bot.sleep(2000); executableShell.bot().button("OK").click(); mainShell = null; for (int i = 0, attempts = 100; i < attempts; i++) { for (SWTBotShell shell : bot.shells()) { if (shell.getText().contains("C/C++ Stand-alone Debugger")) { mainShell = shell; shell.setFocus(); break; } } if (mainShell != null) break; bot.sleep(10); } assertNotNull(mainShell); }
@Override public void confirmShellCreateNewXMPPAccount(JID jid, String password) throws RemoteException { SWTBotShell shell = new SWTBot().shell(SHELL_CREATE_XMPP_JABBER_ACCOUNT); shell.activate(); shell.bot().textWithLabel(LABEL_XMPP_JABBER_SERVER).setText(jid.getDomain()); shell.bot().textWithLabel(LABEL_USER_NAME).setText(jid.getName()); shell.bot().textWithLabel(LABEL_PASSWORD).setText(password); shell.bot().textWithLabel(LABEL_REPEAT_PASSWORD).setText(password); shell.bot().button(FINISH).click(); try { shell.bot().waitUntil(Conditions.shellCloses(shell)); } catch (TimeoutException e) { String errorMessage = ((WizardDialog) shell.widget.getData()).getMessage(); if (errorMessage.matches(ERROR_MESSAGE_TOO_FAST_REGISTER_ACCOUNTS + ".*")) throw new RuntimeException("you are not allowed to register accounts so fast"); else if (errorMessage.matches(ERROR_MESSAGE_ACCOUNT_ALREADY_EXISTS + ".*\n*.*")) throw new RuntimeException("the Account " + jid.getBase() + " already exists"); } }
@Override public void confirmShellRequestOfSubscriptionReceived() throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_REQUEST_OF_SUBSCRIPTION_RECEIVED); shell.activate(); shell.bot().button(OK).click(); bot.waitUntil(Conditions.shellCloses(shell)); // wait for tree update in the saros session view bot.sleep(500); }
@Override public void confirmShellAddContactsToSession(String... baseJIDOfinvitees) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_CONTACT_TO_SESSION); shell.activate(); // wait for tree update bot.sleep(500); SWTBotTree tree = shell.bot().tree(); for (String baseJID : baseJIDOfinvitees) WidgetUtil.getTreeItemWithRegex(tree, Pattern.quote(baseJID) + ".*").check(); shell.bot().button(FINISH).click(); bot.waitUntil(Conditions.shellCloses(shell)); // wait for tree update in the saros session view bot.sleep(500); }
@Override public void confirmShellLeavingClosingSession() throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell; if (!Views.getInstance().sarosView().isHost()) { shell = bot.shell(SHELL_CONFIRM_LEAVING_SESSION); } else { shell = bot.shell(SHELL_CONFIRM_CLOSING_SESSION); } shell.activate(); shell.bot().button(YES).click(); Views.getInstance().sarosView().waitUntilIsNotInSession(); }
@Test public void stashAndApplyChanges() throws Exception { String originalContent = getTestFileContent(); String modifiedContent = "changes to stash"; touch(modifiedContent); assertEquals(modifiedContent, getTestFileContent()); ContextMenuHelper.clickContextMenu( selectProject(), "Team", STASHES, UIText.StashesMenu_StashChangesActionText); SWTBotShell createDialog = bot.shell(UIText.StashCreateCommand_titleEnterCommitMessage); SWTBotText enterMessageText = createDialog.bot().text(0); String stashMessage = "stash message"; enterMessageText.setText(stashMessage); createDialog.bot().button(IDialogConstants.OK_LABEL).click(); assertEquals(originalContent, getTestFileContent()); ContextMenuHelper.clickContextMenu( selectProject(), "Team", STASHES, MessageFormat.format(UIText.StashesMenu_StashItemText, Integer.valueOf(0), stashMessage)); SWTBotEditor stashEditor = bot.activeEditor(); // Check if text with message is there stashEditor.bot().styledText(stashMessage); stashEditor .bot() .toolbarButtonWithTooltip(util.getPluginLocalizedValue("StashApplyCommand.label")) .click(); assertEquals(modifiedContent, getTestFileContent()); }
@Override public void confirmShellAddContact(JID jid) throws RemoteException { SWTBot bot = new SWTBot(); SWTBotShell shell = bot.shell(SHELL_ADD_CONTACT_WIZARD); shell.activate(); shell.bot().comboBoxWithLabel(LABEL_XMPP_JABBER_ID).setText(jid.getBase()); shell.bot().button(FINISH).click(); bot.sleep(500); for (SWTBotShell currentShell : bot.shells()) { // FIXME HARDCODED ! if (currentShell.getText().equals("Contact Unknown")) { currentShell.bot().button(YES).click(); break; } } bot.waitUntil(Conditions.shellCloses(shell)); // wait for tree update in the saros session view bot.sleep(500); }
// DONE! public SWTBotGefEditPart addValidate(SWTBotGefEditPart toPart, String name, String... variables) { appendActivity(toPart, "Validate", name); SWTBot propsBot = propsView.bot(); propsView.selectTab(1); propsBot.button("Add").click(); SWTBotShell shell = bot.shell("Select Variable").activate(); SWTBot viewBot = shell.bot(); SWTBotTable table = viewBot.table(); table.select(variables); viewBot.button("OK").click(); save(); SWTBotGefEditPart added = getEditPart(toPart, name); // log.info("Added [part=" + added + ", name=" + name + "]"); return added; }