Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Joozty committed Nov 8, 2024
1 parent 26be13a commit a407866
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 deletions.
52 changes: 26 additions & 26 deletions packages/integration-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,34 @@ export default defineConfig({
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
use: { ...devices['Desktop Chrome'], headless: false },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

{
name: 'edge',
use: {
...devices['Desktop Edge'],
channel: 'msedge',
},
},

{
name: 'chrome',
use: {
...devices['Desktop Chrome'],
channel: 'chrome',
},
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
//
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
//
// {
// name: 'edge',
// use: {
// ...devices['Desktop Edge'],
// channel: 'msedge',
// },
// },
//
// {
// name: 'chrome',
// use: {
// ...devices['Desktop Chrome'],
// channel: 'chrome',
// },
// },
],

/* Run your local dev server before starting the tests */
Expand Down
4 changes: 4 additions & 0 deletions packages/integration-tests/src/pages/record-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class RecordPage {
return this.page.goto(absoluteUrl)
}

get locator() {
return this.page.locator.bind(this.page)
}

async mockNetwork() {
await this.page.route('*/**/api/v2/spans', async (route, request) => {
const spans = JSON.parse(request.postData())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
* limitations under the License.
*
*/
import { test } from '../../utils/test'
import { expect } from '@playwright/test'

module.exports = {
'redacting attributes with custom exporter': async function (browser) {
const url = browser.globals.getUrl('/redacting-attributes/index.ejs')
await browser.url(url)
test.describe('redacting-attributes', () => {
test('with custom exporter', async ({ recordPage }) => {
await recordPage.goTo('/redacting-attributes/index.ejs')

await browser.click('#btnClick')
await recordPage.locator('#btnClick').click()

const clickSpan = await browser.globals.findSpan((span) => span.name === 'click')
await browser.assert.ok(clickSpan)
await browser.assert.strictEqual(clickSpan.tags['http.url'], '[redacted]')
},
}
await recordPage.waitForSpans((spans) => spans.some((s) => s.name === 'click'))
const receivedSpans = recordPage.receivedSpans
const clickSpans = receivedSpans.filter((span) => span.name === 'click')

expect(clickSpans.every((s) => s.tags['http.url'] === '[redacted]'))
})
})

0 comments on commit a407866

Please sign in to comment.