Skip to content

Commit

Permalink
Use quarkus-playwright (#505)
Browse files Browse the repository at this point in the history
* Use quarkus-playwright

* Update doc

* Use quarkus-playwright
  • Loading branch information
ia3andy authored Sep 12, 2023
1 parent 1160e46 commit b51a34c
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 89 deletions.
11 changes: 5 additions & 6 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,14 @@ public class AllWebUITest {
}
----

The library also brings a very elegant way to do e2e testing using https://github.com/microsoft/playwright-java[Playright]:
The library also brings a very elegant way to do e2e testing using https://docs.quarkiverse.io/quarkus-playwright/dev/[Quarkus Playright]:
[source,java]
----
import com.microsoft.playwright.BrowserContext;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;
import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkiverse.quinoa.testing.QuinoaTestProfiles;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.WithPlaywright;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
Expand All @@ -365,9 +364,9 @@ import java.net.URL;
@QuarkusTest
@TestProfile(QuinoaTestProfiles.Enable.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class MyWebUITest {
@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;
@TestHTTPResource("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;

import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkiverse.playwright.WithPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

@QuarkusTest
@TestProfile(TestProfiles.RootPathTests.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class QuinoaRootPathTest {

@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;

@TestHTTPResource("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.net.URL;

import io.quarkiverse.playwright.WithPlaywright;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -13,18 +14,17 @@
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;

import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

@QuarkusTest
@TestProfile(TestProfiles.AngularTests.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class QuinoaUIAngularTest {

@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;

@TestHTTPResource("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.net.URL;

import io.quarkiverse.playwright.WithPlaywright;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -10,18 +11,17 @@
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;

import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

@QuarkusTest
@TestProfile(TestProfiles.LitTests.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class QuinoaUILitTest {

@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;

@TestHTTPResource("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;

import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkiverse.playwright.WithPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.restassured.http.ContentType;

@QuarkusTest
@TestProfile(TestProfiles.ReactTests.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class QuinoaUIReactTest {

@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;

@TestHTTPResource("/index.html")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Response;

import io.quarkiverse.quinoa.testing.QuarkusPlaywrightManager;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkiverse.playwright.InjectPlaywright;
import io.quarkiverse.playwright.WithPlaywright;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

@QuarkusTest
@TestProfile(TestProfiles.VueTests.class)
@QuarkusTestResource(QuarkusPlaywrightManager.class)
@WithPlaywright
public class QuinoaUIVueTest {

@QuarkusPlaywrightManager.InjectPlaywright
@InjectPlaywright
BrowserContext context;

@TestHTTPResource("/")
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.3.0</quarkus.version>
<playright.version>1.37.0</playright.version>
<quarkus-playright.version>0.0.1</quarkus-playright.version>
<assertj.version>3.24.2</assertj.version>
<frontend-plugin.version>1.14.0</frontend-plugin.version>
</properties>
Expand Down
11 changes: 3 additions & 8 deletions testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
<name>Quarkus - Quinoa - Testing</name>
<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>${playright.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>driver-bundle</artifactId>
<version>${playright.version}</version>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<version>${quarkus-playright.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down

This file was deleted.

0 comments on commit b51a34c

Please sign in to comment.