Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 1.02 KB

File metadata and controls

19 lines (12 loc) · 1.02 KB

Check Whether Web Page Is Opened With TestCafe

Test Code: index.js Tested Page: index.html

When TestCafe runs, it exposes multiple variables with internal TestCafe data to the global object. Your application can check if these variables are present to determine whether it is opened with TestCafe.

This example demonstrates how to let your application know whether it is opened with TestCafe.

The test page includes a <div> with a <span>. When the page is opened, a script determines whether the page was opened with TestCafe. The <span> element then displays yes or no.

During the test, the t.expect.eql method checks the <div> text.

TestCafe Functions and Methods Used in This Example

  1. Test Structure:
  2. Assertion and Evaluation: