Pass another painful spec suite: testing-settings

This commit is contained in:
49lf
2024-11-29 17:01:40 -05:00
parent 7a448760e7
commit b9a7ca26d0
3 changed files with 1199 additions and 1297 deletions

View File

@ -30,6 +30,10 @@ import { isErrorWhitelisted } from './lib/console-error-whitelist'
import { isArray } from 'lib/utils'
import { reportRejection } from 'lib/trap'
const toNormalizedCode = (text: string) => {
return text.replace(/\s+/g, '')
}
type TestColor = [number, number, number]
export const TEST_COLORS = {
WHITE: [249, 249, 249] as TestColor,
@ -505,13 +509,16 @@ export async function getUtils(page: Page, test_?: typeof test) {
)
},
toNormalizedCode: (text: string) => {
return text.replace(/\s+/g, '')
toNormalizedCode(text: string) {
return toNormalizedCode(text)
},
editorTextMatches: async (code: string) => {
async editorTextMatches(code: string) {
const editor = page.locator(editorSelector)
return expect.poll(() => editor.textContent()).toContain(code)
return expect.poll(async () => {
const text = await editor.textContent()
return toNormalizedCode(text)
}).toContain(toNormalizedCode(code))
},
pasteCodeInEditor: async (code: string) => {