Search in sources :

Example 41 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.

the class EditResourcesTest method getBuildConfigTextEditor.

private TextEditor getBuildConfigTextEditor() {
    getBuildConfig().select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT).select();
    System.out.println("TESTING:" + "[" + requiredProject.getProjectName() + "] Build Config : eap-app.json");
    return new TextEditor("[" + requiredProject.getProjectName() + "] Build Config : eap-app.json");
}
Also used : TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)

Example 42 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.

the class HandleCustomTemplateTest method createTemplateFromJson.

private void createTemplateFromJson() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
    new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
    new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(System.getProperty("user.dir") + File.separator + "resources" + File.separator + "hello-world-template.json");
    new FinishButton().click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
    assertTrue("Template is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    List<OpenShiftResource> templates = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().getOpenShiftResources(Resource.TEMPLATE);
    assertTrue("There should be precisely 1 created template for the project.", templates.size() > 0);
    String templateName = templates.get(0).getName();
    assertTrue("Template name '" + templateName + "' does not match required name " + "helloworld-sample.", templateName.equals("helloworld-sample"));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 43 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.

the class ImportApplicationTest method testImportOpenShiftApplicationViaOpenShiftExplorer.

@Test
public void testImportOpenShiftApplicationViaOpenShiftExplorer() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD_CONFIG).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    new CheckBox("Use default clone destination").toggle(false);
    File gitRepo = new File(GIT_REPO_DIRECTORY);
    new LabeledText("Git Clone Location:").setText(gitRepo.getAbsolutePath());
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION), TimePeriod.VERY_LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    ProjectExplorer projectExplorer = new ProjectExplorer();
    projectExplorer.open();
    assertTrue("There should be imported kitchen sink project, but there is not", projectExplorer.containsProject(PROJECT_NAME));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) Matcher(org.hamcrest.Matcher) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) File(java.io.File) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 44 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.

the class LogsTest method shouldShowLogFromApplicationPodContextMenu.

@Test
public void shouldShowLogFromApplicationPodContextMenu() {
    new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringStartsWith("eap-app-"), ResourceState.RUNNING, requiredProject.getProjectName(), requiredConnection.getConnection()), TimePeriod.VERY_LONG);
    this.consoleView = new ConsoleView();
    this.consoleView.open();
    OpenShiftResource pod = OpenShiftUtils.getOpenShiftPod(requiredProject.getProjectName(), new StringStartsWith("eap-app-"), requiredConnection.getConnection());
    String podName = pod.getName();
    pod.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.POD_LOG).select();
    new WaitUntil(new ConsoleHasText(), TimePeriod.DEFAULT);
    new WaitUntil(new ConsoleHasNoChange(TimePeriod.getCustom(WAIT_CONSOLE_NO_CHANGE)), TimePeriod.VERY_LONG);
    assertTrue("Console label is incorrect, it should contains project name and pod name.\n" + "but label is: " + consoleView.getConsoleLabel(), consoleView.getConsoleLabel().contains(requiredProject.getProjectName() + "\\" + podName));
    assertTrue("Console text should contain output from EAP runtime", consoleView.getConsoleText().contains("Admin console is not enabled"));
}
Also used : StringStartsWith(org.hamcrest.core.StringStartsWith) ConsoleView(org.eclipse.reddeer.eclipse.ui.console.ConsoleView) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ConsoleHasText(org.eclipse.reddeer.eclipse.condition.ConsoleHasText) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 45 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.

the class EditResourceLimitsTest method incrementLimits.

private void incrementLimits(int index, String defaultSuffix) {
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT_RESOURCE_LIMITS).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.EDIT_RESOURCE_LIMITS));
    new DefaultShell(OpenShiftLabel.Shell.EDIT_RESOURCE_LIMITS).setFocus();
    Text text = new DefaultText(index);
    String value = text.getText();
    long val = 0L;
    try {
        val = Long.parseLong(value);
    } catch (NumberFormatException e) {
    }
    text.setText(Long.toString(++val));
    Combo combo = new DefaultCombo(index);
    value = combo.getSelection();
    if (StringUtils.isEmpty(value)) {
        combo.setSelection(defaultSuffix);
    }
    new WaitUntil(new ControlIsEnabled(new OkButton()));
    new OkButton().click();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) Text(org.eclipse.reddeer.swt.api.Text) DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) Combo(org.eclipse.reddeer.swt.api.Combo) DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultCombo(org.eclipse.reddeer.swt.impl.combo.DefaultCombo) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Aggregations

ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)73 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)36 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)36 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)33 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)29 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)29 Test (org.junit.Test)26 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)19 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)17 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)15 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)11 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)11 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)8 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)8 KnownConfigurationsView (org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)7 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)7 ImportApplicationWizard (org.jboss.tools.openshift.reddeer.wizard.importapp.ImportApplicationWizard)6 CheckBox (org.eclipse.reddeer.swt.impl.button.CheckBox)5 EditConfigurationShell (org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell)5