File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { test } from "rollwright" ;
2
+ import { expect } from "@playwright/test" ;
3
+ import alias from "@rollup/plugin-alias" ;
4
+
5
+ test . use ( {
6
+ plugins : [
7
+ alias ( {
8
+ entries : [
9
+ {
10
+ find : / ( r e a c t | r e a c t - d o m ) ( \/ .+ | $ ) / ,
11
+ replacement :
"https://esm.sh/[email protected] $2" ,
12
+ customResolver : ( id ) => ( { id, external : true } ) ,
13
+ } ,
14
+ ] ,
15
+ } ) ,
16
+ ] ,
17
+ } ) ;
18
+
19
+ test ( "external" , async ( { execute, page } ) => {
20
+ let root = await execute ( async ( ) => {
21
+ let { createRoot } = await import ( "react-dom/client" ) ;
22
+ let section = document . createElement ( "section" ) ;
23
+ document . body . append ( section ) ;
24
+ let root = createRoot ( section ) ;
25
+ return root ;
26
+ } ) ;
27
+
28
+ await execute ( async ( root ) => {
29
+ let { jsx } = await import ( "react/jsx-runtime" ) ;
30
+ root . render ( jsx ( "h1" , { children : "Hello" } ) ) ;
31
+ } , root ) ;
32
+
33
+ await expect ( page . locator ( "h1" ) ) . toContainText ( "Hello" ) ;
34
+ } ) ;
You can’t perform that action at this time.
0 commit comments