@@ -53,6 +53,12 @@ test.describe('ui', () => {
5353 await testFilter ( page , { mode : 'ui' } )
5454 } )
5555
56+ test ( 'filter reveals initially invisible explorer item' , async ( { page } ) => {
57+ await page . setViewportSize ( { width : 1000 , height : 500 } )
58+ await page . goto ( pageUrl )
59+ await testFilterInitiallyInvisibleItem ( page )
60+ } )
61+
5662 test ( 'tags filter' , async ( { page } ) => {
5763 await page . goto ( pageUrl )
5864 await testTagsFilter ( page )
@@ -87,6 +93,11 @@ test.describe('ui', () => {
8793 await page . goto ( pageUrl )
8894 await testExecute ( page , { mode : 'ui' } )
8995 } )
96+
97+ test ( 'module graph' , async ( { page } ) => {
98+ await page . goto ( pageUrl )
99+ await testModuleGraph ( page )
100+ } )
90101} )
91102
92103test . describe ( 'html report' , ( ) => {
@@ -175,16 +186,29 @@ test.describe('html report', () => {
175186 await page . goto ( pageUrl )
176187 await testExecute ( page , { mode : 'static' } )
177188 } )
189+
190+ test ( 'module graph' , async ( { page } ) => {
191+ await page . goto ( pageUrl )
192+ await testModuleGraph ( page )
193+ } )
178194} )
179195
196+ const TEST_COUNTS = {
197+ pass : 18 ,
198+ fail : 3 ,
199+ files : {
200+ pass : 7 ,
201+ } ,
202+ }
203+
180204async function testBasic ( page : Page , pageUrl : string ) {
181205 const pageErrors : unknown [ ] = [ ]
182206 page . on ( 'pageerror' , error => pageErrors . push ( error ) )
183207
184208 await page . goto ( pageUrl )
185209
186210 // dashboard
187- await assertTestCounts ( page , { pass : 17 , fail : 3 } )
211+ await assertTestCounts ( page , { pass : TEST_COUNTS . pass , fail : TEST_COUNTS . fail } )
188212
189213 // unhandled errors
190214 await expect ( page . getByTestId ( 'unhandled-errors' ) ) . toContainText (
@@ -210,6 +234,18 @@ async function testBasic(page: Page, pageUrl: string) {
210234 expect ( pageErrors ) . toEqual ( [ ] )
211235}
212236
237+ async function testModuleGraph ( page : Page ) {
238+ await openExplorerFileItem ( page , 'sample.test.ts' )
239+ await page . getByTestId ( 'btn-graph' ) . click ( )
240+ await expect ( page . locator ( '[data-testid=graph] text' ) ) . toBeVisible ( )
241+ await expect ( page . locator ( '[data-testid=graph] text' ) ) . toHaveText ( 'sample.test.ts' )
242+
243+ await openExplorerFileItem ( page , 'sample-browser.test.ts' )
244+ await page . getByTestId ( 'btn-graph' ) . click ( )
245+ await expect ( page . locator ( '[data-testid=graph] text' ) ) . toBeVisible ( )
246+ await expect ( page . locator ( '[data-testid=graph] text' ) ) . toHaveText ( 'sample-browser.test.ts' )
247+ }
248+
213249async function testCoverage ( page : Page ) {
214250 await page . getByLabel ( 'Show coverage' ) . click ( )
215251 await page . frameLocator ( '#vitest-ui-coverage' ) . getByRole ( 'heading' , { name : 'All files' } ) . click ( )
@@ -414,7 +450,7 @@ async function testDashboardFilter(page: Page) {
414450async function testFilter ( page : Page , options : { mode : 'ui' | 'static' } ) {
415451 // match all files when no filter
416452 await page . getByPlaceholder ( 'Search...' ) . fill ( '' )
417- await page . getByText ( ' PASS (6)' ) . click ( )
453+ await page . getByText ( ` PASS (${ TEST_COUNTS . files . pass } )` ) . click ( )
418454 await expect ( page . getByTestId ( 'results-panel' ) . getByText ( 'sample.test.ts' , { exact : true } ) ) . toBeVisible ( )
419455
420456 // match nothing
@@ -466,6 +502,12 @@ async function testFilter(page: Page, options: { mode: 'ui' | 'static' }) {
466502 }
467503}
468504
505+ async function testFilterInitiallyInvisibleItem ( page : Page ) {
506+ await expect ( getExplorerItem ( page , 'sample.test.ts' ) ) . not . toBeVisible ( )
507+ await page . getByPlaceholder ( 'Search...' ) . fill ( 'sample.test.ts' )
508+ await expect ( getExplorerItem ( page , 'sample.test.ts' ) ) . toBeVisible ( )
509+ }
510+
469511async function testCrossOriginAccess ( page : Page , pageUrl : string ) {
470512 await page . route ( 'https://example.com/**' , ( route ) => {
471513 return route . fulfill ( {
@@ -527,7 +569,6 @@ async function testExecute(page: Page, options: { mode: 'ui' | 'ui-disallow' | '
527569 await item . hover ( )
528570 await expect ( item . getByTestId ( 'btn-run-test' ) ) . toBeEnabled ( )
529571
530- await page . getByPlaceholder ( 'Search...' ) . fill ( 'snapshot' )
531572 const snapshotItem = getExplorerItem ( page , 'snapshot.test.ts' )
532573 await snapshotItem . hover ( )
533574 await expect ( snapshotItem . getByTestId ( 'btn-fix-snapshot' ) ) . toBeVisible ( )
@@ -539,7 +580,6 @@ async function testExecute(page: Page, options: { mode: 'ui' | 'ui-disallow' | '
539580 await item . hover ( )
540581 await expect ( item . getByTestId ( 'btn-run-test' ) ) . toBeDisabled ( )
541582
542- await page . getByPlaceholder ( 'Search...' ) . fill ( 'snapshot' )
543583 const snapshotItem = getExplorerItem ( page , 'snapshot.test.ts' )
544584 await snapshotItem . hover ( )
545585 await expect ( snapshotItem . getByTestId ( 'btn-fix-snapshot' ) ) . not . toBeVisible ( )
@@ -551,7 +591,6 @@ async function testExecute(page: Page, options: { mode: 'ui' | 'ui-disallow' | '
551591 await item . hover ( )
552592 await expect ( item . getByTestId ( 'btn-run-test' ) ) . not . toBeVisible ( )
553593
554- await page . getByPlaceholder ( 'Search...' ) . fill ( 'snapshot' )
555594 const snapshotItem = getExplorerItem ( page , 'snapshot.test.ts' )
556595 await snapshotItem . hover ( )
557596 await expect ( snapshotItem . getByTestId ( 'btn-fix-snapshot' ) ) . not . toBeVisible ( )
0 commit comments