import { test , expect } from '@playwright/test' ; import { encodeQueryData , createChatThreadAndUsers } from '../common/utils' ; import * as path from 'path' ; import dotenv from 'dotenv' ; dotenv . config ( { path : path . join ( __dirname , '..' , '.env' ) } ) ; const SERVER_URL = 'http://localhost:8080' ; const PARTICIPANTS = [ 'Jack' ] ; test . describe ( 'JS Bundle Test' , ( ) => { test . beforeEach ( async ( { page } ) => { const user = await createChatThreadAndUsers ( PARTICIPANTS ) ; const styleContent = `
    input {
      color: transparent;
      text-shadow: 0 0 0 black;
    } 
    input:focus {
      outline: none;
    }
  ` ; const qs = encodeQueryData ( user [ 0 ] ) ; const url = `${ SERVER_URL }?${ qs }` ; await page . addStyleTag ( { content : styleContent } ) ; await page . goto ( url ) ; } ) ; test ( 'Whether html page is loaded right with 2 composites' , async ( { page } ) => { expect ( await page . waitForSelector ( 'text=Start call' ) ) . toBeTruthy ( ) ; expect ( await page . waitForSelector ( 'text=Hello to you' ) ) . toBeTruthy ( ) ; await page . waitForTimeout ( 1000 ) ; await page . addScriptTag ( { content : `document.querySelector('[data-ui-id=message-timestamp]').innerText='timestamp';` } ) ; expect ( await page . screenshot ( ) ) . toMatchSnapshot ( 'embeddedJsHtml.png' ) ; } ) ; } ) ;