Skip to content

Commit 706cbc1

Browse files
committed
hid pass
1 parent 6d4565f commit 706cbc1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tests/e2e-playwright/tests/conftest.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
from faker import Faker
2222
from playwright.sync_api import APIRequestContext, BrowserContext, Page, WebSocket
2323
from playwright.sync_api._generated import Playwright
24-
from pydantic import AnyUrl, TypeAdapter
24+
from pydantic import AnyUrl, SecretStr, TypeAdapter
2525
from pytest import Item
26+
from pytest_simcore.helpers.faker_factories import DEFAULT_TEST_PASSWORD
2627
from pytest_simcore.helpers.logging_tools import log_context
2728
from pytest_simcore.helpers.playwright import (
2829
MINUTE,
@@ -223,13 +224,13 @@ def user_name(request: pytest.FixtureRequest, auto_register: bool, faker: Faker)
223224
@pytest.fixture
224225
def user_password(
225226
request: pytest.FixtureRequest, auto_register: bool, faker: Faker
226-
) -> str:
227+
) -> SecretStr:
227228
if auto_register:
228-
return faker.password(length=12)
229+
return SecretStr(DEFAULT_TEST_PASSWORD)
229230
if osparc_password := request.config.getoption("--password"):
230231
assert isinstance(osparc_password, str)
231-
return osparc_password
232-
return os.environ["USER_PASSWORD"]
232+
return SecretStr(osparc_password)
233+
return SecretStr(os.environ["USER_PASSWORD"])
233234

234235

235236
@pytest.fixture(scope="session")
@@ -292,7 +293,7 @@ def register(
292293
page: Page,
293294
product_url: AnyUrl,
294295
user_name: str,
295-
user_password: str,
296+
user_password: SecretStr,
296297
) -> Callable[[], AutoRegisteredUser]:
297298
def _do() -> AutoRegisteredUser:
298299
with log_context(
@@ -309,11 +310,13 @@ def _do() -> AutoRegisteredUser:
309310
for pass_id in ["registrationPass1Fld", "registrationPass2Fld"]:
310311
user_password_box = page.get_by_test_id(pass_id)
311312
user_password_box.click()
312-
user_password_box.fill(user_password)
313+
user_password_box.fill(user_password.get_secret_value())
313314
with page.expect_response(re.compile(r"/auth/register")) as response_info:
314315
page.get_by_test_id("registrationSubmitBtn").click()
315316
assert response_info.value.ok, response_info.value.json()
316-
return AutoRegisteredUser(user_email=user_name, password=user_password)
317+
return AutoRegisteredUser(
318+
user_email=user_name, password=user_password.get_secret_value()
319+
)
317320

318321
return _do
319322

@@ -323,7 +326,7 @@ def log_in_and_out(
323326
page: Page,
324327
product_url: AnyUrl,
325328
user_name: str,
326-
user_password: str,
329+
user_password: SecretStr,
327330
auto_register: bool,
328331
register: Callable[[], AutoRegisteredUser],
329332
) -> Iterator[WebSocket]:
@@ -364,7 +367,7 @@ def log_in_and_out(
364367
_user_email_box.fill(user_name)
365368
_user_password_box = page.get_by_test_id("loginPasswordFld")
366369
_user_password_box.click()
367-
_user_password_box.fill(user_password)
370+
_user_password_box.fill(user_password.get_secret_value())
368371
with page.expect_response(re.compile(r"/login")) as response_info:
369372
page.get_by_test_id("loginSubmitBtn").click()
370373
assert response_info.value.ok, f"{response_info.value.json()}"

0 commit comments

Comments
 (0)