11import { expect , test } from '@playwright/test' ;
22
3- import { gotoExplore } from './utils/navigation' ;
3+ import { gotoExplore , gotoStats } from './utils/navigation' ;
44
55test . describe ( 'Stats page' , ( ) => {
66 test ( 'navigates to stats view from the header' , async ( { page } ) => {
@@ -22,4 +22,32 @@ test.describe('Stats page', () => {
2222 await expect ( page . getByText ( 'Funding rounds' , { exact : true } ) ) . toBeVisible ( ) ;
2323 await expect ( page . getByText ( 'Acquisitions' , { exact : true } ) ) . toBeVisible ( ) ;
2424 } ) ;
25+
26+ test ( 'toggles category distribution rows' , async ( { page } ) => {
27+ await gotoStats ( page ) ;
28+
29+ const categoryTable = page . getByRole ( 'treegrid' ) ;
30+ const categoryOneRow = categoryTable . locator ( 'tbody tr' ) . filter ( { hasText : 'Category 1' } ) . first ( ) ;
31+ const categoryTwoRow = categoryTable . locator ( 'tbody tr' ) . filter ( { hasText : 'Category 2' } ) . first ( ) ;
32+
33+ await expect ( categoryTable . getByText ( 'Subcategory 1-1' ) ) . toBeVisible ( ) ;
34+ await expect ( categoryTable . getByText ( 'Subcategory 2-1' ) ) . not . toBeVisible ( ) ;
35+
36+ // Collapse and expand category rows
37+ await categoryOneRow . click ( ) ;
38+ await expect ( categoryTable . getByText ( 'Subcategory 1-1' ) ) . not . toBeVisible ( ) ;
39+ await categoryTwoRow . click ( ) ;
40+ await expect ( categoryTable . getByText ( 'Subcategory 2-1' ) ) . toBeVisible ( ) ;
41+ } ) ;
42+
43+ test ( 'lists repository licenses with counts and percentages' , async ( { page } ) => {
44+ await gotoStats ( page ) ;
45+
46+ // Verify licenses table and details visibility
47+ const licensesTable = page . locator ( 'table' ) . filter ( { hasText : 'License' } ) . first ( ) ;
48+ const apacheRow = licensesTable . getByRole ( 'row' , { name : / A p a c h e - 2 \. 0 / } ) ;
49+
50+ await expect ( apacheRow ) . toContainText ( '4' ) ;
51+ await expect ( apacheRow ) . toContainText ( '100.00%' ) ;
52+ } ) ;
2553} ) ;
0 commit comments