From e16ce4b4f1ecc3955a4e7da0aa7e2166eb9047bb Mon Sep 17 00:00:00 2001 From: jendib Date: Wed, 13 Apr 2016 01:30:02 +0200 Subject: [PATCH] Init e2e testing --- docs-web/src/main/webapp/package.json | 4 +++- docs-web/src/main/webapp/src/app/docs/app.js | 6 ++++- docs-web/src/main/webapp/test/conf.js | 21 +++++++++++++++++ docs-web/src/main/webapp/test/specs/temp.js | 24 ++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 docs-web/src/main/webapp/test/conf.js create mode 100644 docs-web/src/main/webapp/test/specs/temp.js diff --git a/docs-web/src/main/webapp/package.json b/docs-web/src/main/webapp/package.json index c8187b94..29eefd62 100644 --- a/docs-web/src/main/webapp/package.json +++ b/docs-web/src/main/webapp/package.json @@ -19,6 +19,8 @@ "grunt-contrib-less": "~0.9.0", "grunt-remove": "~0.1.0", "grunt-ngmin": "0.0.3", - "grunt-text-replace": "~0.3.11" + "grunt-text-replace": "~0.3.11", + "protractor": "~3.2.2", + "selenium": "~2.20.0" } } diff --git a/docs-web/src/main/webapp/src/app/docs/app.js b/docs-web/src/main/webapp/src/app/docs/app.js index 1e7cea18..a5d52311 100644 --- a/docs-web/src/main/webapp/src/app/docs/app.js +++ b/docs-web/src/main/webapp/src/app/docs/app.js @@ -371,4 +371,8 @@ angular.module('docs', $rootScope.ngProgress.start(); } }); -}); \ No newline at end of file +}); + +if (location.search.indexOf("protractor") > -1) { + window.name = 'NG_DEFER_BOOTSTRAP!'; +} \ No newline at end of file diff --git a/docs-web/src/main/webapp/test/conf.js b/docs-web/src/main/webapp/test/conf.js new file mode 100644 index 00000000..32e83645 --- /dev/null +++ b/docs-web/src/main/webapp/test/conf.js @@ -0,0 +1,21 @@ +'use strict'; + +exports.config = { + seleniumServerJar: '../node_modules/selenium/lib/runner/selenium-server-standalone-2.20.0.jar', + framework: 'jasmine', + rootElement: 'html', + baseUrl: 'http://localhost:9999/docs-web/src/?protractor', + capabilities: { + 'browserName': 'chrome' + }, + + specs: [ + 'specs/**/*.js' + ], + + jasmineNodeOpts: { + isVerbose: true, + showColors: true, + defaultTimeoutInterval: 30000 + } +}; \ No newline at end of file diff --git a/docs-web/src/main/webapp/test/specs/temp.js b/docs-web/src/main/webapp/test/specs/temp.js new file mode 100644 index 00000000..402d9709 --- /dev/null +++ b/docs-web/src/main/webapp/test/specs/temp.js @@ -0,0 +1,24 @@ +'use strict'; + +describe('document', function () { + it('should create and delete a document', function () { + browser.get(''); + + // Login as admin + element(by.model('user.username')).sendKeys('admin'); + element(by.model('user.password')).sendKeys('admin'); + element(by.css('.login-box button[type="submit"]')).click(); + + // Create a document + element(by.partialLinkText('Add a document')).click(); + element(by.model('document.title')).sendKeys('My test document'); + element(by.buttonText('Add')).click(); + + // Open the last document + element(by.css('.table-documents tbody tr:nth-child(1)')).click(); + + // Delete the document + element(by.partialButtonText('Delete')).click(); + element(by.partialButtonText('OK')).click(); + }); +}); \ No newline at end of file