Skip to content

Commit

Permalink
Init Integration tests #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Zizzamia committed Jul 24, 2014
1 parent bfc81fd commit 9ca2a90
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 6 deletions.
35 changes: 35 additions & 0 deletions conf.js
Original file line number Diff line number Diff line change
@@ -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();
}
};
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 18 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```


Expand Down
3 changes: 2 additions & 1 deletion templates/admin/login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ <h1>Accedi a Bombolone</h1>
<input type="password" name="password" value="" size="50" tabindex="20" />
</p>
<p class="submit">
<button tabindex="200" type="submit" class="button button-login">Accedi</button>
<button tabindex="200" type="submit" id="submit"
class="button button-login">Accedi</button>
</p>
</form>
</section>
Expand Down
14 changes: 14 additions & 0 deletions tests/js/e2e/specs/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('App', function() {

// path : /admin/
describe('admin', function() {

beforeEach(function() {
browser.get('/admin/');
});

it('should ...', function() {

});
});
});
2 changes: 2 additions & 0 deletions tests/js/unit/spec/app.js → tests/js/unit/specs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

describe('App', function () {

it('should ...', function() {

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

describe('Controller', function () {

it('should ...', function() {

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

describe('Directive', function () {


it('should ...', function() {

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

describe('Filter', function () {


it('should ...', function() {

});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

describe('Service', function () {

it('should ...', function() {

});
});

0 comments on commit 9ca2a90

Please sign in to comment.