Files
pxil-selenium-automation/RUN_COMMANDS.md
T

392 lines
10 KiB
Markdown

# PXIL Selenium Run Commands
Use these commands from the project folder:
```powershell
cd "C:\Selenium Test"
.\venv\Scripts\Activate.ps1
```
## Config Controls
Edit `config.json` before running.
Session and token together in one login:
```json
"setup": {
"run_session": true,
"run_token": true
}
```
Token only:
```json
"setup": {
"run_session": false,
"run_token": true
}
```
Session only:
```json
"setup": {
"run_session": true,
"run_token": false
}
```
Multiple token product codes:
```json
"product_codes": "IDAS,IDAS1,IDAS2,IDAS3,IDAS4"
```
Single token product code:
```json
"product_codes": "IDAS4"
```
## Commands
Run setup based on `config.json`:
```powershell
pytest tests\setup -s --html=reports/html/setup_run.html --self-contained-html
```
Use this for:
- Session and token together when both flags are `true`.
- Token only when `run_session` is `false` and `run_token` is `true`.
- Session only when `run_session` is `true` and `run_token` is `false`.
Run only token setup:
```powershell
pytest tests\setup\tokens -s --html=reports/html/token_run.html --self-contained-html
```
Use this when `run_token` is `true`. It will create one token or multiple tokens based on `trading_token_idas.product_codes`.
Run only session setup:
```powershell
pytest tests\setup\sessions -s --html=reports/html/session_run.html --self-contained-html
```
Use this when `run_session` is `true`.
Run combined session plus token setup explicitly:
```powershell
pytest tests\setup\test_combined_setup.py -s --html=reports/html/combined_setup_run.html --self-contained-html
```
Use this when both `run_session` and `run_token` are `true`. It logs in once, creates the session, then creates and activates all configured tokens in the same browser session.
Collect tests without opening browser:
```powershell
pytest tests\setup --collect-only -q
```
Use this to confirm pytest can see the setup tests.
## Regression Config Controls
Regression flows use `config/runtime.json`, not `config.json`.
Common fields to edit:
```json
"execution": {
"login_role": "trading_member",
"trading_member_key": "tm_55",
"product_family": "IDAS",
"flow_scope": "bidding"
}
```
Trading-member login uses `environment.login_urls.trading_member`; exchange login
uses `environment.login_urls.exchange`.
Product and market selection:
```json
"active_selection": {
"product_code": "IDAS1",
"trading_market": "DAM",
"bidding_screen": "single_bid"
}
```
Use `"trading_market": "ALL"` to run IDAS bidding for `GDAM`, `DAM`, and `HPDAM` in one test run. Use `"trading_markets": ["GDAM", "DAM"]` to run only those segments in that order.
Use `"bidding_screen": "single_and_block_bid"` to run single-bid folder upload first and then block-bid folder upload in the same logged-in browser session.
Bidding entry method:
```json
"entry_method": {
"bid_entry_method": "file_upload",
"file_upload_mode": "batch",
"auto_submit": true
}
```
Available `bid_entry_method` values:
- `excel_grid`: read Excel and paste values into the bidding grid.
- `json_grid`: read JSON and paste values into the bidding grid.
- `file_upload`: upload one Excel file or upload multiple files in batch mode.
- `folder_upload`: upload each TM folder under the configured folder-upload root, click Submit All, wait for all files to reach 100%, then fetch each file status.
Available `file_upload_mode` values:
- `single`: upload only the configured active entry file.
- `batch`: upload all enabled upload files.
## Regression Commands
Run all active regression tests based on `config/runtime.json`:
```powershell
pytest tests\regression -m regression -s --html=reports/html/regression_run.html --self-contained-html
```
Use this when `execution.flow_scope` is `e2e`, `bidding`, or `matching`. Current active regression tests are exchange IDAS bidding and exchange IDAS matching.
Run IDAS exchange bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_run.html --self-contained-html
```
Set this in `config/runtime.json` before running:
```json
"execution": {
"login_role": "exchange",
"product_family": "IDAS",
"flow_scope": "bidding"
}
```
Run Excel grid bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_excel_grid_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"entry_method": {
"bid_entry_method": "excel_grid",
"auto_submit": true
}
```
Run JSON grid bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_json_grid_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"entry_method": {
"bid_entry_method": "json_grid",
"auto_submit": true
}
```
Run single file upload bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_single_upload_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"entry_method": {
"bid_entry_method": "file_upload",
"file_upload_mode": "single",
"auto_submit": true
}
```
Run batch file upload bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_batch_upload_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"entry_method": {
"bid_entry_method": "file_upload",
"file_upload_mode": "batch",
"auto_submit": true
}
```
Batch upload uses enabled entries from `config/runtime.json > IDAS > bidding > entries`, and upload files from:
```text
data/idas/bidding/uploads
```
Run folder upload bidding:
```powershell
pytest tests\regression\exchange\idas\bidding -m bidding -s --html=reports/html/bidding_folder_upload_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"users": {
"exchange_parallel": [
{
"label": "Parallel Exchange 1",
"username": "exchange_user_1",
"password": "exchange_password_1"
},
{
"label": "Parallel Exchange 2",
"username": "exchange_user_2",
"password": "exchange_password_2"
}
]
},
"entry_method": {
"bid_entry_method": "folder_upload",
"folder_upload_execution_mode": "sequential",
"auto_submit": true
},
"data_paths": {
"folder_upload_root": "data/idas/bidding/folder_uploads",
"folder_upload_sides": ["BUYSELL"]
},
"timing": {
"folder_upload_max_parallel_sessions": 2,
"folder_upload_parallel_login_stagger_seconds": 20,
"folder_upload_parallel_captcha_wait_seconds": 60
}
```
Folder upload uses a separate root from normal single-file uploads. Keep folders like:
```text
data/idas/bidding/folder_uploads/DAM/Single/Buy/C1036
data/idas/bidding/folder_uploads/DAM/Single/Sell/C1036
```
If `trading_market` is `ALL`, the folder root can contain market folders like `GDAM`, `DAM`, and `HPDAM`. The runner then looks under `Market/Single/Buy` or `Market/Single/Sell` and uses each TM folder name, such as `C1036`, to select the TM ID.
After opening each bidding screen, the runner waits for `bidding_screen_ready_wait_seconds` from `IDAS > bidding > timing`. The default is `10`.
Set `folder_upload_execution_mode` to `parallel` to run multiple TM folders at the same time. Parallel mode opens one browser per active TM folder up to `folder_upload_max_parallel_sessions`; each browser has its own manual CAPTCHA wait from `folder_upload_parallel_captcha_wait_seconds`, and is staggered by `folder_upload_parallel_login_stagger_seconds`.
For trading-member login, configure each folder owner under `users.trading_members`
with `member_id` or `folder_upload_tm_ids` matching the folder names, for example
`C1024`. The runner uses that mapping to choose the browser login for each folder
and skips TM dropdown selection because the application locks the TM from login.
For exchange login, configure at least as many `users.exchange_parallel` entries
as `folder_upload_max_parallel_sessions`.
Folder-upload timing/status JSON logs are written under:
```text
reports/logs/<RUN_ID>/test_idas_exchange_bidding_flow
```
Run IDAS exchange matching:
```powershell
pytest tests\regression\exchange\idas\matching -m matching -s --html=reports/html/matching_run.html --self-contained-html
```
Set this in `config/runtime.json` before running:
```json
"execution": {
"login_role": "exchange",
"product_family": "IDAS",
"flow_scope": "matching"
}
```
Matching settings live here:
```json
"matching": {
"matching_product_code": "IDAS(I)",
"matching_type": "Provisional Match",
"source_types": [
"Green",
"Conventional",
"HPDAM"
]
}
```
Run full IDAS e2e regression:
```powershell
pytest tests\regression -m regression -s --html=reports/html/idas_e2e_run.html --self-contained-html
```
Set this in `config/runtime.json`:
```json
"execution": {
"login_role": "exchange",
"product_family": "IDAS",
"flow_scope": "e2e"
}
```
This runs all active regression tests whose flow supports `e2e`. At present, that includes bidding and matching.
Run fake activity smoke test:
```powershell
pytest tests\test_fake_activity.py -m fake_activity -s --html=reports/html/fake_activity_run.html --self-contained-html
```
Use this for random menu/dropdown activity without saving data.
Collect regression tests without opening browser:
```powershell
pytest tests\regression --collect-only -q
```
Use this to confirm which regression tests exist.
## Placeholder Markers
These markers are registered in `pytest.ini`, but no runnable test files are currently present for them in this repo:
- `reports`
- `order_book`
- `trade_book`
When test files are added under `tests\regression`, use the same command shape:
```powershell
pytest tests\regression -m reports -s --html=reports/html/reports_run.html --self-contained-html
pytest tests\regression -m order_book -s --html=reports/html/order_book_run.html --self-contained-html
pytest tests\regression -m trade_book -s --html=reports/html/trade_book_run.html --self-contained-html
```
# Playwright session/token setup
See [Playwright setup commands](playwright_tests/README.md) for login, session creation,
token creation/activation, and combined setup on utilseastern. Use `-c playwright.ini`
to select the new suite; commands below continue to describe the Selenium suite.