summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-07-11 11:16:04 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-07-21 14:40:33 +0300
commit7adc4266e7cb820cf480c5739c32bf610d2bbe08 (patch)
treeb3a2480532c863537e3bfcebeb8ea4d0068cce21 /uitest
parent80fd246adb14850131b1ad1b8f0c69aff4af697a (diff)
downloadvaadin-framework-7adc4266e7cb820cf480c5739c32bf610d2bbe08.tar.gz
vaadin-framework-7adc4266e7cb820cf480c5739c32bf610d2bbe08.zip
Convert EmbeddedAltText test to TB4
Change-Id: I92e0cfbc10d76b76e47f20b366351a8e0023993c
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java60
-rw-r--r--uitest/tb2/com/vaadin/tests/components/embedded/EmbeddedAltText.html47
2 files changed, 60 insertions, 47 deletions
diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java
new file mode 100644
index 0000000000..23dcddd8d0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedAltTextTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.embedded;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.EmbeddedElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class EmbeddedAltTextTest extends MultiBrowserTest {
+
+ @Before
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+ openTestURL();
+ waitForElementPresent(By.className("v-embedded"));
+ }
+
+ @Test
+ public void testEmbeddedAltText() {
+ EmbeddedElement embedded = $(EmbeddedElement.class).first();
+
+ Assert.assertEquals("Alt text of the image", getAltText(embedded));
+ assertHtmlSource("Alt text of the object");
+
+ $(ButtonElement.class).first().click();
+
+ Assert.assertEquals("New alt text of the image!", getAltText(embedded));
+ assertHtmlSource("New alt text of the object!");
+ }
+
+ private void assertHtmlSource(String html) {
+ String pageSource = driver.getPageSource();
+ Assert.assertTrue("Page source does not contain '" + html + "'",
+ pageSource.contains(html));
+ }
+
+ private String getAltText(EmbeddedElement embedded) {
+ return embedded.findElement(By.vaadin("/domChild[0]")).getAttribute(
+ "alt");
+ }
+}
diff --git a/uitest/tb2/com/vaadin/tests/components/embedded/EmbeddedAltText.html b/uitest/tb2/com/vaadin/tests/components/embedded/EmbeddedAltText.html
deleted file mode 100644
index 066c55fe55..0000000000
--- a/uitest/tb2/com/vaadin/tests/components/embedded/EmbeddedAltText.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:8068" />
-<title>EmbeddedAltText</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">EmbeddedAltText</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.embedded.EmbeddedAltText?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VEmbedded[0]/domChild[0]@alt</td>
- <td>Alt text of the image</td>
-</tr>
-<tr>
- <td>assertHtmlSource</td>
- <td>*Alt text of the object*</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertAttribute</td>
- <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VEmbedded[0]/domChild[0]@alt</td>
- <td>New alt text of the image!</td>
-</tr>
-<tr>
- <td>assertHtmlSource</td>
- <td>*New alt text of the object!*</td>
- <td></td>
-</tr>
-
-</tbody></table>
-</body>
-</html>