Skip to content
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

[Jest] Browser tests #810

Merged
merged 10 commits into from
Jan 24, 2022
Merged

[Jest] Browser tests #810

merged 10 commits into from
Jan 24, 2022

Conversation

birkskyum
Copy link
Member

@birkskyum birkskyum commented Jan 22, 2022

browser.test.js was used to generate before each and after each for drag.test.js and zoom.test.js. I combined them all in browser.test.ts, as it's much easier to reason about.

Change jest.config.cjs to:

  "roots": [
    "<rootDir>/src",
    "<rootDir>/test/browser",
  ],

Run

npm install
npm run test-jest -- test/browser/browser

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2022

Bundle size report:

Size Change: 0 B
Total Size Before: 193 kB
Total Size After: 193 kB

Output file Before After Change
maplibre-gl.js 184 kB 184 kB 0 B
maplibre-gl.css 9.49 kB 9.49 kB 0 B
ℹ️ View Details No major changes

@birkskyum birkskyum changed the title [Jest] Browser tests [WIP/Jest] Browser tests Jan 22, 2022
@birkskyum
Copy link
Member Author

birkskyum commented Jan 22, 2022

The tests fail because "map" is undefined. Both the drag and zoom test load html file test/browser/fixtures/land.html where it's defined, but map doesn't seem to be passed to the local scope of the jest tests.

Any ideas how to fix the browser tests would be appreciated :)

Can we i.e. somehow import the maplibre build directly in the browser.test.ts, rather than through the html file?

@HarelM
Copy link
Collaborator

HarelM commented Jan 22, 2022

I would focus on finish migrating the rest of the unit tests as these tests are more integration tests...?

@birkskyum
Copy link
Member Author

birkskyum commented Jan 22, 2022

The end seems to be near for unit tests. I believe the ajax.test.ts is ready to be merged, and image_source is in progress too, which are the only two places tap is used apart from the browser and build tests.

@birkskyum birkskyum added this to the Transition from Tap to Jest milestone Jan 22, 2022
@HarelM
Copy link
Collaborator

HarelM commented Jan 22, 2022

I had no clue we were finishing up with the unit tests, so cool!! :-)
Also I think the build tests are easier, so we might want to do them first.
I'll take a look at this later this week and see if I can help with the problem at hand.

@birkskyum
Copy link
Member Author

I'll have a go at the build tests then

@HarelM
Copy link
Collaborator

HarelM commented Jan 23, 2022

I've reviewed the changes.
Looks good in general.
It still needs to pass though :-)
Thanks for all the hard work!

@wipfli
Copy link
Contributor

wipfli commented Jan 23, 2022

I am re-running the tests. Double-click often fails for no good reason.

@birkskyum
Copy link
Member Author

birkskyum commented Jan 24, 2022

This seems to be working now. The missing piece was likely bumping selenium-webdriver to 4.1.1, which adds support for chrome 97. (#827 )

@birkskyum birkskyum changed the title [WIP/Jest] Browser tests [Jest] Browser tests Jan 24, 2022
@HarelM HarelM merged commit 69bf99c into maplibre:main Jan 24, 2022
@birkskyum birkskyum mentioned this pull request Jan 25, 2022
@HarelM HarelM mentioned this pull request Apr 8, 2022
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