11import { expect , test } from "@playwright/test" ;
22import { startRepoServer } from "../../helpers/playwrightRepoServer.mjs" ;
3+ import { createMessagesPostgresClientStub } from "../../helpers/messagesPostgresClientStub.mjs" ;
34import { workspaceV2CoverageReporter } from "../../helpers/workspaceV2CoverageReporter.mjs" ;
45import { SEED_DB_KEYS } from "../../../src/dev-runtime/seed/seed-db-keys.mjs" ;
56
7+ test . use ( { trace : "off" } ) ;
8+
69test . afterAll ( async ( ) => {
710 await workspaceV2CoverageReporter . writeReport ( ) ;
811} ) ;
@@ -34,7 +37,7 @@ async function createPreviewTtsProfile(server, { name = "Creature Profile" } = {
3437 pitch : 1 ,
3538 providerKey : "browser-speech" ,
3639 rate : 1 ,
37- voiceName : "narrator-voice-uri " ,
40+ voiceName : "Narrator Voice " ,
3841 volume : 1 ,
3942 } ) ,
4043 method : "POST" ,
@@ -44,11 +47,20 @@ async function createPreviewTtsProfile(server, { name = "Creature Profile" } = {
4447 return result . payload . data . ttsProfile ;
4548}
4649
50+ function recordRequestFailure ( failures , request ) {
51+ if ( request . failure ( ) ?. errorText === "net::ERR_ABORTED" ) {
52+ return ;
53+ }
54+ failures . failedRequests . push ( `FAILED ${ request . url ( ) } ` ) ;
55+ }
56+
4757async function openTextToSpeechPage ( page , { authenticated = true , speechAvailable = true } = { } ) {
48- const server = await startRepoServer ( ) ;
58+ const messagesPostgresClient = createMessagesPostgresClientStub ( ) ;
59+ const server = await startRepoServer ( { messagesPostgresClient } ) ;
4960 const failures = {
5061 consoleErrors : [ ] ,
5162 failedRequests : [ ] ,
63+ messagesPostgresClient,
5264 pageErrors : [ ] ,
5365 server,
5466 } ;
@@ -60,7 +72,7 @@ async function openTextToSpeechPage(page, { authenticated = true, speechAvailabl
6072 page . on ( "response" , ( response ) => {
6173 if ( response . status ( ) >= 400 ) failures . failedRequests . push ( `${ response . status ( ) } ${ response . url ( ) } ` ) ;
6274 } ) ;
63- page . on ( "requestfailed" , ( request ) => failures . failedRequests . push ( `FAILED ${ request . url ( ) } ` ) ) ;
75+ page . on ( "requestfailed" , ( request ) => recordRequestFailure ( failures , request ) ) ;
6476
6577 if ( authenticated ) {
6678 const session = await jsonRequest ( `${ server . baseUrl } /api/session/user` , {
@@ -230,7 +242,7 @@ test("Text To Speech page loads and speaks through browser speech synthesis", as
230242 "Actions" ,
231243 ] ) ;
232244 await page . locator ( "[data-tts-profile-row]" ) . filter ( { hasText : "Creature Profile" } ) . getByRole ( "button" , { name : "Edit Profile" } ) . click ( ) ;
233- await expect ( page . locator ( "[data-tts-profile-editor] [data-tts-profile-voice]" ) ) . toHaveValue ( "narrator-voice-uri " ) ;
245+ await expect ( page . locator ( "[data-tts-profile-editor] [data-tts-profile-voice]" ) ) . toHaveValue ( "Narrator Voice " ) ;
234246 await page . locator ( "[data-tts-profile-editor] [data-tts-profile-name]" ) . fill ( "Creature Profile Updated" ) ;
235247 await page . locator ( "[data-tts-profile-editor] [data-tts-commit-profile]" ) . click ( ) ;
236248 await expect ( page . locator ( "[data-tts-status]" ) ) . toHaveText ( "Saved TTS profile: Creature Profile Updated." ) ;
@@ -345,6 +357,7 @@ test("Text To Speech guest profile save redirects to sign in", async ({ page })
345357 await page . locator ( "[data-tts-profile-editor='__new__'] [data-tts-profile-name]" ) . fill ( "Guest Save Profile" ) ;
346358 await page . locator ( "[data-tts-commit-profile='__new__']" ) . click ( ) ;
347359 await page . waitForURL ( / \/ a c c o u n t \/ s i g n - i n \. h t m l $ / ) ;
360+ await page . waitForLoadState ( "networkidle" ) ;
348361
349362 expect ( failures . failedRequests ) . toEqual ( [ ] ) ;
350363 expect ( failures . pageErrors ) . toEqual ( [ ] ) ;
@@ -370,7 +383,7 @@ test("Text To Speech is registered on the toolbox index with the active toolbox
370383 page . on ( "response" , ( response ) => {
371384 if ( response . status ( ) >= 400 ) failures . failedRequests . push ( `${ response . status ( ) } ${ response . url ( ) } ` ) ;
372385 } ) ;
373- page . on ( "requestfailed" , ( request ) => failures . failedRequests . push ( `FAILED ${ request . url ( ) } ` ) ) ;
386+ page . on ( "requestfailed" , ( request ) => recordRequestFailure ( failures , request ) ) ;
374387
375388 await page . addInitScript ( ( { apiUrl, siteUrl } ) => {
376389 window . GameFoundryPublicConfig = {
0 commit comments