use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.
the class DockerConnectionManagerUtils method configureConnectionManager.
/**
* Configures the {@link DockerConnectionManager} with the given array of
* {@link IDockerConnection} (can be mocked) and refreshes the associated
* {@link DockerExplorerView}.
*
* @param connectionStorageManager
* the {@link IDockerConnectionStorageManager} to use (can be
* mocked)
*/
public static void configureConnectionManager(final IDockerConnectionStorageManager connectionStorageManager) {
DockerConnectionManager.getInstance().setConnectionStorageManager(connectionStorageManager);
final SWTWorkbenchBot bot = new SWTWorkbenchBot();
final SWTBotView dockerExplorerBotView = SWTUtils.getSWTBotView(bot, DockerExplorerView.VIEW_ID);
final SWTBotView dockerContainersBotView = SWTUtils.getSWTBotView(bot, DockerContainersView.VIEW_ID);
SWTUtils.syncExec(() -> {
DockerConnectionManager.getInstance().reloadConnections();
if (dockerExplorerBotView != null) {
final DockerExplorerView dockerExplorerView = (DockerExplorerView) dockerExplorerBotView.getViewReference().getView(false);
if (dockerExplorerView != null) {
dockerExplorerView.getCommonViewer().refresh();
dockerExplorerView.showConnectionsOrExplanations();
}
}
if (dockerContainersBotView != null) {
final DockerContainersView dockerContainersView = (DockerContainersView) dockerContainersBotView.getViewReference().getView(false);
if (dockerContainersView != null) {
dockerContainersView.getViewer().refresh();
}
}
});
}
use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.
the class DockerExplorerViewSWTBotTest method setup.
@Before
public void setup() {
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));
this.bot.views().stream().filter(v -> v.getReference().getId().equals(DockerContainersView.VIEW_ID) || v.getReference().getId().equals(DockerImagesView.VIEW_ID) || v.getReference().getId().equals("org.eclipse.ui.views.PropertySheet")).forEach(v -> v.close());
}
use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.
the class AbstractSWTBotTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
// delay click speed
// System.setProperty("org.eclipse.swtbot.playback.delay", "200");
bot = new SWTWorkbenchBot();
try {
bot.viewByTitle("Welcome").close();
// hide Subclipse Usage stats popup if present/installed
bot.shell("Subclipse Usage").activate();
bot.button("Cancel").click();
} catch (WidgetNotFoundException e) {
// ignore
}
// Make sure project explorer is open and tree available
ProjectExplorer.openView();
projectExplorerViewTree = ProjectExplorer.getTree();
}
use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.
the class PreferencesTest method checkDefaultPreference.
private static void checkDefaultPreference(String preferenceCategory, String profilingType) {
SWTWorkbenchBot bot = new SWTWorkbenchBot();
// Open preferences shell.
// $NON-NLS-1$
SWTBotMenu windowsMenu = bot.menu("Window");
// $NON-NLS-1$
windowsMenu.menu("Preferences").click();
// $NON-NLS-1$
SWTBotShell shell = bot.shell("Preferences");
shell.activate();
// Go to specified tree item in "Profiling Categories" preferences page.
bot.text().setText(preferenceCategory);
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "Profiling", "Categories", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
preferenceCategory));
// Restore defaults.
// $NON-NLS-1$
bot.button("Restore Defaults").click();
// $NON-NLS-1$
bot.button("Apply").click();
// Get information for default tool.
String defaultToolId = ProviderFramework.getProviderIdToRun(null, profilingType);
// $NON-NLS-1$
String defaultToolName = ProviderFramework.getToolInformationFromId(defaultToolId, "name");
// $NON-NLS-1$
String defaultToolInfo = ProviderFramework.getToolInformationFromId(defaultToolId, "information");
// $NON-NLS-1$
String defaultToolDescription = ProviderFramework.getToolInformationFromId(defaultToolId, "description");
// $NON-NLS-1$ //$NON-NLS-2$
String defaultToolLabel = defaultToolName + " [" + defaultToolDescription + "]";
// Assert default radio is as expected.
SWTBotRadio defaultRadio = bot.radio(defaultToolLabel);
assertNotNull(defaultRadio);
assertEquals(defaultToolInfo, defaultRadio.getToolTipText());
// $NON-NLS-1$
bot.button("Apply").click();
// $NON-NLS-1$
bot.button("Apply and Close").click();
}
use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.
the class PreferencesTest method setUpWorkbench.
@BeforeClass
public static void setUpWorkbench() throws Exception {
// Set up is based from from GcovTest{c,CPP}.
SWTWorkbenchBot bot = new SWTWorkbenchBot();
try {
// $NON-NLS-1$
bot.viewByTitle("Welcome").close();
// hide Subclipse Usage stats popup if present/installed
// $NON-NLS-1$
bot.shell("Subclipse Usage").activate();
// $NON-NLS-1$
bot.button("Cancel").click();
} catch (WidgetNotFoundException e) {
// ignore
}
// Set C/C++ perspective.
// $NON-NLS-1$
bot.perspectiveByLabel("C/C++").activate();
bot.sleep(500);
for (SWTBotShell sh : bot.shells()) {
if (sh.getText().startsWith("C/C++")) {
// $NON-NLS-1$
sh.activate();
bot.sleep(500);
break;
}
}
// Turn off automatic building by default to avoid timing issues
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription desc = workspace.getDescription();
boolean isAutoBuilding = desc.isAutoBuilding();
if (isAutoBuilding) {
desc.setAutoBuilding(false);
workspace.setDescription(desc);
}
}
Aggregations