summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2014-07-03 14:02:14 +0300
committerHenri Sara <hesara@vaadin.com>2014-07-03 14:08:53 +0300
commit3320dd0eee5d93d73de3eafcc6774b5cb38ea98b (patch)
tree1624514a69d3570a9d8b3e1873f2db4e3ea8f1f7 /uitest/src/com/vaadin/tests
parentff8efe1b94b077c24085962db733fbb26f213484 (diff)
downloadvaadin-framework-3320dd0eee5d93d73de3eafcc6774b5cb38ea98b.tar.gz
vaadin-framework-3320dd0eee5d93d73de3eafcc6774b5cb38ea98b.zip
Revert "Allow changing theme on the fly (#2874)"
This reverts commit 1b73b00b2875c5eafa3c641b77f5d9efc2f7d929 as well as the related changes to @since, release notes etc. Conflicts: client/src/com/vaadin/client/ResourceLoader.java client/src/com/vaadin/client/communication/TranslatedURLReference.java client/src/com/vaadin/client/ui/ui/UIConnector.java server/src/com/vaadin/ui/UI.java shared/src/com/vaadin/shared/ui/ui/UIState.java uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java Change-Id: Id882dc730f51055f6d17200964bcaf8a1f87a35f
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java51
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java103
-rw-r--r--uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java110
3 files changed, 18 insertions, 246 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index f3d50af001..fa704d7b0b 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -16,15 +16,15 @@
package com.vaadin.tests.tb3;
-import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
-import com.vaadin.server.LegacyApplication;
-import com.vaadin.server.UIProvider;
-import com.vaadin.testbench.TestBench;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
import com.vaadin.testbench.TestBenchElement;
-import com.vaadin.testbench.TestBenchTestCase;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
-import com.vaadin.ui.UI;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@@ -41,13 +41,14 @@ import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
+import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
+import com.vaadin.server.LegacyApplication;
+import com.vaadin.server.UIProvider;
+import com.vaadin.testbench.TestBench;
+import com.vaadin.testbench.TestBenchTestCase;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.tb3.MultiBrowserTest.Browser;
+import com.vaadin.ui.UI;
import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed;
@@ -152,8 +153,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
}
protected WebElement getTooltipElement() {
- return getDriver().findElement(
- com.vaadin.testbench.By.className("v-tooltip-text"));
+ return getDriver().findElement(com.vaadin.testbench.By.className("v-tooltip-text"));
}
protected Coordinates getCoordinates(TestBenchElement element) {
@@ -210,22 +210,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase {
* {@link #isPush()}.
*/
protected void openTestURL() {
- openTestURL("");
- }
-
- /**
- * Opens the given test (defined by {@link #getTestUrl()}, optionally with
- * debug window and/or push (depending on {@link #isDebug()} and
- * {@link #isPush()}.
- */
- protected void openTestURL(String extraParameters) {
- String url = getTestUrl();
- if (url.contains("?")) {
- url = url + "&" + extraParameters;
- } else {
- url = url + "?" + extraParameters;
- }
- driver.get(url);
+ driver.get(getTestUrl());
}
/**
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java
deleted file mode 100644
index 8989d88164..0000000000
--- a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFly.java
+++ /dev/null
@@ -1,103 +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.themes;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.server.ThemeResource;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.tests.util.PersonContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Image;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-
-@Theme("reindeer")
-public class ThemeChangeOnTheFly extends AbstractTestUIWithLog {
-
- @Override
- protected void setup(VaadinRequest request) {
- Button inject = new Button("Inject blue background");
- inject.addClickListener(new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- getPage().getStyles().add(
- ".v-app { background: blue !important;}");
-
- }
- });
- addComponent(inject);
-
- GridLayout gl = new GridLayout(2, 4);
- gl.setCaption("Change theme by clicking a button");
- for (final String theme : new String[] { "reindeer", "runo",
- "chameleon", "base", null }) {
- Button b = new Button(theme);
- b.setId(theme + "");
- b.addClickListener(new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- getUI().setTheme(theme);
- }
- });
- gl.addComponent(b);
- }
-
- Table t = new Table();
- PersonContainer pc = PersonContainer.createWithTestData();
- pc.addNestedContainerBean("address");
- t.setContainerDataSource(pc);
- gl.addComponent(t, 0, 3, 1, 3);
- gl.setRowExpandRatio(3, 1);
-
- gl.setWidth("500px");
- gl.setHeight("800px");
-
- HorizontalLayout images = new HorizontalLayout();
- images.setSpacing(true);
-
- Label l = new Label("Chameleon theme image in caption");
- l.setIcon(new ThemeResource("img/magnifier.png"));
- images.addComponent(l);
- Image image = new Image("Runo theme image", new ThemeResource(
- "icons/64/ok.png"));
- images.addComponent(image);
- image = new Image("Reindeer theme image", new ThemeResource(
- "button/img/left-focus.png"));
- images.addComponent(image);
- addComponent(images);
- addComponent(gl);
-
- getLayout().setSpacing(true);
- }
-
- @Override
- protected String getTestDescription() {
- return "Test that you can change theme on the fly";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2874;
- }
-
-}
diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
deleted file mode 100644
index 681a7d762b..0000000000
--- a/uitest/src/com/vaadin/tests/themes/ThemeChangeOnTheFlyTest.java
+++ /dev/null
@@ -1,110 +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.themes;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.junit.Test;
-import org.openqa.selenium.By;
-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.elements.ButtonElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class ThemeChangeOnTheFlyTest extends MultiBrowserTest {
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
- */
- @Override
- public List<DesiredCapabilities> getBrowsersToTest() {
- // Seems like stylesheet onload is not fired on PhantomJS
- List<DesiredCapabilities> l = super.getBrowsersToTest();
- l.remove(Browser.PHANTOMJS.getDesiredCapabilities());
- return l;
- }
-
- @Test
- public void injectedStyleAndThemeChange() throws IOException {
- openTestURL();
- $(ButtonElement.class).caption("Inject blue background").first()
- .click();
- changeTheme("runo");
- compareScreen("runo-blue-background");
- }
-
- @Test
- public void reindeerToOthers() throws IOException {
- openTestURL();
- compareScreen("reindeer");
-
- changeThemeAndCompare("runo");
- changeThemeAndCompare("chameleon");
- changeThemeAndCompare("base");
-
- }
-
- @Test
- public void runoToReindeer() throws IOException {
- openTestURL("theme=runo");
- compareScreen("runo");
- changeThemeAndCompare("reindeer");
- }
-
- @Test
- public void reindeerToNullToReindeer() throws IOException {
- openTestURL();
-
- changeThemeAndCompare("null");
- changeThemeAndCompare("reindeer");
- }
-
- private void changeThemeAndCompare(String theme) throws IOException {
- changeTheme(theme);
- compareScreen(theme);
- }
-
- private void changeTheme(String theme) {
- $(ButtonElement.class).id(theme).click();
- if (theme.equals("null")) {
- waitForThemeToChange("");
- } else {
- waitForThemeToChange(theme);
- }
- }
-
- private void waitForThemeToChange(final String theme) {
-
- final WebElement rootDiv = findElement(By
- .xpath("//div[contains(@class,'v-app')]"));
- waitUntil(new ExpectedCondition<Boolean>() {
-
- @Override
- public Boolean apply(WebDriver input) {
- String rootClass = rootDiv.getAttribute("class").trim();
- String expected = "v-app " + theme;
- expected = expected.trim();
- return rootClass.equals(expected);
- }
- }, 30);
- }
-}