-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from digital-land/fix/NationalMapForApple
Fix/national map for apple
- Loading branch information
Showing
8 changed files
with
122 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import time | ||
|
||
import pytest | ||
import uvicorn | ||
|
||
from multiprocessing.context import Process | ||
from application.settings import get_settings | ||
|
||
settings = get_settings() | ||
|
||
settings.READ_DATABASE_URL = ( | ||
"postgresql://postgres:postgres@localhost/digital_land_test" | ||
) | ||
settings.WRITE_DATABASE_URL = ( | ||
"postgresql://postgres:postgres@localhost/digital_land_test" | ||
) | ||
|
||
from application.app import create_app # noqa: E402 | ||
|
||
app = create_app() | ||
|
||
HOST = "0.0.0.0" | ||
PORT = 9000 | ||
BASE_URL = f"http://{HOST}:{PORT}" | ||
|
||
|
||
def run_server(): | ||
uvicorn.run(app, host=HOST, port=PORT) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def server_process(): | ||
proc = Process(target=run_server, args=(), daemon=True) | ||
proc.start() | ||
time.sleep(10) | ||
yield proc | ||
proc.kill() | ||
|
||
|
||
def wait_for_map_layer(page, layer, attempts=10, check_interval=10): | ||
for i in range(attempts): | ||
isHidden = page.evaluate( | ||
f'() => mapControllers.map.map.getLayer("{layer}").isHidden()' | ||
) | ||
if isHidden is False: | ||
return True | ||
page.wait_for_timeout(check_interval) | ||
assert False, f"Layer {layer} did not appear on the map" | ||
|
||
|
||
def test_toggle_layers_on_the_national_map_correctly_shows_entity( | ||
server_process, | ||
page, | ||
context, | ||
add_base_entities_to_database_yield_reset, | ||
skip_if_not_supportsGL, | ||
): | ||
# as the map xy coords are dependent on the viewport size, we need to set it to make sure the tests are consistent | ||
page.set_viewport_size({"width": 800, "height": 600}) | ||
|
||
page.goto( | ||
BASE_URL + "/map/#50.88865897214836,-2.260771340418273,11.711391365982688z" | ||
) | ||
page.get_by_label("Conservation area").check() | ||
wait_for_map_layer(page, "conservation-area-source-fill-extrusion") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters