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.
- Test Structure:
- Fixture.page Method
- Assertion and Evaluation:
- t.expect.eql Method