quarkiverse / quarkus-playwright

Playwright enables reliable end-to-end testing for modern web apps
https://playwright.dev/
Apache License 2.0
6 stars 2 forks source link

Allow Playwright in Runtime module and GraalVM support #95

Closed melloware closed 4 weeks ago

melloware commented 1 month ago

This will allow using Playwright at Runtime for people who want to screen scrape.

NOTE: this required me to rename the artifactId for playwright to playwright-test which is a breaking change so this should be a 2.0.0 if we go forward.

image

maxandersen commented 4 weeks ago

sounds like good idea to me. whats the migration path? remove -test but keep it in import scope test?

Any reason to not also provide a artifact named -test that just includes the non-test one ?

melloware commented 4 weeks ago

That is a good question. You are saying I could theoretically put all the test stuff in the runtime module and poeple could choose whether or not to mark it <scope>test</scope> or not?

ia3andy commented 4 weeks ago

That is a good question. You are saying I could theoretically put all the test stuff in the runtime module and poeple could choose whether or not to mark it <scope>test</scope> or not?

I also thought about it :) we should try

melloware commented 4 weeks ago

let me try it!

maxandersen commented 4 weeks ago

yes and no - my main question was what the migration path was (if any) and if that was to just remove "-test" then why not just have "-test" include the new runtime one and all is good...

melloware commented 4 weeks ago

Oh sorry the migration path would be if you use this now.

<dependency>
    <groupId>io.quarkiverse.playwright</groupId>
    <artifactId>quarkus-playwright</artifactId>
    <version>${playwright.version}</version>
    <scope>test</scope>
</dependency>

it changes to

<dependency>
    <groupId>io.quarkiverse.playwright</groupId>
    <artifactId>quarkus-playwright-test</artifactId>
    <version>${playwright.version}</version>
    <scope>test</scope>
</dependency>
melloware commented 4 weeks ago

OK it looks like it works! I moved the Test code into the Runtime library and just marked junit5 as an OPTIONAL dependency.

ia3andy commented 4 weeks ago

I think that's ok as the testing part is really small and won't be in the target user app. @aloubyansky any thoughts?

aloubyansky commented 4 weeks ago

You mean the optional dependency on the quarkus-junit5-internal?

ia3andy commented 4 weeks ago

Yes

melloware commented 4 weeks ago

Yep

 <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit5</artifactId>
            <optional>true</optional>
        </dependency>
aloubyansky commented 4 weeks ago

What specifically do you achieve with that?

melloware commented 4 weeks ago

Because we offer Unit testing classes with @WithPlaywright that are QuarkusTest only but also allow PlayWright to be used as a ScreenScraper. So anyone using it as a Test library will do this...

<dependency>
    <groupId>io.quarkiverse.playwright</groupId>
    <artifactId>quarkus-playwright</artifactId>
    <version>${playwright.version}</version>
    <scope>test</scope>
</dependency>
<dependency>
     <groupId>io.quarkus</groupId>
      <artifactId>quarkus-junit5</artifactId>
       <scope>test</scope>
</dependency>

and anyone wanting to use it as a runtime screen scraper can do this....

<dependency>
    <groupId>io.quarkiverse.playwright</groupId>
    <artifactId>quarkus-playwright</artifactId>
    <version>${playwright.version}</version>
</dependency>
aloubyansky commented 4 weeks ago

Ah, not the internal one and the user has to still add the dependency on the quarkus-junit5 - sure, makes sense. Thanks.

melloware commented 4 weeks ago

I was also able to Graal substitute as Playwright uses System.out.println for logging with Jboss logging!