Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vc-testing-module

NotificationsYou must be signed in to change notification settings

VirtoCommerce/vc-testing-module

Repository files navigation

Prerequisites

  1. Install Cursor AI (recommended IDE)
  2. Clone/download project and open with Cursor AI (or PyCharm)

Make sure you have the following installed on your system:

  • Python (version 3.7 or later)
  • pip (Python package manager)
  1. Create and activate a virtual environment

    python -m venv .venvsource venv/bin/activate# On macOS/Linux.venv\Scripts\activate# On Windows
  2. Install dependencies

    python -m pip install --upgrade pippip install -r requirements.txt
  3. Install pre-commit hooks

    pre-commit install

    Note: This step needs to be done manually after installing requirements. Pre-commit hooks (including Black formatter) cannot be installed automatically through requirements.txt as this is a Git security feature.

  4. Install Playwright browsers

    playwright install
  5. Verify Playwright installation

    python -c"import playwright; print(playwright.__version__)"

Running Tests

To execute your Playwright tests with pytest, run:

# To run functional tests:pytest -v -s test_graphql/tests# To run visual tests:pytest e2e/ -v --headed# Run a specific testpytest tests/test_auth.py -k test_user_registrationpytest tests/test_auth.py -k test_user_login# Run with more detailed outputpytest tests/test_auth.py -v

If you want to run Playwright tests in headed mode (with browser UI), use:

pytest --headed

For running tests in a specific browser, specify it as follows:

pytest --browser=chromium# or firefox, webkit

Environment Variables

To store authentication tokens and other secrets securely, create a.env file:

TOKEN=your_auth_token_here

Then, load environment variables in your test files using:

importosfromdotenvimportload_dotenvload_dotenv()TOKEN=os.getenv("TOKEN")

Debugging Tests

  • Use--slowmo to slow down execution for debugging:
    pytest --headed --slowmo=500# 500ms delay between steps
  • Run tests in debug mode:
    pytest --headed --debug

Generating Tests Automatically

Playwright can generate tests for you by recording actions:

playwright codegen example.com

This opens a browser where you can perform actions, and Playwright generates the corresponding test script.

Additional Resources

Happy Testing! 🚀

About

vc-testing-module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp