Skip to content

Commit

Permalink
Allow Playwright in Runtime module
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 25, 2024
1 parent 00f13ef commit 50e39a4
Show file tree
Hide file tree
Showing 16 changed files with 404 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# os: [windows-latest, macos-latest, ubuntu-latest]
# os: [windows-latest, macos-latest, ubuntu-latest]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -53,7 +53,7 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: mvn -B clean install -Dno-format
run: mvn -B clean install -Dno-format --no-transfer-progress

- name: Build with Maven (Native)
run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip
#- name: Build with Maven (Native)
# run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip --no-transfer-progress
35 changes: 26 additions & 9 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<artifactId>quarkus-playwright-deployment</artifactId>
<name>Quarkus Playwright - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.quarkiverse.playwright.deployment;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;

class PlaywrightProcessor {

private static final String FEATURE = "playwright";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.quarkiverse.playwright.deployment.devui;

import com.microsoft.playwright.Playwright;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.ExternalPageBuilder;
import io.quarkus.devui.spi.page.Page;

/**
* Dev UI card for displaying important details such as the Playwright library version.
*/
public class PlaywrightDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void createVersion(BuildProducer<CardPageBuildItem> cardPageBuildItemBuildProducer) {
final CardPageBuildItem card = new CardPageBuildItem();

final ExternalPageBuilder versionPage = Page.externalPageBuilder("Playwright Version")
.icon("font-awesome-solid:tag")
.url("https://playwright.dev")
.doNotEmbed()
.staticLabel(Playwright.class.getPackage().getImplementationVersion());

card.addPage(versionPage);

card.setCustomCard("qwc-playwright-card.js");

cardPageBuildItemBuildProducer.produce(card);
}
}
86 changes: 86 additions & 0 deletions deployment/src/main/resources/dev-ui/qwc-playwright-card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { LitElement, html, css} from 'lit';
import { pages } from 'build-time-data';
import 'qwc/qwc-extension-link.js';

const NAME = "Playwright";
export class QwcPlaywrightCard extends LitElement {

static styles = css`
.identity {
display: flex;
justify-content: flex-start;
}
.description {
padding-bottom: 10px;
}
.logo {
padding-bottom: 10px;
margin-right: 5px;
}
.card-content {
color: var(--lumo-contrast-90pct);
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 2px 2px;
height: 100%;
}
.card-content slot {
display: flex;
flex-flow: column wrap;
padding-top: 5px;
}
`;

static properties = {
description: {type: String}
};

constructor() {
super();
}

connectedCallback() {
super.connectedCallback();
}

render() {
return html`<div class="card-content" slot="content">
<div class="identity">
<div class="logo">
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgdmlld0JveD0iMCAwIDQwMCA0MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMTM2LjQ0NCAyMjEuNTU2QzEyMy41NTggMjI1LjIxMyAxMTUuMTA0IDIzMS42MjUgMTA5LjUzNSAyMzguMDMyQzExNC44NjkgMjMzLjM2NCAxMjIuMDE0IDIyOS4wOCAxMzEuNjUyIDIyNi4zNDhDMTQxLjUxIDIyMy41NTQgMTQ5LjkyIDIyMy41NzQgMTU2Ljg2OSAyMjQuOTE1VjIxOS40ODFDMTUwLjk0MSAyMTguOTM5IDE0NC4xNDUgMjE5LjM3MSAxMzYuNDQ0IDIyMS41NTZaTTEwOC45NDYgMTc1Ljg3Nkw2MS4wODk1IDE4OC40ODRDNjEuMDg5NSAxODguNDg0IDYxLjk2MTcgMTg5LjcxNiA2My41NzY3IDE5MS4zNkwxMDQuMTUzIDE4MC42NjhDMTA0LjE1MyAxODAuNjY4IDEwMy41NzggMTg4LjA3NyA5OC41ODQ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wMy41NjUgMTU4QzIyNi44OTkgMTY0LjYyOCAyMjguNzA2IDE5MC40MjUgMjI4LjcwNiAxOTAuNDI1TDE2Ni40OTcgMTcyLjc1NloiIGZpbGw9IiMxRDhEMjIiLz4NCjxwYXRoIGQ9Ik0xNDEuOTQ2IDI0NS40NTFMMTMxLjA3MiAyNDguNTM3QzEzMy42NDEgMjYzLjAxOSAxMzguMTY5IDI3Ni45MTcgMTQ1LjI3NiAyODkuMTk1QzE0Ni41MTMgMjg4LjkyMiAxNDcuNzQgMjg4LjY4NyAxNDkgMjg4LjM0MkMxNTIuMzAyIDI4Ny40NTEgMTU1LjM2NCAyODYuMzQ4IDE1OC4zMTIgMjg1LjE0NUMxNTAuMzcxIDI3My4zNjEgMTQ1LjExOCAyNTkuNzg5IDE0MS45NDYgMjQ1LjQ1MVpNMTM3LjcgMTQzLjQ1MUMxMzIuMTEyIDE2NC4zMDcgMTI3LjExMyAxOTQuMzI2IDEyOC40ODkgMjI0LjQzNkMxMzAuOTUyIDIyMy4zNjcgMTMzLjU1NCAyMjIuMzcxIDEzNi40NDQgMjIxLjU1MUwxMzguNDU3IDIyMS4xMDFDMTM2LjAwMyAxODguOTM5IDE0MS4zMDggMTU2LjE2NSAxNDcuMjg0IDEzMy44NjZDMTQ4Ljc5OSAxMjguMjI1IDE1MC4zMTggMTIyLjk3OCAxNTEuODMyIDExOC4wODVDMTQ5LjM5MyAxMTkuNjM3IDE0Ni43NjcgMTIxLjIyOCAxNDMuNzc2IDEyMi44NjdDMTQxLjc1OSAxMjkuMDkzIDEzOS43MjIgMTM1Ljg5OCAxMzcuNyAxNDMuNDUxWiIgZmlsbD0iI0MwNEI0MSIvPg0KPC9zdmc+DQo="
alt="${NAME}"
title="${NAME}"
width="32"
height="32">
</div>
<div class="description">${this.description}</div>
</div>
${this._renderCardLinks()}
</div>
`;
}

_renderCardLinks(){
return html`${pages.map(page => html`
<qwc-extension-link slot="link"
extensionName="${NAME}"
iconName="${page.icon}"
displayName="${page.title}"
staticLabel="${page.staticLabel}"
dynamicLabel="${page.dynamicLabel}"
streamingLabel="${page.streamingLabel}"
path="${page.id}"
?embed=${page.embed}
externalUrl="${page.metadata.externalUrl}"
webcomponent="${page.componentLink}" >
</qwc-extension-link>
`)}`;
}

}
customElements.define('qwc-playwright-card', QwcPlaywrightCard);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.quarkiverse.playwright.test;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;

public class PlaywrightDevModeTest {

// Start hot reload (DevMode) test with your extension loaded
@RegisterExtension
static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));

@Test
public void writeYourOwnDevModeTest() {
// Write your dev mode tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-hot-reload for more information
Assertions.assertTrue(true, "Add dev mode assertions to " + getClass().getName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.quarkiverse.playwright.test;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class PlaywrightTest {

// Start unit test with your extension loaded
@RegisterExtension
static final QuarkusUnitTest unitTest = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));

@Test
public void writeYourOwnUnitTest() {
// Write your unit tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-extensions for more information
Assertions.assertTrue(true, "Add some assertions to " + getClass().getName());
}
}
19 changes: 7 additions & 12 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@
</parent>
<artifactId>quarkus-playwright-integration-tests</artifactId>
<name>Quarkus Playwright - Integration Tests</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.web-bundler</groupId>
<artifactId>quarkus-web-bundler</artifactId>
Expand All @@ -32,6 +26,7 @@
<dependency>
<groupId>io.quarkiverse.qute.web</groupId>
<artifactId>quarkus-qute-web</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.mvnpm</groupId>
Expand All @@ -47,7 +42,7 @@
</dependency>
<dependency>
<groupId>io.quarkiverse.playwright</groupId>
<artifactId>quarkus-playwright</artifactId>
<artifactId>quarkus-playwright-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 io.quarkiverse.playwright.it;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

import com.microsoft.playwright.Browser;
import com.microsoft.playwright.BrowserType;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;

@Path("/playwright")
@ApplicationScoped
public class PlaywrightResource {
// add some rest methods here

@GET
public String google() {
String pageTitle = "Hello playwright";
final BrowserType.LaunchOptions launchOptions = new BrowserType.LaunchOptions()
.setHeadless(true)
.setChromiumSandbox(false)
.setChannel("")
.setArgs(List.of("--disable-gpu"));
final Map<String, String> env = new HashMap<>(System.getenv());
try (Playwright playwright = Playwright.create(new Playwright.CreateOptions().setEnv(env))) {
try (Browser browser = playwright.chromium().launch(launchOptions)) {
Page page = browser.newPage();
page.navigate("https://www.google.com/");
pageTitle = page.title();
}
}
return pageTitle;
}
}
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
quarkus.qsp.root-path=/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkiverse.playwright.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;

@QuarkusIntegrationTest
public class PlaywrightResourceIT extends PlaywrightResourceTest {
}
Loading

0 comments on commit 50e39a4

Please sign in to comment.