IKivan-kozenko -aqa
Try yourself as a QA tester
Back to topic

Quiz

Evaluating JavaScript

Check yourself

  1. 1.You need to read a value from window.__APP_STATE__ in a test. Which approach is correct?
  2. 2.You want to replace Math.random() with a fixed value for reproducible tests. When must you inject this replacement?
  3. 3.Inside a page.evaluate() callback, you try to use a variable declared in your test scope. Why does this fail?
  4. 4.How do you read the auth_token value from localStorage in a Playwright test?
  5. 5.You want to dispatch a custom DOM event 'order:updated' from your test. Which method do you use?
  6. 6.What does context.addInitScript() do differently from page.addInitScript()?
  7. 7.You need to make a fetch request from inside the browser (with the browser's own cookies/session) and get the result back in Node.js. Which approach works?
  8. 8.What is the return value constraint for page.evaluate()?