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
We've reached the final part of our introduction to testing. We're going to wrap up our testing section with integration testing. As a reminder of what Integration testing is, it's the process of automating the experience that our actual users experience as they use our application.
19
+
We've reached the final part of our introduction to testing. We're going to wrap up our testing section with integration testing. As a reminder of what Integration testing is, it's the process of automating the experience that our actual users experience as they use our application.
20
20
21
21
<divclass="demo"id="demo1"></div>
22
22
@@ -26,7 +26,7 @@ As we're integration testing, we'll need to have our app actually running as we'
26
26
27
27
## Install
28
28
29
-
The easiest way to install [selenium](http://docs.seleniumhq.org/download/) is to download it through the the selenium website at: [http://docs.seleniumhq.org/download/](http://docs.seleniumhq.org/download/).
29
+
The easiest way to install [selenium](http://docs.seleniumhq.org/download/) is to download it through the the selenium website at: [http://docs.seleniumhq.org/download/](http://docs.seleniumhq.org/download/).
30
30
31
31
> If you're on a mac, you can use [Homebrew](http://brew.sh) with the `brew` command:
32
32
>
@@ -106,7 +106,7 @@ mkdir tests
106
106
touch tests/auth-flow.js
107
107
```
108
108
109
-
The nightwatch tests can be set as an object of exports, where the key is the description of the test and the value is a function with a reference to the client browser. For instance, we'll set up four tests for our `tests/auth-flow.js` test.
109
+
The nightwatch tests can be set as an object of exports, where the key is the description of the test and the value is a function with a reference to the client browser. For instance, we'll set up four tests for our `tests/auth-flow.js` test.
110
110
111
111
Updating our `tests/auth-flow.js` file with these four test functions look like the following:
112
112
@@ -119,7 +119,7 @@ module.exports = {
119
119
}
120
120
```
121
121
122
-
Each of the functions in our object exports will receive a `browser` instance which serves as the interface between our test and the selenium webdriver. We have all sorts of available options we can run on this `browser` variable.
122
+
Each of the functions in our object exports will receive a `browser` instance which serves as the interface between our test and the selenium webdriver. We have all sorts of available options we can run on this `browser` variable.
123
123
124
124
Let's write our first test to demonstrate this function. We're going to set up nightwatch so that it launches the page, and clicks on the Login link in the navbar. We'll take the following steps to do this:
125
125
@@ -150,7 +150,7 @@ module.exports = {
150
150
151
151
Thats it. Before we get too far ahead, let's run this test to make sure our test setup works. We'll need to open 3 terminal windows here.
152
152
153
-
In the first terminal window, let's launch selenium. If you downloaded the `.jar` file, you can start this with the command:
153
+
In the first terminal window, let's launch selenium. If you downloaded the `.jar` file, you can start this with the command:
When we run the `nightwatch` command, we'll see a chrome window open up, visit the site, and click on the login link automatically... (pretty cool, right?).
184
184
185
-
All of our tests pass at this point. Let's actually tell the browser to log a user in.
185
+
All of our tests pass at this point. Let's actually tell the browser to log a user in.
186
186
187
187
Since the first step will run, the browser will already be on the login page. In the second key of our tests, we'll want to take the following steps:
One final note, if you're interested in a deeper set of selenium tutorials, check out the free tutorials from guru99.com at [https://www.guru99.com/selenium-tutorial.html](https://www.guru99.com/selenium-tutorial.html). They are pretty in-depth and well done (in our opinion).
307
+
306
308
That's it! We've made it and have covered 3 types of testing entirely, from low-level up through faking a real browser instance. Now we have the tools to ensure our applications are ready for full deployment.
307
309
308
310
But wait, we don't actually have deployment figured out yet, do we? Stay tuned for tomorrow when we start getting our application deployed into the cloud.
0 commit comments