diff options
author | Michael Keppler | 2018-07-19 15:58:22 +0000 |
---|---|---|
committer | Matthias Sohn | 2018-10-21 09:57:55 +0000 |
commit | a422ae2507860789f0c7b3c987429324ccb69b72 (patch) | |
tree | 671e241cf83f03aafe1275ce6e825458fb7ba3ed /org.eclipse.egit.ui.test/src/org/eclipse/egit | |
parent | 3b0d9464da089747dd549b65bf640f955d997fea (diff) | |
download | egit-a422ae2507860789f0c7b3c987429324ccb69b72.tar.gz egit-a422ae2507860789f0c7b3c987429324ccb69b72.tar.xz egit-a422ae2507860789f0c7b3c987429324ccb69b72.zip |
Use verbs instead of OK
I went through typical UI and watched for dialogs still using OK. This
is surely not exhaustive, but should at least cover many of the
remaining typical operations.
Wizard dialogs remain with the very generic "Finish", which we may want
to think about, too.
Bug: 538108
Change-Id: I2fec65a53a12c43d498546257c4e565cc2550341
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit')
9 files changed, 66 insertions, 43 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java index dc3d927560..70483c1606 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/LoginDialogTester.java @@ -11,7 +11,6 @@ package org.eclipse.egit.ui.common; import org.eclipse.egit.ui.internal.UIText; -import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; public class LoginDialogTester { @@ -22,7 +21,7 @@ public class LoginDialogTester { bot.textWithLabel(UIText.LoginDialog_user).setText(user); bot.textWithLabel(UIText.LoginDialog_password).setText(password); bot.checkBoxWithLabel(UIText.LoginDialog_storeInSecureStore).deselect(); - bot.button(IDialogConstants.OK_LABEL).click(); + bot.button(UIText.LoginDialog_ButtonOK).click(); } } diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java index 7ca9b5b62a..83dba055a7 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractFeatureFinishHandlerTest.java @@ -43,7 +43,7 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa bot.waitUntil(shellIsActive(UIText.FinishFeatureDialog_title)); selectOptions(); bot.checkBox(UIText.FinishFeatureDialog_saveAsDefault).click(); - bot.button("OK").click(); + bot.button(UIText.FinishFeatureDialog_ButtonOK).click(); preFinish(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); } @@ -67,7 +67,7 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa bot.waitUntil(shellIsActive(UIText.FeatureStartHandler_provideFeatureName)); bot.text().setText(featureName); - bot.button("OK").click(); + bot.button(UIText.StartDialog_ButtonOK).click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); } @@ -91,7 +91,7 @@ public abstract class AbstractFeatureFinishHandlerTest extends AbstractGitflowHa bot.text().setText(featureName); TestUtil.waitForJobs(500, 5000); bot.tree().select(featureName); - bot.button("OK").click(); + bot.button(UIText.FeatureCheckoutHandler_ButtonOK).click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); } diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java index 6be0187837..ab42efce06 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java @@ -146,7 +146,7 @@ public class InitHandlerTest extends AbstractGitflowHandlerTest { private void fillDialog(String masterBranch) { typeInto(InitDialog_developBranch, ILLEGAL_BRANCH_NAME); - SWTBotButton ok = bot.button("OK"); + SWTBotButton ok = bot.button(UIText.InitDialog_ButtonOK); assertFalse(ok.isEnabled()); typeInto(InitDialog_developBranch, DEVELOP_BRANCH); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/StashesMenuTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/StashesMenuTest.java index 785e791891..1cab418ed5 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/StashesMenuTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/actions/StashesMenuTest.java @@ -19,7 +19,6 @@ import org.eclipse.egit.ui.common.LocalRepositoryTestCase; import org.eclipse.egit.ui.internal.UIText; import org.eclipse.egit.ui.test.ContextMenuHelper; import org.eclipse.egit.ui.test.TestUtil; -import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; @@ -65,7 +64,7 @@ public class StashesMenuTest extends LocalRepositoryTestCase { SWTBotText enterMessageText = createDialog.bot().text(0); String stashMessage = "stash message"; enterMessageText.setText(stashMessage); - createDialog.bot().button(IDialogConstants.OK_LABEL).click(); + createDialog.bot().button(UIText.StashCreateCommand_ButtonOK).click(); assertEquals(originalContent, getTestFileContent()); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java index 1f351ac7af..5c12d43d88 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java @@ -13,8 +13,8 @@ package org.eclipse.egit.ui.prefpages.configuration; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.File; import java.util.ArrayList; @@ -126,7 +126,8 @@ public class GlobalConfigurationPageTest { // reset saved preferences state SWTBotShell preferencePage = new Eclipse().openPreferencePage(null); preferencePage.bot().tree(0).getTreeItem("General").select(); - preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); + preferencePage.bot().button(IDialogConstants.OK_LABEL) + .click(); TestUtil.processUIEvents(); } @@ -168,7 +169,7 @@ public class GlobalConfigurationPageTest { addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_ValueLabel) .setText("true"); // close the dialog - addDialog.bot().button(IDialogConstants.OK_LABEL).click(); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK).click(); // close the editor preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); @@ -194,7 +195,7 @@ public class GlobalConfigurationPageTest { addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_ValueLabel) .setText("true"); // close the dialog - addDialog.bot().button(IDialogConstants.OK_LABEL).click(); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK).click(); // close the editor preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); @@ -241,7 +242,7 @@ public class GlobalConfigurationPageTest { .setText(TESTSECTION + "." + TESTNAME); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_ValueLabel) .setText("true"); - assertTrue(addDialog.bot().button(IDialogConstants.OK_LABEL) + assertTrue(addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) .isEnabled()); addDialog.close(); } @@ -255,74 +256,91 @@ public class GlobalConfigurationPageTest { .shell(UIText.AddConfigEntryDialog_AddConfigTitle); addDialog.activate(); assertFalse("Should be disabled when neither key nor value set", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_ValueLabel) .setText("Somevalue"); assertFalse("Should be disabled when no key", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(TESTSECTION); assertFalse("Should be disabled when no dot", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(TESTSECTION + "." + TESTNAME); assertTrue("Should be enabled with one dot", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(TESTSECTION + "." + TESTSUBSECTION + "." + TESTNAME); assertTrue("Should be enabled with two dots", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(TESTSECTION + ". some stuff with dots.. and . non-ASCII characters: àéè." + TESTNAME); // ok: first and last section alphanumeric,subsection will be quoted assertTrue("Should be enabled with strange subsection", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("föö.bar.baz"); assertFalse("Should be disabled with non-ASCII in first segment", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foo.bar.bàz"); assertFalse("Should be disabled with non-ASCII in last segment", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foo bar.baz"); assertFalse("Should be disabled with blank in first segment", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foo.bar baz"); assertFalse("Should be disabled with blank in last segment", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foo-bar.baz-"); assertTrue("Should be enabled with dashes", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foo.bar."); assertFalse("Should be disabled when ending in dot", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(".foo.bar."); assertFalse("Should be disabled when beginning with dot", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText(".."); assertFalse("Should be disabled for \"..\"", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foobar.9nines"); assertFalse("Should be disabled for variable name starting with digit", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foobar.-bar"); assertFalse("Should be disabled for variable name starting with a dash", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_KeyLabel) .setText("foobar.b-9"); assertTrue("Should be enabled for variable name starting with a letter", - addDialog.bot().button(IDialogConstants.OK_LABEL).isEnabled()); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) + .isEnabled()); } @Test @@ -340,11 +358,11 @@ public class GlobalConfigurationPageTest { .setText(TESTSECTION + "." + subsection + "." + TESTNAME); addDialog.bot().textWithLabel(UIText.AddConfigEntryDialog_ValueLabel) .setText("true"); - assertTrue(addDialog.bot().button(IDialogConstants.OK_LABEL) + assertTrue(addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK) .isEnabled()); // close the dialog - addDialog.bot().button(IDialogConstants.OK_LABEL).click(); + addDialog.bot().button(UIText.AddConfigEntryDialog_ButtonOK).click(); // close the editor preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java index 13315742c3..d701d66242 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java @@ -409,11 +409,13 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase { // rename stable to renamed SWTBotShell newNameDialog = bot.shell(UIText.BranchRenameDialog_Title); newNameDialog.bot().text().setText("master"); - assertFalse(newNameDialog.bot().button(IDialogConstants.OK_LABEL) + assertFalse(newNameDialog.bot() + .button(UIText.RenameBranchDialog_RenameButtonLabel) .isEnabled()); newNameDialog.bot().text().setText("renamed"); - newNameDialog.bot().button(IDialogConstants.OK_LABEL).click(); + newNameDialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel) + .click(); TestUtil.joinJobs(JobFamilies.CHECKOUT); @@ -427,7 +429,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase { newNameDialog = bot.shell(UIText.BranchRenameDialog_Title); newNameDialog.bot().text().setText("stable"); - newNameDialog.bot().button(IDialogConstants.OK_LABEL).click(); + newNameDialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel) + .click(); TestUtil.joinJobs(JobFamilies.CHECKOUT); dialog = openRenameBranchDialog(); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java index 4724595ed7..6be393b081 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java @@ -38,7 +38,6 @@ import org.eclipse.egit.ui.internal.dialogs.CompareTreeView; import org.eclipse.egit.ui.test.ContextMenuHelper; import org.eclipse.egit.ui.test.JobJoiner; import org.eclipse.egit.ui.test.TestUtil; -import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.ResetCommand.ResetType; import org.eclipse.jgit.lib.Constants; @@ -127,7 +126,8 @@ public class CompareActionsTest extends LocalRepositoryTestCase { JobJoiner jobJoiner = JobJoiner.startListening( ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS); - dialog.bot().button(IDialogConstants.OK_LABEL).click(); + dialog.bot().button(UIText.HistoryCommitSelectionDialog_ButtonOK) + .click(); jobJoiner.join(); closeFirstEmptySynchronizeDialog(); @@ -141,7 +141,8 @@ public class CompareActionsTest extends LocalRepositoryTestCase { jobJoiner = JobJoiner.startListening( ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS); - dialog.bot().button(IDialogConstants.OK_LABEL).click(); + dialog.bot().button(UIText.HistoryCommitSelectionDialog_ButtonOK) + .click(); jobJoiner.join(); assertSynchronizeFile1Changed(); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java index 7b7df801cf..a267d25c79 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java @@ -324,10 +324,12 @@ public class GitRepositoriesViewBranchHandlingTest extends renameDialog.bot().text(" " + // the text is now in the error message, and the MessageAreaDialog seems to add a space NLS.bind(UIText.ValidationUtils_InvalidRefNameMessage, "refs/heads/invalid~name")); - assertFalse(renameDialog.bot().button(IDialogConstants.OK_LABEL) + assertFalse(renameDialog.bot() + .button(UIText.RenameBranchDialog_RenameButtonLabel) .isEnabled()); newBranchNameText.setText("newmaster"); - renameDialog.bot().button(IDialogConstants.OK_LABEL).click(); + renameDialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel) + .click(); refreshAndWait(); @@ -343,7 +345,7 @@ public class GitRepositoriesViewBranchHandlingTest extends newBranchNameText = renameDialog.bot().text(0); newBranchNameText.setText("master"); - renameDialog.bot().button(IDialogConstants.OK_LABEL).click(); + renameDialog.bot().button(UIText.BranchRenameDialog_ButtonOK).click(); refreshAndWait(); @@ -501,7 +503,8 @@ public class GitRepositoriesViewBranchHandlingTest extends }; ListenerHandle handle = repo.getConfig().addChangeListener(listener); // only now click ok - configureBranchDialog.bot().button("OK").click(); + configureBranchDialog.bot() + .button(UIText.BranchConfigurationDialog_ButtonOK).click(); // cleanup behind ourselves handle.remove(); diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java index befc5bbcb7..e10c09e83c 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java @@ -144,7 +144,7 @@ public class GitRepositoriesViewRemoteHandlingTest extends "testRemote"); // configure fetch first shell.bot().radio(UIText.NewRemoteDialog_FetchRadio).click(); - shell.bot().button(IDialogConstants.OK_LABEL).click(); + shell.bot().button(UIText.NewRemoteDialog_ButtonOK).click(); // configure fetch dialog shell = bot.shell(UIText.SimpleConfigureFetchDialog_WindowTitle); |