After a tested Electron application and a TestComplete project are prepared for testing, you can create a test and run it. The easiest way to create a test is to record a sequence of user actions over the application:
-
If your tested Electron application is running, close it.
-
To start recording, from the TestComplete main menu, select Test > Record > Record Keyword Test:
-
Important: Expand the Recording toolbar, click Run App, and then select your tested Electron application:
If you run your tested application not from TestComplete, but in any other way (for instance, from the command line), TestComplete will not be able to expose your application internal objects. To test Electron applications, always start them from TestComplete (see the Exposing Electron Applications section in the About Testing Electron Applications topic).
-
TestComplete will launch the tested application:
-
Click anywhere within the main page of the application.
-
Create a property checkpoint that will verify the text that the application window shows:
-
On the Recording toolbar, click Add Check. In the resulting Checkpoint wizard, click Object property:
-
Select the Hello World! text on the main page. To select the text, you can –
Press , drag the target glyph to the text, and then release the mouse button.
Click , move the mouse pointer to the text, and then press the Select object shortcut (by default, SHIFT+CTRL+A).
-
On the next page of the wizard, select the
contentText
property (selected by default): -
Click Finish.
-
-
Close your tested application and click Stop on the Recording toolbar.
TestComplete will stop the recording and open the recorded test:
To run the recorded test for your Electron application, click Run on the Keyword Test editor toolbar:
TestComplete will launch your tested application and play back all the recorded user actions. After the test is over, you can view test results:
Where to Go Next
For further information on creating automated tests for web pages, see the following sections:
See Also
Testing Electron Applications - Tutorial
About Testing Electron Applications