@@ -22,7 +22,7 @@ import {
2222// Step 1: detectCftPlatform()
2323unitTest ( "detectCftPlatform - returns valid CftPlatform for current system" , async ( ) => {
2424 const result = detectCftPlatform ( ) ;
25- const validPlatforms = [ "linux64" , "mac-arm64" , "mac-x64" , "win32" , "win64" ] ;
25+ const validPlatforms = [ "linux64" , "linux-arm64" , " mac-arm64", "mac-x64" , "win32" , "win64" ] ;
2626 assert (
2727 validPlatforms . includes ( result . platform ) ,
2828 `Expected one of ${ validPlatforms . join ( ", " ) } , got: ${ result . platform } ` ,
@@ -172,3 +172,67 @@ unitTest(
172172 ignore : runningInCI ( ) ,
173173 } ,
174174) ;
175+
176+ // -- Playwright CDN tests (arm64 Linux support) --
177+
178+ import {
179+ isPlaywrightCdnPlatform ,
180+ playwrightCdnDownloadUrl ,
181+ fetchPlaywrightBrowsersJson ,
182+ } from "../../../src/tools/impl/chrome-for-testing.ts" ;
183+
184+ // isPlaywrightCdnPlatform — pure logic, runs everywhere
185+ unitTest ( "isPlaywrightCdnPlatform - returns false on non-arm64 platform" , async ( ) => {
186+ if ( os === "linux" && arch === "aarch64" ) return ; // Skip on actual arm64
187+ const result = isPlaywrightCdnPlatform ( ) ;
188+ assertEquals ( result , false ) ;
189+ } ) ;
190+
191+ // playwrightCdnDownloadUrl — pure function, no HTTP
192+ unitTest ( "playwrightCdnDownloadUrl - constructs correct arm64 URL" , async ( ) => {
193+ const url = playwrightCdnDownloadUrl ( "1219" ) ;
194+ assert (
195+ url . startsWith ( "https://cdn.playwright.dev/" ) ,
196+ `URL should start with cdn.playwright.dev, got: ${ url } ` ,
197+ ) ;
198+ assert (
199+ url . includes ( "/builds/chromium/1219/" ) ,
200+ `URL should contain revision path, got: ${ url } ` ,
201+ ) ;
202+ assert (
203+ url . endsWith ( "chromium-headless-shell-linux-arm64.zip" ) ,
204+ `URL should end with arm64 zip name, got: ${ url } ` ,
205+ ) ;
206+ } ) ;
207+
208+ // fetchPlaywrightBrowsersJson — external HTTP, skip on CI
209+ unitTest ( "fetchPlaywrightBrowsersJson - returns chromium-headless-shell entry" , async ( ) => {
210+ const entry = await fetchPlaywrightBrowsersJson ( ) ;
211+ assert ( entry . revision , "revision should be non-empty" ) ;
212+ assert (
213+ / ^ \d + $ / . test ( entry . revision ) ,
214+ `revision should be numeric, got: ${ entry . revision } ` ,
215+ ) ;
216+ assert ( entry . browserVersion , "browserVersion should be non-empty" ) ;
217+ assert (
218+ / ^ \d + \. \d + \. \d + \. \d + $ / . test ( entry . browserVersion ) ,
219+ `browserVersion format wrong: ${ entry . browserVersion } ` ,
220+ ) ;
221+ } , { ignore : runningInCI ( ) } ) ;
222+
223+ // findCftExecutable with Playwright arm64 layout (chrome-linux/headless_shell)
224+ unitTest ( "findCftExecutable - finds binary in Playwright arm64 layout" , async ( ) => {
225+ if ( isWindows ) return ; // arm64 layout is Linux-only, no .exe
226+ const tempDir = Deno . makeTempDirSync ( ) ;
227+ try {
228+ const subdir = join ( tempDir , "chrome-linux" ) ;
229+ Deno . mkdirSync ( subdir ) ;
230+ Deno . writeTextFileSync ( join ( subdir , "headless_shell" ) , "fake binary" ) ;
231+
232+ const found = findCftExecutable ( tempDir , "headless_shell" ) ;
233+ assert ( found !== undefined , "should find headless_shell in chrome-linux/" ) ;
234+ assert ( found ! . endsWith ( "headless_shell" ) , `should end with headless_shell, got: ${ found } ` ) ;
235+ } finally {
236+ safeRemoveSync ( tempDir , { recursive : true } ) ;
237+ }
238+ } ) ;
0 commit comments