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

add DOM elements for sync with puppeteer browser automation #1036

Draft
wants to merge 3 commits into
base: poc-maplibre-layer
Choose a base branch
from

Conversation

mki-c2c
Copy link

@mki-c2c mki-c2c commented Aug 20, 2024

Experimentation with headless chrome printing via puppeteer has brought the need to detect the end of rendering in both raster layers (OL) and vector tile layers (maplibre)

The webviewer can be opened in an automated browser window (headless) via puppeteer:

const browser = await puppeteer.launch({
    headless: false,
    defaultViewport: {width, height, deviceScaleFactor},
    executablePath: '/usr/bin/google-chrome',
    args: [
        "--no-sandbox",
    ]
});
const page = await browser.newPage();
await page.goto(webviewer_url);

Puppeteer can monitor the DOM and wait until the sync elements appear in the document:

await page.waitForFunction(
    "document.getElementById('maplibre_complete') && document.getElementById('openlayer_complete')",
    {timeout: 10000}
).catch(()=>console.log('timeout after 10s, the web page has not finished rendering'))

Test link

pakb and others added 3 commits July 4, 2024 08:56
replaces all BG layers with a VectorTile equivalent
switch to mercator as default projection to make it happen (not possible yet to mix projection systems, needs some work done on the geoblocks/ol-maplibre-layer library)
no sys service serves theses styles yet
Copy link

cypress bot commented Aug 20, 2024



Test summary

0 129 19 35


Run details

Project web-mapviewer
Status Failed
Commit 7df88a4
Started Aug 20, 2024 4:05 PM
Ended Aug 20, 2024 4:38 PM
Duration 32:58 💡
OS Linux Ubuntu -
Browser Electron 118

View run in Cypress Cloud ➡️


Failures

tests/cypress/tests-e2e/drawing.cy.js 10 Failed
1 Drawing module tests > Drawing mode/tools > can create marker/icons and edit them
2 Drawing module tests > KML management > deletes the drawing when confirming the delete modal
3 Drawing module tests > KML management > manages the KML layer in the layer list / URL params correctly
4 Drawing module tests > KML management > keeps the KML after a page reload, and creates a copy if it is then edited
5 Drawing module tests > KML management > manages the KML layer correctly if it comes attached with an adminId at startup
6 Drawing module tests > KML management > manages the KML layer correctly if it comes attached with an adminId at startup from a legacy URL
7 Drawing module tests > others > doesn't save an empty drawing (if not modified)
8 Drawing module tests > others > can export the drawing/profile in multiple formats
9 Drawing module tests > others > generates short links when sharing a drawing
10 Drawing module tests > others > shows a profile of a line/measure coming from service-alti data
This comment includes only the first 10 test failures. See all 129 failures in the Cypress Cloud.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

@pakb pakb force-pushed the poc-maplibre-layer branch 5 times, most recently from 41e4b94 to 1925e79 Compare September 20, 2024 08:15
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