11import '../../src/types/global.d.ts'
22import { Page , expect , test } from '@playwright/test'
3+ // eslint-disable-next-line no-restricted-imports
4+ import { RuntimeBlockList } from '../../src/oasis-nexus/generated/api'
35
46async function setup ( page : Page , mode : 'allow-matomo-lib' | 'block-matomo-lib' ) {
57 await page . route (
@@ -8,6 +10,25 @@ async function setup(page: Page, mode: 'allow-matomo-lib' | 'block-matomo-lib')
810 // Don't respond
911 } ,
1012 )
13+ await page . route ( 'https://nexus.oasis.io/v1/sapphire/blocks?**' , route => {
14+ route . fulfill ( {
15+ json : {
16+ blocks : [
17+ {
18+ gas_used : 61315 ,
19+ hash : 'b2f888813b26511570c22dbba4c8b9e9546084dd7a576d768d375ab8661b9c27' ,
20+ min_gas_price : '100000000000' ,
21+ num_transactions : 1 ,
22+ round : 11318110 ,
23+ size : 315 ,
24+ timestamp : '2025-11-04T02:30:15Z' ,
25+ } ,
26+ ] ,
27+ is_total_count_clipped : false ,
28+ total_count : 1 ,
29+ } satisfies RuntimeBlockList ,
30+ } )
31+ } )
1132 await page . route ( 'https://matomo.oasis.io/matomo.php?**' , route => {
1233 // Don't send tracked events
1334 } )
@@ -38,7 +59,7 @@ test.describe('analytics', () => {
3859 await expect ( page . getByRole ( 'button' , { name : 'Privacy Settings' } ) ) . toBeVisible ( )
3960 expect ( getMatomoRequests ( ) ) . toHaveLength ( 1 ) // Loaded library
4061
41- await page . getByRole ( 'link' , { name : 'Oasis Explorer Home ' } ) . click ( )
62+ await page . getByRole ( 'link' , { name : '11,318,110 ' } ) . click ( )
4263 await page . getByRole ( 'button' , { name : 'Decline' } ) . click ( )
4364 expect ( getMatomoRequests ( ) ) . toHaveLength ( 1 )
4465
@@ -48,7 +69,7 @@ test.describe('analytics', () => {
4869 expect ( getMatomoRequests ( ) ) . toHaveLength ( 2 ) // Tracked
4970
5071 await Promise . all ( [
51- page . getByRole ( 'link' , { name : 'Blocks ' } ) . first ( ) . click ( ) ,
72+ page . getByRole ( 'link' , { name : 'Go to previous page ' } ) . click ( ) ,
5273 page . waitForRequest ( 'https://matomo.oasis.io/matomo.php?**' ) , // Debounced https://github.com/matomo-org/matomo/blob/f51b30f8/js/piwik.js#L7192-L7201
5374 ] )
5475 await page . waitForTimeout ( 100 )
0 commit comments