diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 11:06:18 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-04-15 14:00:58 +0300 |
commit | 6b8412033e680ce6e5c7827ac504adf132305726 (patch) | |
tree | 0df05d16c324b285610af8910c126b58f4c490c5 /uitest/src/com/vaadin/tests/components/ui | |
parent | 9192b0bb5e5e699b506b3d3e7df4cf295fbea44a (diff) | |
download | vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.tar.gz vaadin-framework-6b8412033e680ce6e5c7827ac504adf132305726.zip |
Build uitest war with maven
Change-Id: I32625901ca27a282253df44c6e776cf9632bacda
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/ui')
65 files changed, 0 insertions, 3989 deletions
diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java deleted file mode 100644 index d4599fc1a3..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemText.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Label; - -public class ComboboxSelectedItemText extends AbstractTestUIWithLog { - @Override - protected void setup(VaadinRequest request) { - getLayout() - .addComponent( - new Label( - "Select first ANTIGUA AND BARBUDA from the first combobox. Then select ANTIGUA AND BARBUDA from the second combobox. Finally, click the popup button on the first combobox. Before fix you would see UA AND BAR in the field.")); - - ComboBox combobox = new ComboBox("Text input enabled:"); - combobox.setWidth("100px"); - - combobox.addItem("AMERICAN SAMOA"); - combobox.addItem("ANTIGUA AND BARBUDA"); - - ComboBox combobox2 = new ComboBox("Text input disabled:"); - combobox2.setWidth("100px"); - combobox2.setTextInputAllowed(false); - - combobox2.addItem("AMERICAN SAMOA"); - combobox2.addItem("ANTIGUA AND BARBUDA"); - - getLayout().addComponent(combobox); - getLayout().addComponent(combobox2); - } - - @Override - protected String getTestDescription() { - return "Tests selected item is displayed from the beginning"; - } - - @Override - protected Integer getTicketNumber() { - return 13477; - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java deleted file mode 100644 index 760d2f39ea..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.components.ui; - -import java.io.IOException; -import java.util.List; - -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.testbench.By; -import com.vaadin.testbench.parallel.Browser; -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Test class for issue #13477, where selecting a combobox item that is too long - * would render the ending of an item instead of the beginning, which was - * considered less than informative. - * - * @author Vaadin Ltd - */ - -public class ComboboxSelectedItemTextTest extends MultiBrowserTest { - - public final String SCREENSHOT_NAME_EDITABLE = "LongComboboxItemSelectedEditable"; - public final String SCREENSHOT_NAME_NON_EDITABLE = "LongComboboxItemSelectedNonEditable"; - public final int INDEX_EDITABLE_COMBOBOX = 1; - public final int INDEX_NON_EDITABLE_COMBOBOX = 2; - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - // Ignoring Chrome 40 because of a regression. See #16636. - return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, - Browser.IE11, Browser.FIREFOX, Browser.PHANTOMJS); - } - - @Test - public void testCombobox() throws IOException { - testCombobox(INDEX_EDITABLE_COMBOBOX, INDEX_NON_EDITABLE_COMBOBOX, - SCREENSHOT_NAME_EDITABLE); - } - - @Test - public void testComboboxNonEditable() throws IOException { - testCombobox(INDEX_NON_EDITABLE_COMBOBOX, INDEX_EDITABLE_COMBOBOX, - SCREENSHOT_NAME_NON_EDITABLE); - } - - private void testCombobox(int indexToTest, int indexToFocus, - String screenshotIdentifier) throws IOException { - openTestURL(); - - WebElement comboBox = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" - + indexToTest + "]/VFilterSelect[0]"); - WebElement comboBoxFocus = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" - + indexToFocus + "]/VFilterSelect[0]"); - - // Select an element from the first (to test) combobox. - - comboBox.findElement(By.className("v-filterselect-button")).click(); - waitForPopup(comboBox); - WebElement comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" - + indexToTest + "]/VFilterSelect[0]#popup"); - comboBoxPopup.findElements(By.tagName("td")).get(2).click(); - - // Select an element from the second (to focus) combobox to remove - // focus from the first combobox - - comboBoxFocus.findElement(By.className("v-filterselect-button")) - .click(); - waitForPopup(comboBoxFocus); - comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" - + indexToFocus + "]/VFilterSelect[0]#popup"); - comboBoxPopup.findElements(By.tagName("td")).get(2).click(); - - // click the button of the first combobox. This would reveal the - // unwanted behaviour. - - comboBox.findElement(By.className("v-filterselect-button")).click(); - - // sadly, screenshot comparison is the only reasonable way to test a - // rendering issue. - - compareScreen(screenshotIdentifier); - - } - - private void waitForPopup(final WebElement comboBox) { - waitUntilNot(new ExpectedCondition<Boolean>() { - @Override - public Boolean apply(WebDriver input) { - return comboBox.findElements(By.vaadin("#popup")).isEmpty(); - } - }, 10); - } - -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java deleted file mode 100644 index f674567a2d..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetset.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent; - -@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet") -public class ComponentIncludedInCustomWidgetset extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - MissingFromDefaultWidgetsetComponent component = new MissingFromDefaultWidgetsetComponent(); - component.setId("missing-component"); - addComponent(component); - } - - @Override - public String getTestDescription() { - return "This contents if this UI should work as the component is present in TestingWidgetSet"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7885); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java deleted file mode 100644 index 4bab0e5237..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentIncludedInCustomWidgetsetTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Tests if a component is included in a custom widgetset - * (com.vaadin.tests.widgetset.TestingWidgetSet) - * - * @author Vaadin Ltd - */ -public class ComponentIncludedInCustomWidgetsetTest extends MultiBrowserTest { - - @Test - public void testComponentInTestingWidgetsetNotInDefaultWidgetset() { - openTestURL(); - WebElement component = vaadinElementById("missing-component"); - assertEquals( - "This component is available in TestingWidgetset, but not in DefaultWidgetset", - component.getText()); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java deleted file mode 100644 index 554a461c37..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetset.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent; - -public class ComponentMissingFromDefaultWidgetset extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - MissingFromDefaultWidgetsetComponent component = new MissingFromDefaultWidgetsetComponent(); - component.setId("missing-component"); - addComponent(component); - } - - @Override - public String getTestDescription() { - return "This contents if this UI should not work as the component is not present in DefaultWidgetSet"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7885); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java b/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java deleted file mode 100644 index 429bcc0afc..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/ComponentMissingFromDefaultWidgetsetTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Test for testing if a component is missing from a widgetset. - * - * @author Vaadin Ltd - */ -public class ComponentMissingFromDefaultWidgetsetTest extends MultiBrowserTest { - - @Test - public void testComponentInTestingWidgetset() { - openTestURL(); - WebElement component = vaadinElementById("missing-component"); - assertTrue(component - .getText() - .startsWith( - "Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.tests.widgetset.server.MissingFromDefaultWidgetsetComponent.")); - - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java deleted file mode 100644 index cba2adb5db..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetained.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.util.ArrayList; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.UI; -import com.vaadin.util.CurrentInstance; - -public class CurrentUiRetained extends AbstractTestUIWithLog { - public static class GcProbe { - - } - - @Override - protected void setup(VaadinRequest request) { - final ArrayList<UI> uiLog = new ArrayList<UI>(); - final ArrayList<Boolean> probeLog = new ArrayList<Boolean>(); - - final Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - uiLog.add(UI.getCurrent()); - - GcProbe gcProbe = new GcProbe(); - CurrentInstance.set(GcProbe.class, gcProbe); - probeLog.add(CurrentInstance.get(GcProbe.class) != null); - gcProbe = null; - - Thread.sleep(500l); - System.gc(); - Thread.sleep(500l); - - probeLog.add(CurrentInstance.get(GcProbe.class) != null); - uiLog.add(UI.getCurrent()); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); - thread.start(); - - addComponent(new Button("Show result", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - try { - thread.join(); - - log("Correct UI.getCurrent before GC: " - + (uiLog.get(0) == CurrentUiRetained.this)); - log("Correct UI.getCurrent after GC: " - + (uiLog.get(1) == CurrentUiRetained.this)); - - log("GC probe available before GC: " + probeLog.get(0)); - log("GC probe available after GC: " + probeLog.get(1)); - - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - })); - } - - @Override - protected String getTestDescription() { - return "Tests that garbage collection removes stale CurrentInstance values while retaining values not collected."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12509); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java b/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java deleted file mode 100644 index d4e1ecb5ce..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/CurrentUiRetainedTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class CurrentUiRetainedTest extends MultiBrowserTest { - @Test - public void testCurrentUiRetained() throws Exception { - openTestURL(); - $(ButtonElement.class).first().click(); - assertLogText(3, "1. Correct UI.getCurrent before GC: true"); - assertLogText(2, "2. Correct UI.getCurrent after GC: true"); - assertLogText(1, "3. GC probe available before GC: true"); - assertLogText(0, "4. GC probe available after GC: false"); - } - - private void assertLogText(int index, String expected) { - Assert.assertEquals("Unexpected log contents,", expected, - getLogRow(index)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java b/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java deleted file mode 100644 index a960e9cc46..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/CustomUITest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.tests.widgetset.client.CustomUIConnectorRpc; - -@Widgetset(TestingWidgetSet.NAME) -public class CustomUITest extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - getRpcProxy(CustomUIConnectorRpc.class).test(); - } - - @Override - protected String getTestDescription() { - return "It should be possible to change the implementation of the UIConnector class"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(10867); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/DynamicViewport.java b/uitest/src/com/vaadin/tests/components/ui/DynamicViewport.java deleted file mode 100644 index ca9ebcd451..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/DynamicViewport.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.ViewportGeneratorClass; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.ViewportGenerator; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.components.ui.DynamicViewport.MyViewportGenerator; -import com.vaadin.ui.Label; - -@ViewportGeneratorClass(MyViewportGenerator.class) -public class DynamicViewport extends AbstractTestUI { - public static class MyViewportGenerator implements ViewportGenerator { - @Override - public String getViewport(VaadinRequest request) { - String userAgent = request.getHeader("User-Agent"); - System.out.println(userAgent); - if (userAgent == null || userAgent.contains("Chrome")) { - return null; - } - return userAgent; - } - } - - @Override - protected void setup(VaadinRequest request) { - addComponent(new Label("I should have a dynamic viewport tag")); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java b/uitest/src/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java deleted file mode 100644 index 55466130ad..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/DynamicViewportEmptyTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.parallel.Browser; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class DynamicViewportEmptyTest extends MultiBrowserTest { - - @Override - protected Class<?> getUIClass() { - return DynamicViewport.class; - } - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - return getBrowserCapabilities(Browser.CHROME); - } - - @Test - public void testGeneratedEmptyViewport() { - openTestURL(); - - List<WebElement> viewportElements = findElements(By - .cssSelector("meta[name=viewport]")); - - Assert.assertTrue("There should be no viewport tags", - viewportElements.isEmpty()); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/DynamicViewportTest.java b/uitest/src/com/vaadin/tests/components/ui/DynamicViewportTest.java deleted file mode 100644 index f1d9efdbd1..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/DynamicViewportTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class DynamicViewportTest extends SingleBrowserTest { - - @Test - public void testGeneratedViewport() { - openTestURL(); - - WebElement viewportElement = findElement(By - .cssSelector("meta[name=viewport]")); - - Assert.assertTrue(viewportElement.getAttribute("content").contains( - "PhantomJS")); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/EmptyWindow.java b/uitest/src/com/vaadin/tests/components/ui/EmptyWindow.java deleted file mode 100644 index 07ce8c3ff8..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/EmptyWindow.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class EmptyWindow extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - addWindow(new Window("My empty window")); - setContent(new Label("UI")); - } - - @Override - protected String getTestDescription() { - return "There should be an empty window on the screen. Currently it should have the min width defined in VWindow"; - } - - @Override - protected Integer getTicketNumber() { - return 10325; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/IdOverrideTest.java b/uitest/src/com/vaadin/tests/components/ui/IdOverrideTest.java deleted file mode 100644 index eeadc89691..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/IdOverrideTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.annotations.Theme; -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.MarginInfo; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.tests.widgetset.server.IdTestLabel; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; - -@Widgetset(TestingWidgetSet.NAME) -@Theme("tests-tickets") -public class IdOverrideTest extends AbstractTestUI { - - @Override - protected String getTestDescription() { - return "Id shouldn't get overridden unless specifically re-set.<br>" - + "First two are custom labels with a default id, third is an ordinary label for comparison."; - } - - @Override - protected Integer getTicketNumber() { - return 10179; - } - - @Override - protected void setup(VaadinRequest request) { - getLayout().setSpacing(true); - getLayout().setMargin(new MarginInfo(true, false, false, false)); - - final IdTestLabel idTestLabel = new IdTestLabel("default id"); - idTestLabel.setSizeUndefined(); - addComponent(idTestLabel); - - final IdTestLabel idTestLabelWithId = new IdTestLabel("set id"); - idTestLabelWithId.setSizeUndefined(); - idTestLabelWithId.setId("set10179"); - idTestLabelWithId.setImmediate(true); - addComponent(idTestLabelWithId); - - final Label label = new Label("no id"); - label.setSizeUndefined(); - addComponent(label); - - Button button = new Button(); - button.setCaption("Toggle"); - button.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if (idTestLabelWithId.getId() == null) { - idTestLabelWithId.setId("set10179"); - idTestLabelWithId.setValue("set id"); - idTestLabel.setValue("default id"); - label.setValue("no id"); - } else { - idTestLabelWithId.setId(null); - idTestLabelWithId.setValue("removed id"); - idTestLabel.setValue("still default id"); - label.setValue("still no id"); - } - } - }); - button.setId("toggle"); - button.setImmediate(true); - addComponent(button); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java deleted file mode 100644 index d8d197c881..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.Page.UriFragmentChangedEvent; -import com.vaadin.server.Page.UriFragmentChangedListener; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; - -public class InitialFragmentEvent extends AbstractTestUIWithLog { - - private String lastKnownFragment = "\"no event received\""; - - @Override - protected void setup(VaadinRequest request) { - getPage().addUriFragmentChangedListener( - new UriFragmentChangedListener() { - - @Override - public void uriFragmentChanged( - UriFragmentChangedEvent source) { - String newFragment = source.getUriFragment(); - log("Fragment changed from " + lastKnownFragment - + " to " + newFragment); - lastKnownFragment = newFragment; - } - }); - addButton("Set fragment to 'foo'", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - setFragment("foo"); - } - }); - addButton("Set fragment to 'bar'", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - setFragment("bar"); - } - }); - } - - protected void setFragment(String fragment) { - getPage().setUriFragment(fragment); - } - - @Override - protected Integer getTicketNumber() { - return 9558; - } - - @Override - protected String getTestDescription() { - return "URI fragment handling should fire for initial fragment change"; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEventTest.java b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEventTest.java deleted file mode 100644 index f52797dd63..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEventTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class InitialFragmentEventTest extends MultiBrowserTest { - - @Test - public void testChangeFragmentOnServerToMatchClient() { - openTestURL("#foo"); - - assertEquals("Log should not contain any text initially", " ", - getLogRow(0)); - - $(ButtonElement.class).caption("Set fragment to 'foo'").first().click(); - - assertEquals("Log should not contain any text after clicking button", - " ", getLogRow(0)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java deleted file mode 100644 index fc948ab3db..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragmentTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class InitiallyEmptyFragmentTest extends MultiBrowserTest { - - @Override - protected Class<?> getUIClass() { - return InitialFragmentEvent.class; - } - - @Test - public void testNoFragmentChangeEventWhenInitiallyEmpty() throws Exception { - openTestURL(); - /* - * There is no fragment change event when the fragment is initially - * empty - */ - assertLogText(" "); - executeScript("window.location.hash='bar'"); - assertLogText("1. Fragment changed from \"no event received\" to bar"); - } - - private void assertLogText(String expected) { - Assert.assertEquals("Unexpected log contents,", expected, getLogRow(0)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/InvalidViewport.java b/uitest/src/com/vaadin/tests/components/ui/InvalidViewport.java deleted file mode 100644 index 9557a2d2b0..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/InvalidViewport.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.Viewport; -import com.vaadin.annotations.ViewportGeneratorClass; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.components.ui.DynamicViewport.MyViewportGenerator; -import com.vaadin.ui.Label; - -@ViewportGeneratorClass(MyViewportGenerator.class) -@Viewport("myViewport") -public class InvalidViewport extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - addComponent(new Label( - "I shouldn't load because of conflicting viewport definitions")); - - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/InvalidViewportTest.java b/uitest/src/com/vaadin/tests/components/ui/InvalidViewportTest.java deleted file mode 100644 index 9d0aac49f7..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/InvalidViewportTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class InvalidViewportTest extends SingleBrowserTest { - - @Test - public void testInvalidViewport() { - openTestURL(); - - WebElement heading = findElement(By.tagName("h2")); - - Assert.assertEquals("HTTP ERROR 500", heading.getText()); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java deleted file mode 100644 index 984ac69d6e..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.ExternalResource; -import com.vaadin.server.Page; -import com.vaadin.server.UIClassSelectionEvent; -import com.vaadin.server.UICreateEvent; -import com.vaadin.server.UIProviderEvent; -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.AbstractTestUIProvider; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.UI; -import com.vaadin.ui.VerticalLayout; - -public class LazyInitUIs extends AbstractTestUIProvider { - - // @EagerInit - private static class EagerInitUI extends UI { - @Override - public void init(VaadinRequest request) { - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - setContent(layout); - - layout.addComponent(getRequestInfo("EagerInitUI", request)); - } - } - - @Override - public UI createInstance(UICreateEvent event) { - return getUI(event); - } - - @Override - public Class<? extends UI> getUIClass(UIClassSelectionEvent event) { - return getUI(event).getClass(); - } - - private UI getUI(UIProviderEvent event) { - VaadinRequest request = event.getRequest(); - if (request.getParameter("lazyCreate") != null) { - // UI created on second request - UI uI = new UI() { - @Override - protected void init(VaadinRequest request) { - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - setContent(layout); - - layout.addComponent(getRequestInfo("LazyCreateUI", request)); - } - }; - return uI; - } else if (request.getParameter("eagerInit") != null) { - // UI inited on first request - return new EagerInitUI(); - } else { - // The standard UI - UI uI = new UI() { - @Override - protected void init(VaadinRequest request) { - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - setContent(layout); - - layout.addComponent(getRequestInfo("NormalUI", request)); - - String location = getPage().getLocation().toString(); - Link lazyCreateLink = new Link("Open lazyCreate UI", - new ExternalResource(location.replaceFirst( - "(\\?|#|$).*", "?lazyCreate#lazyCreate"))); - lazyCreateLink.setTargetName("_blank"); - layout.addComponent(lazyCreateLink); - - Link lazyInitLink = new Link("Open eagerInit UI", - new ExternalResource(location.replaceFirst( - "(\\?|#|$).*", "?eagerInit#eagerInit"))); - lazyInitLink.setTargetName("_blank"); - layout.addComponent(lazyInitLink); - } - }; - - return uI; - } - } - - public static Label getRequestInfo(String name, VaadinRequest request) { - String info = name; - info += "<br />pathInfo: " + request.getPathInfo(); - info += "<br />parameters: " + request.getParameterMap().keySet(); - info += "<br />uri fragment: " - + Page.getCurrent().getLocation().getFragment(); - return new Label(info, ContentMode.HTML); - } - - @Override - protected String getTestDescription() { - return "BrowserDetails should be available in Application.getUI if UIRequiresMoreInformation has been thrown and in UI.init if the UI has the @UIInitRequiresBrowserDetals annotation"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7883); // + #7882 + #7884 - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java deleted file mode 100644 index 3c857a8753..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.NativeButton; -import com.vaadin.ui.TextField; - -public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog { - - private TextField firstDelay; - private TextField secondDelay; - private TextField thirdDelay; - - @Override - protected void setup(VaadinRequest request) { - final TextField delayField = new TextField("Delay (ms)"); - delayField.setConverter(Integer.class); - delayField.setConvertedValue(1000); - - NativeButton delayButton = new NativeButton("Wait"); - delayButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - try { - Thread.sleep((Integer) delayField.getConvertedValue()); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); - - firstDelay = createIntegerTextField("First delay (ms)", - getState().loadingIndicatorConfiguration.firstDelay); - firstDelay.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - getLoadingIndicatorConfiguration().setFirstDelay( - (Integer) firstDelay.getConvertedValue()); - } - }); - secondDelay = createIntegerTextField("Second delay (ms)", - getState().loadingIndicatorConfiguration.secondDelay); - secondDelay.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - getLoadingIndicatorConfiguration().setSecondDelay( - (Integer) secondDelay.getConvertedValue()); - } - }); - thirdDelay = createIntegerTextField("Third delay (ms)", - getState().loadingIndicatorConfiguration.thirdDelay); - thirdDelay.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - getLoadingIndicatorConfiguration().setThirdDelay( - (Integer) thirdDelay.getConvertedValue()); - } - }); - - getLayout().addComponents(firstDelay, secondDelay, thirdDelay); - - HorizontalLayout hl = new HorizontalLayout(); - hl.setMargin(true); - hl.setDefaultComponentAlignment(Alignment.BOTTOM_RIGHT); - hl.addComponents(delayField, delayButton); - addComponent(hl); - - } - - private TextField createIntegerTextField(String caption, int initialValue) { - TextField tf = new TextField(caption); - tf.setId(caption); - tf.setConverter(Integer.class); - tf.setImmediate(true); - tf.setConvertedValue(initialValue); - return tf; - } - - @Override - protected String getTestDescription() { - return "Tests that loading indicator delay can be configured"; - } - - @Override - protected Integer getTicketNumber() { - return 7448; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java b/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java deleted file mode 100644 index 007a49e0e2..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/MultiFileUploadTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.io.IOException; -import java.io.OutputStream; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Upload.ChangeEvent; -import com.vaadin.ui.Upload.ChangeListener; -import com.vaadin.ui.Upload.FailedEvent; -import com.vaadin.ui.Upload.FailedListener; -import com.vaadin.ui.Upload.Receiver; -import com.vaadin.ui.Upload.SucceededEvent; -import com.vaadin.ui.Upload.SucceededListener; -import com.vaadin.ui.VerticalLayout; - -public class MultiFileUploadTest extends AbstractTestUIWithLog { - - private ChangeListener changeListener = new ChangeListener() { - - @Override - public void filenameChanged(ChangeEvent event) { - if (event.getFilename().equals("")) { - removeUpload(event.getSource()); - } else { - addUpload(); - } - - } - }; - private VerticalLayout uploadsLayout = new VerticalLayout(); - - @Override - protected void setup(VaadinRequest request) { - getPage().getStyles().add( - ".v-upload-hidden-button .v-button {display:none};"); - addUpload(); - addComponent(uploadsLayout); - addComponent(new Button("Upload files", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - for (Upload u : getUploads()) { - u.submitUpload(); - } - } - })); - } - - protected Iterable<Upload> getUploads() { - return (Iterable) uploadsLayout; - } - - protected void removeUpload(Upload source) { - uploadsLayout.removeComponent(source); - - } - - protected void addUpload() { - Upload upload = createUpload(); - upload.addSucceededListener(new SucceededListener() { - - @Override - public void uploadSucceeded(SucceededEvent event) { - log("Upload of " + event.getFilename() + " complete"); - uploadsLayout.removeComponent(event.getUpload()); - } - }); - - upload.addFailedListener(new FailedListener() { - @Override - public void uploadFailed(FailedEvent event) { - log("Upload of " + event.getFilename() + " FAILED"); - } - }); - - upload.setReceiver(new Receiver() { - @Override - public OutputStream receiveUpload(String filename, String mimeType) { - return new OutputStream() { - @Override - public void write(int arg0) throws IOException { - - } - }; - } - }); - upload.setStyleName("hidden-button"); - uploadsLayout.addComponent(upload); - - } - - private Upload createUpload() { - Upload upload = new Upload(); - upload.addChangeListener(changeListener); - return upload; - } - - @Override - protected String getTestDescription() { - return "Tests that an Upload change event can be used to create a multiple file upload component"; - } - - @Override - protected Integer getTicketNumber() { - return 13222; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/MultipleUIUploadTest.java b/uitest/src/com/vaadin/tests/components/ui/MultipleUIUploadTest.java deleted file mode 100644 index f92e22d06b..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/MultipleUIUploadTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.vaadin.tests.components.ui; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; - -import com.vaadin.server.StreamResource; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Notification; -import com.vaadin.ui.Upload; -import com.vaadin.ui.VerticalLayout; - -public class MultipleUIUploadTest extends AbstractTestUI { - - private MemoryBuffer buffer = new MemoryBuffer(); - private Upload upload; - - @Override - protected String getTestDescription() { - return "Using Upload with multiple UIs causes NPE." - + " Open test in first browser window and open the file selection window." - + " Then open test in second browser window (without ?restartApplication) and click the notification button." - + " Then go back to the first window, select a file, and click Upload." - + " Click notification button to ensure the upload was received successfully."; - } - - @Override - protected Integer getTicketNumber() { - return 10112; - } - - @Override - protected void setup(VaadinRequest request) { - final VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - layout.setSpacing(true); - setContent(layout); - - upload = new Upload(null, buffer); - upload.setId("upload"); - layout.addComponent(upload); - - Button button = new Button("show notification"); - button.setId("notify"); - button.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - Notification.show("uploaded: " + buffer.getFileName()); - } - }); - layout.addComponent(button); - - } - - public class MemoryBuffer implements StreamResource.StreamSource, - Upload.Receiver { - ByteArrayOutputStream outputBuffer = null; - - String mimeType; - - String fileName; - - public MemoryBuffer() { - - } - - @Override - public InputStream getStream() { - if (outputBuffer == null) { - return null; - } - return new ByteArrayInputStream(outputBuffer.toByteArray()); - } - - /** - * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, String) - */ - @Override - public OutputStream receiveUpload(String filename, String MIMEType) { - fileName = filename; - mimeType = MIMEType; - outputBuffer = new ByteArrayOutputStream() { - @Override - public synchronized void write(byte[] b, int off, int len) { - super.write(b, off, len); - } - - }; - return outputBuffer; - } - - /** - * Returns the fileName. - * - * @return String - */ - public String getFileName() { - return fileName; - } - - /** - * Returns the mimeType. - * - * @return String - */ - public String getMimeType() { - return mimeType; - } - - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListening.java b/uitest/src/com/vaadin/tests/components/ui/PollListening.java deleted file mode 100644 index 1ec4f4d9f7..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/PollListening.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.event.UIEvents.PollEvent; -import com.vaadin.event.UIEvents.PollListener; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -public class PollListening extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - final Label statusLabel = new Label("Default Label"); - addComponent(statusLabel); - - setPollInterval(2000); - addPollListener(new PollListener() { - @Override - public void poll(PollEvent event) { - setPollInterval(-1); - statusLabel.setValue(event.getClass().getSimpleName() - + " received"); - removePollListener(this); - } - }); - } - - @Override - protected String getTestDescription() { - return "Polling should fire a PollEvent on the server-side"; - } - - @Override - protected Integer getTicketNumber() { - return 12466; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java b/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java deleted file mode 100644 index 5770570ed1..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/PollListeningTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class PollListeningTest extends MultiBrowserTest { - - @Test - public void testReceivePollEvent() { - openTestURL(); - waitUntilPollEventReceived(); - } - - private void waitUntilPollEventReceived() { - waitUntil(new ExpectedCondition<Boolean>() { - private String expected = "PollEvent received"; - - @Override - public Boolean apply(WebDriver arg0) { - return driver.getPageSource().contains(expected); - } - - @Override - public String toString() { - return String.format("page to contain text '%s'", expected); - } - }); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java deleted file mode 100644 index 1dbcc0ab2b..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.ui.PageClientRpc; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; - -public class RpcInvocationHandlerToString extends AbstractTestUIWithLog { - - PageClientRpc dummyProxy = getRpcProxy(PageClientRpc.class); - - @Override - protected void setup(VaadinRequest request) { - addButton("Exec toString() for an invocation proxy", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("An invoation proxy: " + dummyProxy.toString()); - } - }); - addButton("Exec hashCode() for an invocation proxy", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Invocation proxy.hashCode(): " - + dummyProxy.hashCode()); - } - }); - addButton("Exec equals(false) for an invocation proxy", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Invocation proxy.equals(false): " - + dummyProxy.equals(false)); - } - }); - } - - @Override - protected String getTestDescription() { - return "Clicking on the buttons invokes Object methods on a dummy proxy instance. They should only cause log rows to appear and no client rpc to be sent"; - } - - @Override - protected Integer getTicketNumber() { - return 9802; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java deleted file mode 100644 index 10a297d47b..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToStringTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.NotificationElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class RpcInvocationHandlerToStringTest extends MultiBrowserTest { - @Test - public void testMethodsOnInvocationProxy() throws Exception { - openTestURL(); - execMethodForProxy("toString()"); - execMethodForProxy("hashCode()"); - execMethodForProxy("equals(false)"); - } - - private void execMethodForProxy(String method) { - $(ButtonElement.class) - .caption("Exec " + method + " for an invocation proxy").first() - .click(); - Assert.assertFalse(method - + " for invocation proxy caused a notification", - $(NotificationElement.class).exists()); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/StaticViewport.java b/uitest/src/com/vaadin/tests/components/ui/StaticViewport.java deleted file mode 100644 index 813206dbe8..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/StaticViewport.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.Viewport; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -@Viewport("myViewport") -public class StaticViewport extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - addComponent(new Label("I should have a static viewport tag")); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/StaticViewportTest.java b/uitest/src/com/vaadin/tests/components/ui/StaticViewportTest.java deleted file mode 100644 index 61b3c944c9..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/StaticViewportTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class StaticViewportTest extends SingleBrowserTest { - - @Test - public void testStaticViewport() { - openTestURL(); - - WebElement viewportElement = findElement(By - .cssSelector("meta[name=viewport]")); - - Assert.assertEquals("myViewport", - viewportElement.getAttribute("content")); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TestUITheme.java b/uitest/src/com/vaadin/tests/components/ui/TestUITheme.java deleted file mode 100644 index bfed424483..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TestUITheme.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.annotations.Theme; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -@Theme("tests-tickets") -public class TestUITheme extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - Label label = new Label("A green label"); - label.setStyleName("green"); - addComponent(label); - } - - @Override - public String getTestDescription() { - return "UI with @Theme(\"tests-tickets\"). The label uses a stylename that should only be defined in the test-tickets theme."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7885); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java deleted file mode 100644 index 0d38de5923..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagation.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.event.ShortcutAction.KeyCode; -import com.vaadin.event.ShortcutAction.ModifierKey; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.TextArea; -import com.vaadin.ui.TextField; - -/** - * UI test for TextArea behavior when ENTER has been assigned as a keyboard - * shortcut. - * - * @author Vaadin Ltd - */ -public class TextAreaEventPropagation extends AbstractTestUIWithLog { - - @Override - protected void setup(VaadinRequest request) { - - FormLayout form = new FormLayout(); - TextArea textArea = new TextArea("Text input"); - TextField textField = new TextField("Text field input"); - - Button enterButton = new Button("Enter"); - enterButton.setClickShortcut(KeyCode.ENTER); - enterButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - - log("Enter button pressed"); - } - }); - - Button shiftEnterButton = new Button("Shift-Enter"); - shiftEnterButton.setClickShortcut(KeyCode.ENTER, ModifierKey.SHIFT); - shiftEnterButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - - log("Shift-Enter button pressed"); - } - }); - - Button ctrlEnterButton = new Button("Ctrl-Enter"); - ctrlEnterButton.setClickShortcut(KeyCode.ENTER, ModifierKey.CTRL); - ctrlEnterButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - - log("Ctrl-Enter button pressed"); - } - }); - - Button escapeButton = new Button("Escape"); - escapeButton.setClickShortcut(KeyCode.ESCAPE); - escapeButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Escape button pressed"); - } - }); - - form.addComponent(textArea); - form.addComponent(textField); - form.addComponent(enterButton); - form.addComponent(escapeButton); - form.addComponent(shiftEnterButton); - form.addComponent(ctrlEnterButton); - addComponent(form); - - } - - @Override - protected String getTestDescription() { - return "Enter as s shortcut in a TextArea should not trigger shortcuts as enter is handled internally. Enter + modifier key should trigger shortcut."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12424); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java deleted file mode 100644 index 43422feb58..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationModifierKeysTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.elements.TextAreaElement; -import com.vaadin.testbench.parallel.Browser; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest { - @Test - public void textAreaShiftEnterEventPropagation() - throws InterruptedException { - openTestURL(); - - WebElement textArea = $(TextAreaElement.class).first(); - Actions builder = new Actions(driver); - builder.click(textArea); - builder.sendKeys(textArea, "first line asdf"); - builder.keyDown(Keys.SHIFT); - builder.sendKeys(Keys.ENTER); - builder.keyUp(Keys.SHIFT); - builder.sendKeys(textArea, "second line jkl;"); - builder.perform(); - - // Should have triggered shortcut - Assert.assertEquals("1. Shift-Enter button pressed", getLogRow(0)); - } - - @Test - public void textAreaCtrlEnterEventPropagation() throws InterruptedException { - openTestURL(); - - WebElement textArea = $(TextAreaElement.class).first(); - Actions builder = new Actions(driver); - builder.click(textArea); - builder.sendKeys(textArea, "first line asdf"); - builder.keyDown(Keys.CONTROL); - builder.sendKeys(Keys.ENTER); - builder.keyUp(Keys.CONTROL); - builder.sendKeys(textArea, "second line jkl;"); - builder.perform(); - - // Should have triggered shortcut - Assert.assertEquals("1. Ctrl-Enter button pressed", getLogRow(0)); - } - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - // IE8 and Firefox can't handle ctrl. - // IE9-11 has issues with shift and ctrl - return getBrowserCapabilities(Browser.CHROME, Browser.PHANTOMJS); - } - - @Override - protected Class<?> getUIClass() { - return TextAreaEventPropagation.class; - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java b/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java deleted file mode 100644 index 5de903e8d4..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; - -import com.vaadin.testbench.elements.TextAreaElement; -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * Tests that the TextArea widget correctly stops ENTER events from propagating. - * - * @author Vaadin Ltd - */ -public class TextAreaEventPropagationTest extends MultiBrowserTest { - - @Test - public void textAreaEnterEventPropagation() throws InterruptedException { - openTestURL(); - WebElement textArea = $(TextAreaElement.class).first(); - Actions builder = new Actions(driver); - builder.click(textArea); - builder.sendKeys(textArea, "first line asdf"); - builder.sendKeys(Keys.ENTER); - builder.sendKeys(textArea, "second line jkl;"); - builder.perform(); - - // Should not have triggered shortcut - assertEquals(" ", getLogRow(0)); - } - - @Test - public void testTextAreaEscapeEventPropagation() - throws InterruptedException { - openTestURL(); - WebElement textArea = $(TextAreaElement.class).first(); - Actions builder = new Actions(driver); - builder.click(textArea); - builder.sendKeys(textArea, "first line asdf"); - builder.sendKeys(Keys.ESCAPE); - builder.sendKeys(textArea, "second line jkl;"); - builder.perform(); - - assertEquals("1. Escape button pressed", getLogRow(0)); - } - - @Test - public void testTextFieldEscapeEventPropagation() { - openTestURL(); - WebElement textField = $(TextFieldElement.class).first(); - Actions builder2 = new Actions(driver); - builder2.click(textField); - - builder2.sendKeys("third line"); - builder2.sendKeys(Keys.ENTER); - builder2.sendKeys(Keys.ESCAPE); - - builder2.perform(); - - assertEquals("1. Enter button pressed", getLogRow(1)); - assertEquals("2. Escape button pressed", getLogRow(0)); - } - - @Test - public void testTextFieldEnterEventPropagation() { - openTestURL(); - WebElement textField = $(TextFieldElement.class).first(); - Actions builder2 = new Actions(driver); - builder2.click(textField); - - builder2.sendKeys("third line"); - builder2.sendKeys(Keys.ENTER); - - builder2.perform(); - - assertEquals("1. Enter button pressed", getLogRow(0)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java deleted file mode 100644 index cb62ccdb19..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivity.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.server.CustomizedSystemMessages; -import com.vaadin.server.SystemMessages; -import com.vaadin.server.SystemMessagesInfo; -import com.vaadin.server.SystemMessagesProvider; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -public class TimeoutRedirectResetsOnActivity extends AbstractTestUI { - - private int maxActiveInterval = 15; - private int timeoutOverhead = 15; - - @Override - protected void setup(VaadinRequest request) { - setupTimeout(request); - - Label startedLabel = new Label(); - startedLabel.setValue(String.valueOf(System.currentTimeMillis())); - startedLabel.setId("startedTime"); - - Label originalLabel = new Label(); - originalLabel.setId("originalExpireTime"); - originalLabel.setValue(String.valueOf(getExpireTime())); - - final Label expiresLabel = new Label(); - expiresLabel.setId("actualExpireTime"); - - Button button = new Button("Reset", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - expiresLabel.setValue(String.valueOf(getExpireTime())); - } - - }); - button.setId("reset"); - - addComponent(button); - - addComponent(startedLabel); - addComponent(originalLabel); - addComponent(expiresLabel); - } - - private long getExpireTime() { - return System.currentTimeMillis() - + (maxActiveInterval + timeoutOverhead) * 1000; - } - - private void setupTimeout(VaadinRequest request) { - request.getService().setSystemMessagesProvider( - new SystemMessagesProvider() { - @Override - public SystemMessages getSystemMessages( - SystemMessagesInfo systemMessagesInfo) { - CustomizedSystemMessages msgs = new CustomizedSystemMessages(); - msgs.setSessionExpiredMessage(null); - msgs.setSessionExpiredCaption(null); - msgs.setSessionExpiredNotificationEnabled(true); - msgs.setSessionExpiredURL("http://example.com/"); - return msgs; - } - }); - /* - * NOTE: in practice, this means a timeout after 25 seconds, because of - * implementation details in - * com.vaadin.server.communication.MetadataWriter - */ - getSession().getSession().setMaxInactiveInterval(maxActiveInterval); - } - - @Override - protected String getTestDescription() { - return "The timeout redirect timer should reset if there's activity between the client and server."; - } - - @Override - @SuppressWarnings("boxing") - protected Integer getTicketNumber() { - return 12446; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java b/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java deleted file mode 100644 index b5440b8f76..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/TimeoutRedirectResetsOnActivityTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.MatcherAssert.assertThat; - -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.tests.tb3.RetryOnFail; - -public class TimeoutRedirectResetsOnActivityTest extends MultiBrowserTest { - - @Rule - // Timing issues are really hard to resolve in a way that this test would be - // 100% reliable on all browsers. Hence we shall allow one retry. - public RetryOnFail retry = new RetryOnFail(); - - private int waitBeforeActivity = 4000; - private int communicationOverhead = 2000; - - private static int i = 0; - - @Test - @Ignore("The test modifies the system messages, which are global and the changes will affect other tests") - public void verifyRedirectWorks() throws Exception { - setDebug(true); - openTestURL(); - - long startedTime = getTime("startedTime"); - long originalExpireTime = getTime("originalExpireTime"); - - Thread.sleep(waitBeforeActivity); - hitButton("reset"); - - Thread.sleep(200); - - long actualExpireTime = getTime("actualExpireTime"); - - Thread.sleep(originalExpireTime - startedTime - waitBeforeActivity); - - assertThat(driver.getCurrentUrl(), is(getTestUrl())); - - testBench().disableWaitForVaadin(); - Thread.sleep(actualExpireTime - originalExpireTime - + communicationOverhead); - - assertThat(driver.getCurrentUrl(), is(not(getTestUrl()))); - } - - private long getTime(String id) { - WebElement element = vaadinElementById(id); - return Long.parseLong(element.getText()); - } - - @Override - protected String getTestUrl() { - return super.getTestUrl() + "?restartApplication"; - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java b/uitest/src/com/vaadin/tests/components/ui/UIAccess.java deleted file mode 100644 index 70a69ef7d3..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccess.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.locks.ReentrantLock; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinService; -import com.vaadin.server.VaadinSession; -import com.vaadin.shared.communication.PushMode; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.UI; -import com.vaadin.util.CurrentInstance; - -public class UIAccess extends AbstractTestUIWithLog { - - private volatile boolean checkCurrentInstancesBeforeResponse = false; - - private Future<Void> checkFromBeforeClientResponse; - - private class CurrentInstanceTestType { - private String value; - - public CurrentInstanceTestType(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - } - - @Override - protected void setup(VaadinRequest request) { - addComponent(new Button("Access from UI thread", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - // Ensure beforeClientResponse is invoked - markAsDirty(); - checkFromBeforeClientResponse = access(new Runnable() { - @Override - public void run() { - log("Access from UI thread is run"); - } - }); - log("Access from UI thread future is done? " - + checkFromBeforeClientResponse.isDone()); - } - })); - addComponent(new Button("Access from background thread", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - final CountDownLatch latch = new CountDownLatch(1); - - new Thread() { - @Override - public void run() { - final boolean threadHasCurrentResponse = VaadinService - .getCurrentResponse() != null; - // session is locked by request thread at this - // point - final Future<Void> initialFuture = access(new Runnable() { - @Override - public void run() { - log("Initial background message"); - log("Thread has current response? " - + threadHasCurrentResponse); - } - }); - - // Let request thread continue - latch.countDown(); - - // Wait until thread can be locked - while (!getSession().getLockInstance() - .tryLock()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - try { - log("Thread got lock, inital future done? " - + initialFuture.isDone()); - setPollInterval(-1); - } finally { - getSession().unlock(); - } - } - }.start(); - - // Wait for thread to do initialize before continuing - try { - latch.await(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - - setPollInterval(3000); - } - })); - addComponent(new Button("Access throwing exception", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - final Future<Void> firstFuture = access(new Runnable() { - @Override - public void run() { - log("Throwing exception in access"); - throw new RuntimeException( - "Catch me if you can"); - } - }); - access(new Runnable() { - @Override - public void run() { - log("firstFuture is done? " - + firstFuture.isDone()); - try { - firstFuture.get(); - log("Should not get here"); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } catch (ExecutionException e) { - log("Got exception from firstFuture: " - + e.getMessage()); - } - } - }); - } - })); - addComponent(new Button("Cancel future before started", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - Future<Void> future = access(new Runnable() { - @Override - public void run() { - log("Should not get here"); - } - }); - future.cancel(false); - log("future was cancelled, should not start"); - } - })); - addComponent(new Button("Cancel running future", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - final ReentrantLock interruptLock = new ReentrantLock(); - - final Future<Void> future = access(new Runnable() { - @Override - public void run() { - log("Waiting for thread to start"); - while (!interruptLock.isLocked()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - log("Premature interruption"); - throw new RuntimeException(e); - } - } - - log("Thread started, waiting for interruption"); - try { - interruptLock.lockInterruptibly(); - } catch (InterruptedException e) { - log("I was interrupted"); - } - } - }); - - new Thread() { - @Override - public void run() { - interruptLock.lock(); - // Wait until UI thread has started waiting for - // the lock - while (!interruptLock.hasQueuedThreads()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - future.cancel(true); - } - }.start(); - } - })); - addComponent(new Button("CurrentInstance accessSynchronously values", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - // accessSynchronously should maintain values - CurrentInstance.set(CurrentInstanceTestType.class, - new CurrentInstanceTestType( - "Set before accessSynchronosly")); - accessSynchronously(new Runnable() { - @Override - public void run() { - log.log("accessSynchronously has request? " - + (VaadinService.getCurrentRequest() != null)); - log.log("Test value in accessSynchronously: " - + CurrentInstance - .get(CurrentInstanceTestType.class)); - CurrentInstance.set( - CurrentInstanceTestType.class, - new CurrentInstanceTestType( - "Set in accessSynchronosly")); - } - }); - log.log("has request after accessSynchronously? " - + (VaadinService.getCurrentRequest() != null)); - log("Test value after accessSynchornously: " - + CurrentInstance - .get(CurrentInstanceTestType.class)); - } - })); - addComponent(new Button("CurrentInstance access values", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - // accessSynchronously should maintain values - CurrentInstance - .setInheritable(CurrentInstanceTestType.class, - new CurrentInstanceTestType( - "Set before access")); - access(new Runnable() { - @Override - public void run() { - log.log("access has request? " - + (VaadinService.getCurrentRequest() != null)); - log.log("Test value in access: " - + CurrentInstance - .get(CurrentInstanceTestType.class)); - CurrentInstance.setInheritable( - CurrentInstanceTestType.class, - new CurrentInstanceTestType( - "Set in access")); - } - }); - CurrentInstance.setInheritable( - CurrentInstanceTestType.class, - new CurrentInstanceTestType( - "Set before run pending")); - - getSession().getService().runPendingAccessTasks( - getSession()); - - log.log("has request after access? " - + (VaadinService.getCurrentRequest() != null)); - log("Test value after access: " - + CurrentInstance - .get(CurrentInstanceTestType.class)); - } - })); - - addComponent(new Button("CurrentInstance when pushing", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - if (getPushConfiguration().getPushMode() != PushMode.AUTOMATIC) { - log("Can only test with automatic push enabled"); - return; - } - - final VaadinSession session = getSession(); - new Thread() { - @Override - public void run() { - // Pretend this isn't a Vaadin thread - CurrentInstance.clearAll(); - - /* - * Get explicit lock to ensure the (implicit) - * push does not happen during normal request - * handling. - */ - session.lock(); - try { - access(new Runnable() { - @Override - public void run() { - checkCurrentInstancesBeforeResponse = true; - // Trigger beforeClientResponse - markAsDirty(); - } - }); - } finally { - session.unlock(); - } - } - }.start(); - } - })); - } - - @Override - public void beforeClientResponse(boolean initial) { - if (checkFromBeforeClientResponse != null) { - log("beforeClientResponse future is done? " - + checkFromBeforeClientResponse.isDone()); - checkFromBeforeClientResponse = null; - } - if (checkCurrentInstancesBeforeResponse) { - UI currentUI = UI.getCurrent(); - VaadinSession currentSession = VaadinSession.getCurrent(); - - log("Current UI matches in beforeResponse? " + (currentUI == this)); - log("Current session matches in beforeResponse? " - + (currentSession == getSession())); - checkCurrentInstancesBeforeResponse = false; - } - } - - @Override - protected String getTestDescription() { - return "Test for various ways of using UI.access"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(11897); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java deleted file mode 100644 index bd18d93328..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandling.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import com.vaadin.server.DefaultErrorHandler; -import com.vaadin.server.ErrorHandler; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinService; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.UI; -import com.vaadin.util.CurrentInstance; - -public class UIAccessExceptionHandling extends AbstractTestUIWithLog implements - ErrorHandler { - - private Future<Void> future; - - @Override - protected void setup(VaadinRequest request) { - getSession().setErrorHandler(this); - - addComponent(new Button("Throw RuntimeException on UI.access", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - - // Ensure beforeClientResponse is invoked - markAsDirty(); - - future = access(new Runnable() { - @Override - public void run() { - throw new RuntimeException(); - } - }); - } - })); - - addComponent(new Button("Throw RuntimeException on Session.access", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - - // Ensure beforeClientResponse is invoked - markAsDirty(); - - VaadinService service = VaadinService.getCurrent(); - - future = service.accessSession(getSession(), - new Runnable() { - - @Override - public void run() { - throw new RuntimeException(); - } - }); - } - })); - - addComponent(new Button( - "Throw RuntimeException after removing instances", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - - // Ensure beforeClientResponse is invoked - markAsDirty(); - - assert UI.getCurrent() == UIAccessExceptionHandling.this; - - Map<Class<?>, CurrentInstance> instances = CurrentInstance - .getInstances(false); - CurrentInstance.clearAll(); - - assert UI.getCurrent() == null; - - future = access(new Runnable() { - @Override - public void run() { - throw new RuntimeException(); - } - }); - - CurrentInstance.restoreInstances(instances); - } - })); - - addComponent(new Button("Clear", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.clear(); - } - })); - } - - @Override - public void beforeClientResponse(boolean initial) { - if (future != null) { - try { - future.get(); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - log("Exception caught on get: " + e.getClass().getName()); - } finally { - future = null; - } - } - } - - @Override - public void error(com.vaadin.server.ErrorEvent event) { - log("Exception caught on execution with " - + event.getClass().getSimpleName() + " : " - + event.getThrowable().getClass().getName()); - - DefaultErrorHandler.doDefault(event); - } - - @Override - protected String getTestDescription() { - return "Test for handling exceptions in UI.access and Session.access"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12703); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java deleted file mode 100644 index b49de55a56..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessExceptionHandlingTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIAccessExceptionHandlingTest extends MultiBrowserTest { - - @Test - public void testExceptionHandlingOnUIAccess() throws Exception { - openTestURL(); - $(ButtonElement.class).first().click(); - assertLogTexts( - "1. Exception caught on get: java.util.concurrent.ExecutionException", - "0. Exception caught on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException"); - - $(ButtonElement.class).get(1).click(); - assertLogTexts( - "1. Exception caught on get: java.util.concurrent.ExecutionException", - "0. Exception caught on execution with ErrorEvent : java.util.concurrent.ExecutionException"); - - $(ButtonElement.class).get(2).click(); - assertLogTexts( - "1. Exception caught on get: java.util.concurrent.ExecutionException", - "0. Exception caught on execution with ConnectorErrorEvent : java.util.concurrent.ExecutionException"); - } - - private void assertLogTexts(String first, String second) { - assertLogText(0, first); - assertLogText(1, second); - } - - private void assertLogText(int index, String expected) { - Assert.assertEquals("Unexpected log contents,", expected, - getLogRow(index)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java deleted file mode 100644 index 0e37aa36fb..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAccessTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.MultiBrowserTest; -import org.junit.Test; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import static org.junit.Assert.assertTrue; - -public class UIAccessTest extends MultiBrowserTest { - - @Override - public void setup() throws Exception { - super.setup(); - - setPush(false); - openTestURL(); - } - - @Test - public void testThreadLocals() { - setPush(true); - openTestURL(); - - $(ButtonElement.class).get(7).click(); - - waitForLogToContainText("0. Current UI matches in beforeResponse? true"); - waitForLogToContainText("1. Current session matches in beforeResponse? true"); - } - - @Test - public void canBeAccessedFromUIThread() { - $(ButtonElement.class).first().click(); - - assertTrue(logContainsText("0. Access from UI thread future is done? false")); - assertTrue(logContainsText("1. Access from UI thread is run")); - assertTrue(logContainsText("2. beforeClientResponse future is done? true")); - } - - @Test - public void canBeAccessedFromBackgroundThread() { - $(ButtonElement.class).get(1).click(); - - assertTrue(logContainsText("0. Initial background message")); - assertTrue(logContainsText("1. Thread has current response? false")); - - waitForLogToContainText("2. Thread got lock, inital future done? true"); - } - - private void waitForLogToContainText(final String text) { - waitUntil(new ExpectedCondition<Object>() { - @Override - public Object apply(WebDriver input) { - return logContainsText(text); - } - }); - } - - @Test - public void exceptionCanBeThrown() { - $(ButtonElement.class).get(2).click(); - - assertTrue(logContainsText("0. Throwing exception in access")); - assertTrue(logContainsText("1. firstFuture is done? true")); - assertTrue(logContainsText("2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can")); - } - - @Test - public void futureIsCancelledBeforeStarted() { - $(ButtonElement.class).get(3).click(); - - assertTrue(logContainsText("0. future was cancelled, should not start")); - } - - @Test - public void runningThreadIsCancelled() { - $(ButtonElement.class).get(4).click(); - - waitForLogToContainText("0. Waiting for thread to start"); - waitForLogToContainText("1. Thread started, waiting for interruption"); - waitForLogToContainText("2. I was interrupted"); - } - - @Test - public void testAccessSynchronously() { - $(ButtonElement.class).get(5).click(); - - assertTrue(logContainsText("0. accessSynchronously has request? true")); - assertTrue(logContainsText("1. Test value in accessSynchronously: Set before accessSynchronosly")); - assertTrue(logContainsText("2. has request after accessSynchronously? true")); - assertTrue(logContainsText("3. Test value after accessSynchornously: Set in accessSynchronosly")); - } - - @Test - public void currentInstanceCanAccessValue() { - $(ButtonElement.class).get(6).click(); - - assertTrue(logContainsText("0. access has request? false")); - assertTrue(logContainsText("1. Test value in access: Set before access")); - assertTrue(logContainsText("2. has request after access? true")); - assertTrue(logContainsText("3. Test value after access: Set before run pending")); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleName.java b/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleName.java deleted file mode 100644 index 35dc4cd325..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleName.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; - -/** - * Empty test ui to check auto-generated style name for UI. - * - * @author Vaadin Ltd - */ -public class UIAutoGeneratedStyleName extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - } - - @Override - protected String getTestDescription() { - return "Add UI specific autogenerated style name to ui div element" - + " and overlays container"; - } - - @Override - protected Integer getTicketNumber() { - return 14670; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java b/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java deleted file mode 100644 index 73e0a7f6b9..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.tests.tb3.MultiBrowserTest; -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; - -import java.util.Locale; - -/** - * Test to check auto-generated style name for UI div and overlays div. - * - * @author Vaadin Ltd - */ -public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { - - @Test - public void testUiStyleName() { - openTestURL(); - - Assert.assertTrue( - "UI div element doesn't contain autogenerated style name", - containsStyle(getDriver().findElement(By.className("v-app")), - UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); - - Assert.assertTrue( - "Overlays div element doesn't contain autogenerated style name", - containsStyle( - getDriver().findElement( - By.className("v-overlay-container")), - UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); - } - - private boolean containsStyle(WebElement element, String style) { - return element.getAttribute("class").contains(style); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java deleted file mode 100644 index 130d432940..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java +++ /dev/null @@ -1,59 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.components.ui; - -import com.vaadin.server.Page; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.WebBrowser; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; - -public class UIInitBrowserDetails extends AbstractTestUI { - - private GridLayout l = new GridLayout(3, 1); - private VaadinRequest r; - - @Override - protected void setup(VaadinRequest request) { - r = request; - l.setWidth("100%"); - addComponent(l); - - Page p = getPage(); - WebBrowser wb = p.getWebBrowser(); - - addDetail("location", "v-loc", p.getLocation()); - - addDetail("browser window width", "v-cw", p.getBrowserWindowWidth()); - addDetail("browser window height", "v-ch", p.getBrowserWindowHeight()); - addDetail("screen width", "v-sw", wb.getScreenWidth()); - addDetail("screen height", "v-sh", wb.getScreenHeight()); - - addDetail("timezone offset", "v-tzo", wb.getTimezoneOffset()); - addDetail("raw timezone offset", "v-rtzo", wb.getRawTimezoneOffset()); - addDetail("dst saving", "v-dstd", wb.getDSTSavings()); - addDetail("dst in effect", "v-dston", wb.isDSTInEffect()); - addDetail("current date", "v-curdate", wb.getCurrentDate()); - } - - private void addDetail(String name, String param, Object value) { - Label requestLabel = new Label(r.getParameter(param)); - requestLabel.setId(param); - Label browserLabel = new Label("" + value); - browserLabel.setId(name); - l.addComponents(new Label(name), requestLabel, browserLabel); - } - - @Override - public String getTestDescription() { - return "Browser details should be available in UI init"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(9037); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java deleted file mode 100644 index 1e69662935..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetailsTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIInitBrowserDetailsTest extends MultiBrowserTest { - - @Test - public void testBrowserDetails() throws Exception { - openTestURL(); - /* location */ - compareRequestAndBrowserValue("v-loc", "location", "null"); - /* browser window width */ - compareRequestAndBrowserValue("v-cw", "browser window width", "-1"); - /* browser window height */ - compareRequestAndBrowserValue("v-ch", "browser window height", "-1"); - /* screen width */ - compareRequestAndBrowserValue("v-sw", "screen width", "-1"); - /* screen height */ - compareRequestAndBrowserValue("v-sh", "screen height", "-1"); - /* timezone offset */ - assertTextNotNull("timezone offset"); - /* raw timezone offset */ - assertTextNotNull("raw timezone offset"); - /* dst saving */ - assertTextNotNull("dst saving"); - /* dst in effect */ - assertTextNotNull("dst in effect"); - /* current date */ - assertTextNotNull("v-curdate"); - assertTextNotNull("current date"); - } - - private void compareRequestAndBrowserValue(String paramName, - String browserName, String errorValue) { - assertTextNotEquals(browserName, errorValue); - Assert.assertEquals(String.format( - "Browser and request values differ in '%s',", browserName), - getLabelText(paramName), getLabelText(browserName)); - } - - private String getLabelText(String id) { - return $(LabelElement.class).id(id).getText(); - } - - private void assertTextNotNull(String id) { - assertTextNotEquals(id, "null"); - } - - private void assertTextNotEquals(String id, String notExpected) { - String actual = getLabelText(id); - Assert.assertNotEquals(String.format("Unexpected value for '%s'", id), - notExpected, actual); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitException.java b/uitest/src/com/vaadin/tests/components/ui/UIInitException.java deleted file mode 100644 index d5f26ade29..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; - -public class UIInitException extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - throw new RuntimeException("Catch me if you can"); - } - - @Override - protected String getTestDescription() { - return "Throwing an exception in application code during a browser details request should show a sensible message in the client"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(8243); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java deleted file mode 100644 index d002642a74..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitExceptionTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIInitExceptionTest extends MultiBrowserTest { - @Test - public void testExceptionOnUIInit() throws Exception { - openTestURL(); - Assert.assertTrue("Page does not contain the given text", driver - .getPageSource().contains("Catch me if you can")); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java b/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java deleted file mode 100644 index 7d5bbe156b..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIInitTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -public class UIInitTest extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - addComponent(new Label("Hello UI")); - } - - @Override - public String getTestDescription() { - return "Testing basic UI creation"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(3067); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java deleted file mode 100644 index 7d9f09892c..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.tests.util.Log; -import com.vaadin.ui.TextField; - -public class UIPolling extends AbstractTestUIWithLog { - - protected static final long SLEEP_TIME = 500; - - private class BackgroundLogger extends Thread { - - @Override - public void run() { - int i = 0; - while (true) { - i++; - try { - Thread.sleep(SLEEP_TIME); - } catch (InterruptedException e) { - } - final int iteration = i; - access(new Runnable() { - @Override - public void run() { - log.log((iteration * SLEEP_TIME) + "ms has passed"); - } - }); - } - } - } - - private BackgroundLogger logger = null; - - @Override - protected void setup(VaadinRequest request) { - log = new Log(20); - log.setNumberLogRows(true); - TextField pollingInterval = new TextField("Poll interval", - new MethodProperty<Integer>(this, "pollInterval")); - pollingInterval.setImmediate(true); - pollingInterval.setValue("-1"); - pollingInterval.addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - if (logger != null) { - logger.stop(); - logger = null; - } - if (getPollInterval() >= 0) { - logger = new BackgroundLogger(); - logger.start(); - } - } - }); - addComponent(pollingInterval); - - } - - @Override - protected String getTestDescription() { - return "Tests the polling feature of UI. Set the polling interval using the text field. Enabling polling will at the same time start a background thread which logs every 500ms"; - } - - @Override - protected Integer getTicketNumber() { - return 11495; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java b/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java deleted file mode 100644 index c4a41d135a..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIPollingTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.vaadin.tests.components.ui; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.testbench.elements.TextFieldElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIPollingTest extends MultiBrowserTest { - - @Override - public List<DesiredCapabilities> getBrowsersToTest() { - // Manually testing IE8 stops polling with -1, but with automated test - // it seems to be highly unpredictable. - return super.getBrowsersExcludingIE8(); - } - - @Test - public void testPolling() throws Exception { - openTestURL(); - getTextField().setValue("500"); - sleep(2000); - /* Ensure polling has taken place */ - Assert.assertTrue("Page does not contain the given text", driver - .getPageSource().contains("2. 1000ms has passed")); - getTextField().setValue("-1"); - sleep(2000); - /* Ensure polling has stopped */ - Assert.assertFalse("Page contains the given text", driver - .getPageSource().contains("20. 10000ms has passed")); - } - - public TextFieldElement getTextField() { - return $(TextFieldElement.class).first(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java deleted file mode 100644 index 9fcc1eedde..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -@PreserveOnRefresh -public class UIRefresh extends AbstractTestUI { - - public static final String REINIT_ID = "reinit"; - - @Override - protected void setup(VaadinRequest request) { - } - - @Override - protected void refresh(VaadinRequest request) { - Label l = new Label("Reinit!"); - l.setId(REINIT_ID); - addComponent(l); - } - - @Override - public String getTestDescription() { - return "UI reinit after refresh"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12191); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java deleted file mode 100644 index 7d701f4ae0..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIRefreshTest extends MultiBrowserTest { - - @Test - public void testUIRefresh() { - openTestURL(); - Assert.assertFalse(reinitLabelExists()); - // Reload the page; UI.refresh should be invoked - openTestURL(); - Assert.assertTrue(reinitLabelExists()); - } - - private boolean reinitLabelExists() { - return !getDriver().findElements(By.id(UIRefresh.REINIT_ID)).isEmpty(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java deleted file mode 100644 index cbd317b027..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.PrintWriter; -import java.io.Serializable; -import java.io.StringWriter; -import java.util.Date; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.util.Log; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; - -public class UISerialization extends AbstractTestUI { - - private Log log = new Log(5); - - @Override - protected void setup(VaadinRequest request) { - addComponent(log); - addComponent(new Button("Serialize UI", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - Date d = new Date(); - try { - byte[] result = serialize(UISerialization.this); - long elapsed = new Date().getTime() - d.getTime(); - log.log("Serialized UI in " + elapsed + "ms into " - + result.length + " bytes"); - Object diffStateBefore = getConnectorTracker() - .getDiffState(UISerialization.this); - UISerialization app = (UISerialization) deserialize(result); - log.log("Deserialized UI in " + elapsed + "ms"); - Object diffStateAfter = getConnectorTracker().getDiffState( - UISerialization.this); - if (diffStateBefore.equals(diffStateAfter)) { - log.log("Diff states match, size: " - + diffStateBefore.toString().length()); - } else { - log.log("Diff states do not match"); - } - } catch (Exception e) { - log.log("Exception caught: " + e.getMessage()); - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - addComponent(new Label(sw.toString(), - ContentMode.PREFORMATTED)); - } - - } - })); - } - - protected void serializeInstance(Class<?> cls) - throws InstantiationException, IllegalAccessException, IOException { - serialize((Serializable) cls.newInstance()); - } - - protected byte[] serialize(Serializable serializable) throws IOException { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - ObjectOutputStream oos; - oos = new ObjectOutputStream(os); - oos.writeObject(serializable); - return os.toByteArray(); - } - - protected Object deserialize(byte[] result) { - ByteArrayInputStream is = new ByteArrayInputStream(result); - ObjectInputStream ois; - try { - ois = new ObjectInputStream(is); - return ois.readObject(); - } catch (Exception e) { - throw new RuntimeException("Deserialization failed", e); - } - } - - @Override - protected String getTestDescription() { - // TODO Auto-generated method stub - return null; - } - - @Override - protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java b/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java deleted file mode 100644 index 649f48c9ce..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.components.ui; - -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.endsWith; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class UISerializationTest extends SingleBrowserTest { - - @Test - public void uiIsSerialized() throws Exception { - openTestURL(); - - serialize(); - - assertThat(getLogRow(0), startsWith("3. Diff states match, size: ")); - assertThat(getLogRow(1), startsWith("2. Deserialized UI in ")); - assertThat( - getLogRow(2), - allOf(startsWith("1. Serialized UI in"), - containsString(" into "), endsWith(" bytes"))); - } - - private void serialize() { - $(ButtonElement.class).first().click(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java b/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java deleted file mode 100644 index c3bb036966..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UITabIndex.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class UITabIndex extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - addButton("Set tabIndex to -1", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - setTabIndex(-1); - } - }); - addButton("Set tabIndex to 0", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - setTabIndex(0); - } - }); - addButton("Set tabIndex to 1", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - setTabIndex(1); - } - }); - } - - @Override - protected String getTestDescription() { - return "Tests tab index handling for UI"; - } - - @Override - protected Integer getTicketNumber() { - return 11129; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java b/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java deleted file mode 100644 index 390907ee8a..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UITabIndexTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.UIElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UITabIndexTest extends MultiBrowserTest { - - @Test - public void testTabIndexOnUIRoot() throws Exception { - openTestURL(); - assertTabIndex("1"); - $(ButtonElement.class).first().click(); - assertTabIndex("-1"); - $(ButtonElement.class).get(1).click(); - assertTabIndex("0"); - $(ButtonElement.class).get(2).click(); - assertTabIndex("1"); - } - - private void assertTabIndex(String expected) { - Assert.assertEquals("Unexpected tab index,", expected, - $(UIElement.class).first().getAttribute("tabIndex")); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java deleted file mode 100644 index 25bf40edde..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.components.ui; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -import com.vaadin.server.UIClassSelectionEvent; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinSession; -import com.vaadin.tests.components.AbstractTestUIProvider; -import com.vaadin.ui.Label; -import com.vaadin.ui.UI; -import com.vaadin.ui.VerticalLayout; - -public class UIsInMultipleTabs extends AbstractTestUIProvider { - // No cleanup -> will leak, but shouldn't matter for tests - private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<VaadinSession, AtomicInteger>(); - - public static class TabUI extends UI { - @Override - protected void init(VaadinRequest request) { - VaadinSession application = VaadinSession.getCurrent(); - AtomicInteger count = numberOfUIsOpened.get(application); - if (count == null) { - numberOfUIsOpened.putIfAbsent(application, new AtomicInteger()); - // Get our added instance or another instance that was added by - // another thread between previous get and putIfAbsent - count = numberOfUIsOpened.get(application); - } - int currentCount = count.incrementAndGet(); - String message = "This is UI number " + currentCount; - - VerticalLayout layout = new VerticalLayout(); - layout.setMargin(true); - setContent(layout); - - layout.addComponent(new Label(message)); - } - } - - @Override - public Class<? extends UI> getUIClass(UIClassSelectionEvent event) { - return TabUI.class; - } - - @Override - protected String getTestDescription() { - return "Opening the same application again (e.g. in a new tab) should create a new UI."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7894); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java deleted file mode 100644 index e703deb634..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIsInMultipleTabsTest extends MultiBrowserTest { - - @Test - public void testPageReloadChangesUI() throws Exception { - openTestURL(); - assertUI(1); - openTestURL(); - assertUI(2); - openTestURL("restartApplication"); - assertUI(1); - } - - private void assertUI(int i) { - Assert.assertEquals("Unexpected UI found,", "This is UI number " + i, - $(LabelElement.class).first().getText()); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtml.java b/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtml.java deleted file mode 100644 index 96210b2027..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtml.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.JavaScript; -import com.vaadin.annotations.StyleSheet; -import com.vaadin.annotations.Theme; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -@JavaScript("uiDependency.js") -@StyleSheet("theme://uiDependency.css") -@Theme("tests-valo") -public class UiDependenciesInHtml extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - Label statusBox = new Label("Status box"); - statusBox.setId("statusBox"); - addComponent(statusBox); - - getPage().getJavaScript().execute("window.reportUiDependencyStatus();"); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java b/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java deleted file mode 100644 index 188a0aea3e..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UiDependenciesInHtmlTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.By; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -public class UiDependenciesInHtmlTest extends SingleBrowserTest { - - @Test - public void testUiDependencisInHtml() { - openTestURL(); - - String statusText = findElement(By.id("statusBox")).getText(); - - Assert.assertEquals( - "Script loaded before vaadinBootstrap.js: true\nStyle tag before vaadin theme: true", - statusText); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUI.java b/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUI.java deleted file mode 100644 index e80686f6f3..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUI.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import com.vaadin.annotations.Theme; -import com.vaadin.server.Responsive; -import com.vaadin.server.VaadinRequest; -import com.vaadin.ui.Button; -import com.vaadin.ui.CssLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.UI; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.themes.ValoTheme; - -/** - * - * @since - * @author Vaadin Ltd - */ -@Theme("valo") -public class UnnecessaryPaddingInResponsiveUI extends UI { - - @Override - protected void init(VaadinRequest request) { - Responsive.makeResponsive(this); - - HorizontalLayout root = new HorizontalLayout(); - root.setSpacing(true); - - MenuLayout menu = new MenuLayout(); - - root.addComponent(menu); - - setContent(root); - - setWidth(799, Unit.PIXELS); - setId("UI"); - - // Uncomment this to enable responsive features in Valo Menu and - // introduce a padding-top to the UI. When this is commented the - // padding-top should be 0 and the related test should pass. - - // addStyleName(ValoTheme.UI_WITH_MENU); - } - - class MenuLayout extends VerticalLayout { - public MenuLayout() { - setSizeFull(); - setPrimaryStyleName(ValoTheme.MENU_ROOT); - - CssLayout titleLo = new CssLayout(); - titleLo.addStyleName(ValoTheme.MENU_TITLE); - titleLo.addComponent(new Label("menu-title")); - - addComponent(titleLo); - - for (int i = 1; i <= 5; i++) { - Button button = new Button("Menu Item " + i); - button.setPrimaryStyleName(ValoTheme.MENU_ITEM); - addComponent(button); - } - } - - } -}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUITest.java b/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUITest.java deleted file mode 100644 index 661db179e7..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UnnecessaryPaddingInResponsiveUITest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import org.junit.Test; -import org.openqa.selenium.WebElement; - -import com.vaadin.tests.tb3.SingleBrowserTest; - -/** - * - * @since - * @author Vaadin Ltd - */ -public class UnnecessaryPaddingInResponsiveUITest extends SingleBrowserTest { - - @Test - public void testUIShouldHaveNoPaddingTop() { - openTestURL(); - - WebElement ui = vaadinElementById("UI"); - - String paddingTop = ui.getCssValue("padding-top"); - - Integer paddingHeight = Integer.parseInt(paddingTop.substring(0, - paddingTop.length() - 2)); - - assertThat(paddingHeight, equalTo(0)); - - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UriFragment.java b/uitest/src/com/vaadin/tests/components/ui/UriFragment.java deleted file mode 100644 index c726c49b12..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UriFragment.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.Page; -import com.vaadin.server.Page.UriFragmentChangedEvent; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Label; - -public class UriFragment extends AbstractTestUI { - - private final Label fragmentLabel = new Label(); - - @Override - protected void setup(VaadinRequest request) { - fragmentLabel.setId("fragmentLabel"); - addComponent(fragmentLabel); - updateLabel(); - getPage().addListener(new Page.UriFragmentChangedListener() { - @Override - public void uriFragmentChanged(UriFragmentChangedEvent event) { - updateLabel(); - } - }); - - addComponent(createButton("test", "Navigate to #test", "test")); - addComponent(createButton("empty", "Navigate to #", "")); - addComponent(createButton("null", "setUriFragment(null)", null)); - } - - private Button createButton(String id, String caption, final String fragment) { - Button button = new Button(caption, new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getPage().setUriFragment(fragment); - } - }); - - button.setId(id); - - return button; - } - - private void updateLabel() { - String fragment = getPage().getUriFragment(); - if (fragment == null) { - fragmentLabel.setValue("No URI fragment set"); - } else { - fragmentLabel.setValue("Current URI fragment: " + fragment); - } - } - - @Override - public String getTestDescription() { - return "URI fragment status should be known when the page is loaded and retained while navigating to different fragments or using the back and forward buttons."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(8048); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java b/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java deleted file mode 100644 index e7fbf4f7ec..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UriFragmentTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.vaadin.tests.components.ui; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.support.ui.ExpectedCondition; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UriFragmentTest extends MultiBrowserTest { - - @Test - public void testUriFragment() throws Exception { - driver.get(getTestUrl() + "#urifragment"); - assertFragment("urifragment"); - navigateToTest(); - assertFragment("test"); - ((JavascriptExecutor) driver).executeScript("history.back()"); - - assertFragment("urifragment"); - ((JavascriptExecutor) driver).executeScript("history.forward()"); - assertFragment("test"); - - // Open other URL in between to ensure the page is loaded again - // (testbench doesn't like opening a URI that only changes the fragment) - driver.get(getBaseURL() + "/statictestfiles/"); - driver.get(getTestUrl()); - - // Empty initial fragment - assertEquals("No URI fragment set", getFragmentLabelValue()); - - navigateToNull(); - // Still no # after setting to null - assertEquals("No URI fragment set", getFragmentLabelValue()); - navigateToEmptyFragment(); - // Empty # is added when setting to "" - assertEquals("Current URI fragment:", getFragmentLabelValue()); - navigateToTest(); - assertFragment("test"); - navigateToNull(); // Setting to null when there is a fragment actually - // sets it to # - assertEquals("Current URI fragment:", getFragmentLabelValue()); - } - - private void assertFragment(String fragment) { - final String expectedText = "Current URI fragment: " + fragment; - waitUntil(new ExpectedCondition<Boolean>() { - - @Override - public Boolean apply(WebDriver input) { - return expectedText.equals(getFragmentLabelValue()); - } - }); - - } - - private void navigateToEmptyFragment() { - hitButton("empty"); - } - - private void navigateToNull() { - hitButton("null"); - } - - private void navigateToTest() { - hitButton("test"); - } - - private String getFragmentLabelValue() { - return vaadinElementById("fragmentLabel").getText(); - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java b/uitest/src/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java deleted file mode 100644 index 37766dd060..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/VaadinFinderLocatorUISearchTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2000-2014 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.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.elements.UIElement; -import com.vaadin.tests.components.button.ButtonClick; -import com.vaadin.tests.tb3.MultiBrowserTest; - -/** - * - * @since - * @author Vaadin Ltd - */ -public class VaadinFinderLocatorUISearchTest extends MultiBrowserTest { - - @Override - protected Class<?> getUIClass() { - return ButtonClick.class; - } - - @Test - public void getUIElementTest() { - openTestURL(); - UIElement ui = $(UIElement.class).first(); - Assert.assertNotNull("Couldn't find the UI Element on the page", ui); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/WindowWithLabel.java b/uitest/src/com/vaadin/tests/components/ui/WindowWithLabel.java deleted file mode 100644 index 790ff00e60..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/WindowWithLabel.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.tests.components.ui; - -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class WindowWithLabel extends AbstractTestUI { - - @Override - protected void setup(VaadinRequest request) { - setContent(new Label("UI")); - Window window = new Window("A window"); - addWindow(window); - } - - @Override - protected String getTestDescription() { - return "Resize the window. It should work."; - } - - @Override - protected Integer getTicketNumber() { - return 10375; - } - -} diff --git a/uitest/src/com/vaadin/tests/components/ui/uiDependency.js b/uitest/src/com/vaadin/tests/components/ui/uiDependency.js deleted file mode 100644 index 4a5775c57f..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/uiDependency.js +++ /dev/null @@ -1,24 +0,0 @@ -(function() { - var loadedBeforeVaadin = (window.vaadin === undefined); - - window.reportUiDependencyStatus = function() { - var styleIndex = 1000; - var themeIndex = -1; - - var stylesheets = document.querySelectorAll("link[rel=stylesheet]"); - for(var i = 0; i < stylesheets.length; i++) { - var stylesheet = stylesheets[i]; - var href = stylesheet.getAttribute("href"); - if (href.indexOf("uiDependency.css") > -1) { - styleIndex = i; - } else if (href.indexOf("styles.css" > -1)) { - themeIndex = i; - } - } - - var status = "Script loaded before vaadinBootstrap.js: " + loadedBeforeVaadin; - status += "<br />Style tag before vaadin theme: " + (styleIndex < themeIndex); - - document.getElementById("statusBox").innerHTML = status; - } -})();
\ No newline at end of file |