Skip to content

Commit

Permalink
Selenium refuses to work, Playwright it shall be
Browse files Browse the repository at this point in the history
  • Loading branch information
mstahv committed Sep 6, 2023
1 parent 9550836 commit d52059a
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
java-version: '17'
distribution: 'temurin'
- name: Build with Maven
run: mvn --batch-mode install
run: mvn --batch-mode install -PallTests
31 changes: 27 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<properties>
<java.version>17</java.version>
<vaadin.version>24.1.8</vaadin.version>
<project.tests.exclude>IntegrationTest</project.tests.exclude>
</properties>

<parent>
Expand All @@ -32,10 +33,6 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
Expand Down Expand Up @@ -65,6 +62,17 @@
<version>0.0.2</version>
</dependency>

<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.36.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -80,10 +88,25 @@
<maxAttempts>240</maxAttempts>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<excludedGroups>${project.tests.exclude}</excludedGroups>
</configuration>
</plugin>

</plugins>
</build>

<profiles>
<profile>
<id>allTests</id>
<properties>
<project.tests.exclude></project.tests.exclude>
</properties>
</profile>
<profile>
<!-- Production mode is activated using -Pproduction
or automatically for e.g. "cloud native buildpack" builds
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
logging.level.org.atmosphere = warn

# To improve the performance during development.
# For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters
# vaadin.whitelisted-packages= org/vaadin/example
vaadin.whitelisted-packages=org/example,org/vaadin
38 changes: 38 additions & 0 deletions src/test/java/org/example/TrivialWebDriverTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.example;

import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;

import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@Tag("IntegrationTest")
public class TrivialWebDriverTest {


@LocalServerPort
private int port;

static Playwright playwright;

@BeforeAll
public static void setup() {
playwright = Playwright.create();
}

@Test
public void smokeTest() {
Browser browser = playwright.firefox().launch();
Page page = browser.newPage();
page.navigate("http://localhost:" + port + "/");
assertThat(page.getByText("Welcome }> add-on demo project")).isVisible();
}

}

0 comments on commit d52059a

Please sign in to comment.