diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-11 13:39:18 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-11 13:39:18 +0300 |
commit | e570c659afb2e11f7f8ed75dca8c18d4e2814e64 (patch) | |
tree | 74d57228be18e70ea2b507be1a6908084f86ade8 /tests | |
parent | df92b70b06a5f6a6a3160370037bcefb778e8db1 (diff) | |
parent | af19523dd55e1a81acabade6b8ade096ffa7d785 (diff) | |
download | vaadin-framework-e570c659afb2e11f7f8ed75dca8c18d4e2814e64.tar.gz vaadin-framework-e570c659afb2e11f7f8ed75dca8c18d4e2814e64.zip |
Merge commit 'af1952'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.html | 36 | ||||
-rw-r--r-- | tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java | 57 |
2 files changed, 93 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.html b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.html new file mode 100644 index 0000000000..f20967c8de --- /dev/null +++ b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.html @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>TabSheetWithDisappearingContent</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TabSheetWithDisappearingContent</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.application.TerminalErrorNotification?restartApplication&debug</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestsapplicationTerminalErrorNotification::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>vaadin=runcomvaadintestsapplicationTerminalErrorNotification::Root/VNotification[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsapplicationTerminalErrorNotification::Root/VNotification[0]/HTML[0]/domChild[0]</td> + <td>Got an exception: You asked for it</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java new file mode 100644 index 0000000000..93e38bac5b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/application/TerminalErrorNotification.java @@ -0,0 +1,57 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.tests.application; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Window; +import com.vaadin.ui.Window.Notification; + +public class TerminalErrorNotification extends TestBase { + + @Override + protected void setup() { + Button button = new Button("Throw exception", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + throw new RuntimeException("You asked for it"); + } + }); + + addComponent(button); + } + + @Override + public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) { + event.getThrowable().printStackTrace(); + + Window mainWindow = getMainWindow(); + if (mainWindow != null) { + Throwable throwable = event.getThrowable(); + + // Find the root cause + while (throwable.getCause() != null) { + throwable = throwable.getCause(); + } + + mainWindow.showNotification( + "Got an exception: " + throwable.getMessage(), + Notification.TYPE_ERROR_MESSAGE); + } else { + System.out.println("No main window found"); + } + } + + @Override + protected String getDescription() { + return "Showing a notification in the terminalError method should make the notification appear in the browser."; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8778); + } + +} |