Test Code: index.js
Tested Page: index.html
This example demonstrates how to simulate the web page losing focus.
The tested page includes a script. When the user switches to another tab or minimizes the main window, the script logs a message to the console.
Before the test begins, a ClientFunction
is declared. When called, this function employs the EventTarget.dispatchEvent method to dispatch a blur Event at the main window.
During the test, the t.expect.ok
method asserts that the client function has fired.
- Test Structure:
- Fixture.page Method
- test Function
- Assertion and Evaluation:
- t.expect.ok Method
- Custom Scripts:
- ClientFunction Object