@@ -7,12 +7,13 @@ import {
77 PlaywrightVisualRegressionTracker ,
88 PageTrackOptions ,
99 ElementHandleTrackOptions ,
10- } from "." ;
10+ } from "./index " ;
1111import { mocked } from "ts-jest/utils" ;
1212import { MaybeMocked } from "ts-jest/dist/utils/testing" ;
1313
1414jest . mock ( "@visual-regression-tracker/sdk-js" ) ;
1515
16+ let browserName = chromium . name ( ) ;
1617let browserType = chromium ;
1718let browser : Browser ;
1819let context : BrowserContext ;
@@ -25,6 +26,7 @@ const config: Config = {
2526 project : "Default project" ,
2627 apiKey : "BAZ0EG0PRH4CRQPH19ZKAVADBP9E" ,
2728 enableSoftAssert : false ,
29+ browserName : "chrome" ,
2830} ;
2931
3032beforeAll ( async ( ) => {
@@ -44,11 +46,11 @@ afterAll(async () => {
4446
4547describe ( "playwright" , ( ) => {
4648 beforeEach ( ( ) => {
47- playwrightVrt = new PlaywrightVisualRegressionTracker ( browserType , config ) ;
49+ playwrightVrt = new PlaywrightVisualRegressionTracker ( browserName , config ) ;
4850 } ) ;
4951
5052 it ( "constructor" , async ( ) => {
51- expect ( playwrightVrt [ "browser" ] ) . toBe ( browserType . name ( ) ) ;
53+ expect ( playwrightVrt [ "browser" ] ) . toBe ( browserName ) ;
5254 expect ( VisualRegressionTracker ) . toHaveBeenCalledWith ( config ) ;
5355 } ) ;
5456
@@ -111,7 +113,7 @@ describe("playwright", () => {
111113 expect ( VisualRegressionTracker . prototype . track ) . toHaveBeenCalledWith ( {
112114 name : imageName ,
113115 imageBase64 : screenshot . toString ( "base64" ) ,
114- browser : browserType . name ( ) ,
116+ browser : browserName ,
115117 viewport : `1800x1600` ,
116118 os : trackOptions . agent ?. os ,
117119 device : trackOptions . agent ?. device ,
@@ -130,7 +132,7 @@ describe("playwright", () => {
130132 expect ( VisualRegressionTracker . prototype . track ) . toHaveBeenCalledWith ( {
131133 name : imageName ,
132134 imageBase64 : screenshot . toString ( "base64" ) ,
133- browser : browserType . name ( ) ,
135+ browser : browserName ,
134136 viewport : undefined ,
135137 os : undefined ,
136138 device : undefined ,
@@ -181,7 +183,7 @@ describe("playwright", () => {
181183 expect ( VisualRegressionTracker . prototype . track ) . toHaveBeenCalledWith ( {
182184 name : imageName ,
183185 imageBase64 : screenshot . toString ( "base64" ) ,
184- browser : browserType . name ( ) ,
186+ browser : browserName ,
185187 viewport : trackOptions . agent ?. viewport ,
186188 os : trackOptions . agent ?. os ,
187189 device : trackOptions . agent ?. device ,
@@ -205,7 +207,7 @@ describe("playwright", () => {
205207 expect ( VisualRegressionTracker . prototype . track ) . toHaveBeenCalledWith ( {
206208 name : imageName ,
207209 imageBase64 : screenshot . toString ( "base64" ) ,
208- browser : browserType . name ( ) ,
210+ browser : browserName ,
209211 viewport : undefined ,
210212 os : undefined ,
211213 device : undefined ,
0 commit comments