Skip to content

Conversation

@Gerodotry
Copy link
Owner

оновлена версія з врахуванням зауважень

@Gerodotry Gerodotry requested a review from lipskydan October 28, 2025 11:57
Copy link
Collaborator

@lipskydan lipskydan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded sensitive credentials in tests
Issue: Phone number and plaintext password are committed in test_login.py.
Risk: Security leak / credential compromise; tests cannot be safely public.
Fix: Move credentials to environment variables or a secrets manager (os.environ / pytest config), and never commit real credentials.

Missing / inconsistent fixture setup and teardown
Issue: setup_module() and globals were removed but no pytest fixtures shown; tests now expect fixtures (home, driver, product, cart) that may not exist.
Risk: Tests will fail when run (NameError / pytest fixture not found) or leave drivers open.
Fix: Implement and reuse well-scoped pytest fixtures (session/module/function) for WebDriver and page objects; ensure proper teardown (driver.quit) in finalizer.

Flaky/wrong waiting strategy and assertions
Issue: Some tests assert current_url or element presence without waiting (or use inconsistent waiting). Example: test_step1 checks driver.current_url immediately; test_search_kley waits for element but previously used time.sleep removed in places.
Risk: Intermittent failures due to timing/network variability.
Fix: Use explicit WebDriverWait for expected conditions (url_contains, element_to_be_clickable, presence_of_element_located) consistently before assertions.

Brittle locators (absolute XPaths / generic selectors)
Issue: Use of absolute XPath (e.g., "/html/body/…") and generic CSS selectors like input[type='search'] can easily break when UI changes.
Risk: High maintenance cost and flaky tests.
Fix: Prefer data-test-id/data-testid attributes or stable IDs/classes; use semantic, relative XPaths or CSS that target meaningful attributes. If not available, coordinate with devs to add test hooks.

Tests depend on external production site (integration vs unit)
Issue: Tests operate directly against epicentrk.ua (live site), so they're slow and environment-dependent.
Risk: Slow CI, failures due to network/site changes, rate-limits, or data variability.
Fix: Classify these as end-to-end/integration tests and run them separately; for unit/functional tests, mock network interactions or use a controlled staging environment. Add markers (pytest.mark.e2e) and configure CI to gate/run them appropriately.

This workflow runs unit tests and Selenium end-to-end tests on push and pull request events for the dev and main branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants