ci: Skip intermittent-failing tests when on the CI.

A few tests have been failing randomly, leading to developers not having
a lot of trust in the CI, and having to retrigger the runs.

Here is the list of tests:

- `test_should_honor_toZoom`
- `test_default_view_locate`
- `test_umap_import_from_textarea`

This skips these tests when running in the CI, by looking at the `CI`
environment variable, set by Github Actions [0]

[0] https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
This commit is contained in:
Alexis Métaireau 2024-09-26 10:22:43 +02:00
parent eb5a67dadd
commit 4af5089bcc
No known key found for this signature in database
GPG key ID: 1C21B876828E5FF2
3 changed files with 15 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import json import json
import os
import re import re
import pytest import pytest
@ -55,6 +55,10 @@ def test_should_honour_fromZoom(live_server, map, datalayer, page):
expect(markers).to_be_visible() expect(markers).to_be_visible()
@pytest.mark.skipif(
os.environ.get("CI", "false") == "true",
reason="Test is failing intermittently, skipping in the CI",
)
def test_should_honour_toZoom(live_server, map, datalayer, page): def test_should_honour_toZoom(live_server, map, datalayer, page):
set_options(datalayer, displayOnLoad=True, toZoom=6) set_options(datalayer, displayOnLoad=True, toZoom=6)
page.goto(f"{live_server.url}{map.get_absolute_url()}#7/48.55/14.68") page.goto(f"{live_server.url}{map.get_absolute_url()}#7/48.55/14.68")

View file

@ -1,4 +1,5 @@
import json import json
import os
import platform import platform
import re import re
from pathlib import Path from pathlib import Path
@ -70,6 +71,10 @@ def test_umap_import_from_file(live_server, tilelayer, page):
expect(nonloaded).to_have_count(1) expect(nonloaded).to_have_count(1)
@pytest.mark.skipif(
os.environ.get("CI", "false") == "true",
reason="Test is failing intermittently, skipping in the CI",
)
def test_umap_import_from_textarea(live_server, tilelayer, page, settings): def test_umap_import_from_textarea(live_server, tilelayer, page, settings):
settings.UMAP_ALLOW_ANONYMOUS = True settings.UMAP_ALLOW_ANONYMOUS = True
page.goto(f"{live_server.url}/map/new/") page.goto(f"{live_server.url}/map/new/")

View file

@ -1,3 +1,4 @@
import os
import re import re
import pytest import pytest
@ -147,6 +148,10 @@ def test_default_view_latest_with_polygon(map, live_server, page):
expect(layers).to_have_count(1) expect(layers).to_have_count(1)
@pytest.mark.skipif(
os.environ.get("CI", "false") == "true",
reason="Test is failing intermittently, skipping in the CI",
)
def test_default_view_locate(browser, live_server, map): def test_default_view_locate(browser, live_server, map):
context = browser.new_context( context = browser.new_context(
geolocation={"longitude": 8.52967, "latitude": 39.16267}, geolocation={"longitude": 8.52967, "latitude": 39.16267},