diff --git a/conf.js b/conf.js new file mode 100644 index 0000000..f0b2b58 --- /dev/null +++ b/conf.js @@ -0,0 +1,35 @@ +var admin = { + 'username': 'admin', + 'password': 'admin123' +}; + +// An example configuration file. +exports.config = { + // The address of a running selenium server. + seleniumAddress: 'http://localhost:4444/wd/hub', + + // Capabilities to be passed to the webdriver instance. + capabilities: { + 'browserName': 'chrome' + }, + + // Spec patterns are relative to the current working directly when + // protractor is called. + specs: ['tests/js/e2e/specs/*.js'], + + baseUrl: 'http://0.0.0.0:5000', + + // Options to be passed to Jasmine-node. + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000 + }, + + onPrepare: function() { + browser.driver.get('http://0.0.0.0:5000/login/'); + + browser.driver.findElement(by.name('username')).sendKeys(admin.username); + browser.driver.findElement(by.name('password')).sendKeys(admin.password); + browser.driver.findElement(by.id('submit')).click(); + } +}; diff --git a/karma.conf.js b/karma.conf.js index dbded95..49735c1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -13,7 +13,7 @@ module.exports = function(config){ 'static/components/angular-mocks/angular-mocks.js', 'static/js/*.js', 'static/js/**/*.js', - 'tests/js/unit/spec/*.js' + 'tests/js/unit/specs/*.js' ], // preprocess matching files before serving them to the browser diff --git a/package.json b/package.json index da59921..6089198 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "karma-chrome-launcher": "^0.1.4", "karma-cli": "0.0.4", "karma-jasmine": "^0.1.5", - "karma-spec-reporter": "^0.0.13" + "karma-spec-reporter": "^0.0.13", + "protractor": "^0.24.2" }, "scripts": { "test": "cd tests/js/unit/ && karma start --single-run --reporters spec" diff --git a/readme.md b/readme.md index 18cf6c3..e7d9ffe 100755 --- a/readme.md +++ b/readme.md @@ -162,10 +162,27 @@ Download and install Node from [http://nodejs.org/download/](http://nodejs.org/d curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash # Select Nvm -nvm use v0.10.29 +nvm alias default v0.10.29 # Installing all node packaged modules npm install + +# Install Protractor global +npm install -g protractor + +# Install Selenium +webdriver-manager update +``` + +Run Unit tests +```shell +npm test +``` + +Run Integration tests +```shell +webdriver-manager start +protractor conf.js ``` diff --git a/templates/admin/login/login.html b/templates/admin/login/login.html index 4e0245a..0537762 100755 --- a/templates/admin/login/login.html +++ b/templates/admin/login/login.html @@ -17,7 +17,8 @@

Accedi a Bombolone

- +

diff --git a/tests/js/e2e/specs/admin.js b/tests/js/e2e/specs/admin.js new file mode 100644 index 0000000..2e401bd --- /dev/null +++ b/tests/js/e2e/specs/admin.js @@ -0,0 +1,14 @@ +describe('App', function() { + + // path : /admin/ + describe('admin', function() { + + beforeEach(function() { + browser.get('/admin/'); + }); + + it('should ...', function() { + + }); + }); +}); \ No newline at end of file diff --git a/tests/js/unit/spec/app.js b/tests/js/unit/specs/app.js similarity index 57% rename from tests/js/unit/spec/app.js rename to tests/js/unit/specs/app.js index aba318e..d789105 100644 --- a/tests/js/unit/spec/app.js +++ b/tests/js/unit/specs/app.js @@ -2,5 +2,7 @@ describe('App', function () { + it('should ...', function() { + }); }); \ No newline at end of file diff --git a/tests/js/unit/spec/controllers.js b/tests/js/unit/specs/controllers.js similarity index 61% rename from tests/js/unit/spec/controllers.js rename to tests/js/unit/specs/controllers.js index 9b2d91b..4a06af3 100644 --- a/tests/js/unit/spec/controllers.js +++ b/tests/js/unit/specs/controllers.js @@ -2,5 +2,7 @@ describe('Controller', function () { + it('should ...', function() { + }); }); diff --git a/tests/js/unit/spec/directives.js b/tests/js/unit/specs/directives.js similarity index 57% rename from tests/js/unit/spec/directives.js rename to tests/js/unit/specs/directives.js index bb6707c..7a3c2cf 100644 --- a/tests/js/unit/spec/directives.js +++ b/tests/js/unit/specs/directives.js @@ -2,5 +2,7 @@ describe('Directive', function () { - + it('should ...', function() { + + }); }); diff --git a/tests/js/unit/spec/filters.js b/tests/js/unit/specs/filters.js similarity index 55% rename from tests/js/unit/spec/filters.js rename to tests/js/unit/specs/filters.js index 03ef4e6..0c93df7 100644 --- a/tests/js/unit/spec/filters.js +++ b/tests/js/unit/specs/filters.js @@ -2,5 +2,7 @@ describe('Filter', function () { - + it('should ...', function() { + + }); }); \ No newline at end of file diff --git a/tests/js/unit/spec/services.js b/tests/js/unit/specs/services.js similarity index 59% rename from tests/js/unit/spec/services.js rename to tests/js/unit/specs/services.js index 84e1e5c..932859a 100644 --- a/tests/js/unit/spec/services.js +++ b/tests/js/unit/specs/services.js @@ -2,5 +2,7 @@ describe('Service', function () { + it('should ...', function() { + }); }); \ No newline at end of file