diff --git a/tests/util/basic-checks.js b/tests/util/basic-checks.js index 38b2f0cda..e49c64ff2 100644 --- a/tests/util/basic-checks.js +++ b/tests/util/basic-checks.js @@ -1,5 +1,5 @@ /* eslint-disable */ -import {notFirefox, notIE, notIOS, notSafari, onlyIE} from "../../tools/browser-matcher/common-matchers.mjs"; +import {onlyAndroid, onlyIE, supportsFirstPaint, supportsFirstContentfulPaint} from "../../tools/browser-matcher/common-matchers.mjs"; export const baseQuery = expect.objectContaining({ a: expect.any(String), @@ -286,7 +286,7 @@ export function checkSpa ({ query, body }, { trigger } = {}) { const interaction = body.find(b => b.type === 'interaction') expect(interaction).toBeDefined() - expect(interaction).toMatchObject({ + expect(interaction).toEqual(expect.objectContaining({ type: "interaction", children: expect.any(Array), start: expect.any(Number), @@ -300,8 +300,14 @@ export function checkSpa ({ query, body }, { trigger } = {}) { category: expect.any(String), id: expect.any(String), nodeId: expect.any(String), - firstPaint: browserMatch([notIE, notSafari, notIOS, notFirefox]) && (!trigger || trigger === 'initialPageLoad') ? expect.any(Number) : null, - firstContentfulPaint: browserMatch(notIE) && (!trigger || trigger === 'initialPageLoad') ? expect.any(Number) : null, navTiming: expect.any(Object) - }) + })) + // *cli Jun'24 - LambdaTest's Android Chrome arbitrarily have paint timing in spa tests checking IPL depending on some race condition. + // Sometimes they are present (Number) and sometimes not (null). It's too unreliable for tests so their check is excluded. + if (!browserMatch(onlyAndroid)) { + expect(interaction).toEqual(expect.objectContaining({ + firstPaint: browserMatch(supportsFirstPaint) && (!trigger || trigger === 'initialPageLoad') ? expect.any(Number) : null, + firstContentfulPaint: browserMatch(supportsFirstContentfulPaint) && (!trigger || trigger === 'initialPageLoad') ? expect.any(Number) : null + })) + } } diff --git a/tools/browser-matcher/common-matchers.mjs b/tools/browser-matcher/common-matchers.mjs index a16bcc643..4981d6b0d 100644 --- a/tools/browser-matcher/common-matchers.mjs +++ b/tools/browser-matcher/common-matchers.mjs @@ -86,7 +86,7 @@ export const onlyAndroid = new SpecMatcher() export const onlyChromium = new SpecMatcher() .include('chrome') .include('edge') - .include('android>9.0') + .include('android>=9.0') export const onlyFirefox = new SpecMatcher() .include('firefox') @@ -109,17 +109,17 @@ export const supportsBFCache = new SpecMatcher() // .include('edge>=89') -- not enabled by default still (current v109); user must set flag .include('firefox') .include('ios') - // .include('android>9.0') -- does not work on android 9.0 emulator (v100 Chrome) for unknown precise reason; + .include('android>=9.0') // -- does not work on android 9.0 emulator (v100 Chrome) for unknown precise reason; export const supportsFirstPaint = new SpecMatcher() .include('chrome>=60') .include('edge>=79') - // .include('android>9.0') -- LT simulated chromium android does not appear to support PerformancePaintTiming + // .include('android>=9.0') -- LT simulated chromium android does not appear to support PerformancePaintTiming export const supportsFirstContentfulPaint = new SpecMatcher() .include('chrome>=60') .include('edge>=79') - // .include('android>9.0') -- LT simulated chromium android does not appear to support PerformancePaintTiming + // .include('android>=9.0') -- LT simulated chromium android does not appear to support PerformancePaintTiming .include('firefox>=84') .include('safari>15') // this should be >= 14.1 but safari 15 on Sauce hates FCP, and it destroys the other tests on the same thread too... .include('ios>=14.5') // -- *cli Mar'23 - FYI there's a bug associated with paint observer for version < 16, see ios-version.js @@ -128,17 +128,17 @@ export const supportsFirstInputDelay = new SpecMatcher() .include('chrome>=76') .include('edge>=79') .include('firefox>=89') - .include('android>9.0') + .include('android>=9.0') export const supportsLargestContentfulPaint = new SpecMatcher() .include('chrome>=77') .include('edge>=79') - .include('android>9.0') + .include('android>=9.0') export const supportsInteractionToNextPaint = new SpecMatcher() .include('chrome>=96') .include('edge>=96') - .include('android>9.0') + .include('android>=9.0') export const supportsLongTaskTiming = new SpecMatcher() .include('chrome>=58')