Skip to content

Commit

Permalink
firefox fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 28, 2024
1 parent 64f51c9 commit 2423334
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test.beforeEach(async ({ context }) => {
})
})
;['fetch', 'xhr'].forEach((networkType) => {
test('it captures ' + networkType, async ({ page }) => {
test('it captures ' + networkType, async ({ page, browserName }) => {
const exampleComResponse = page.waitForResponse('https://example.com/')
const sessionRecordingDataSent = page.waitForResponse('**/ses/*')
await page.click(`[data-cy-${networkType}-call-button]`)
Expand All @@ -120,7 +120,8 @@ test.beforeEach(async ({ context }) => {

const expectedInitiatorType = networkType === 'fetch' ? 'fetch' : 'xmlhttprequest'
const expectedCaptureds: [RegExp, string][] = [
[/file:\/\/.*\/playground\/cypress\//, 'navigation'],
// firefox doesn't expose the file path presumably for security reasons
[browserName === 'firefox' ? /^document$/ : /file:\/\/.*\/playground\/cypress\//, 'navigation'],
[/https:\/\/localhost:\d+\/static\/array.js/, 'script'],
[/https:\/\/localhost:\d+\/array\/test%20token\/config.js/, 'script'],
[
Expand All @@ -134,6 +135,7 @@ test.beforeEach(async ({ context }) => {

// yay, includes expected network data
expect(capturedRequests.length).toEqual(expectedCaptureds.length)
console.log('cr', capturedRequests)
expectedCaptureds.forEach(([url, initiatorType], index) => {
expect(capturedRequests[index].name).toMatch(url)
expect(capturedRequests[index].initiatorType).toEqual(initiatorType)
Expand Down

0 comments on commit 2423334

Please sign in to comment.