@@ -31,53 +31,56 @@ const getBlock = ({ url, openInNew }: { url: string; openInNew?: boolean }): Blo
3131 ] ,
3232} ) ;
3333
34- test . describe ( "react" , ( ) => {
35- test ( " link component navigation" , async ( { page } ) => {
34+ const run = ( packageName : string ) => {
35+ test ( ` ${ packageName } link component navigation` , async ( { page } ) => {
3636 await mockBlocksEndpoint ( page , [ getBlock ( { url : "/another-page" } ) ] ) ;
37- await page . goto ( `/react .html?LinkComponent =true` ) ;
37+ await page . goto ( `/${ packageName } .html?customNavigation =true` ) ;
3838 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
3939 await page . getByText ( "Go to another page" , { exact : true } ) . click ( ) ;
4040 // The example app uses HashRouter
41- await expect ( page ) . toHaveURL ( `/react .html?LinkComponent =true#/another-page` ) ;
41+ await expect ( page ) . toHaveURL ( `/${ packageName } .html?customNavigation =true#/another-page` ) ;
4242 } ) ;
43- test ( " should use link with relative urls" , async ( { page } ) => {
43+ test ( ` ${ packageName } should use link with relative urls` , async ( { page } ) => {
4444 await mockBlocksEndpoint ( page , [ getBlock ( { url : "?search=test" } ) ] ) ;
45- await page . goto ( `/react .html?LinkComponent =true` ) ;
45+ await page . goto ( `/${ packageName } .html?customNavigation =true` ) ;
4646 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
4747 await page . getByText ( "Go to another page" , { exact : true } ) . click ( ) ;
48- await expect ( page ) . toHaveURL ( `/react .html?LinkComponent =true#/?search=test` ) ;
48+ await expect ( page ) . toHaveURL ( `/${ packageName } .html?customNavigation =true#/?search=test` ) ;
4949 } ) ;
50- test ( " should support personalization" , async ( { page } ) => {
50+ test ( ` ${ packageName } should support personalization` , async ( { page } ) => {
5151 await mockBlocksEndpoint ( page , [ getBlock ( { url : "/{{ email }}" } ) ] ) ;
52- await page . goto ( `/react .html?LinkComponent =true` ) ;
52+ await page . goto ( `/${ packageName } .html?customNavigation =true` ) ;
5353 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
5454 await expect ( page . getByRole ( "link" , { name : "Go to another page" } ) ) . toHaveAttribute (
5555 "href" ,
56- "#/ test@flows.sh" ,
56+ / \/ t e s t @ f l o w s \ .s h / ,
5757 ) ;
5858 } ) ;
59- test ( " should fallback to <a> without link component" , async ( { page } ) => {
59+ test ( ` ${ packageName } should fallback to <a> without link component` , async ( { page } ) => {
6060 await mockBlocksEndpoint ( page , [ getBlock ( { url : "/another-page" } ) ] ) ;
61- await page . goto ( `/react .html` ) ;
61+ await page . goto ( `/${ packageName } .html` ) ;
6262 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
6363 await page . getByText ( "Go to another page" , { exact : true } ) . click ( ) ;
6464 await expect ( page ) . toHaveURL ( `/another-page` ) ;
6565 } ) ;
66- test ( " shouldn't use link component with target blank" , async ( { page } ) => {
66+ test ( ` ${ packageName } shouldn't use link component with target blank` , async ( { page } ) => {
6767 await mockBlocksEndpoint ( page , [ getBlock ( { url : "/another-page" , openInNew : true } ) ] ) ;
68- await page . goto ( `/react .html?LinkComponent =true` ) ;
68+ await page . goto ( `/${ packageName } .html?customNavigation =true` ) ;
6969 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
7070 await page . getByText ( "Go to another page" , { exact : true } ) . click ( ) ;
7171 const newTabPromise = page . waitForEvent ( "popup" ) ;
72- await expect ( page ) . toHaveURL ( `/react .html?LinkComponent =true` ) ;
72+ await expect ( page ) . toHaveURL ( `/${ packageName } .html?customNavigation =true` ) ;
7373 const newTab = await newTabPromise ;
7474 await expect ( newTab ) . toHaveURL ( "/another-page" ) ;
7575 } ) ;
76- test ( " shouldn't use link component for external links" , async ( { page } ) => {
76+ test ( ` ${ packageName } shouldn't use link component for external links` , async ( { page } ) => {
7777 await mockBlocksEndpoint ( page , [ getBlock ( { url : "https://example.com" } ) ] ) ;
78- await page . goto ( `/react .html?LinkComponent =true` ) ;
78+ await page . goto ( `/${ packageName } .html?customNavigation =true` ) ;
7979 await expect ( page . getByText ( "My modal" , { exact : true } ) ) . toBeVisible ( ) ;
8080 await page . getByText ( "Go to another page" , { exact : true } ) . click ( ) ;
8181 await expect ( page ) . toHaveURL ( `https://example.com` ) ;
8282 } ) ;
83- } ) ;
83+ } ;
84+
85+ run ( "js" ) ;
86+ run ( "react" ) ;
0 commit comments