Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion weblate/trans/tests/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import weblate.machinery.models
from weblate.auth.models import User
from weblate.configuration.models import Setting, SettingCategory
from weblate.fonts.tests.utils import FONT, FONT_SOURCE
from weblate.lang.models import Language
from weblate.machinery.dummy import DummyTranslation
Expand Down Expand Up @@ -163,7 +164,7 @@
raise
else:
# Increase webdriver timeout to avoid occasional errors in CI
cls._driver.command_executor.client_config.timeout = 300

Check failure on line 167 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Item "str" of "str | RemoteConnection" has no attribute "client_config"

# Restore custom fontconfig settings
if backup_fc is not None:
Expand Down Expand Up @@ -429,7 +430,7 @@
self.actions.send_keys_to_element(body, "?").perform()
WebDriverWait(self.driver, 5).until(
lambda driver: (
"show"

Check failure on line 433 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Unsupported right operand type for in ("str | None")
in driver.find_element(By.ID, "shortcuts-modal").get_attribute("class")
)
)
Expand All @@ -438,7 +439,7 @@
"""Test that machinery hotkeys use current result rows."""
identifier = SeleniumDummyTranslation.get_identifier()
original_service = weblate.machinery.models.MACHINERY.data.get(identifier)
weblate.machinery.models.MACHINERY[identifier] = SeleniumDummyTranslation

Check failure on line 442 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible types in assignment (expression has type "type[SeleniumDummyTranslation]", target has type "BatchMachineTranslation")

def restore_dummy_machinery() -> None:
if original_service is None:
Expand All @@ -449,7 +450,10 @@
self.addCleanup(restore_dummy_machinery)

project = self.create_component()
project.machinery_settings = {identifier: {}}
project.machinery_settings = dict.fromkeys(
Setting.objects.get_settings_dict(SettingCategory.MT)
)
project.machinery_settings[identifier] = {}
project.save(update_fields=["machinery_settings"])

self.do_login(superuser=True)
Expand Down Expand Up @@ -697,7 +701,7 @@
@social_core_override_settings(AUTHENTICATION_BACKENDS=TEST_BACKENDS)
def test_auth_backends(self) -> None:
user = self.do_login()
user.social_auth.create(provider="google-oauth2", uid=user.email)

Check failure on line 704 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Incompatible type for "uid" of "UserSocialAuth" (got "str | None", expected "str | int | Combinable")
user.social_auth.create(provider="github", uid="123456")
user.social_auth.create(provider="bitbucket", uid="weblate")
self.click(htmlid="user-dropdown")
Expand Down Expand Up @@ -1323,7 +1327,7 @@

# Upload font
element = self.driver.find_element(By.ID, "id_font")
self.upload_file(element, FONT)

Check failure on line 1330 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Argument 2 to "upload_file" of "SeleniumTests" has incompatible type "Traversable"; expected "str | Path"
with self.wait_for_page_load():
self.click(htmlid="upload_font_submit")

Expand All @@ -1334,7 +1338,7 @@

# Upload second font
element = self.driver.find_element(By.ID, "id_font")
self.upload_file(element, FONT_SOURCE)

Check failure on line 1341 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Argument 2 to "upload_file" of "SeleniumTests" has incompatible type "Traversable"; expected "str | Path"
with self.wait_for_page_load():
self.click(htmlid="upload_font_submit")

Expand Down Expand Up @@ -1570,7 +1574,7 @@
self.click(last_7_days)

value = period_input.get_attribute("value")
self.assertRegex(value, r"\d{2}/\d{2}/\d{4} - \d{2}/\d{2}/\d{4}")

Check failure on line 1577 in weblate/trans/tests/test_selenium.py

View workflow job for this annotation

GitHub Actions / mypy

Value of type variable "AnyStr" of "assertRegex" of "TestCase" cannot be "str | None"

self.assertEqual(picker.value_of_css_property("display"), "none")

Expand Down
Loading