-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(nextjs): Migrate
app
directory tests to Playwright. (#6896)
- Loading branch information
1 parent
1855705
commit 3696504
Showing
4 changed files
with
54 additions
and
46 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
packages/nextjs/test/integration/test/client/appDirTracingPageloadClientcomponent.js
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
packages/nextjs/test/integration/test/client/appDirTracingPageloadClientcomponent.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getMultipleSentryEnvelopeRequests, countEnvelopes } from './utils/helpers'; | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('should create a pageload transaction when the `app` directory is used with a client component.', async ({ | ||
page, | ||
}) => { | ||
if (Number(process.env.NEXTJS_VERSION) < 13 || Number(process.env.NODE_MAJOR) < 16) { | ||
// Next.js versions < 13 don't support the app directory and the app dir requires Node v16.8.0 or later. | ||
return; | ||
} | ||
|
||
const [transaction] = await getMultipleSentryEnvelopeRequests(page, 1, { | ||
url: '/clientcomponent', | ||
envelopeType: 'transaction', | ||
}); | ||
|
||
expect(transaction).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'pageload', | ||
}, | ||
}, | ||
transaction: '/clientcomponent', | ||
}); | ||
|
||
expect(await countEnvelopes(page, { url: '/clientcomponent', envelopeType: 'transaction', timeout: 2000 })).toBe(1); | ||
}); |
23 changes: 0 additions & 23 deletions
23
packages/nextjs/test/integration/test/client/appDirTracingPageloadServercomponent.js
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
packages/nextjs/test/integration/test/client/appDirTracingPageloadServercomponent.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getMultipleSentryEnvelopeRequests, countEnvelopes } from './utils/helpers'; | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('should create a pageload transaction when the `app` directory is used with a server component.', async ({ | ||
page, | ||
}) => { | ||
if (Number(process.env.NEXTJS_VERSION) < 13 || Number(process.env.NODE_MAJOR) < 16) { | ||
// Next.js versions < 13 don't support the app directory and the app dir requires Node v16.8.0 or later. | ||
return; | ||
} | ||
|
||
const [transaction] = await getMultipleSentryEnvelopeRequests(page, 1, { | ||
url: '/servercomponent', | ||
envelopeType: 'transaction', | ||
}); | ||
|
||
expect(transaction).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
op: 'pageload', | ||
}, | ||
}, | ||
transaction: '/servercomponent', | ||
}); | ||
|
||
expect(await countEnvelopes(page, { url: '/servercomponent', envelopeType: 'transaction', timeout: 2000 })).toBe(1); | ||
}); |