blob: 1db4901b4dca2a0f3024dbaad4e980c0c8d43c77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
package com.vaadin.tests.themes.valo;
import static org.junit.Assert.assertNotEquals;
import java.util.List;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.ui.themes.ValoTheme;
/**
* Test for H1 and P elements styles in Notifications.
*
* @author Vaadin Ltd
*/
public class NotificationStyleTest extends MultiBrowserTest {
@Test
public void testNotificationH1Style() {
openTestURL();
$(ButtonElement.class).first().click();
new Actions(getDriver()).moveByOffset(10, 10).perform();
waitUntil(notificationPresentCondition(), 2);
WebElement notification = findElement(By.className("v-Notification"));
List<WebElement> headers = notification
.findElements(By.tagName(ValoTheme.LABEL_H1));
String textAlign = headers.get(0).getCssValue("text-align");
String textAlignInnerHeader = headers.get(1).getCssValue("text-align");
assertNotEquals(
"Styles for notification defined h1 tag "
+ "and custom HTML tag are the same",
textAlign, textAlignInnerHeader);
}
@Test
public void testNotificationPStyle() {
openTestURL();
$(ButtonElement.class).get(1).click();
new Actions(getDriver()).moveByOffset(10, 10).perform();
waitUntil(notificationPresentCondition(), 2);
WebElement notification = findElement(By.className("v-Notification"));
WebElement description = notification
.findElement(By.className("v-Notification-description"));
String display = description.getCssValue("display");
String displayP2 = notification.findElement(By.className("tested-p"))
.getCssValue("display");
assertNotEquals(
"Styles for notification defined 'p' tag "
+ "and custom HTML tag are the same",
display, displayP2);
}
private ExpectedCondition<Boolean> notificationPresentCondition() {
return input -> isElementPresent(By.className("v-Notification"));
}
}
|