Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Fixes for docs 2.0 #5054

Merged
merged 3 commits into from May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 27 additions & 24 deletions docs/README.md
Expand Up @@ -6,7 +6,7 @@
* [Guides](articles/documentation/guides/README.md)
* Basic Guides
* [Install TestCafe](articles/documentation/guides/basic-guides/install-testcafe.md)
* [Test Organization](articles/documentation/guides/basic-guides/test-organization.md)
* [Organize Tests](articles/documentation/guides/basic-guides/organize-tests.md)
* [Select Page Elements](articles/documentation/guides/basic-guides/select-page-elements.md)
* [Interact with the Page](articles/documentation/guides/basic-guides/interact-with-the-page.md)
* [Assert](articles/documentation/guides/basic-guides/assert.md)
Expand Down Expand Up @@ -133,14 +133,14 @@
* [expect.lt](articles/documentation/reference/test-api/testcontroller/expect/lt.md)
* [expect.lte](articles/documentation/reference/test-api/testcontroller/expect/lte.md)
* [expect.match](articles/documentation/reference/test-api/testcontroller/expect/match.md)
* [expect.notcontains](articles/documentation/reference/test-api/testcontroller/expect/notcontains.md)
* [expect.noteql](articles/documentation/reference/test-api/testcontroller/expect/noteql.md)
* [expect.notmatch](articles/documentation/reference/test-api/testcontroller/expect/notmatch.md)
* [expect.notok](articles/documentation/reference/test-api/testcontroller/expect/notok.md)
* [expect.nottypeof](articles/documentation/reference/test-api/testcontroller/expect/nottypeof.md)
* [expect.notwithin](articles/documentation/reference/test-api/testcontroller/expect/notwithin.md)
* [expect.notContains](articles/documentation/reference/test-api/testcontroller/expect/notcontains.md)
* [expect.notEql](articles/documentation/reference/test-api/testcontroller/expect/noteql.md)
* [expect.notMatch](articles/documentation/reference/test-api/testcontroller/expect/notmatch.md)
* [expect.notOk](articles/documentation/reference/test-api/testcontroller/expect/notok.md)
* [expect.notTypeOf](articles/documentation/reference/test-api/testcontroller/expect/nottypeof.md)
* [expect.notWithin](articles/documentation/reference/test-api/testcontroller/expect/notwithin.md)
* [expect.ok](articles/documentation/reference/test-api/testcontroller/expect/ok.md)
* [expect.typeof](articles/documentation/reference/test-api/testcontroller/expect/typeof.md)
* [expect.typeOf](articles/documentation/reference/test-api/testcontroller/expect/typeof.md)
* [expect.within](articles/documentation/reference/test-api/testcontroller/expect/within.md)
* [fixtureCtx](articles/documentation/reference/test-api/testcontroller/fixturectx.md)
* [getBrowserConsoleMessages](articles/documentation/reference/test-api/testcontroller/getbrowserconsolemessages.md)
Expand Down Expand Up @@ -194,19 +194,22 @@
* [createLiveModeRunner](articles/documentation/reference/testcafe-api/testcafe/createlivemoderunner.md)
* [createRunner](articles/documentation/reference/testcafe-api/testcafe/createrunner.md)
* [Recipes](articles/documentation/recipes/README.md)
* [Access Environment Variables in Tests](articles/documentation/recipes/access-environment-variables-in-tests.md)
* [Create Data-Driven Tests](articles/documentation/recipes/create-data-driven-tests.md)
* [Debug Tests](articles/documentation/recipes/debug-tests/README.md)
* [Chrome Developer Tools](articles/documentation/recipes/debug-tests/chrome-dev-tools.md)
* [Visual Studio Code](articles/documentation/recipes/debug-tests/visual-studio-code.md)
* [WebStorm](articles/documentation/recipes/debug-tests/webstorm.md)
* [Create Helpers](articles/documentation/recipes/create-helpers.md)
* [Find Code Issues with Flow Type Checker](articles/documentation/recipes/find-code-issues-with-flow-type-checker.md)
* [Import Third-Party Modules](articles/documentation/recipes/import-third-party-modules.md)
* [Test <select> Elements](articles/documentation/recipes/test-select-elements.md)
* [Test Static HTML Pages](articles/documentation/recipes/test-static-html-pages.md)
* [Test on Remote Computers and Mobile Devices](articles/documentation/recipes/test-on-remote-computers-and-mobile-devices.md)
* [Use Angular CLI Builder](articles/documentation/recipes/use-angular-cli-builder.md)
* [Use Task Runners](articles/documentation/recipes/use-task-runners/README.md)
* [Grunt](articles/documentation/recipes/use-task-runners/grunt.md)
* [Gulp](articles/documentation/recipes/use-task-runners/gulp.md)
* Basics
* [Test \<select\> Elements](articles/documentation/recipes/basics/test-select-elements.md)
* [Test Static HTML Pages](articles/documentation/recipes/basics/test-static-html-pages.md)
* [Test on Remote Computers and Mobile Devices](articles/documentation/recipes/basics/test-on-remote-computers-and-mobile-devices.md)
* Best Practices
* [Create Helpers](articles/documentation/recipes/best-practices/create-helpers.md)
* [Create Data-Driven Tests](articles/documentation/recipes/best-practices/create-data-driven-tests.md)
* Integrations
* [Import Third-Party Modules](articles/documentation/recipes/integrations/import-third-party-modules.md)
* [Angular CLI Builder](articles/documentation/recipes/integrations/use-angular-cli-builder.md)
* [Gulp](articles/documentation/recipes/integrations/gulp.md)
* [Grunt](articles/documentation/recipes/integrations/grunt.md)
* [Flow Type Checker](articles/documentation/recipes/integrations/find-code-issues-with-flow-type-checker.md)
* Configuration
* [Access Environment Variables in Tests](articles/documentation/recipes/configuration/access-environment-variables-in-tests.md)
* Debugging
* [Chrome Developer Tools](articles/documentation/recipes/debugging/chrome-dev-tools.md)
* [Visual Studio Code](articles/documentation/recipes/debugging/visual-studio-code.md)
* [WebStorm](articles/documentation/recipes/debugging/webstorm.md)
6 changes: 3 additions & 3 deletions docs/articles/documentation/getting-started/README.md
Expand Up @@ -42,21 +42,21 @@ Firstly, import the `testcafe` module.
import { Selector } from 'testcafe';
```

Then declare a fixture using the [fixture](../guides/basic-guides/test-organization.md#fixtures) function.
Then declare a fixture using the [fixture](../guides/basic-guides/organize-tests.md#fixtures) function.

```js
fixture `Getting Started`
```

In this tutorial, you create a test for the [http://devexpress.github.io/testcafe/example](/testcafe/example) sample page.
Specify this page as a start page for the fixture using the [page](../guides/basic-guides/test-organization.md#specify-the-start-webpage) function.
Specify this page as a start page for the fixture using the [page](../guides/basic-guides/organize-tests.md#specify-the-start-webpage) function.

```js
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;
```

Then, create the [test](../guides/basic-guides/test-organization.md#tests) function where you can enter test code.
Then, create the [test](../guides/basic-guides/organize-tests.md#tests) function where you can enter test code.

```js
import { Selector } from 'testcafe';
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/documentation/guides/README.md
Expand Up @@ -8,7 +8,7 @@ permalink: /documentation/guides/
## Basic Guides

* [Install TestCafe](basic-guides/install-testcafe.md)
* [Test Organization](basic-guides/test-organization.md)
* [Organize Tests](basic-guides/organize-tests.md)
* [Select Page Elements](basic-guides/select-page-elements.md)
* [Interact with the Page](basic-guides/interact-with-the-page.md)
* [Assert](basic-guides/assert.md)
Expand Down
Expand Up @@ -11,6 +11,13 @@ redirect_from:

TestCafe includes a [user role](#user-roles) mechanism that allows you to emulate user actions to log in to a website. You can also use [HTTP Basic and NTLM](#http-authentication) authentication.

* [User Roles](#user-roles)
* [Why Use Roles](#why-use-roles)
* [Create and Apply Roles](#create-and-apply-roles)
* [Anonymous Role](#anonymous-role)
* [HTTP Authentication](#http-authentication)
* [Troubleshooting](#troubleshooting)

## User Roles

Many test scenarios involve activity from more than one user. TestCafe allows you to isolate test actions required to authenticate a user (e.g., enter credentials, click 'Sign in'). During the test, you can switch between user accounts with a single method call.
Expand All @@ -19,10 +26,10 @@ A *role* contains code that logs in a particular user. You can define a role for

### Why Use Roles

Unlike other methods used to [extract reusable test logic](../../recipes/extract-reusable-test-code/README.md), roles are designed for login operations and provide the following dedicated features:
Unlike [page models](../concepts/page-model.md) or [helper functions](../../recipes/best-practices/create-helpers.md), roles are designed for login operations and provide the following dedicated features:

* **Object-based API.** Authentication data and logic are stored in an object that is easy to pass and activate when needed.
* **Single login.** Login actions are not repeated when you switch to a previously used role within the same session. If you activate a role in the [beforeEach](../basic-guides/test-organization.md#test-hooks) hook, login actions run once before the first test. Subsequent tests reuse authentication data so that it happens instantly.
* **Single login.** Login actions are not repeated when you switch to a previously used role within the same session. If you activate a role in the [beforeEach](../basic-guides/organize-tests.md#test-hooks) hook, login actions run once before the first test. Subsequent tests reuse authentication data so that it happens instantly.
* **Automatic return.** The browser automatically navigates back to the page where you switched roles. (You can disable this behavior if required.)
* **No logout needed.** Authentication data is automatically cleared when you switch between roles.
* **Multiple authentication support.** If you log in to different services/websites during a test, authentication data from cookie and browser storage accumulates in the active role. When you switch back to this role within the same test, you are automatically logged in to all websites.
Expand Down
Expand Up @@ -41,7 +41,7 @@ Property | Type | Description | Example

### Create a Browser-Specific Hook

The following example shows how to create a [beforeEach](../basic-guides/test-organization.md#test-hooks) hook that runs for particular [browser engines](../../reference/test-api/testcontroller/browser.md#engine) only:
The following example shows how to create a [beforeEach](../basic-guides/organize-tests.md#test-hooks) hook that runs for particular [browser engines](../../reference/test-api/testcontroller/browser.md#engine) only:

```js
import { Selector } from 'testcafe';
Expand Down
Expand Up @@ -17,6 +17,11 @@ redirect_from:

This section describes how to handle HTTP requests in your tests. TestCafe ships with request hooks that allow you to log the requests and mock the responses. You can also create a custom HTTP request hook, which enables you, for instance, to emulate authentications like **Kerberos** or **Client Certificate Authentication**.

* [Log HTTP Requests](#log-http-requests)
* [Mock HTTP Requests](#mock-http-requests)
* [Create a Custom Request Hook](#create-a-custom-request-hook)
* [Attach Hooks to Tests and Fixtures](#attach-hooks-to-tests-and-fixtures)

## Log HTTP Requests

You can use the [request logger](../../reference/test-api/requestlogger/README.md) to record HTTP requests the tested web app sends and responses it receives. For instance, you may want to make sure that the data from a remote service is correct.
Expand Down
1 change: 1 addition & 0 deletions docs/articles/documentation/guides/basic-guides/assert.md
Expand Up @@ -16,6 +16,7 @@ This topic consists of the following sections:

* [Assertion Structure](#assertion-structure)
* [Smart Assertion Query Mechanism](#smart-assertion-query-mechanism)
* [Options](#options)

## Assertion Structure

Expand Down
Expand Up @@ -19,6 +19,20 @@ redirect_from:

Test API provides a set of **actions** you can use to interact with the page.

* [Click](#click)
* [Press Key](#press-key)
* [Navigate](#navigate)
* [Type Text](#type-text)
* [Select Text](#select-text)
* [Hover](#hover)
* [Drag Elements](#drag-elements)
* [Upload Files](#upload-files)
* [Take Screenshot](#take-screenshot)
* [Work with iframes](#work-with-iframes)
* [Handle Native Dialogs](#handle-native-dialogs)
* [Resize Window](#resize-window)
* [Wait](#wait)

They are implemented as methods in the [test controller](../../reference/test-api/testcontroller/README.md) object. You can call them in a chained fashion.

The available actions with reproducible usage examples and links to their descriptions are listed below.
Expand Down
Expand Up @@ -12,6 +12,17 @@ redirect_from:

TestCafe allows you to create *client functions* that can return any serializable value from the client side, such as the current URL or custom data calculated by a client script.

* [Client Function Constructor](#client-function-constructor)
* [Run Asynchronous Client Code](#run-asynchronous-client-code)
* [Execute Client Functions](#execute-client-functions)
* [Overwrite Client Function Options](#overwrite-client-function-options)
* [One-Time Client Code Execution](#one-time-client-code-execution)
* [Import Functions to be Used as Client Function Dependencies](#import-functions-to-be-used-as-client-function-dependencies)
* [Call Client Functions from Node.js Callbacks](#call-client-functions-from-nodejs-callbacks)
* [Client Function Limitations](#client-function-limitations)
* [Access Console Messages](#access-console-messages)
* [Examples](#examples)

> Do not modify the tested webpage within client functions.
> Use [test actions](interact-with-the-page.md) to interact with the page instead.

Expand Down Expand Up @@ -59,7 +70,7 @@ test('My Test', async t => {
});
```

## Overwrite Client Function Option
## Overwrite Client Function Options

Overwrite client function options via the ClientFunction's [with](../../reference/test-api/clientfunction/with.md) method.

Expand Down
@@ -1,11 +1,11 @@
---
layout: docs
title: Test Organization
permalink: /documentation/guides/basic-guides/test-organization.html
title: Organize Tests
permalink: /documentation/guides/basic-guides/organize-tests.html
redirect_from:
- /documentation/test-api/test-code-structure.html
---
# Test Organization
# Organize Tests

This topic describes how to organize test code, declare fixtures, tests, and hooks.

Expand Down
27 changes: 25 additions & 2 deletions docs/articles/documentation/guides/basic-guides/run-tests.md
Expand Up @@ -29,6 +29,29 @@ testCafe.close();

TestCafe also allows you to create a [configuration file](../../reference/configuration-file.md) where you can define test run settings. You can then omit these settings in the command line or API to use values from the configuration file.

* [Specify Tests to Run](#specify-tests-to-run)
* [Run Tests From Multiple Sources](#run-tests-from-multiple-sources)
* [Use Glob Patterns](#use-glob-patterns)
* [Filter Tests and Fixtures by Name](#filter-tests-and-fixtures-by-name)
* [Filter Tests and Fixtures by Metadata](#filter-tests-and-fixtures-by-metadata)
* [Specify Target Browsers](#specify-target-browsers)
* [Use Multiple Browsers](#use-multiple-browsers)
* [Run Tests in All Installed Browsers](#run-tests-in-all-installed-browsers)
* [Test in Portable Browsers](#test-in-portable-browsers)
* [Use Headless Mode](#use-headless-mode)
* [Enable Mobile Device Emulation](#enable-mobile-device-emulation)
* [Test in Cloud Testing Services](#test-in-cloud-testing-services)
* [Test on Remote and Mobile Devices](#test-on-remote-and-mobile-devices)
* [Specify the Report Format](#specify-the-report-format)
* [Customize Screenshot and Video Settings](#customize-screenshot-and-video-settings)
* [Run Tests Concurrently](#run-tests-concurrently)
* [Stage the Tested App](#stage-the-tested-app)
* [Provide a Proxy URL](#provide-a-proxy-url)
* [Live Mode](#live-mode)
* [How Live Mode Works](#how-live-mode-works)
* [Console Shortcuts in Live Mode](#console-shortcuts-in-live-mode)
* [Quarantine Mode](#quarantine-mode)

## Specify Tests to Run

You should specify a path to a file or directory with tests you want to run in the [second command line argument](../../reference/command-line-interface.md#file-pathglob-pattern):
Expand Down Expand Up @@ -479,7 +502,7 @@ testcafe -c 2 remote:4 tests/test.js

If you test against multiple remote browsers, open and connect all instances of one browser before connecting the next browser.

## Deploy the Tested App
## Stage the Tested App

TestCafe can execute a specified shell command before it starts tests. For instance, you can run a command that starts a local web server and deploys the tested app. TestCafe automatically terminates the process when tests are finished.

Expand Down Expand Up @@ -598,7 +621,7 @@ You can use live mode with any browsers: local, remote, mobile or headless.

> Important! Live mode is designed to work with tests locally. Do not use it in CI systems.

**Tip:** use the [only](test-organization.md#skip-tests) function to work with a single test.
**Tip:** use the [only](organize-tests.md#skip-tests) function to work with a single test.

### Console Shortcuts in Live Mode

Expand Down
Expand Up @@ -65,6 +65,28 @@ const parent = Selector('#query-my-parent').parent();

You can use selectors to [inspect elements](#obtain-element-state), define [action targets](#define-action-targets), and [assertion actual values](#define-assertion-actual-value).

* [Create Selectors](#create-selectors)
* [Member Tables](#member-tables)
* [Use Selectors](#use-selectors)
* [Check if an Element Exists](#check-if-an-element-exists)
* [Obtain Element State](#obtain-element-state)
* [DOM Node Snapshot](#dom-node-snapshot)
* [Define Action Targets](#define-action-targets)
* [Define Assertion Actual Value](#define-assertion-actual-value)
* [Selector Timeout](#selector-timeout)
* [Debug Selectors](#debug-selectors)
* [Extend Selectors with Custom Properties and Methods](#extend-selectors-with-custom-properties-and-methods)
* [Overwrite Options](#overwrite-options)
* [Framework-Specific Selectors](#framework-specific-selectors)
* [React](#react)
* [Angular](#angular)
* [AngularJS](#angularjs)
* [Vue](#vue)
* [Aurelia](#aurelia)
* [Call Selectors from Node.js Callbacks](#call-selectors-from-nodejs-callbacks)
* [Limitations](#limitations)
* [Examples](#examples)

> Important! Do not modify the tested webpage within selectors.
> To interact with the page, use [test actions](interact-with-the-page.md).

Expand Down Expand Up @@ -135,7 +157,7 @@ const sel = Selector('div').child();
</html>
```

### Member Tables
## Member Tables

The following methods filter elements from the selector:

Expand Down
14 changes: 14 additions & 0 deletions docs/articles/documentation/guides/concepts/browsers.md
Expand Up @@ -16,8 +16,22 @@ redirect_from:
This topic lists browsers supported by TestCafe and describes how to use various browser features.

* [Browser Support](#browser-support)
* [Officially Supported Browsers](#officially-supported-browsers)
* [Locally Installed Browsers](#locally-installed-browsers)
* [Portable Browsers](#portable-browsers)
* [Browsers on Remote Devices](#browsers-on-remote-devices)
* [Browsers in Cloud Testing Services](#browsers-in-cloud-testing-services)
* [Microsoft Edge Legacy Support](#microsoft-edge-legacy-support)
* [Nonconventional Browsers](#nonconventional-browsers)
* [Test in Headless Mode](#test-in-headless-mode)
* [Automation Port](#automation-port)
* [Use Chromium Device Emulation](#use-chromium-device-emulation)
* [Emulate a Device](#emulate-a-device)
* [Emulate Screen Size](#emulate-screen-size)
* [Use Emulation in Headless Mode](#use-emulation-in-headless-mode)
* [Use Emulation in Chrome Portable](#use-emulation-in-chrome-portable)
* [Substitute a User Agent](#substitute-a-user-agent)
* [Emulator Parameters](#emulator-parameters)
* [User Profiles](#user-profiles)

## Browser Support
Expand Down