Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 1.31 KB

File metadata and controls

23 lines (15 loc) · 1.31 KB

Simulate the Web Page Losing Focus

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.

TestCafe Functions and Methods Used in This Example

  1. Test Structure:
  2. Assertion and Evaluation:
  3. Custom Scripts: