Skip to content

Commit

Permalink
fix(e2e): refactor tests and fix expects() on bottomSheets.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBurleson committed May 18, 2015
1 parent 395ccb5 commit e149dbb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<body ng-app="starterApp" layout="column" ng-controller="UserController as ul">

<md-toolbar layout="row">
<md-toolbar layout="row" class="md-whiteframe-z1">
<md-button class="menu" hide-gt-sm ng-click="ul.toggleList()" aria-label="Show User List">
<md-icon md-svg-icon="menu" ></md-icon>
</md-button>
Expand Down
4 changes: 2 additions & 2 deletions app/src/users/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
function showContactOptions($event) {
var user = self.selected;

$mdBottomSheet.show({
return $mdBottomSheet.show({
parent: angular.element(document.getElementById('content')),
templateUrl: '/src/users/view/contactSheet.html',
controller: [ '$mdBottomSheet', ContactPanelController],
Expand All @@ -85,7 +85,7 @@
{ name: 'Google+' , icon: 'google_plus' , icon_url: 'assets/svg/google_plus.svg'},
{ name: 'Hangout' , icon: 'hangouts' , icon_url: 'assets/svg/hangouts.svg'}
];
this.contactUser = function(action) {
this.submitContact = function(action) {
$mdBottomSheet.hide(action);
};
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/users/view/contactSheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<md-list>
<md-item ng-repeat="item in cp.actions">
<md-button ng-click="cp.contactUser(item)" id="item_{{$index}}">
<md-button ng-click="cp.submitContact(item)" id="item_{{$index}}">
<md-icon md-svg-icon="{{ item.icon_url }}"></md-icon>
{{item.name}}
</md-button>
Expand Down
10 changes: 6 additions & 4 deletions e2e/pages/ContactUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ var ContactUser = function() {
};

this.buttons = function() {
return element.all(by.css('[ng-click="cp.contactWith(item)"]'));
browser.driver.sleep(500);
return element.all(by.css('[ng-click="cp.submitContact(item)"]'));
};

this.focusedButton = function() {
return browser.driver.switchTo().activeElement();
};

this.focusedAction = function() {
return browser.driver.switchTo().activeElement().getText();
}
};

module.exports = ContactUser;
Expand Down
13 changes: 7 additions & 6 deletions e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ exports.config = {
baseUrl: 'http:https://localhost:8080',


chromeDriver: '/usr/local/lib/node_modules/protractor/selenium/chromedriver',
seleniumServerJar: '/usr/local/lib/node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
//chromeDriver: '/usr/local/lib/node_modules/protractor/selenium/chromedriver',
//seleniumServerJar: '/usr/local/lib/node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar',
seleniumAddress:'http:https://127.0.0.1:4444/wd/hub',

framework: 'jasmine',

plugins: [{
chromeA11YDevTools: true,
path: '../node_modules/protractor/plugins/accessibility/index.js'
}],
//plugins: [{
// chromeA11YDevTools: true,
// path: '../node_modules/protractor/plugins/accessibility/index.js'
//}],

jasmineNodeOpts: {
defaultTimeoutInterval: 30000
Expand Down
15 changes: 6 additions & 9 deletions e2e/scenarios/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ describe('my app', function() {
beforeEach(function() {

users.loadAll();
details.load();
//details.load();
//contact.load();

});

Expand All @@ -24,17 +25,13 @@ describe('my app', function() {
describe('selecting a user', function() {

beforeEach(function() {
return details.contactUser().then(function() {
return contact.load();
});
return details.contactUser();
});

it('should set focus on first button in the bottomsheet view', function() {
contact.buttons().then(function(items) {
expect( items.length ).toEqual( 4 );

expect( contact.focusedAction() ).toEqual( 'PHONE' );
});
expect( contact.buttons().count() ).toBe(4);
expect( contact.buttons().first().getText() ).toEqual( 'PHONE' );
expect( contact.focusedButton().getText() ).toEqual( 'PHONE' );
});

});
Expand Down

0 comments on commit e149dbb

Please sign in to comment.