Search in sources :

Example 11 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class CreaterepoWizardTest method setUpBeforeClass.

/**
 * Setup the bot, monitor and workspace root.
 */
@BeforeClass
public static void setUpBeforeClass() {
    bot = new SWTWorkbenchBot();
    root = ResourcesPlugin.getWorkspace().getRoot();
    monitor = new NullProgressMonitor();
    try {
        bot.shell(ICreaterepoTestConstants.MAIN_SHELL).activate();
    } catch (WidgetNotFoundException e) {
    // cannot activate main shell, continue anyways
    }
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) BeforeClass(org.junit.BeforeClass)

Example 12 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class ProjectExplorerViewRule method before.

@Override
protected void before() {
    final SWTWorkbenchBot bot = new SWTWorkbenchBot();
    SWTUtils.syncExec(() -> {
        try {
            return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PROJECT_EXPLORER_VIEW_ID);
        } catch (PartInitException e) {
            e.printStackTrace();
            return null;
        }
    });
    this.projectExplorerBotView = bot.viewById(PROJECT_EXPLORER_VIEW_ID);
    this.projectExplorerBotView.setFocus();
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) PartInitException(org.eclipse.ui.PartInitException)

Example 13 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class DockerContainersViewSWTBotTest method setup.

@Before
public void setup() {
    this.bot = new SWTWorkbenchBot();
    final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("defaultcon").status("Running").build()).image(MockImageFactory.id("987654321abcde").name("default:1").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Default", client).withDefaultTCPConnectionSettings();
    dockerConnection.removeContainerListener(DockerContainerRefreshManager.getInstance());
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    SWTUtils.asyncExec(() -> {
        try {
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerContainersView.VIEW_ID);
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerExplorerView.VIEW_ID);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Failed to open Docker Explorer view: " + e.getMessage());
        }
    });
    this.dockerContainersViewBot = bot.viewById(DockerContainersView.VIEW_ID);
    this.dockerContainersView = (DockerContainersView) (dockerContainersViewBot.getViewReference().getView(true));
    this.dockerExplorerBotView = bot.viewById(DockerExplorerView.VIEW_ID);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) DockerClient(com.spotify.docker.client.DockerClient) Before(org.junit.Before)

Example 14 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class DockerImageHierarchyViewSWTBotTest method setupViews.

@Before
public void setupViews() {
    this.bot = new SWTWorkbenchBot();
    SWTUtils.asyncExec(() -> {
        try {
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerExplorerView.VIEW_ID);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Failed to open Docker Explorer view: " + e.getMessage());
        }
    });
    this.dockerExplorerViewBot = bot.viewById(DockerExplorerView.VIEW_ID);
    this.dockerExplorerView = (DockerExplorerView) (dockerExplorerViewBot.getViewReference().getView(true));
    // make sure that the Docker Image Hierarchy view is closed
    this.bot.views().stream().filter(v -> v.getReference().getId().equals(DockerImageHierarchyView.VIEW_ID)).forEach(v -> v.close());
}
Also used : IDockerImage(org.eclipse.linuxtools.docker.core.IDockerImage) CloseWelcomePageRule(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.CloseWelcomePageRule) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IDockerContainer(org.eclipse.linuxtools.docker.core.IDockerContainer) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) DockerImageHierarchyViewAssertions(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.DockerImageHierarchyViewAssertions) DockerConnectionManagerUtils(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.DockerConnectionManagerUtils) TabDescriptorAssertions(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.TabDescriptorAssertions) DockerClient(com.spotify.docker.client.DockerClient) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) After(org.junit.After) MockContainerFactory(org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) ClassRule(org.junit.ClassRule) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) Before(org.junit.Before) MockImageFactory(org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory) PlatformUI(org.eclipse.ui.PlatformUI) MockDockerConnectionFactory(org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) Test(org.junit.Test) Collectors(java.util.stream.Collectors) MockDockerClientFactory(org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) Container(com.spotify.docker.client.messages.Container) List(java.util.List) DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) Rule(org.junit.Rule) Image(com.spotify.docker.client.messages.Image) MenuAssertion(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.MenuAssertion) ClearConnectionManagerRule(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.ClearConnectionManagerRule) IDockerImageHierarchyNode(org.eclipse.linuxtools.docker.core.IDockerImageHierarchyNode) TestLoggerRule(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.TestLoggerRule) SWTUtils(org.eclipse.linuxtools.internal.docker.ui.testutils.swt.SWTUtils) Assert(org.junit.Assert) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) Before(org.junit.Before)

Example 15 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class DockerImagesViewSWTBotTest method setup.

@Before
public void setup() {
    this.bot = new SWTWorkbenchBot();
    final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("angry_bar").status("Stopped").build()).image(MockImageFactory.id("987654321abcde").name("default:1").build()).build();
    final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Default", client).withDefaultTCPConnectionSettings();
    DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
    SWTUtils.asyncExec(() -> {
        try {
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerExplorerView.VIEW_ID);
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerImagesView.VIEW_ID);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Failed to open Docker Images view: " + e.getMessage());
        }
    });
    this.dockerImagesBotView = bot.viewById("org.eclipse.linuxtools.docker.ui.dockerImagesView");
    this.dockerImagesView = (DockerImagesView) (dockerImagesBotView.getViewReference().getView(true));
    this.dockerExplorerBotView = bot.viewById(DockerExplorerView.VIEW_ID);
}
Also used : DockerConnection(org.eclipse.linuxtools.internal.docker.core.DockerConnection) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) DockerClient(com.spotify.docker.client.DockerClient) Before(org.junit.Before)

Aggregations

SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)37 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)15 BeforeClass (org.junit.BeforeClass)15 Test (org.junit.Test)10 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)8 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)5 AbstractRefactoringSwtBotTest (org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)5 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 DockerClient (com.spotify.docker.client.DockerClient)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)4 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 SWTUtils (org.eclipse.linuxtools.internal.docker.ui.testutils.swt.SWTUtils)3 Before (org.junit.Before)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 IWorkspace (org.eclipse.core.resources.IWorkspace)2 IWorkspaceDescription (org.eclipse.core.resources.IWorkspaceDescription)2