diff options
author | Artur Signell <artur@vaadin.com> | 2013-03-18 13:56:56 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-03-21 07:22:18 +0000 |
commit | 5d8b1862b63d32070b4084d7e49cae1f4bc66953 (patch) | |
tree | 371dfef129c53d6fc63d01a7c6d58469a2bfbe09 /uitest | |
parent | e4c9eda51082a443822b66864df2fe14be7dc6d7 (diff) | |
download | vaadin-framework-5d8b1862b63d32070b4084d7e49cae1f4bc66953.tar.gz vaadin-framework-5d8b1862b63d32070b4084d7e49cae1f4bc66953.zip |
Unified all portal integration tests to be based on JSR286Portlet (#8013, #9566, #11314)
All portal tests are now based on the same test script. Portal tests avoid Vaadin locators to avoid random problems with the portlet id changing between test runs.
* eXo 3 test must be run on Firefox, does not work in Chrome
* Liferay theme test is now a separate test which does not depend on the Liferay integration test
* Changing to maximized state using an action URL does not work with GateIn or eXo
* The edit mode link does not work in WebLogic Portal as WebLogic feels it is not an allowed mode for the portlet
Change-Id: I7a683688d8ffc611e211f8a60889a34b233b81c9
Diffstat (limited to 'uitest')
12 files changed, 1165 insertions, 365 deletions
diff --git a/uitest/integration-testscripts/GateIn-3/integration-test-GateIn-3.1.0-portlet2.html b/uitest/integration-testscripts/GateIn-3/integration-test-GateIn-3.1.0-portlet2.html index 5d2d4c3445..7df5894f15 100644 --- a/uitest/integration-testscripts/GateIn-3/integration-test-GateIn-3.1.0-portlet2.html +++ b/uitest/integration-testscripts/GateIn-3/integration-test-GateIn-3.1.0-portlet2.html @@ -172,21 +172,146 @@ <td>Vaadin Portlet 2.0 Test</td> <td></td> </tr> -<!--Switch to view mode--> +<!--Switch to portlet user mode--> <tr> <td>mouseClickAndWait</td> <td>//a[@onclick='eXo.core.DOMUtil.disableOnClick(this);']</td> <td>13,5</td> </tr> +<!--Start of actual portlet test--> <tr> <td>waitForElementPresent</td> - <td>//div[2]/div/div[2]/img</td> + <td>//div[2]/div/div/div/span</td> <td></td> </tr> <tr> + <td>assertText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>initial</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertTextNotPresent</td> + <td>Action * received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<!--Send an action--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>Action 'someAction' received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<!--Switch to edit mode--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[5]/div/a/span</td> + <td>12,3</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<!--Restore back to normal--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<tr> <td>screenCapture</td> <td></td> - <td>view</td> + <td>final</td> </tr> </tbody></table> </body> diff --git a/uitest/integration-testscripts/Liferay-5/integration-test-liferay-5.2.3-portlet2.html b/uitest/integration-testscripts/Liferay-5/integration-test-liferay-5.2.3-portlet2.html index 55c9d18eb8..e1ceca0f1b 100644 --- a/uitest/integration-testscripts/Liferay-5/integration-test-liferay-5.2.3-portlet2.html +++ b/uitest/integration-testscripts/Liferay-5/integration-test-liferay-5.2.3-portlet2.html @@ -81,90 +81,140 @@ <td>//div[@id='Vaadin-VaadinPortlet20Test']/p/a</td> <td>16,11</td> </tr> +<!--Start of actual portlet test--> <tr> - <td>pause</td> - <td>1000</td> + <td>waitForElementPresent</td> + <td>//div[2]/div/div/div/span</td> <td></td> </tr> <tr> - <td>waitForVaadin</td> - <td></td> + <td>assertText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>screenCapture</td> <td></td> + <td>initial</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[2]</td> - <td></td> + <td>//body/div[2]/div</td> + <td>0,0</td> </tr> <tr> - <td>verifyTextNotPresent</td> - <td>Action received</td> + <td>assertTextNotPresent</td> + <td>Action * received</td> <td></td> </tr> <tr> - <td>mouseClickAndWait</td> - <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[4]/VLink[0]/domChild[0]/domChild[0]</td> - <td>8,7</td> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> </tr> +<!--Send an action--> <tr> - <td>closeNotification</td> - <td>//body/div[2]</td> - <td>0,0</td> + <td>mouseClickAndWait</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> </tr> <tr> - <td>verifyTextPresent</td> - <td>Done</td> + <td>assertTextPresent</td> + <td>Action 'someAction' received</td> <td></td> </tr> <tr> - <td>verifyTextPresent</td> - <td>Action received</td> - <td></td> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<!--Switch to edit mode--> +<tr> <td>mouseClickAndWait</td> - <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[7]/VLink[0]/domChild[0]/domChild[0]</td> - <td>28,7</td> + <td>//div[5]/div/a/span</td> + <td>12,3</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[2]</td> + <td>//body/div[2]/div</td> <td>0,0</td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> <td>mouseClickAndWait</td> - <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[5]/VLink[0]/domChild[0]/domChild[0]</td> - <td>37,-41</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: maximized</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[2]</td> + <td>//body/div[2]/div</td> <td>0,0</td> </tr> <tr> - <td>verifyTextPresent</td> + <td>assertText</td> + <td>//div[6]/div/a/span</td> <td>Back to normal</td> - <td></td> </tr> +<!--Restore back to normal--> <tr> <td>mouseClickAndWait</td> - <td>vaadin=v-JSR286TestPortlet_WAR_demo_LAYOUT_10706::/VVerticalLayout[0]/ChildComponentContainer[5]/VLink[0]/domChild[0]/domChild[0]</td> - <td>46,-57</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[2]</td> + <td>//body/div[2]/div</td> <td>0,0</td> </tr> <tr> - <td>verifyTextPresent</td> - <td>Edit</td> - <td></td> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> </tr> <tr> - <td>verifyTextPresent</td> + <td>assertText</td> + <td>//div[6]/div/a/span</td> <td>Maximize</td> +</tr> +<tr> + <td>screenCapture</td> <td></td> + <td>final</td> </tr> </tbody></table> </body> diff --git a/uitest/integration-testscripts/Liferay-6/Liferay6-and-6EE-theme-deploy.html b/uitest/integration-testscripts/Liferay-6/Liferay6-and-6EE-theme-deploy.html new file mode 100644 index 0000000000..50f71d992c --- /dev/null +++ b/uitest/integration-testscripts/Liferay-6/Liferay6-and-6EE-theme-deploy.html @@ -0,0 +1,146 @@ +<?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>integration-test-liferay-6.0.5</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">integration-test-liferay-6.0.5</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/web/guest/</td> + <td></td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>sign-in</td> + <td>49,17</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>_58_login</td> + <td>test@liferay.com</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>_58_password</td> + <td>test</td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>//input[@value='Sign In']</td> + <td>43,18</td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>//input[@type='submit']</td> + <td>16,-1321</td> +</tr> +<tr> + <td>type</td> + <td>reminderQueryAnswer</td> + <td>-</td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>//input[@value='Save']</td> + <td>86,13</td> +</tr> +<tr> + <td>drag</td> + <td>link=Add</td> + <td></td> +</tr> +<tr> + <td>mouseOver</td> + <td>link=Add</td> + <td>60,15</td> +</tr> +<tr> + <td>mouseClick</td> + <td>addPage</td> + <td>45,11</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>//div/span[1]/span/input</td> + <td>Vaadin Liferay Theme</td> +</tr> +<tr> + <td>mouseClick</td> + <td>save</td> + <td>10,12</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>//nav/ul/li[2]/a/span</td> + <td></td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>//nav/ul/li[2]/a/span</td> + <td>26,7</td> +</tr> +<tr> + <td>drag</td> + <td>link=Add</td> + <td></td> +</tr> +<tr> + <td>mouseOver</td> + <td>link=Manage</td> + <td>32,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>link=Page Layout</td> + <td>78,17</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>//form/div/div</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[2]/img</td> + <td>47,73</td> +</tr> +<tr> + <td>mouseClickAndWait</td> + <td>//div[5]/span/span/input</td> + <td>32,14</td> +</tr> +<tr> + <td>drag</td> + <td>link=Add</td> + <td></td> +</tr> +<tr> + <td>mouseOver</td> + <td>link=Add</td> + <td>56,23</td> +</tr> +<tr> + <td>mouseClick</td> + <td>link=Moreā¦</td> + <td>50,13</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>//div[@title='Vaadin Liferay Theme']/p/a</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>//div[@title='Vaadin Liferay Theme']/p/a</td> + <td>10,10</td> +</tr> +</tbody></table> +</body> +</html>
\ No newline at end of file diff --git a/uitest/integration-testscripts/Liferay-6/Liferay6-theme.html b/uitest/integration-testscripts/Liferay-6/Liferay6-theme.html index c61adb0dd7..03f2d25120 100644 --- a/uitest/integration-testscripts/Liferay-6/Liferay6-theme.html +++ b/uitest/integration-testscripts/Liferay-6/Liferay6-theme.html @@ -4,21 +4,19 @@ <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>test-liferay6-theme</title> +<title>integration-test-liferay-6.0.5</title> </head> <body> -<!-- - If you update this test, remember make the same changes to Liferay6EE-theme too! ---> <table cellpadding="1" cellspacing="1" border="1"> <thead> -<tr><td rowspan="1" colspan="3">LiferayTheme</td></tr> +<tr><td rowspan="1" colspan="3">integration-test-liferay-6.0.5</td></tr> </thead><tbody> <tr> <td>open</td> - <td>/web/guest/vaadin-liferay-theme/</td> + <td>/web/guest/vaadin-liferay-theme</td> <td></td> </tr> +<!--Start actual test--> <tr> <td>screenCapture</td> <td></td> @@ -356,13 +354,6 @@ <td>vaadin=v-VaadinLiferayThemePortlet_WAR_demo_LAYOUT_11352::Root/VNotification[0]</td> <td>0,0</td> </tr> -<!-- -<tr> - <td>pause</td> - <td>500</td> - <td></td> -</tr> ---> <tr> <td>click</td> <td>vaadin=v-VaadinLiferayThemePortlet_WAR_demo_LAYOUT_11352::/VVerticalLayout[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTabsheet[0]/VTabsheetPanel[0]/VGridLayout[0]/VButton[3]/domChild[0]/domChild[0]</td> @@ -388,7 +379,6 @@ <td></td> <td>openedmenu</td> </tr> - </tbody></table> </body> </html>
\ No newline at end of file diff --git a/uitest/integration-testscripts/Liferay-6/integration-test-liferay-6.0.5.html b/uitest/integration-testscripts/Liferay-6/integration-test-liferay-6.0.5.html index 037ce23865..656f2352e5 100644 --- a/uitest/integration-testscripts/Liferay-6/integration-test-liferay-6.0.5.html +++ b/uitest/integration-testscripts/Liferay-6/integration-test-liferay-6.0.5.html @@ -69,7 +69,7 @@ <tr> <td>enterCharacter</td> <td>//div/span[1]/span/input</td> - <td>Vaadin Liferay Theme</td> + <td>portlet2</td> </tr> <tr> <td>mouseClick</td> @@ -133,43 +133,148 @@ </tr> <tr> <td>waitForElementPresent</td> - <td>//div[@title='Vaadin Liferay Theme']/p/a</td> + <td>//div[@title='Vaadin Portlet 2.0 Test']/p/a</td> <td></td> </tr> <tr> <td>mouseClick</td> - <td>//div[@title='Vaadin Liferay Theme']/p/a</td> + <td>//div[@title='Vaadin Portlet 2.0 Test']/p/a</td> <td>10,10</td> </tr> +<!--Start actual test--> <tr> - <td>waitForTextPresent</td> - <td>Normal Label</td> + <td>waitForElementPresent</td> + <td>//div[2]/div/div/div/span</td> <td></td> </tr> <tr> + <td>assertText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> <td>screenCapture</td> <td></td> - <td>theme</td> + <td>initial</td> </tr> <tr> - <td>mouseClick</td> - <td>//td[3]/div/div/div</td> - <td>22,7</td> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> </tr> <tr> - <td>assertTextPresent</td> - <td>Normal TextField</td> + <td>assertTextNotPresent</td> + <td>Action * received</td> <td></td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<!--Send an action--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> +</tr> +<tr> <td>assertTextPresent</td> - <td>Normal TextArea</td> + <td>Action 'someAction' received</td> <td></td> </tr> <tr> - <td>assertTextNotPresent</td> - <td>Normal Label</td> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> +</tr> +<!--Switch to edit mode--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[5]/div/a/span</td> + <td>12,3</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: edit State: maximized</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Back to normal</td> +</tr> +<!--Restore back to normal--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<tr> + <td>screenCapture</td> <td></td> + <td>final</td> </tr> </tbody></table> </body> diff --git a/uitest/integration-testscripts/Liferay-6EE/Liferay6EE-theme.html b/uitest/integration-testscripts/Liferay-6EE/Liferay6EE-theme.html index f4772ef7ad..15d9571bad 100644 --- a/uitest/integration-testscripts/Liferay-6EE/Liferay6EE-theme.html +++ b/uitest/integration-testscripts/Liferay-6EE/Liferay6EE-theme.html @@ -4,22 +4,19 @@ <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>test-liferay6ee-theme</title> +<title>integration-test-liferay-6.0.5</title> </head> <body> -<!-- - This test is the same test as the Liferay6-theme test. - The only change is VaadinLiferayThemePortlet_WAR_demo_LAYOUT_11352 => VaadinLiferayThemePortlet_WAR_demo_LAYOUT_10413 ---> <table cellpadding="1" cellspacing="1" border="1"> <thead> -<tr><td rowspan="1" colspan="3">LiferayTheme</td></tr> +<tr><td rowspan="1" colspan="3">integration-test-liferay-6.0.5</td></tr> </thead><tbody> <tr> <td>open</td> - <td>/web/guest/vaadin-liferay-theme/</td> + <td>/web/guest/vaadin-liferay-theme</td> <td></td> </tr> +<!--Start actual test--> <tr> <td>screenCapture</td> <td></td> @@ -357,13 +354,6 @@ <td>vaadin=v-VaadinLiferayThemePortlet_WAR_demo_LAYOUT_10413::Root/VNotification[0]</td> <td>0,0</td> </tr> -<!-- -<tr> - <td>pause</td> - <td>500</td> - <td></td> -</tr> ---> <tr> <td>click</td> <td>vaadin=v-VaadinLiferayThemePortlet_WAR_demo_LAYOUT_10413::/VVerticalLayout[0]/VCssLayout[0]/VCssLayout$FlowPane[0]/VTabsheet[0]/VTabsheetPanel[0]/VGridLayout[0]/VButton[3]/domChild[0]/domChild[0]</td> @@ -389,7 +379,6 @@ <td></td> <td>openedmenu</td> </tr> - </tbody></table> </body> </html>
\ No newline at end of file diff --git a/uitest/integration-testscripts/common/portlet_test.tpl b/uitest/integration-testscripts/common/portlet_test.tpl new file mode 100644 index 0000000000..e4b83ef805 --- /dev/null +++ b/uitest/integration-testscripts/common/portlet_test.tpl @@ -0,0 +1,134 @@ +<tr> + <td>waitForElementPresent</td> + <td>//div[2]/div/div/div/span</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>initial</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertTextNotPresent</td> + <td>Action * received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<!--Send an action--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>Action 'someAction' received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<!--Switch to edit mode--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[5]/div/a/span</td> + <td>12,3</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: maximized</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Back to normal</td> +</tr> +<!--Restore back to normal--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[2]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[2]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>final</td> +</tr>
\ No newline at end of file diff --git a/uitest/integration-testscripts/eXo-3/integration-test-eXo-3.0.3-portlet2.html b/uitest/integration-testscripts/eXo-3/integration-test-eXo-3.0.3-portlet2.html index af85dfd161..8813f7fe23 100644 --- a/uitest/integration-testscripts/eXo-3/integration-test-eXo-3.0.3-portlet2.html +++ b/uitest/integration-testscripts/eXo-3/integration-test-eXo-3.0.3-portlet2.html @@ -3,13 +3,13 @@ <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="http://vaadin-integration-tests.intra.itmill.com:8080/" /> -<title>integration-test-eXo-3.0.3-portlet2</title> +<link rel="selenium.base" href="" /> +<title>integration-test-eXo-3.1.0-portlet2</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> -<tr><td rowspan="1" colspan="3">integration-test-eXo-3.0.3-portlet2</td></tr> +<tr><td rowspan="1" colspan="3">integration-test-eXo-3.1.0-portlet2</td></tr> </thead><tbody> <tr> <td>open</td> @@ -32,164 +32,296 @@ <td>37,4</td> </tr> <tr> - <td>setTimeout</td> - <td>60000</td> + <td>waitForElementPresent</td> + <td>link=Applications Registry</td> <td></td> </tr> <tr> - <td>waitForElementPresent</td> + <td>mouseClickAndWait</td> <td>link=Applications Registry</td> <td></td> </tr> <tr> - <td>open</td> - <td>/portal/private/intranet/administration/registry</td> - <td>138,17</td> + <td>mouseClick</td> + <td>link=Portlet</td> + <td>33,11</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>link=Vaadin Portlet 2.0 Test</td> + <td>59,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>link=Vaadin Portlet 2.0 Test</td> + <td>59,9</td> </tr> <tr> <td>waitForElementPresent</td> - <td>//div[@id='UIApplicationOrganizer']/div[1]/div[2]</td> + <td>link=Click here to add into categories</td> <td></td> </tr> <tr> - <td>expectDialog</td> - <td>//div[@id='UIApplicationOrganizer']/div[1]/div[2]</td> - <td>36,15</td> + <td>mouseClick</td> + <td>link=Click here to add into categories</td> + <td>48,3</td> </tr> <tr> - <td>getConfirmation</td> + <td>waitForElementPresent</td> + <td>name=category_Gadgets</td> <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>name=category_Gadgets</td> + <td>10,16</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>link=Save</td> <td></td> </tr> <tr> + <td>mouseClick</td> + <td>link=Save</td> + <td>4,6</td> +</tr> +<tr> <td>waitForElementPresent</td> - <td>link=demo</td> + <td>link=Vaadin Liferay Theme</td> <td></td> </tr> <tr> <td>mouseClick</td> - <td>link=Add New Page</td> - <td>64,16</td> + <td>link=Vaadin Liferay Theme</td> + <td>64,13</td> </tr> <tr> <td>waitForElementPresent</td> - <td>//form[@id='UIWizardPageSetInfo']/div[2]/div[2]/div/div[2]/div[1]</td> + <td>link=Click here to add into categories</td> <td></td> </tr> <tr> <td>mouseClick</td> - <td>pageName</td> - <td>98,10</td> + <td>link=Click here to add into categories</td> + <td>96,9</td> </tr> <tr> - <td>enterCharacter</td> - <td>pageName</td> - <td>Application_test</td> + <td>waitForElementPresent</td> + <td>name=category_Gadgets</td> + <td>7,12</td> </tr> <tr> - <td>enterCharacter</td> - <td>pageDisplayName</td> - <td>Vaadin test</td> + <td>mouseClick</td> + <td>name=category_Gadgets</td> + <td>7,12</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>link=Save</td> + <td>4,6</td> </tr> <tr> <td>mouseClick</td> - <td>//div[@id='UIPageCreationWizard']/div/div[3]/div/div/div/div[2]/div/table/tbody/tr/td/div[2]/div/div/div</td> - <td>24,16</td> + <td>link=Save</td> + <td>4,6</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>link=Add New Page</td> + <td>55,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>link=Add New Page</td> + <td>55,11</td> </tr> <tr> <td>waitForElementPresent</td> - <td>//form[@id='UIWizardPageSelectLayoutForm']/div[2]/div/div[1]/div[2]/div[1]/div[1]/div/div</td> + <td>pageName</td> <td></td> </tr> <tr> <td>mouseClick</td> + <td>pageName</td> + <td>33,16</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>pageName</td> + <td>Portlet2</td> +</tr> +<tr> + <td>mouseClick</td> <td>//div[@id='UIPageCreationWizard']/div/div[3]/div/div/div/div[2]/div/table/tbody/tr/td/div[2]/div/div/div</td> - <td>20,12</td> + <td>36,12</td> </tr> <tr> <td>waitForElementPresent</td> - <td>link=demo</td> + <td>//div[@id='UIDropDownPageTemp']/div[1]/div/div/div/div/div/div</td> <td></td> </tr> <tr> <td>mouseClick</td> - <td>link=demo</td> - <td>24,7</td> + <td>//div[@id='UIPageCreationWizard']/div/div[3]/div/div/div/div[2]/div/table/tbody/tr/td/div[2]/div/div/div</td> + <td>21,13</td> </tr> +<!--Drag JSR286 test portlet to page--> <tr> <td>waitForElementPresent</td> - <td>//div[@id='demo/JSR286TestPortlet']/div/div/div[1]/div[1]</td> + <td>//div[@id='Gadgets/JSR286TestPortlet']/div/div/div/div</td> <td></td> </tr> <tr> <td>drag</td> - <td>//div[@id='demo/JSR286TestPortlet']/div/div/div[1]/div[2]</td> - <td>147,6</td> + <td>//div[@id='Gadgets/JSR286TestPortlet']/div/div/div/div</td> + <td></td> </tr> <tr> - <td>mouseMoveAt</td> + <td>drop</td> <td>//div[2]/div/div/div[1]/div/div[2]/div/div/div/div</td> - <td>20,20</td> + <td>113,9</td> </tr> <tr> - <td>drop</td> - <td>//div[@id='UIPortalApplication']/div[4]</td> - <td>760,138</td> + <td>waitForTextPresent</td> + <td>Vaadin Portlet 2.0 Test</td> + <td></td> </tr> +<!--Switch to view mode--> <tr> <td>mouseClickAndWait</td> <td>//a[@onclick='eXo.core.DOMUtil.disableOnClick(this);']</td> - <td>10,7</td> + <td>13,5</td> +</tr> +<!--Start of actual portlet test--> +<tr> + <td>waitForText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>initial</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[4]/div</td> <td>0,0</td> </tr> <tr> - <td>setTimeout</td> - <td>60000</td> + <td>assertTextNotPresent</td> + <td>Action * received</td> <td></td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> +</tr> +<!--Send an action--> +<tr> <td>mouseClickAndWait</td> - <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td> - <td>10,10</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>Action 'someAction' received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Edit</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[4]/div</td> <td>0,0</td> </tr> +<!--Switch to edit mode--> <tr> - <td>pause</td> - <td>1000</td> - <td></td> + <td>mouseClickAndWait</td> + <td>//div[5]/div/a/span</td> + <td>12,3</td> </tr> <tr> - <td>screenCapture</td> - <td></td> - <td>Edit_mode</td> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[4]/div</td> + <td>0,0</td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> <td>mouseClickAndWait</td> - <td>//div[@id='UIPage']/div/div/div[2]/div/div/div/div/div/div/div[2]/div[5]/div/a</td> - <td>15,8</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: edit State: normal</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[3]/div</td> <td>0,0</td> </tr> <tr> - <td>pause</td> - <td>1000</td> - <td></td> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<!--Restore back to normal--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[3]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[3]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> </tr> <tr> <td>screenCapture</td> <td></td> - <td>done</td> + <td>final</td> </tr> </tbody></table> </body> diff --git a/uitest/integration-testscripts/weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html b/uitest/integration-testscripts/weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html index 98256862aa..f9f1d316c9 100644 --- a/uitest/integration-testscripts/weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html +++ b/uitest/integration-testscripts/weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html @@ -1,57 +1,140 @@ -<?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="http://vaadin-integration-tests.intra.itmill.com:7001/" /> -<title>integration-test-WebLogic-Portal-10.3.2-portlet2</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">integration-test-WebLogic-Portal-10.3.2-portlet2</td></tr> -</thead><tbody> <tr> <td>open</td> <td>/VaadinTest/TestPortal.portal</td> <td></td> </tr> +<!--Start actual test--> +<tr> + <td>waitForElementPresent</td> + <td>//div[2]/div/div/div/span</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[2]/div/div/div/span</td> + <td>Test of ApplicationResources with full path</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>initial</td> +</tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[4]/div</td> <td>0,0</td> </tr> <tr> + <td>assertTextNotPresent</td> + <td>Action * received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-disabled v-widget"]/a/span</td> + <td></td> +</tr> +<!--Send an action--> +<tr> <td>mouseClickAndWait</td> - <td>edit</td> - <td>31,9</td> + <td>//div[8]/div/a/span</td> + <td>32,9</td> +</tr> +<tr> + <td>assertTextPresent</td> + <td>Action 'someAction' received</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: view State: normal</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-disabled v-widget"]/a/span</td> + <td></td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[4]/div</td> <td>0,0</td> </tr> +<!--Switch to edit mode--> <tr> - <td>screenCapture</td> - <td></td> - <td>Edit_mode</td> + <td>mouseClickAndWait</td> + <td>name=edit</td> + <td>3,5</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: edit State: normal</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[4]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<!--Maximize--> +<tr> + <td>mouseClickAndWait</td> + <td>//div[6]/div/a/span</td> + <td>16,7</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: edit State: maximized</td> +</tr> +<tr> + <td>closeNotification</td> + <td>//body/div[4]/div</td> + <td>0,0</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Back to normal</td> </tr> +<!--Restore back to normal--> <tr> <td>mouseClickAndWait</td> - <td>vaadin=v-JSR286TestPortlet_1::/VVerticalLayout[0]/ChildComponentContainer[4]/VLink[0]/domChild[0]/domChild[0]</td> - <td>44,2</td> + <td>//div[6]/div/a/span</td> + <td>71,8</td> +</tr> +<tr> + <td>assertText</td> + <td>//body/div[4]/div//p</td> + <td>exact:Mode: edit State: normal</td> </tr> <tr> <td>closeNotification</td> - <td>//body/div[4]</td> + <td>//body/div[4]/div</td> <td>0,0</td> </tr> <tr> + <td>assertText</td> + <td>//div[@class="v-link v-widget"]/a/span</td> + <td>Done</td> +</tr> +<tr> + <td>assertText</td> + <td>//div[6]/div/a/span</td> + <td>Maximize</td> +</tr> +<tr> <td>screenCapture</td> <td></td> - <td>done</td> + <td>final</td> </tr> - -</tbody></table> -</body> -</html> diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml index 9eab2d563c..f8d250554c 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -183,12 +183,24 @@ <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> + <antcall target="run-generic-integration-test"> + <param name="startDelay" value="600" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> + <param name="target-server" value="liferay6" /> + </antcall> + </target> + + <target name="integration-test-liferay6-theme"> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> + <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> + <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" /> <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> <param name="target-server" value="liferay6" /> </antcall> </target> @@ -199,6 +211,7 @@ <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> <param name="target-server" value="liferay5" /> </antcall> </target> @@ -207,11 +220,23 @@ <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> + <antcall target="run-generic-integration-test"> + <param name="startDelay" value="600" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> + <param name="target-server" value="liferay6ee" /> + </antcall> + </target> + + <target name="integration-test-liferay6ee-theme"> + <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> + <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> + <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" /> <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> <param name="target-server" value="liferay6ee" /> </antcall> </target> @@ -231,7 +256,7 @@ <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> <antcall target="run-generic-integration-test"> <param name="startDelay" value="600" /> - <param name="test_browsers" value="winxp-googlechrome21" /> + <param name="test_browsers" value="winxp-firefox17-esr" /> <param name="target-server" value="exo3" /> </antcall> </target> @@ -306,6 +331,8 @@ </antcontrib:trycatch> <antcall target="integration-test-liferay6" /> <antcall target="integration-test-liferay6ee" /> + <antcall target="integration-test-liferay6-theme" /> + <antcall target="integration-test-liferay6ee-theme" /> <antcall target="integration-test-exo3" /> <antcall target="integration-test-weblogicPortal" /> <antcall target="integration-test-liferay5" /> diff --git a/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java new file mode 100644 index 0000000000..859175394d --- /dev/null +++ b/uitest/src/com/vaadin/tests/integration/JSR286Portlet.java @@ -0,0 +1,214 @@ +package com.vaadin.tests.integration; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.EventRequest; +import javax.portlet.EventResponse; +import javax.portlet.PortletMode; +import javax.portlet.PortletRequest; +import javax.portlet.PortletURL; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; +import javax.portlet.ResourceRequest; +import javax.portlet.ResourceResponse; +import javax.portlet.WindowState; + +import com.vaadin.annotations.StyleSheet; +import com.vaadin.server.ExternalResource; +import com.vaadin.server.VaadinPortletRequest; +import com.vaadin.server.VaadinPortletService; +import com.vaadin.server.VaadinPortletSession; +import com.vaadin.server.VaadinPortletSession.PortletListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.label.ContentMode; +import com.vaadin.ui.Embedded; +import com.vaadin.ui.Label; +import com.vaadin.ui.Link; +import com.vaadin.ui.Notification; +import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.TextField; +import com.vaadin.ui.UI; +import com.vaadin.ui.Upload; +import com.vaadin.ui.Upload.Receiver; +import com.vaadin.ui.VerticalLayout; + +/** + * Adapted from old PortletDemo to support integration testing. + */ +@StyleSheet("PortletConnectorResource.css") +public class JSR286Portlet extends UI { + + TextField tf = new TextField("Some value"); + Label userInfo = new Label(); + Link portletEdit = new Link(); + Link portletMax = new Link(); + Link someAction = null; + private VerticalLayout main = new VerticalLayout(); + + @Override + protected void init(VaadinRequest request) { + setContent(main); + Embedded appResourceTest = new Embedded( + "Test of ApplicationResources with full path", + new FlagSeResource()); + main.addComponent(appResourceTest); + Embedded specialNameResourceTest = new Embedded( + "Test ApplicationResources with special names", + new SpecialNameResource()); + specialNameResourceTest.addStyleName("hugeBorder"); + main.addComponent(specialNameResourceTest); + + userInfo.setCaption("User info"); + userInfo.setContentMode(ContentMode.PREFORMATTED); + main.addComponent(userInfo); + + tf.setEnabled(false); + tf.setImmediate(true); + main.addComponent(tf); + + portletEdit.setEnabled(false); + main.addComponent(portletEdit); + portletMax.setEnabled(false); + main.addComponent(portletMax); + + Upload upload = new Upload("Upload a file", new Receiver() { + + @Override + public OutputStream receiveUpload(String filename, String mimeType) { + return new ByteArrayOutputStream(); + } + }); + main.addComponent(upload); + + possiblyChangedModeOrState(); + getSession().addPortletListener(new DemoPortletListener()); + } + + @Override + public VaadinPortletSession getSession() { + return (VaadinPortletSession) super.getSession(); + } + + private void possiblyChangedModeOrState() { + VaadinPortletRequest request = (VaadinPortletRequest) VaadinPortletService + .getCurrentRequest(); + + boolean inViewMode = (request.getPortletMode() == PortletMode.VIEW); + boolean inNormalState = (request.getWindowState() == WindowState.NORMAL); + // Portlet up-and-running, enable stuff + portletEdit.setEnabled(true); + portletMax.setEnabled(true); + + // Editable if we're in editmode + tf.setEnabled(!inViewMode); + + // Show notification about current mode and state + getPage().showNotification( + new Notification("Portlet status", "Mode: " + + request.getPortletMode() + " State: " + + request.getWindowState(), Type.WARNING_MESSAGE)); + + // Display current user info + Map<?, ?> uinfo = (Map<?, ?>) request + .getAttribute(PortletRequest.USER_INFO); + if (uinfo != null) { + String s = ""; + for (Iterator<?> it = uinfo.keySet().iterator(); it.hasNext();) { + Object key = it.next(); + Object val = uinfo.get(key); + s += key + ": " + val + "\n"; + } + if (request.isUserInRole("administrator")) { + s += "(administrator)"; + } + userInfo.setValue(s); + } else { + userInfo.setValue("-"); + } + + // Create Edit/Done link (actionUrl) + PortletURL url = getSession().generateActionURL("changeMode"); + try { + if (inViewMode) { + url.setPortletMode(PortletMode.EDIT); + portletEdit.setCaption("Edit"); + } else { + url.setPortletMode(PortletMode.VIEW); + portletEdit.setCaption("Done"); + } + portletEdit.setResource(new ExternalResource(url.toString())); + } catch (Exception e) { + portletEdit.setEnabled(false); + Logger.getLogger(getClass().getName()).log(Level.SEVERE, + "Error creating edit mode link", e); + } + + // Create Maximize/Normal link (actionUrl) + url = getSession().generateActionURL("changeState"); + try { + if (inNormalState) { + url.setWindowState(WindowState.MAXIMIZED); + portletMax.setCaption("Maximize"); + } else { + url.setWindowState(WindowState.NORMAL); + portletMax.setCaption("Back to normal"); + + } + portletMax.setResource(new ExternalResource(url.toString())); + } catch (Exception e) { + portletMax.setEnabled(false); + Logger.getLogger(getClass().getName()).log(Level.SEVERE, + "Error creating state change link", e); + } + + if (someAction == null) { + url = getSession().generateActionURL("someAction"); + try { + someAction = new Link("An action", new ExternalResource( + url.toString())); + main.addComponent(someAction); + } catch (Exception e) { + // Oops + System.err.println("Could not create someAction: " + e); + } + + } + } + + private class DemoPortletListener implements PortletListener { + + @Override + public void handleActionRequest(ActionRequest request, + ActionResponse response, UI window) { + main.addComponent(new Label("Action '" + + request.getParameter("javax.portlet.action") + + "' received")); + } + + @Override + public void handleRenderRequest(RenderRequest request, + RenderResponse response, UI window) { + possiblyChangedModeOrState(); + } + + @Override + public void handleEventRequest(EventRequest request, + EventResponse response, UI window) { + // events not used by this test + } + + @Override + public void handleResourceRequest(ResourceRequest request, + ResourceResponse response, UI window) { + // nothing special to do here + } + } + +} diff --git a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java deleted file mode 100644 index 81b7ebb653..0000000000 --- a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.vaadin.tests.integration; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import java.util.Iterator; -import java.util.Map; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.EventRequest; -import javax.portlet.EventResponse; -import javax.portlet.PortletMode; -import javax.portlet.PortletRequest; -import javax.portlet.PortletURL; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.portlet.WindowState; - -import com.vaadin.annotations.StyleSheet; -import com.vaadin.server.ExternalResource; -import com.vaadin.server.LegacyApplication; -import com.vaadin.server.VaadinPortletSession; -import com.vaadin.server.VaadinPortletSession.PortletListener; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Label; -import com.vaadin.ui.LegacyWindow; -import com.vaadin.ui.Link; -import com.vaadin.ui.Notification; -import com.vaadin.ui.TextField; -import com.vaadin.ui.UI; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Upload.Receiver; - -/** - * Adapted from old PortletDemo to support integration testing. - */ -public class JSR286PortletApplication extends LegacyApplication { - - @StyleSheet("PortletConnectorResource.css") - public final class LegacyWindowWithStylesheet extends LegacyWindow { - - } - - LegacyWindow main = new LegacyWindowWithStylesheet(); - TextField tf = new TextField("Some value"); - Label userInfo = new Label(); - Link portletEdit = new Link(); - Link portletMax = new Link(); - Link someAction = null; - - @Override - public void init() { - setMainWindow(main); - - Embedded appResourceTest = new Embedded( - "Test of ApplicationResources with full path", - new FlagSeResource()); - main.addComponent(appResourceTest); - Embedded specialNameResourceTest = new Embedded( - "Test ApplicationResources with special names", - new SpecialNameResource()); - specialNameResourceTest.addStyleName("hugeBorder"); - main.addComponent(specialNameResourceTest); - - userInfo.setCaption("User info"); - userInfo.setContentMode(ContentMode.PREFORMATTED); - main.addComponent(userInfo); - - tf.setEnabled(false); - tf.setImmediate(true); - main.addComponent(tf); - - portletEdit.setEnabled(false); - main.addComponent(portletEdit); - portletMax.setEnabled(false); - main.addComponent(portletMax); - - Upload upload = new Upload("Upload a file", new Receiver() { - - @Override - public OutputStream receiveUpload(String filename, String mimeType) { - return new ByteArrayOutputStream(); - } - }); - main.addComponent(upload); - - if (getContext() instanceof VaadinPortletSession) { - VaadinPortletSession ctx = (VaadinPortletSession) getContext(); - ctx.addPortletListener(new DemoPortletListener()); - } else { - getMainWindow().showNotification("Not inited via Portal!", - Notification.TYPE_ERROR_MESSAGE); - } - - } - - private class DemoPortletListener implements PortletListener { - - @Override - public void handleActionRequest(ActionRequest request, - ActionResponse response, UI window) { - main.addComponent(new Label("Action received")); - } - - @Override - public void handleRenderRequest(RenderRequest request, - RenderResponse response, UI window) { - // Portlet up-and-running, enable stuff - portletEdit.setEnabled(true); - portletMax.setEnabled(true); - - // Editable if we're in editmode - tf.setEnabled((request.getPortletMode() == PortletMode.EDIT)); - - // Show notification about current mode and state - getMainWindow().showNotification( - "Portlet status", - "Mode: " + request.getPortletMode() + " State: " - + request.getWindowState(), - Notification.TYPE_WARNING_MESSAGE); - - // Display current user info - Map<?, ?> uinfo = (Map<?, ?>) request - .getAttribute(PortletRequest.USER_INFO); - if (uinfo != null) { - String s = ""; - for (Iterator<?> it = uinfo.keySet().iterator(); it.hasNext();) { - Object key = it.next(); - Object val = uinfo.get(key); - s += key + ": " + val + "\n"; - } - if (request.isUserInRole("administrator")) { - s += "(administrator)"; - } - userInfo.setValue(s); - } else { - userInfo.setValue("-"); - } - - // Create Edit/Done link (actionUrl) - PortletURL url = response.createActionURL(); - try { - url.setPortletMode((request.getPortletMode() == PortletMode.VIEW ? PortletMode.EDIT - : PortletMode.VIEW)); - portletEdit.setResource(new ExternalResource(url.toString())); - portletEdit - .setCaption((request.getPortletMode() == PortletMode.VIEW ? "Edit" - : "Done")); - } catch (Exception e) { - portletEdit.setEnabled(false); - } - // Create Maximize/Normal link (actionUrl) - url = response.createActionURL(); - try { - url.setWindowState((request.getWindowState() == WindowState.NORMAL ? WindowState.MAXIMIZED - : WindowState.NORMAL)); - portletMax.setResource(new ExternalResource(url.toString())); - portletMax - .setCaption((request.getWindowState() == WindowState.NORMAL ? "Maximize" - : "Back to normal")); - } catch (Exception e) { - portletMax.setEnabled(false); - } - - if (someAction == null) { - url = response.createActionURL(); - try { - someAction = new Link("An action", new ExternalResource( - url.toString())); - main.addComponent(someAction); - } catch (Exception e) { - // Oops - System.err.println("Could not create someAction: " + e); - } - - } - } - - @Override - public void handleEventRequest(EventRequest request, - EventResponse response, UI window) { - // events not used by this test - } - - @Override - public void handleResourceRequest(ResourceRequest request, - ResourceResponse response, UI window) { - // nothing special to do here - } - } - -} |