Add product-specific session and token setup

This commit is contained in:
2026-09-23 09:27:55 +05:30
parent 4749efe45f
commit 9d16b20eb4
8 changed files with 249 additions and 66 deletions
+41 -1
View File
@@ -11,6 +11,46 @@ cd "C:\Selenium Test"
Edit `config.json` before running.
Common URL, login credentials, login waits, and step delay stay at the top level.
`setup.run_session` and `setup.run_token` are defaults for every enabled product.
`setup.session` provides common session timing defaults.
`products` contains separate `IDAS`, `RTM`, `UPC`, `RA`, and `REC` sections.
Each product has its own `me_instance`, optional `session` timing overrides, and
`token` settings (codes, delivery offset, expiry, and time sessions).
Existing IDAS settings are preserved. Other product templates are disabled until
you fill in their actual ME instance/token codes and set `enabled` to `true`.
Additional products can be added using the same structure.
To override the defaults for one product, add flags directly inside that product:
```json
"RTM": {
"enabled": true,
"run_session": false,
"run_token": true,
"me_instance": "",
"token": {
"market_code": "NATIONAL",
"product_type": "RTM",
"product_codes": "YOUR_ACTUAL_RTM_CODE"
}
}
```
Remove a product's `run_session` or `run_token` key to inherit that common flag
again. Explicit `false` overrides a common `true`; explicit `true` overrides a
common `false`. Both false skips that product; `enabled: false` always skips it.
Session timing overrides inherit any fields omitted from `setup.session`.
Token timing settings belong to each product independently.
Use `pytest tests\setup -s` to run all enabled products. Each product runs in its
own browser: both flags true runs session then tokens in one login; otherwise
only its enabled action runs. Test/report names include the product name.
The session and token subfolder commands below select only products configured
for session-only and token-only respectively; use the full setup command for a
mixture of modes.
Session and token together in one login:
```json
@@ -69,7 +109,7 @@ Run only token setup:
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`.
Use this when `run_token` is `true`. It will create one token or multiple tokens based on `products.<product>.token.product_codes`.
Run only session setup: