Skip to content

Migrate consent integration tests to playwright from webdriver.io - LIBRARIES-2546 #1279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

neelkanth-kaushik
Copy link

@neelkanth-kaushik neelkanth-kaushik commented Apr 21, 2025

Work In Progress : One Trust Test Case pending

  1. JIRA - https://segment.atlassian.net/browse/LIBRARIES-2546?linkSource=email
  2. Replaced One Test Case from WebDriver.IO to Playwright.
  3. Test Cases Replaced: consent-tools-vanilla-opt-in.test.ts and consent-tools-vanilla-opt-out.test.ts
  4. Test Case Pending: One Trust
  5. Removed all old WebDriver.IO Test Case files under the directory: packages/consent/consent-tools-integration-tests/src/tests

To execute the tests, run either of the following commands from the root directory of monorepo

Headless: analytics-next % yarn workspace @internal/consent-tools-integration-tests test:int
Headfull: analytics-next % yarn workspace @internal/consent-tools-integration-tests test:int-debug

Copy link

changeset-bot bot commented Apr 21, 2025

⚠️ No Changeset found

Latest commit: cc45627

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

})
.addActionDestinationSettings(
{
private async mockCDNSettingsAPI() {
Copy link
Contributor

@silesky silesky Apr 22, 2025

Choose a reason for hiding this comment

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

Can we still use CDNSettingsBuilder? The point is that it also updates remotePlugins correctly, which is important, and it’s an important helper to decouple our tests IMO

Copy link
Author

@neelkanth-kaushik neelkanth-kaushik Apr 23, 2025

Choose a reason for hiding this comment

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

Screenshot 2025-04-23 at 4 15 37 PM I have verified it again that the endpoint "https://cdn.segment.com/v1/projects/foo/settings" is returning 200 OK and there is no error or warning in the Playwright Inspector console as well.

Copy link
Contributor

@silesky silesky Apr 23, 2025

Choose a reason for hiding this comment

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

Maybe not following -- great that it works, but is it a problem to use CDNSettingsBuilder instead like we were before?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@silesky silesky marked this pull request as draft April 22, 2025 22:43
await this.clearStorage()
}

getAllTrackingEvents(): any[] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use SegmentEvent[] rather than any, like we were before? Ditto anywhere else 'any' is used

Copy link
Author

@neelkanth-kaushik neelkanth-kaushik Apr 24, 2025

Choose a reason for hiding this comment

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

I have updated segmentTrackingApiReqs: SegmentEvent[] = [] but had to use fetchIntegrationReqs: CoreExtraContext[] = [] because of a linter error in the private async mockNextIntegrationsAPI() {...} at the line this.fetchIntegrationReqs.push({ url: request.url() }). The Error says: 'url' does not exist in type 'SegmentEvent'.

The only interface where url is available is [CoreExtraContext](https://github.com/segmentio/analytics-next/blob/master/packages/core/src/events/interfaces.ts). Being the only interface fitting in this scenario I assume it is fine to use it. What do you think?

"playwright-test:headed": "playwright test --headed",
"playwright-test:debug": "playwright test --debug",
"serve": "http-server public -p 4567",
"server": "http-server --port 5432",
Copy link
Contributor

@silesky silesky Apr 23, 2025

Choose a reason for hiding this comment

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

why have serve and server? can we just use one -- I prefer "serve" just because that's the name we use in signals-integration-tests?

Copy link
Author

Choose a reason for hiding this comment

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

I think I forgot to remove the server. Thanks for pointing that out.

@@ -10,13 +10,20 @@
"lint": "yarn concurrently 'yarn:eslint .' 'yarn:tsc --noEmit'",
Copy link
Contributor

@silesky silesky Apr 23, 2025

Choose a reason for hiding this comment

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

  1. Can we remove all the old wdio dependencies?
  2. Can we update/commit the yarn.lock? (CI is failing)

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Author

@neelkanth-kaushik neelkanth-kaushik Apr 24, 2025

Choose a reason for hiding this comment

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

CI is still failing after pushing yarn.lock. I will look into it separately once all the test cases have been migrated.

@neelkanth-kaushik neelkanth-kaushik changed the title [Work In Progress. Do Not Merge] Migrate consent integration tests to playwright from webdriver.io - LIBRARIES-2546 Migrate consent integration tests to playwright from webdriver.io - LIBRARIES-2546 May 5, 2025
Copy link

codecov bot commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.02%. Comparing base (aa86141) to head (cc45627).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1279   +/-   ##
=======================================
  Coverage   84.02%   84.02%           
=======================================
  Files         224      224           
  Lines        5921     5921           
  Branches     1351     1351           
=======================================
  Hits         4975     4975           
  Misses        946      946           
Flag Coverage Δ
browser 92.16% <ø> (ø)
core 89.86% <ø> (ø)
node 87.93% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants