Skip to content

♻️ improve browser extension e2e tests#3823

Merged
thomas-lebeau merged 12 commits into
mainfrom
thomas.lebeau/refactor-browser-extention-e2e-tests
Sep 15, 2025
Merged

♻️ improve browser extension e2e tests#3823
thomas-lebeau merged 12 commits into
mainfrom
thomas.lebeau/refactor-browser-extention-e2e-tests

Conversation

@thomas-lebeau

@thomas-lebeau thomas-lebeau commented Sep 5, 2025

Copy link
Copy Markdown
Collaborator

Motivation

Testing browser extensions in e2e was not working the same way as other tests, this PR refactor this to simplify and harmonize
It also fixes the e2e test for the browser extension that were not working properly

Changes

  • Remove unused popup and background-script from the test browser extension as we don't do any test on them
  • withExtension() will now get an Extension object that can contain a separate rum configuration
  • Add createExtension(path) to use with withExtension(). It's rum configuration is configured separately from the base page rum config, allowing to test our different use-cases.
    createTest()
      .withRum()
      .withExtension(createExtension().withRum({ allowTrackingOrigin: ['example.com'] }))
      .run()
    
  • The extension follows the same DEFAULT_RUM_CONFIGURATION as other tests, including the intake proxy config so we can now do assertion on the request send to the intake and the data will be send to datadog with the proper context and api keys
  • Exposes withSetup() in order to run some test with a unique setup.
  • Simplify the browser extension tests to test what actually matter
  • Add a test (failing from now) for the false positive we encountered

Test instructions

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Sep 5, 2025

Copy link
Copy Markdown

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 92.61% (+0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0395dae | Docs | Was this helpful? Give us feedback!

@thomas-lebeau
thomas-lebeau force-pushed the thomas.lebeau/refactor-browser-extention-e2e-tests branch from ffb354b to 6812024 Compare September 5, 2025 11:54
@cit-pr-commenter

cit-pr-commenter Bot commented Sep 5, 2025

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 156.51 KiB 156.51 KiB 0 B 0.00%
Rum Recorder 19.53 KiB 19.53 KiB 0 B 0.00%
Rum Profiler 5.18 KiB 5.18 KiB 0 B 0.00%
Logs 55.12 KiB 55.12 KiB 0 B 0.00%
Flagging N/A 931 B 931 B N/A%
Rum Slim 114.29 KiB 114.29 KiB 0 B 0.00%
Worker 23.60 KiB 23.60 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.007 0.006 -0.002
addaction 0.022 0.019 -0.003
addtiming 0.005 0.004 -0.001
adderror 0.017 0.018 0.001
startstopsessionreplayrecording 0.001 0.001 -0.000
startview 0.006 0.005 -0.002
logmessage 0.020 0.028 0.008
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 26.14 KiB 25.89 KiB -250 B
addaction 46.20 KiB 45.00 KiB -1227 B
addtiming 24.28 KiB 24.69 KiB 418 B
adderror 50.81 KiB 50.62 KiB -195 B
startstopsessionreplayrecording 24.29 KiB 24.03 KiB -268 B
startview 424.64 KiB 428.78 KiB 4.15 KiB
logmessage 42.74 KiB 43.25 KiB 531 B

🔗 RealWorld

Comment thread test/apps/base-extension/src/cdnContentScript.ts Outdated
Comment thread test/apps/base-extension/src/cdnContentScript.ts Outdated
Comment thread test/e2e/scenario/browser-extensions/browserExtensions.scenario.ts Outdated
Comment thread test/e2e/scenario/browser-extensions/browserExtensions.scenario.ts Outdated
@thomas-lebeau thomas-lebeau changed the title ♻️ simplify browser extension e2e tests ♻️ improve browser extension e2e tests Sep 10, 2025
`
})
.run(async ({ withBrowserLogs, flushEvents, intakeRegistry }) => {
test.fail() // TODO: remove this once the issue is fixed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensure the test is failing but mark the test as passed. When we fix the implementation of allowTrackingOrigin we will be able to remove this.

@thomas-lebeau
thomas-lebeau marked this pull request as ready for review September 10, 2025 10:00
@thomas-lebeau
thomas-lebeau requested a review from a team as a code owner September 10, 2025 10:00
@thomas-lebeau
thomas-lebeau merged commit 184c1c3 into main Sep 15, 2025
20 checks passed
@thomas-lebeau
thomas-lebeau deleted the thomas.lebeau/refactor-browser-extention-e2e-tests branch September 15, 2025 06:44
rgaignault pushed a commit that referenced this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants