@@ -35,9 +35,7 @@ test.beforeAll(async ({ browser }) => {
3535} ) ;
3636
3737test ( 'Insights is available' , async ( ) => {
38- const navLink = page . locator ( `nav a:has-text("Adoption Insights")` ) . first ( ) ;
39- await navLink . waitFor ( { state : 'visible' } ) ;
40- await navLink . click ( ) ;
38+ await navigate ( 'Adoption Insights' ) ;
4139
4240 const heading = page . getByRole ( 'heading' , { name : 'Insights' } ) . first ( ) ;
4341
@@ -68,22 +66,44 @@ test('Select date range', async () => {
6866test ( 'Active users panel shows 1 visitor' , async ( ) => {
6967 const panel = page . locator ( '.v5-MuiPaper-root' , { hasText : 'Active users' } ) ;
7068 await expect ( panel . locator ( '.recharts-surface' ) ) . toBeVisible ( ) ;
71- await expect ( panel ) . toContainText ( '1 active users per hour' ) ;
69+ await expect ( panel ) . toMatchAriaSnapshot ( `
70+ - heading "Active users" [level=5]
71+ - button "Export CSV"
72+ - paragraph: 1 active users per hour were conducted during this period.
73+ ` ) ;
7274} ) ;
7375
7476test ( 'Total number of users panel shows 1 visitor of 100' , async ( ) => {
7577 const panel = page . locator ( '.v5-MuiPaper-root' , {
7678 hasText : 'Total number of users' ,
7779 } ) ;
7880 await expect ( panel . locator ( '.recharts-surface' ) ) . toBeVisible ( ) ;
79- await expect ( panel ) . toContainText ( '1of 100' ) ;
80- await expect ( panel ) . toContainText ( '1%have logged in' ) ;
81+ await expect ( panel ) . toMatchAriaSnapshot ( `
82+ - heading "Total number of users" [level=5]
83+ - img:
84+ - text: 1 of 100
85+ - list:
86+ - listitem: Logged-in users
87+ - listitem: Licensed
88+ - heading "1%" [level=1]
89+ - paragraph: have logged in
90+ ` ) ;
8191} ) ;
8292
8393test ( 'Top plugins shows catalog' , async ( ) => {
8494 const panel = page . locator ( '.v5-MuiPaper-root' , { hasText : 'Top 3 plugins' } ) ;
85- const entries = panel . locator ( 'tbody' ) . getByRole ( 'row' ) ;
86- await expect ( entries . getByText ( 'catalog' ) ) . toBeVisible ( ) ;
95+ await expect ( panel ) . toMatchAriaSnapshot ( `
96+ - heading "Top 3 plugins" [level=5]
97+ - table:
98+ - rowgroup:
99+ - row :
100+ - columnheader "Name"
101+ - columnheader "Trend"
102+ - columnheader "Views"
103+ - rowgroup:
104+ - row :
105+ - cell "catalog"
106+ ` ) ;
87107} ) ;
88108
89109test ( 'Rest of the panels have no data' , async ( ) => {
@@ -128,8 +148,12 @@ test.describe(() => {
128148 // do a search
129149 await page . getByRole ( 'button' , { name : 'search' } ) . click ( ) ;
130150 await page . getByRole ( 'textbox' ) . fill ( 'searching for something' ) ;
131- await new Promise ( res => setTimeout ( res , 1000 ) ) ;
132- await page . locator ( `button[aria-label='close']` ) . click ( ) ;
151+
152+ const noSearchResults = page . getByRole ( 'heading' , {
153+ name : 'Sorry, no results were found' ,
154+ } ) ;
155+ await noSearchResults . waitFor ( { state : 'visible' } ) ;
156+ await page . getByRole ( 'button' , { name : 'close' } ) . click ( ) ;
133157
134158 // wait for the flush interval to be sure
135159 await new Promise ( res => setTimeout ( res , 8000 ) ) ;
@@ -158,16 +182,18 @@ test.describe(() => {
158182
159183 test ( 'New data shows in searches' , async ( ) => {
160184 const panel = page . locator ( '.v5-MuiPaper-root' , { hasText : '1 searches' } ) ;
185+ await panel . scrollIntoViewIfNeeded ( ) ;
186+ await expect ( panel . locator ( '.recharts-surface' ) ) . toBeVisible ( ) ;
161187 await expect ( panel ) . toContainText (
162188 'An average of 1 searches per hour were conducted during this period.' ,
163189 ) ;
164- await expect ( panel . locator ( '.recharts-surface' ) ) . toBeVisible ( ) ;
165190 } ) ;
166191
167192 test ( 'New data shows in top templates' , async ( ) => {
168193 const panel = page . locator ( '.v5-MuiPaper-root' , {
169194 hasText : 'Top 3 templates' ,
170195 } ) ;
196+ await panel . scrollIntoViewIfNeeded ( ) ;
171197 const entries = panel . locator ( 'tbody' ) . locator ( 'tr' ) ;
172198 await expect ( entries ) . toHaveCount ( 1 ) ;
173199 await expect ( entries ) . toContainText ( 'example-nodejs-template' ) ;
0 commit comments