The requested page is not available for the requested platform. You are viewing the content for Default platform.

Explorer Panel

  • 5 min to read

The Explorer panel allows you to view and manage files in your test directory.

The panel shows the directory's content as a tree of subdirectories, files, and tests. See Test Structure for more information.

Explorer panel

You can manage test directories, files, fixtures, and tests using context menu commands. The available commands depend on the selected item in the panel.

The panel also has buttons for frequently-used actions: Record a New Test icon Record a New Test and Create aNew Fixture icon Create a New Fixture.

Create a Directory

To create a new directory, invoke the context menu for a directory where you want to create it and select New directory icon New Directory. Specify the directory name in the invoked dialog and click Create.

New Directory dialog

The new directory appears in the Explorer panel.

Create a Fixture

To create a new fixture, select a directory where you want to create it and click Create New Fixture icon Create a New Fixture or select the New fixture icon New Fixture command from the context menu. This invokes the Fixture Properties dialog.

Create a fixture

Specify the fixture's properties and click Create. The new file with a fixture appears in the Explorer panel.

Create a Test

You can create a new test in one of the following ways:

  • Record a test - Select the fixture where you want to create a test and click the Record button Record a New Test button. This automatically creates a new test, adds it to the fixture and starts recording.

  • Create an empty test - Select the fixture where you want to create a test and select New test icon New Test from the context menu to open the New Test dialog.

    New Test dialog

    Specify the test name and click Create. TestCafe Studio creates an empty test and opens it in the Test Editor.

Copy and Paste a Test or Hook

To copy a test or hook, do one of the following:

  • Invoke the context menu for this item and select Copy icon Copy from the context menu.
  • Select this item and press Cmd/Ctrl-C.

You can also copy several tests at once. To select multiple tests, use:

  • Cmd/Ctrl-click
  • Shift-click
  • Shift-Arrow
  • Shift-Page Up
  • Shift-Page Down
  • Cmd/Ctrl+A

Then copy these tests as described above. Note that you cannot copy more than one before each or after each hook.

To paste the copied items to a fixture, do one of the following:

  • Invoke the context menu for a desired fixture or .testcafe file and select Paste icon Paste from the context menu.
  • Select a fixture or .testcafe file and press Cmd/Ctrl-V.

Create a Test Script

To create a new file with a test script, invoke the context menu in the directory where you want to create a file and select New Test Script button New Test Script. Specify the file name and extension in the invoked dialog and click Create.

New Test Script dialog

The created file appears in the Explorer panel and opens in the Code Editor.

Create a File

To create a new file, invoke the context menu in the directory where you want to create a file and select New file icon New File. Specify the file name and extension in the invoked dialog and click Create.

New File dialog

The created file appears in the Explorer panel and opens in the Code Editor.

Create a Hook

You can use the Explorer panel to create an empty hook.

To add a hook to a fixture, invoke the context menu for this fixture and select Before each hook icon Add 'before each' hook or After each hook icon Add 'after each' hook.

Add an empty hook

Copy Actions to a Hook

Select Before each hook icon Copy actions to 'before each' hook or After each hook icon Copy actions to 'after each' hook from the context menu invoked for a test to copy all its actions to a hook.

Copy actions to a hook

TestCafe Studio appends these actions to an existing hook, or creates a new hook if none exists.

Run Tests

To run any runnable item (test, fixture or directory), hover the mouse over it and click the The Run test button Run test or Run all tests button next to this item.

To run several tests from different fixtures and directories, you can select multiple items with:

  • Cmd/Ctrl-click
  • Shift-click
  • Shift-Arrow
  • Shift-Page Up
  • Shift-Page Down
  • Cmd/Ctrl+A

Then click the The Run tests button Run Tests button next to any selected item.

Run multiple items

You can also use the context menu's Run test icon Run Test command to run tests.

Modify a Fixture's Properties

To edit fixture properties, open its context menu and select Edit icon Edit to invoke the Fixture Propeties dialog. You can change the fixture name, file name, target webpage, and authentication credentials in this dialog. To save the changes, click OK.

Fixture Properties dialog

Rename Tests

To rename a test, invoke its context menu and select Rename icon Rename. The Rename Test dialog appears. Specify the new test name and click Rename.

Rename Test dialog

Convert Recorded Tests to JavaScript

You can convert a recorded test or a fixture to a .js file. To do this, select a desired item in the Explorer panel, invoke its context menu and select Convert icon Convert to JavaScript Code. This invokes the Convert to JavaScript dialog. Specify the file name and extension, then click Create.

Convert to JavaScript Dialog

TestCafe Studio creates the test script file in the same test directory and displays it in the Explorer panel.

View Test Code

To open a test script file in the Code Editor, double-click it in the Explorer panel or invoke the context menu and select Show code icon Show Code.

Show Files in Windows Explorer/MacOS Finder

To view a fixture or directory in Windows Explorer and macOS Finder, invoke the context menu for the fixture or directory and select Show in Explorer icon Show in Explorer/Finder.

Delete Items

To delete a directory, file, recorded test, or hook, invoke its context menu and select Delete icon Delete. Click Yes in the confirmation dialog.

Note

The Delete command is not available for individual tests in test script files However, you can go to the Code Editor and delete these tests from code.

You can also delete several recorded tests from different files and directories. To do this, select the tests with Shift-click, Ctrl-click, or Command-click, then select Delete icon Delete from the context menu.

Delete multiple items