1. Variables & Scope (let, const)
basicUse "const" for values that should not change after assignment (like timeouts, URLs, and element selectors). Use "let" for values that will be reassigned (like loop counters, toggle states, and retry accumulators). Avoid "var" because it is function-scoped and can cause leakages.
const TIMEOUT = 5000;
let retryCount = 0;Always prefer const by default. Only use let when you explicitly plan to change the variable's value later in the test execution.
Declare selectors and configuration objects with "const" to prevent accidental runtime reassignments that would break E2E test runs.