-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add e2e Playwright tests #69
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review for now
I haven't reviewed deeply, just a review
* Performs the addition of the Cats project to the map | ||
* @param {Page} page The page object | ||
*/ | ||
export async function addCatProjectToMap(page) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export async function addCatProjectToMap(page) { | |
export async function addCatProjectToMap(page) { |
I think you should remove this function, and add by default the folder in the docker conf INI file
See 3liz/lizmap-web-client#5227 for instance.
Adding a folder is/must be a test in LWC core. It will speed up your tests here, as you do not need to log in as admin and "manually" add your folder in the admin panel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, grouped answer here
await page.getByRole('checkbox', {name: 'No base map'}).click(); | ||
} | ||
|
||
const locator = page.locator('id=jforms_mapBuilderAdmin_config_baseLayerDefault'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const locator = page.locator('id=jforms_mapBuilderAdmin_config_baseLayerDefault'); | |
const locator = page.locator('#jforms_mapBuilderAdmin_config_baseLayerDefault'); |
Is-it not better ? (if yes, search and replace all other occurences) L21 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I helped myself with other Playwright test but they are equivalent. I'm still going to change them with more explicit ones like #...
@@ -0,0 +1,95 @@ | |||
import { test, expect } from '@playwright/test'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you look to TS check, like in LWC core, // @ts-check
?
And all in spec.js
.
|
||
test('Open/Close attribute table', async ({ page }) => { | ||
|
||
await page.locator('button.dispayDataButton').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, but I would be nice to use POM https://playwright.dev/docs/pom
To design the interface in the test model page.
* Performs the removal of the Cats project from the map | ||
* @param {Page} page The page object | ||
*/ | ||
export async function removeCatProjectToMap(page) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to test this ? into the module.
Removing a projet should be kept in LWC core I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't a test but a way to "clean" tests.
In mapBuilder we insert projects onto the "builder map" by adding them through the administration panel but I wasn't sure if I should add it completely ( like the demo project already in ) or add it like this.
I will definitely add it to the git project so we can test the module with two projects already loaded in the map.
But I will check to get a lighter project for testing purposes.
@@ -0,0 +1,5 @@ | |||
## Cats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the cat project is nice ;-)
But for testing, I'm not a big fan of adding this 4MB GPKG tests/lizmap/instances/cats/data_cats/cats.gpkg
and a few tests/lizmap/instances/cats/media/data_cats/NAME.jpg
.
GPKG is a binary files, with a few dis-avantages in the GIS world (lock file etc, not nice with git...)
Keep in mind for later about "test data", even if it's nice for testing to have some cats ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove it and find another lighter project which will fit easier for testing purposes.
Adding Playwright tests to the project
MapBuilder
through PlaywrightCats
project directly in source files in order to have 2 different source of layersREADME
to indicate how to run e2e tests