Skip to content

Commit

Permalink
ic: refactoring e2e tests + adding 1 test
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Jan 14, 2017
1 parent 93e6f2c commit 6e83f4d
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nightwatch.conf.js
Expand Up @@ -3,7 +3,7 @@ const BINPATH = './node_modules/nightwatch/bin/';

module.exports = {
"src_folders": [
"tests/functional"
"tests/e2e"
],
"output_folder": "./reports",
"test_runner" : "mocha",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -13,9 +13,9 @@
"test-cov": "istanbul cover _mocha -- --recursive --compilers js:babel-register --require babel-polyfill",
"test-coveralls": "istanbul cover _mocha --report lcovonly -- --recursive --compilers js:babel-register --require babel-polyfill -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"install-selenium": "node nightwatch.conf.js",
"pretest-func": "ROOT=$PWD/tests/demo ./dist/index.js serve -p 3003 &",
"test-func": "sleep 6 && node_modules/.bin/nightwatch --config nightwatch.conf.js",
"posttest-func": "kill -9 $(lsof -ti tcp:3003)",
"pretest-e2e": "ROOT=$PWD/tests/demo ./dist/index.js serve -p 3003 &",
"test-e2e": "sleep 6 && node_modules/.bin/nightwatch --config nightwatch.conf.js",
"posttest-e2e": "kill -9 $(lsof -ti tcp:3003)",
"start": "node --debug --harmony ./dist/server/index.js",
"babel": "babelify --presets [ es2015 ] src/server/public/abejs/scripts/template-engine.js -o src/server/public/abejs/scripts/template-engine-compiled.js",
"watch": "./node_modules/.bin/parallelshell './node_modules/.bin/watchify -v -t [ babelify --presets [ es2015 ] ] src/server/public/abejs/scripts/template-engine.js -o src/server/public/abejs/scripts/template-engine-compiled.js' './node_modules/.bin/watchify -v -t [ babelify --presets [ es2015 ] ] src/server/public/abejs/scripts/admin.js -o src/server/public/abejs/scripts/admin-compiled.js' './node_modules/.bin/watchify -v -t [ babelify --presets [ es2015 ] ] src/server/public/abejs/scripts/user-login.js -o src/server/public/abejs/scripts/user-login-compiled.js' 'npm run watch:sass'",
Expand Down
34 changes: 34 additions & 0 deletions tests/demo/data/articles/article-3-abe-d20170114T011124015Z.json
@@ -0,0 +1,34 @@
{
"abe_meta": {
"template": "single",
"link": "/articles/article-3.html",
"complete": "100",
"type": "publish",
"date": "2016-11-05T17:05:38.370Z",
"latest": {
"date": "2017-01-14T01:11:24.015Z",
"abeUrl": "/articles/article-3-abe-d20170114T011124015Z.html"
},
"status": "draft",
"draft": {
"date": "2016-11-05T17:05:38.370Z",
"abeUrl": "/articles/article-3-abe-d20161105T170538370Z.html",
"latest": {
"date": "2017-01-14T01:11:24.015Z",
"abeUrl": "/articles/article-3-abe-d20170114T011124015Z.html"
}
},
"cleanName": "article-3",
"cleanFilename": "/articles"
},
"article_main_image": "/image/5238561864_86a3ccb678_b-7c9e.jpg",
"article_title": "Article 3",
"article_date": "20 March 2016",
"article_highlight": "another highlight",
"category_json": [
{
"category": "Photography"
}
],
"article_content": "This is the content of article 3"
}
50 changes: 50 additions & 0 deletions tests/demo/reference/months.json
@@ -0,0 +1,50 @@
[
{
"month": "January",
"monthFormated": "01"
},
{
"month": "February",
"monthFormated": "02"
},
{
"month": "March",
"monthFormated": "03"
},
{
"month": "April",
"monthFormated": "04"
},
{
"month": "May",
"monthFormated": "05"
},
{
"month": "June",
"monthFormated": "06"
},
{
"month": "July",
"monthFormated": "07"
},
{
"month": "August",
"monthFormated": "08"
},
{
"month": "September",
"monthFormated": "09"
},
{
"month": "October",
"monthFormated": "10"
},
{
"month": "November",
"monthFormated": "11"
},
{
"month": "December",
"monthFormated": "12"
}
]
26 changes: 26 additions & 0 deletions tests/demo/reference/years.json
@@ -0,0 +1,26 @@
[
{
"year": 2017,
"yearFormated": 17
},
{
"year": 2018,
"yearFormated": 18
},
{
"year": 2019,
"yearFormated": 19
},
{
"year": 2020,
"yearFormated": 20
},
{
"year": 2021,
"yearFormated": 21
},
{
"year": 2022,
"yearFormated": 22
}
]
12 changes: 12 additions & 0 deletions tests/demo/templates/slug.html
@@ -0,0 +1,12 @@
{{abe type="slug" source="acl-{{testYear[0].yearFormated}}{{testMonth[0].monthFormated}}-en-1"}}
{{abe type='data' key='testYear' source='reference/years.json' desc='Year' required="true" display="year" tab="slug" visible="false" max-length="1"}}
{{abe type='data' key='testMonth' source='reference/months.json' desc='Month' required="true" display="month" tab="slug" visible="false" max-length="1"}}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>title</title>
</head>
<body>
content
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions tests/e2e/slug/slug.js
@@ -0,0 +1,34 @@
describe('Abe', function() {

describe('slug', function() {

before(function(client, done) {
done();
});

after(function(client, done) {
client.end(function() {
done();
});
});

afterEach(function(client, done) {
done();
});

beforeEach(function(client, done) {
done();
});

it('Create a slug template post', function(client) {
client
.useXpath()
.url('http://localhost:3003/abe/editor')
.click('//*[@id="selectTemplate"]/option[11]')
.pause(1000)
.elements('xpath',"//div[@data-precontrib-templates='slug']", function (result) {
client.assert.equal(result.value.length, 2);
});
});
});
});

0 comments on commit 6e83f4d

Please sign in to comment.