Skip to content

[Map] Add E2E tests, close #3022 #3038

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

Merged
merged 2 commits into from
Aug 22, 2025
Merged

[Map] Add E2E tests, close #3022 #3038

merged 2 commits into from
Aug 22, 2025

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Aug 21, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Fix #3022
License MIT

I only tested Leaflet map with various features, including custom icons.

Google Maps won't be tested as it requires a paid API Key.

@Kocal Kocal self-assigned this Aug 21, 2025
@carsonbot carsonbot added Map Status: Needs Review Needs to be reviewed labels Aug 21, 2025
Comment on lines +88 to +90
'react-dom/client' => [
'version' => '18.3.1',
],
Copy link
Member Author

Choose a reason for hiding this comment

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

Related to #3030


await expect(await page.getByTestId('map')).toBeVisible();

// Since we can't test Google Maps rendering due to API costs, we only assert that Google Maps API is (wrongly) loaded
Copy link
Member

Choose a reason for hiding this comment

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

I would not do this test.

i think this could be a (tiny but still very real) problem in term of privacy, as we are making requests on behalf of the user... (even if it's on its own local machine)..

If someone want Google Maps fully tested, they probably already pay for GoogleMaps .....
so maybe they can invest some coins around here to support the work....

In the meantime I clearly would not spend too much time or energy to test a (very) costly (and "not-always" privacy-compliant) solution your our own time and/or money 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I see what you mean, but since #2146 Map Bridges tests were run inside a browser and so requests were already made to Google.

I think that's fine if we make it opt-out explicitly:

  • pnpm run test:browser: run browsers tests on all UX packages with test:browser pnpm script except UX Google Map
  • pnpm run test:browser:no-privacy (or something similar): run browsers tests on all UX packages with test:browser pnpm script including UX Google Map

If someone want Google Maps fully tested, they probably already pay for GoogleMaps .....
so maybe they can invest some coins around here to support the work....

About writing real tests for Google Map Bridge too, I thought about putting my own API key as a GitHub secret (so no one can see it), but if someone decide to trigger 10k times the CI, I'm bankrupt 🤯

Running a test that ensure the Google Maps API is loaded is the best of both worlds imo

import * as fs from 'fs';

export function getSymfonyKernelVersionId(): number {
const kernelPath = path.join(import.meta.dirname, '../test_apps/e2e-app/vendor/symfony/http-kernel/Kernel.php');
Copy link
Member

Choose a reason for hiding this comment

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

Would use an ENV_VAR here (as its done for KERNEL_CLASS in a way)

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it too but re-using SYMFONY_REQUIRE env var would makes things counterproductive IMHO:

  • it's not very intuitive to pass this env var while running Playwright, I'm sure everyone including me will forgot it
  • if you change your Symfony version through SYMFONY_REQUIRE=x.y.* composer update, you must close Playwright and re-open Playwright with SYMFONY_REQUIRE=x.y.*
  • there is no native version_compare() function in Node.js, we must re-implement the logic ourselves with https://github.com/npm/node-semver for example

The VERSION_ID from test_apps/e2e-app/vendor/symfony/http-kernel/Kernel.php is the best source of truth we can get when being inside Playwright context

Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

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

👏

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Aug 21, 2025
@Kocal Kocal merged commit 0dbdc10 into symfony:2.x Aug 22, 2025
23 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Map Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add E2E tests for Map
3 participants