Skip to content

Commit d6f061b

Browse files
committed
fix(tests): simplify GitHub testing in Selenium tests
Reduce GitHub hits by defining branch and allowlisting DNS host.
1 parent 7262be6 commit d6f061b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

weblate/trans/tests/test_selenium.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ def download_translations(
113113
)
114114

115115

116+
# The fixture repositories are known public GitHub repos; allowlisting them
117+
# avoids flaky runtime DNS checks while keeping the real import path covered.
118+
@override_settings(VCS_ALLOW_HOSTS={"github.com"})
116119
class SeleniumTests(BaseLiveServerTestCase, RegistrationTestMixin, TempDirMixin):
117120
_driver: WebDriver | None = None
118121
_driver_error: str = ""
@@ -724,6 +727,7 @@ def create_component(self) -> Project:
724727
slug="language-names",
725728
project=project,
726729
repo="https://github.com/WeblateOrg/demo.git",
730+
branch="main",
727731
filemask="weblate/langdata/locale/*/LC_MESSAGES/django.po",
728732
new_base="weblate/langdata/locale/django.pot",
729733
file_format="po",
@@ -1097,6 +1101,7 @@ def test_weblate(self) -> None: # noqa: PLR0915
10971101
self.driver.find_element(By.ID, "id_repo").send_keys(
10981102
"https://github.com/WeblateOrg/demo.git"
10991103
)
1104+
self.driver.find_element(By.ID, "id_branch").send_keys("main")
11001105
self.driver.find_element(By.ID, "id_repoweb").send_keys(
11011106
"https://github.com/WeblateOrg/demo/blob/{{branch}}/{{filename}}#L{{line}}"
11021107
)
@@ -1426,6 +1431,7 @@ def test_add_component(self) -> None:
14261431
self.driver.find_element(By.ID, "id_repo").send_keys(
14271432
"https://github.com/WeblateOrg/demo.git"
14281433
)
1434+
self.driver.find_element(By.ID, "id_branch").send_keys("main")
14291435
self.screenshot("user-add-component-init.png")
14301436
with self.wait_for_page_load(timeout=1200):
14311437
self.driver.find_element(By.ID, "id_name").submit()
@@ -1461,6 +1467,7 @@ def test_alerts(self) -> None:
14611467
slug="duplicates",
14621468
project=project,
14631469
repo="https://github.com/WeblateOrg/test.git",
1470+
branch="main",
14641471
filemask="po-duplicates/*.dpo",
14651472
new_base="po-duplicates/hello.pot",
14661473
file_format="po",
@@ -1483,6 +1490,7 @@ def test_alerts(self) -> None:
14831490
slug="guidance",
14841491
project=project,
14851492
repo="https://github.com/WeblateOrg/test.git",
1493+
branch="main",
14861494
filemask="po/*.po",
14871495
file_format="po",
14881496
)

0 commit comments

Comments
 (0)