Last active
November 13, 2015 14:13
-
-
Save edgahan/3d713bf4d3b684f93cec to your computer and use it in GitHub Desktop.
scrolling protractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# utils.js | |
module.exports = { | |
scrollIntoView: function(el) { | |
browser.executeScript(function(el) { | |
el.scrollIntoView(); | |
}, el.getWebElement()); | |
} | |
} | |
# inside page object somewhere... | |
var scrollIntoView = require('../utils').scrollIntoView; | |
module.exports = { | |
clickBackBtn: function() { | |
var el = element(by.buttonText('Go back')); | |
scrollIntoView(el); | |
el.click(); | |
return; | |
} | |
} | |
# in the test itself... | |
it('should allow the user to go back to the profile page', function() { | |
PageObject.clickBackBtn(); | |
expect(browser.getCurrentUrl()).toContain('/user/profile'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 💯