newrelic / newrelic-browser-agent

New Relic Browser Agent
Apache License 2.0
77 stars 40 forks source link

chore: redesign network expects #1096

Closed patrickhousley closed 3 months ago

patrickhousley commented 3 months ago

Please add a one-paragraph summary here, suitable for a release notes description. This will help with documentation.

Overview

Redesigned the network expects in our integration tests. Tests can now setup network captures before executing any browser commands. The network capture instances will capture all network traffic for the specific test allowing us to verify how many times a BAM api is called, check for calls to BAM apis happened, and wait for BAM api calls to happen. This resolves the race condition we were seeing with the existing network expects logic and ensures the capture is setup prior to loading the test page.

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-283311

Testing

Two spec files have been updated in this PR to use the new network capture feature in place of the old network expect. You can run those on LT to verify it is working.

Local test results:

> npm run wdio -- tests/specs/api.e2e.js --no-retry --concurrent 30 -b 'safar@*,chrome@*,firefox@*,edge@*'
Spec Files:      6 passed, 6 total (100% completed) in 00:02:31

> npm run wdio -- tests/specs/api.e2e.js --no-retry --concurrent 30 -b 'ios@*'
Spec Files:      2 passed, 2 total (100% completed) in 00:04:19

> npm run wdio -- tests/specs/api.e2e.js --no-retry --concurrent 30 -b 'android@*'
Spec Files:      2 passed, 2 total (100% completed) in 00:03:06

> npm run wdio -- --webview --no-retry --concurrent 30 -b 'android@latest'
Spec Files:      1 passed, 1 skipped, 2 total (100% completed) in 00:01:12

> npm run wdio -- --webview --no-retry --concurrent 30 -b 'ios@latest'
Spec Files:      1 passed, 1 skipped, 2 total (100% completed) in 00:01:14
github-actions[bot] commented 3 months ago

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 34.71 kB / 12.1 kB (gzip) 34.71 kB / 12.1 kB (gzip) 0% / 0% (gzip)
lite async-chunk 50.09 kB / 16.18 kB (gzip) 50.09 kB / 16.18 kB (gzip) 0% / 0% (gzip)
pro loader 55.24 kB / 18.69 kB (gzip) 55.24 kB / 18.69 kB (gzip) 0% / 0% (gzip)
pro async-chunk 96.12 kB / 28.85 kB (gzip) 96.12 kB / 28.85 kB (gzip) 0% / 0% (gzip)
spa loader 63.18 kB / 21.12 kB (gzip) 63.18 kB / 21.12 kB (gzip) 0% / 0% (gzip)
spa async-chunk 111.23 kB / 33.23 kB (gzip) 111.23 kB / 33.23 kB (gzip) 0% / 0% (gzip)
lite-polyfills loader 128.38 kB / 41.43 kB (gzip) 128.38 kB / 41.43 kB (gzip) 0% / 0% (gzip)
lite-polyfills async-chunk 63.99 kB / 18.45 kB (gzip) 63.99 kB / 18.45 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 150.57 kB / 47.66 kB (gzip) 150.57 kB / 47.66 kB (gzip) 0% / 0% (gzip)
pro-polyfills async-chunk 116.19 kB / 31.08 kB (gzip) 116.19 kB / 31.08 kB (gzip) 0% / 0% (gzip)
spa-polyfills loader 158.77 kB / 49.82 kB (gzip) 158.77 kB / 49.82 kB (gzip) 0% / 0% (gzip)
spa-polyfills async-chunk 133.16 kB / 35.78 kB (gzip) 133.16 kB / 35.78 kB (gzip) 0% / 0% (gzip)
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.62%. Comparing base (03efcf3) to head (217cc7b). Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1096 +/- ## ======================================= Coverage 87.62% 87.62% ======================================= Files 162 162 Lines 7249 7251 +2 Branches 1421 1423 +2 ======================================= + Hits 6352 6354 +2 Misses 781 781 Partials 116 116 ``` | [Flag](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1096/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | Coverage Δ | | |---|---|---| | [integration-tests](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1096/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `91.49% <ø> (ø)` | | | [unit-tests](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1096/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `76.43% <ø> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 3 months ago

Static Badge

Last ran on July 01, 2024 10:26:30 CDT Checking merge of (217cc7b1d420f68af8aef0009a95d695b9114dbf) into main (e2beeedc460a1c2acb33bebec352ea72c6c0c1b7)