Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- committed Dec 15, 2021
1 parent f43ee46 commit e760742
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testcategory.SlowTests;
import com.vaadin.testbench.TestBenchElement;

@NotThreadSafe
@Category(SlowTests.class)
Expand Down Expand Up @@ -57,9 +58,8 @@ public void liveReloadOnTouchedFrontendFile() {
waitForLiveReload();

// then: the frontend changes are visible in the DOM
WebElement customComponent = findElement(
By.id(FrontendLiveReloadView.CUSTOM_COMPONENT));
WebElement embeddedDiv = customComponent.$("*").id("custom-div");
TestBenchElement customComponent = $("*").id(FrontendLiveReloadView.CUSTOM_COMPONENT);
TestBenchElement embeddedDiv = customComponent.$("*").id("custom-div");
Assert.assertEquals("Updated component contents",
embeddedDiv.getText());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;

import com.vaadin.flow.testutil.DevModeGizmoElement;
import com.vaadin.testbench.TestBenchElement;

import net.jcip.annotations.NotThreadSafe;
import org.junit.Assert;
Expand All @@ -34,13 +35,9 @@ public void overlayShouldRender() {

// Upon opening, the LiveReloadUI should show the indicator but not the
// message window
waitForElementPresent(By.tagName("vaadin-devmode-gizmo"));
List<WebElement> liveReloads = findElements(
By.tagName("vaadin-devmode-gizmo"));
Assert.assertEquals(1, liveReloads.size());
WebElement liveReload = liveReloads.get(0);
DevModeGizmoElement liveReload = $(DevModeGizmoElement.class).waitForFirst();

WebElement window = liveReload.$("*")
TestBenchElement window = liveReload.$("*")
.attributeContains("class", "window").first();
Assert.assertFalse(window.isDisplayed());

Expand All @@ -67,17 +64,15 @@ public void splashMessageShownOnAutoReloadAndClosedOnBodyClick() {

waitForLiveReload();

WebElement liveReload = findElement(By.tagName("vaadin-devmode-gizmo"));
Assert.assertNotNull(liveReload);
DevModeGizmoElement liveReload = $(DevModeGizmoElement.class).waitForFirst();
WebElement gizmo1 = liveReload.$("*")
.attributeContains("class", "gizmo").first();

Assert.assertTrue(gizmo1.getAttribute("class").contains("active"));

findElement(By.tagName("body")).click();

WebElement liveReload2 = findElement(
By.tagName("vaadin-devmode-gizmo"));
DevModeGizmoElement liveReload2 = $(DevModeGizmoElement.class).waitForFirst();
Assert.assertNotNull(liveReload2);
WebElement gizmo2 = liveReload2.$("*")
.attributeContains("class", "gizmo").first();
Expand All @@ -90,7 +85,7 @@ public void deactivateLiveReload() {
open();

// given: live reload is deactivated
DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).waitForFirst();

gizmo.setLiveReload(false);

Expand All @@ -100,8 +95,7 @@ public void deactivateLiveReload() {
liveReloadTrigger.click();

// then: page is not reloaded
WebElement liveReload2 = findElement(
By.tagName("vaadin-devmode-gizmo"));
DevModeGizmoElement liveReload2 = $(DevModeGizmoElement.class).waitForFirst();
WebElement gizmo2 = liveReload2.$("*")
.attributeContains("class", "gizmo").first();
Assert.assertFalse(gizmo2.getAttribute("class").contains("active"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
package com.vaadin.flow.uitest.ui;

import net.jcip.annotations.NotThreadSafe;

import com.vaadin.flow.testutil.DevModeGizmoElement;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
Expand All @@ -28,8 +31,7 @@ public class PreserveOnRefreshLiveReloadIT extends AbstractLiveReloadIT {
public void notificationShownWhenLoadingPreserveOnRefreshView() {
open();

WebElement liveReload = findElement(By.tagName("vaadin-devmode-gizmo"));
Assert.assertNotNull(liveReload);
DevModeGizmoElement liveReload = $(DevModeGizmoElement.class).waitForFirst();
WebElement messageDetails = liveReload.$("*")
.attributeContains("class", "warning").first();
Assert.assertTrue(
Expand Down

0 comments on commit e760742

Please sign in to comment.