From a5a91311e9941cc4db775d6edb58781ca435b022 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 28 Oct 2013 16:55:45 +0200 Subject: [PATCH] Converted LayoutTesterApplication test to TB3 Change-Id: I2cee37ae8297c74b4a37fc59e3cf835c9291ed43 --- .../layouts/layouttester/GridLayoutTests.java | 26 + .../layouttester/HorizontalLayoutTests.java | 21 +- .../layouttester/LayoutTesterApplication.html | 896 ------------------ .../layouttester/LayoutTesterApplication.java | 15 +- .../LayoutTesterApplicationTest.java | 137 +++ .../layouttester/VerticalLayoutTests.java | 20 +- 6 files changed, 211 insertions(+), 904 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html create mode 100644 uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index 221680be11..f55867c464 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -124,6 +124,13 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button5 = new Button("Test remove row 0"); final Button button6 = new Button("Test remove comp row3"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + button5.setId("testButton5"); + button6.setId("testButton6"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); @@ -223,6 +230,10 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button4 = new Button("undefined size+add, table"); glo.replaceComponent(x22, x22 = getTestTable()); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); @@ -287,6 +298,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("set all cols expand 0.25"); final Button button3 = new Button("set row 0 expand 0.5"); final Button button4 = new Button("set row 3 expand 0.2"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + glo.setHeight("400px"); glo.replaceComponent(x22, x22 = getTestTable()); @@ -396,6 +412,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + glo.replaceComponent(x22, x22 = getTestTable()); baseLayout.addComponent(button1); @@ -467,6 +488,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java index 7a53a6583e..971205ccbb 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java @@ -123,7 +123,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button replaceButton = new Button("Test replace"); final Button moveButton = new Button("Test move"); final Button removeButton = new Button("Test remove"); - + addButton.setId("testButton1"); + replaceButton.setId("testButton2"); + moveButton.setId("testButton3"); + removeButton.setId("testButton4"); replaceButton.setEnabled(false); moveButton.setEnabled(false); removeButton.setEnabled(false); @@ -193,6 +196,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button smallerButton = new Button("200 px width"); final Button originalButton = new Button("undefined size+add"); + biggerButton.setId("testButton1"); + smallerButton.setId("testButton2"); + originalButton.setId("testButton3"); + baseLayout.addComponent(biggerButton); baseLayout.addComponent(smallerButton); baseLayout.addComponent(originalButton); @@ -257,6 +264,11 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); @@ -332,6 +344,9 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button1 = new Button("Expand to 1/undefined"); final Button button2 = new Button("Expand to 0.5/0.5"); final Button button3 = new Button("Expand to 0.75/0.25"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); @@ -438,6 +453,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("Set spacing on"); final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html deleted file mode 100644 index 8408aba9fd..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html +++ /dev/null @@ -1,896 +0,0 @@ - - - - - - -LayoutTesterApplication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LayoutTesterApplication
open/run/com.vaadin.tests.layouts.layouttester.LayoutTesterApplication?restartApplication
screenCapture1
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture2
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture3
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture4
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture5
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture6
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture7
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture8
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture9
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture10
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture11
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture12
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture13
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture14
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture15
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture16
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture17
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture18
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture19
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture20
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture21
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture22
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture23
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture24
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture25
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture26
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture27
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture28
selectvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]label=class com.vaadin.ui.HorizontalLayout
screenCapture29
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture30
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture31
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture32
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture33
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture34
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture35
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture36
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture37
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture38
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture39
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture40
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture41
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture42
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture43
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture44
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture45
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture46
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture47
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture48
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture49
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture50
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture51
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture52
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture53
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture54
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture55
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture56
selectvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]label=class com.vaadin.ui.GridLayout
screenCapture57
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture58
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture59
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture60
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture61
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture62
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture63
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture64
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture65
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture66
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture67
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture68
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture69
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture70
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture71
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture72
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture73
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture74
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture75
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]
screenCapture76
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]
screenCapture77
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture78
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture79
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture80
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture81
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture82
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]
screenCapture83
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture84
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture85
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapture86
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture87
clickvaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture88
- - diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java index 72863895a1..ef092d2539 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java @@ -20,18 +20,20 @@ public class LayoutTesterApplication extends AbstractTestCase { Button nextButton = new Button("Next"); private int layoutIndex = -1; - private static final String[] layoutGetters = new String[] { - "getCaptionsTests", "getIconsTests", - "getRequiredErrorIndicatorsTests", "getAlignmentTests", - "getExpandRatiosTests", "getMarginSpacingTests", - "getComponentAddReplaceMoveTests", "getComponentSizingTests", - "getLayoutSizingTests" }; + static final String[] layoutGetters = new String[] { "getCaptionsTests", + "getIconsTests", "getRequiredErrorIndicatorsTests", + "getAlignmentTests", "getExpandRatiosTests", + "getMarginSpacingTests", "getComponentAddReplaceMoveTests", + "getComponentSizingTests", "getLayoutSizingTests" }; + public static final String NEXT_BUTTON_ID = "nextButton"; + private static final String LAYOUT_SELECT_ID = "layoutSelect"; private LegacyWindow mainWindow; private NativeSelect layoutSelector; @Override public void init() { + nextButton.setId(NEXT_BUTTON_ID); mainWindow = new LegacyWindow("LayoutTesterApplication"); setMainWindow(mainWindow); nextLayout(); @@ -112,6 +114,7 @@ public class LayoutTesterApplication extends AbstractTestCase { private NativeSelect getLayoutTypeSelect() { if (layoutSelector == null) { layoutSelector = new NativeSelect(); + layoutSelector.setId(LAYOUT_SELECT); layoutSelector.addItem(VerticalLayout.class); layoutSelector.addItem(HorizontalLayout.class); layoutSelector.addItem(GridLayout.class); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java new file mode 100644 index 0000000000..33197613dc --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java @@ -0,0 +1,137 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.layouts.layouttester; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; + +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +public class LayoutTesterApplicationTest extends MultiBrowserTest { + Map numberOfSubTests = new HashMap(); + private Set tableOrIconsTests = new HashSet(); + + { + numberOfSubTests.put("getExpandRatiosTests", 3); + numberOfSubTests.put("getLayoutSizingTests", 4); + numberOfSubTests.put("getComponentAddReplaceMoveTests", 4); + numberOfSubTests.put("getMarginSpacingTests", 4); + numberOfSubTests.put("getComponentSizingTests", 3); + + tableOrIconsTests.add("getComponentSizingTests"); + tableOrIconsTests.add("getExpandRatiosTests"); + tableOrIconsTests.add("getLayoutSizingTests"); + tableOrIconsTests.add("getMarginSpacingTests"); + tableOrIconsTests.add("getIconsTests"); + + } + + @Test + public void verticalLayout() throws Exception { + openTestURL(); + runTest(VerticalLayout.class); + } + + @Test + public void horizontalLayout() throws Exception { + openTestURL(); + runTest(HorizontalLayout.class); + } + + @Test + public void gridLayout() throws Exception { + numberOfSubTests.put("getComponentAddReplaceMoveTests", 6); + numberOfSubTests.put("getComponentSizingTests", 4); + numberOfSubTests.put("getExpandRatiosTests", 4); + + openTestURL(); + runTest(GridLayout.class); + } + + private void runTest(Class layoutClass) throws Exception { + new Select(vaadinElementById("layoutSelect").findElement( + By.xpath("select"))) + .selectByVisibleText(layoutClass.toString()); + focusElementWithId("nextButton"); + + for (String subTest : LayoutTesterApplication.layoutGetters) { + compareScreen(subTest); + Integer subTests = numberOfSubTests.get(subTest); + if (subTests != null) { + for (int i = 1; i <= subTests; i++) { + clickAndCompareScreen(subTest, "testButton" + i); + } + } + getNextButton().click(); + } + + } + + /** + * @param elementId + * the id of the element to focus + */ + private void focusElementWithId(String elementId) { + // This should really be in TestBench + ((JavascriptExecutor) getDriver()) + .executeScript("document.getElementById('" + elementId + + "').focus()"); + } + + /** + * Clicks the button with the given id and compares the result to a + * screenshot named 'screenshotPrefix'-buttonCaption. + * + * @param screenshotPrefix + * @param buttonId + * @throws Exception + */ + private void clickAndCompareScreen(String screenshotPrefix, String buttonId) + throws Exception { + WebElement button = vaadinElementById(buttonId); + button.click(); + if (needsDelayToStabilize(screenshotPrefix)) { + // Table does some extra layout phase and TestBench does not always + // take this into account, grabbing screenshots before the layout + // phase is done (see #12866). + sleep(200); + } + compareScreen(screenshotPrefix + "-" + sanitize(button.getText())); + } + + private boolean needsDelayToStabilize(String screenshotPrefix) { + return tableOrIconsTests.contains(screenshotPrefix); + } + + private String sanitize(String text) { + return text.replace("%", "pct").replaceAll("[^a-zA-Z0-9]", "-"); + } + + private WebElement getNextButton() { + return vaadinElementById(LayoutTesterApplication.NEXT_BUTTON_ID); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java index 7764589ff7..04cee2d68d 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java @@ -127,6 +127,10 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button replaceButton = new Button("Test replace"); final Button moveButton = new Button("Test move"); final Button removeButton = new Button("Test remove"); + addButton.setId("testButton1"); + replaceButton.setId("testButton2"); + moveButton.setId("testButton3"); + removeButton.setId("testButton4"); replaceButton.setEnabled(false); moveButton.setEnabled(false); @@ -196,7 +200,9 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button biggerButton = new Button("full size"); final Button smallerButton = new Button("200 px width"); final Button originalButton = new Button("undefined size and add"); - + biggerButton.setId("testButton1"); + smallerButton.setId("testButton2"); + originalButton.setId("testButton3"); vlo.addComponent(biggerButton); vlo.addComponent(smallerButton); vlo.addComponent(originalButton); @@ -265,6 +271,11 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + vlo.addComponent(button1); vlo.addComponent(button2); vlo.addComponent(button3); @@ -344,8 +355,11 @@ public class VerticalLayoutTests extends AbstractLayoutTests { c2.setSizeFull(); final Button button1 = new Button("Expand to 1/undefined"); + button1.setId("testButton1"); final Button button2 = new Button("Expand to 0.5/0.5"); + button2.setId("testButton2"); final Button button3 = new Button("Expand to 0.75/0.25"); + button3.setId("testButton3"); vlo.addComponent(button1); vlo.addComponent(button2); @@ -460,6 +474,10 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("Set spacing on"); final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); vlo.addComponent(button1); vlo.addComponent(button2); -- 2.39.5