Skip to content

Latest commit

 

History

History

blur-window

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

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: