You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/acceptance.md
+17-13Lines changed: 17 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,14 @@
1
1
# Acceptance Testing
2
2
3
-
How does your client, manager, or tester, or any other non-technical person, know your web application is working? By opening the browser, accessing a site, clicking on links, filling in the forms, and actually seeing the content on a web page.
3
+
How does your client, manager, or tester, or any other non-technical person, know your web application is working? By opening the browser, accessing a site, clicking on links, filling in the forms, and actually seeing the content on a web page.
4
4
5
5
Acceptance (also called End to End) tests can cover standard but complex scenarios from a user's perspective. With acceptance tests you can be confident that users, following all defined scenarios, won't get errors. We check **not just functionality of application but a user interface** (UI) as well.
6
6
7
-
By default CodeceptJS uses [WebDriverIO](http://127.0.0.1:8000/helpers/WebDriverIO/) helper and **Selenium** to automate browser. Within web page you can locate elements, interact with them, and check that expected elements are present on a page. That is what a test look like.
7
+
By default CodeceptJS uses [WebDriverIO](/helpers/WebDriverIO/) helper and **Selenium** to automate browser. Within web page you can locate elements, interact with them, and check that expected elements are present on a page.
8
+
However, you can also choose [SeleniumWebdriver](/helpers/SeleniumWebdriver) or [Protractor](/helpers/Protractor) helpers, driven by corresponding libraries.
9
+
No matter of helper and library you use for acceptance testing, CodeceptJS should execute same actions in similar manner.
10
+
11
+
That is what a test look like.
8
12
9
13
In case of CodeceptJS you can be sure that in code it will be as easy as it sounds. You just describe a test scenario with JavaScript DSL and allow the framework to handle the rest.
10
14
@@ -20,16 +24,16 @@ This is how we can check that login form of a simple web application works. At f
20
24
21
25
## Locating Element
22
26
23
-
Element can be found by CSS or XPath locators. Practically every steps
24
-
in WebDriverIO helper accept them both.
27
+
Element can be found by CSS or XPath locators. Practically every steps
28
+
in WebDriverIO helper accept them both.
25
29
26
30
```js
27
31
I.seeElement('.user'); // element with CSS class user
Copy file name to clipboardExpand all lines: docs/quickstart.md
+75-5Lines changed: 75 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,19 @@
1
1
# QuickStart
2
2
3
-
**NodeJS v 4.2.0** and higher required to start.
3
+
**NodeJS v 4.2.0** and higher required to start.
4
4
Install **CodeceptJS** with NPM:
5
5
6
+
You can install it globally:
7
+
6
8
```
7
-
npm install -g codeceptjs
9
+
[sudo] npm install -g codeceptjs
8
10
```
9
11
10
-
(you may need `sudo` to do it).
12
+
or locally
13
+
14
+
```
15
+
npm install --save-dev codeceptjs
16
+
```
11
17
12
18
## Setup
13
19
@@ -19,14 +25,18 @@ codeceptjs init
19
25
20
26
It will create `codecept.json` config in current directory (or provide path in the first argument).
21
27
22
-
You will be asked for tests location (they will be searched in current dir by default).
28
+
You will be asked for tests location (they will be searched in current dir by default).
23
29
24
30
On next step you are asked to select **Helpers**. Helpers include actions which can be used in tests.
25
31
We recommend to start with **WebDriverIO** helper in order to write acceptance tests using webdriverio library and Selenium Server as test runner.
32
+
If you want to test AngularJS application, use Protractor helper, or if you are more familiar with official Selenium Webdriver JS library, choose it.
33
+
No matter what helper you've chosen they will be similar in use.
26
34
27
35
```
28
-
? What helpers do you want to use?
36
+
? What helpers do you want to use?
29
37
❯◉ WebDriverIO
38
+
◯ Protractor
39
+
◯ SeleniumWebdriver
30
40
◯ FileSystem
31
41
```
32
42
@@ -52,5 +62,65 @@ WebDriverIO helper will ask for additional configuration as well:
52
62
53
63
If you agree with defaults, finish the installation.
54
64
65
+
Depending on a helper you've chosen you will be asked to install corresponding package manually in the end of init.
66
+
In case of webdriver you will need to run
67
+
68
+
```
69
+
[sudo] npm install -g webdriverio
70
+
```
71
+
72
+
for global installation. In case CodeceptJS is installed locally, webdriverio can be installed locally as well.
73
+
In a similar way you may install `protractor` or `selenium-webdriver`.
74
+
55
75
## Creating First Test
56
76
77
+
Tests can be easily created by running
78
+
79
+
```bash
80
+
codeceptjs gt
81
+
```
82
+
83
+
*(or `generate test`)*
84
+
85
+
Provide a test name and open generated file in your favorite JavaScript editor (with ES6 support).
86
+
87
+
```js
88
+
Feature('My First Test');
89
+
90
+
Scenario('test something', (I) => {
91
+
92
+
});
93
+
```
94
+
95
+
Inside the scenario block you can write your first test scenario by using [actions from WebDriverIO helper](/helpers/WebDriverIO/). Let's assume we have a web server on `localhost` is running and there is a **Welcome** text on the first page. The simplest test will look like this:
96
+
97
+
```js
98
+
Feature('My First Test');
99
+
100
+
Scenario('test something', (I) => {
101
+
I.amOnPage('/');
102
+
I.see('Welcome');
103
+
});
104
+
```
105
+
106
+
Before running this test we should ensure that [Selenium Web Server is running](/helpers/WebDriverIO/#selenium-installation). Then we can execute tests with
107
+
108
+
```bash
109
+
codeceptjs run --steps
110
+
```
111
+
112
+
*steps option will display test execution process in console*
113
+
114
+
If everything is done right, you will see in console:
0 commit comments