Skip to content

Commit e0789d6

Browse files
committed
run a blackbox test suite as part of circleci
closes #2507
1 parent 2ac39e6 commit e0789d6

File tree

8 files changed

+1195
-11
lines changed

8 files changed

+1195
-11
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,16 @@ OFFLINE_SSR_TEST=true SDC_DATABASE_URL="mysql://[email protected]/steemit_dev" NODE
290290

291291
This will read data from the blobs in `api_mockdata` directory. If you want to use another set of mock data, create a similar directory to that one and add an argument `OFFLINE_SSR_TEST_DATA_DIR` pointing to your new directory.
292292

293+
### Run blackbox tests using nightwatch
294+
295+
To run a Selenium test suite, start the condenser docker image with a name `condenser` (like `docker run --name condenser -itp 8080:8080 steemit/condenser:latest`) and then run the blackboxtest image attached to the condneser image's network:
296+
297+
```
298+
docker build -t=steemit/condenser-blackboxtest blackboxtest/
299+
docker run --network container:condenser steemit/condenser-blackboxtest:latest
300+
301+
```
302+
293303
## Issues
294304

295305
To report a non-critical issue, please file an issue on this GitHub project.

blackboxtest/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM circleci/openjdk:jdk-node-browsers
2+
3+
WORKDIR /home/circleci
4+
COPY package.json yarn.lock nightwatch-deps.sh /home/circleci/
5+
RUN yarn install --non-interactive --frozen-lockfile
6+
RUN curl -s https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar > /home/circleci/selenium-server-standalone.jar
7+
RUN curl -s https://chromedriver.storage.googleapis.com/2.36/chromedriver_linux64.zip | funzip > /home/circleci/chromedriver && chmod +x /home/circleci/chromedriver
8+
9+
COPY . /home/circleci/
10+
11+
12+
CMD [ "/home/circleci/node_modules/nightwatch/bin/nightwatch", "--config", "/home/circleci/nightwatch.json" ]
13+
14+

blackboxtest/nightwatch-deps.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
curl -s https://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar > ./selenium-server-standalone.jar
3+
curl -s https://chromedriver.storage.googleapis.com/2.36/chromedriver_linux64.zip | funzip > ./chromedriver && chmod +x ./chromedriver
4+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
'Ensure homepage loads without strange errors': browser => {
3+
browser
4+
.url('http://localhost:8080')
5+
.pause(300)
6+
//.assert.containsText('h1.articles__h1', 'Trending: All tags')
7+
.assert.containsText('a.Header__login-link', 'Login')
8+
.getLog('browser', function(result) {
9+
this.assert.ok(
10+
reasonableErrorLog(result),
11+
'error log is reasonable'
12+
);
13+
})
14+
.end();
15+
},
16+
};
17+
18+
function reasonableErrorLog(logs) {
19+
return (
20+
logs[0].message ===
21+
'http://localhost:8080/api/v1/page_view - Failed to load resource: the server responded with a status of 500 (Internal Server Error)' &&
22+
logs.length === 1
23+
);
24+
}

blackboxtest/nightwatch.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"src_folders" : ["/home/circleci/nightwatch-tests"],
3+
"output_folder" : "/home/circleci/nightwatch-reports",
4+
"custom_commands_path" : "",
5+
"custom_assertions_path" : "",
6+
"page_objects_path" : "",
7+
"globals_path" : "",
8+
9+
"selenium" : {
10+
"start_process" : true,
11+
"server_path" : "/home/circleci/selenium-server-standalone.jar",
12+
"log_path" : "",
13+
"port" : 4444,
14+
"cli_args" : {
15+
"webdriver.chrome.driver" : "/home/circleci/chromedriver"
16+
}
17+
},
18+
19+
"test_settings" : {
20+
"default" : {
21+
"launch_url" : "http://localhost",
22+
"selenium_port" : 4444,
23+
"selenium_host" : "localhost",
24+
"silent": true,
25+
"screenshots" : {
26+
"enabled" : false,
27+
"path" : ""
28+
},
29+
"desiredCapabilities": {
30+
"browserName": "chrome",
31+
"javascriptEnabled": true,
32+
"acceptSslCerts": true
33+
}
34+
},
35+
36+
"chrome" : {
37+
"desiredCapabilities": {
38+
"browserName": "chrome",
39+
"javascriptEnabled": true,
40+
"acceptSslCerts": true
41+
}
42+
}
43+
}
44+
}

blackboxtest/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "condenser-blackboxtest",
3+
"version": "1.0.0",
4+
"main": "false",
5+
"license": "MIT",
6+
"dependencies": {
7+
"nightwatch": "0.9.19",
8+
"phantomjs-prebuilt": "2.1.16"
9+
}
10+
}

0 commit comments

Comments
 (0)