Search in sources :

Example 1 with CaptureScreenshotException

use of org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method debugDockerImageTest.

/**
 * Auxiliary method for helping with debugging JBIDE-23841.
 * This method maximizes Docker explorer view, captures screenshot and restores the view back.
 * It also gathers some info and returns it.
 */
private static String debugDockerImageTest() {
    String message = "";
    DockerExplorerView dockerExplorerView = new DockerExplorerView();
    dockerExplorerView.maximize();
    try {
        ScreenshotCapturer.getInstance().captureScreenshot("DeployDockerImageTest#setup");
    } catch (CaptureScreenshotException e) {
        // Capturing screenshot was not successfull. No big deal.
        LOGGER.debug("Capturing screenshot was not succesfull.");
    }
    dockerExplorerView.restore();
    List<String> names = dockerExplorerView.getDockerConnectionNames();
    for (String name : names) {
        DockerConnection connection = dockerExplorerView.getDockerConnectionByName(name);
        TreeItem treeItem = connection.getTreeItem();
        message += "TreeItem for connection \"" + name + "\": " + treeItem.getText() + "\n";
    }
    return message;
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)

Example 2 with CaptureScreenshotException

use of org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException in project jbosstools-hibernate by jbosstools.

the class EntityValidationTest method userIdentifierGeneratorValidationTest.

// known issue JBIDE-19526
@Test(expected = HibernateTestException.class)
public void userIdentifierGeneratorValidationTest() {
    ProblemsView pv = new ProblemsView();
    pv.open();
    List<Problem> problems = pv.getProblems(ProblemType.ERROR);
    assertTrue(problems.isEmpty());
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(PROJECT_NAME).getProjectItem("src/main/java", "org.hibernate.ui.test.model", "UserIdGenerator.java").delete();
    try {
        ScreenshotCapturer.getInstance().captureScreenshot("entity_validation");
    } catch (CaptureScreenshotException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    pv.activate();
    String expectedProblem = "Strategy class \"org.hibernate.ui.test.model.UserIdGenerator\" could not be found.";
    new WaitUntil(new ProblemExists(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem)), TimePeriod.DEFAULT, false);
    problems = pv.getProblems(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem));
    if (problems.size() != 1) {
        throw new HibernateTestException();
    }
}
Also used : ProblemExists(org.eclipse.reddeer.eclipse.condition.ProblemExists) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) MarkerDescriptionMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView) HibernateTestException(org.jboss.tools.hibernate.ui.bot.test.HibernateTestException) Test(org.junit.Test)

Aggregations

CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)2 DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)1 DockerConnection (org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 ProblemExists (org.eclipse.reddeer.eclipse.condition.ProblemExists)1 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)1 MarkerDescriptionMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher)1 Problem (org.eclipse.reddeer.eclipse.ui.problems.Problem)1 ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 HibernateTestException (org.jboss.tools.hibernate.ui.bot.test.HibernateTestException)1 Test (org.junit.Test)1