Skip to content

Add bucket-list e2e test code #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions e2e-test/bucket/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
var environment = require('../environment.js');
var naturalSort = require('javascript-natural-sort');
var traslate = require('../languages/index.js');

describe('Bucket List : ',() => {
const emailInput = element(by.css('[ng-model="signin.credentials.email"]'));
const passwdInput = element(by.css('[ng-model="signin.credentials.password"]'));
const signinButton = element(by.css('[ng-click="signin.submit()"]'));
const emptyBucketList = element(by.css('[class="empty-state ng-scope layout-align-center-center layout-column"]'));
const existBucketList = element(by.css('[class="table table-cursor table-hover"]'));
const menuButton = element.all(by.css('[ng-click="$mdOpenMenu($event)"]'));
const signoutButton = element(by.css('[ng-click="nav.signOut($event)"]'));
const leaveButton = element(by.css('[ng-click="dialog.hide()"]'));
const noBucketMessage = element(by.css('[class="md-headline"]'));
const noBucketCreateBucket = element(by.css('[ng-click="bucket.createBucket($event)"]'));
const buckets = element.all(by.css('[ng-repeat="bucket in bucket.data"]'));

const env = new environment();

browser.getProcessedConfig().then((config) => {
env.setUser(config.capabilities.browserName+"-"+config.capabilities.os);
});

beforeEach(() => {
browser.get(env.getWeb()+'/auth/signin');
});

describe('When user enter account alreay exists buckets : ',() => {
beforeEach(() => {
emailInput.sendKeys(env.getCorrectEmail());
passwdInput.sendKeys(env.getCorrectPassword());
signinButton.click();
});
it('Should check the bucket list will displayed.',() => {
expect(existBucketList.isPresent()).toBe(true);
});
it('Should check whether sorted of the new bucket.',() => {
buckets.getText().then((result) => {
expect(result).toBe(result.sort(naturalSort));
});
});
afterEach(() => {
menuButton.then((btns) => {
btns[0].click();
});
signoutButton.click();
leaveButton.click();
browser.sleep(1000);
});
});

describe('When user enter account not exist any buckets : ',() => {
beforeEach(() => {
emailInput.sendKeys(env.getCorrectEmail()+'1');
passwdInput.sendKeys(env.getCorrectPassword());
signinButton.click();
});
it('Should check message will displayed.',() => {
expect(noBucketMessage.isDisplayed()).toBe(true);
});
it('Should check [CREATE BUCKET] will enabled.',() => {
expect(noBucketCreateBucket.isEnabled()).toBe(true);
});
afterEach(() => {
menuButton.then((btns) => {
btns[0].click();
});
signoutButton.click();
leaveButton.click();
browser.sleep(1000);
});
});
});
63 changes: 63 additions & 0 deletions e2e-test/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
exports.config = {
framework: 'jasmine2',
specs: [
'./auth/signup.js',
'./auth/signin.js',
'./auth/back.js',
'./auth/signout.js',
'./bucket/create.js',
'./bucket/list.js'
],
multiCapabilities: [{
browserName: 'chrome',
seleniumAddress: 'http://10.26.1.27:4444/wd/hub',
os: 'ubuntu-14.04'
}
,{
browserName: 'firefox',
seleniumAddress: 'http://10.26.1.27:4444/wd/hub',
os: 'ubuntu-14.04'
}
,{
browserName: 'chrome',
seleniumAddress: 'http://10.26.1.34:4444/wd/hub',
os: 'win7'
},{
browserName: 'firefox',
seleniumAddress: 'http://10.26.1.34:4444/wd/hub',
os: 'win7'
},{
browserName: 'chrome',
seleniumAddress: 'http://10.26.1.55:4444/wd/hub',
os: 'win8'
},{
browserName: 'firefox',
seleniumAddress: 'http://10.26.1.55:4444/wd/hub',
os: 'win8'
},{
browserName: 'chrome',
seleniumAddress: 'http://10.26.1.56:4444/wd/hub',
os: 'win10'
},{
browserName: 'firefox',
seleniumAddress: 'http://10.26.1.56:4444/wd/hub',
os: 'win10'
},{
browserName: 'chrome',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
os: 'osx'
},{
browserName: 'firefox',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
os: 'osx'
},{
browserName: 'safari',
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
os: 'osx'
}
],
onPrepare: function() {
const SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
}
}
51 changes: 51 additions & 0 deletions e2e-test/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function User() {
this.correctEmail = 'no';
this.incorrectEmail = 'no';
this.correctpassword = 'password';
this.incorrectPassword = 'pass';
this.web = 'http://10.26.1.124:3000';
};

var array = {
'chrome-ubuntu-14.04': 'chrome-ubuntu-14.04@inwinstack.com,chrome-ubuntu-14.04',
'firefox-ubuntu-14.04': 'firefox-ubuntu-14.04@inwinstack.com,firefox-ubuntu-14.04',
'chrome-win7': 'chrome-win7@inwinstack.com,chrome-win7',
'firefox-win7': 'firefox-win7@inwinstack.com,firefox-win7',
'internet explorer-win7': 'ie-win7@inwinstack.com,ie-win7',
'chrome-win8': 'chrome-win8@inwinstack.com,chrome-win8',
'firefox-win8': 'firefox-win8@inwinstack.com,firefox-win8',
'internet explorer-win8': 'ie-win8@inwinstack.com,ie-win8',
'chrome-win10': 'chrome-win10@inwinstack.com,chrome-win10',
'firefox-win10': 'firefox-win10@inwinstack.com,firefox-win10',
'internet explorer-win10': 'ie-win10@inwinstack.com,ie-win10',
'chrome-osx': 'chrome-osx@inwinstack.com,chrome-osx',
'firefox-osx': 'firefox-osx@inwinstack.com,firefox-osx',
'safari-osx': 'safari-osx@inwinstack.com,safari-osx'
};

User.prototype.getWeb = function(){
return this.web;
};

User.prototype.setUser = function(user){
this.correctEmail = array[user].split(',')[0];
this.incorrectEmail = array[user].split(',')[1];
};

User.prototype.getCorrectEmail = function(){
return this.correctEmail;
};

User.prototype.getIncorrectEmail = function(){
return this.incorrectEmail;
};

User.prototype.getCorrectPassword = function(){
return this.correctpassword;
};

User.prototype.getIncorrectPassword = function(){
return this.incorrectPassword;
};

module.exports = User;
12 changes: 12 additions & 0 deletions e2e-test/languages/cn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function Translate(){
this.languages = null;
}

Translate.prototype.get = function(term){
this.languages = languages[term];
return this.languages
}

const languages = {}

module.exports = Translate;
12 changes: 12 additions & 0 deletions e2e-test/languages/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function Translate(){
this.languages = null;
}

Translate.prototype.get = function(term){
this.languages = languages[term];
return this.languages
}

const languages = {}

module.exports = Translate;
23 changes: 23 additions & 0 deletions e2e-test/languages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const tw = require('./tw.js');
const cn = require('./cn.js');
const en = require('./en.js');

const twTranslate = new tw();
const cnTranslate = new cn();
const enTranslate = new en();

function Translate(language, term){
switch(language){
case 'tw':
return twTranslate.get(term);
break;
case 'cn':
return cnTranslate.get(term);
break;
case 'en':
return enTranslate.get(term);
break;
}
}

module.exports = Translate;
12 changes: 12 additions & 0 deletions e2e-test/languages/tw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function Translate(){
this.languages = null;
}

Translate.prototype.get = function(term){
this.languages = languages[term];
return this.languages
}

const languages = {}

module.exports = Translate;