Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

pranjal-jately-ld
Copy link
Contributor

Description

Makes E2E more robust.

What does this PR do?

Fixes failing E2E tests when running the server using pnpm demo:mock. This was because Playwright mocks were not overriding the values from MSW which resulted in failing tests.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation (changes to documentation only)
  • 🔧 Refactor (code change that neither fixes a bug nor adds a feature)
  • 🎨 Style (formatting, missing semicolons, etc; no production code change)
  • Performance (code change that improves performance)
  • Test (adding missing tests, refactoring tests; no production code change)
  • 🔨 Chore (updating grunt tasks, build process, etc; no production code change)

Screenshots/Videos


Fixes failing E2E tests when running the server using pnpm demo:mock.
This was because Playwright mocks were not overriding the values from
MSW which resulted in failing tests.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed these and replaced them with the following:

const LD_BASE_URL = '**/sdk/evalx/**';
const LD_EVENT_STREAM_URL = '**/eval/**';

The change allows us to continue using the internal url when developing in our env vars and allows the requests to still be mocked by Playwright - which they would not otherwise since the domains did not match.

useMocks: import.meta.env.VITE_USE_MOCK_FLAGS === 'true',
// Use mocks if explicitly enabled via env var, but never during automated tests
// Automated tests (like Playwright) provide their own network mocking
useMocks: import.meta.env.VITE_USE_MOCK_FLAGS === 'true' && !isAutomatedTest(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this adds some "magic" which is happening in the demo app. It's not so obvious that Playwright relies on this as the logic is decoupled. Perhaps we can add a README.md to Playwright as a follow-up which describes the approach we've taken along with other basic info about our e2e testing strategy?

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.