Login and validate portfolio amount using the Playwright Pytest framework.
- "Device Approval" via email is requred during the first run:
- On first execution, the test will pause and wait for you to approve the device via email.
- After approval, the test will continue and pass.
- Subsequent runs will utilize the stored session and should not require device approval.
All commands from root of project:
-
Using the example
env_example
file, create a.env
filecp env_example .env
-
Customize the
.env
file with your own credentials, base_url and portfolio value.- Ensure there are no leading or trailing spaces around the = sign in the .env file
- To later run with different parameteres, modify the
.env
file and re-source it:. .env
-
Activate Virtual Environment (venv)
This step is optional but it is recommended to create a venv to isolate packages from your global python installation.
python3 -m venv .qa source .qa/bin/activate
-
Install dependencies
pip install -r requirements.txt
# First run you should see: WARNING:conftest:Storage State needs to be saved. Waiting for you to check email.
# Script will wait for you to approve the device via email.
pytest -vv -s test_portfolio.py --headed
# If you want to run with debugger/inspector
PWDEBUG=1 pytest -s test_portfolio.py --headed
# add --browser=[firefox|webkit] to the command
pytest -vv -s test_portfolio.py --headed --browser=firefox
If you get the follwing error, run playwright install
as instructed.
E ║ Looks like Playwright was just installed or updated. ║
E ║ Please run the following command to download new browsers: ║
E ║ ║
E ║ playwright install