Last active
August 29, 2015 13:55
-
-
Save misaxi/8701339 to your computer and use it in GitHub Desktop.
A base Page object class which wraps
This file contains hidden or 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
class Page | |
constructor: -> | |
# this is singleton | |
@ptor = protractor.getInstance() | |
get: (relativeUrl, ignoreSync) -> | |
# we want to ignore sync if the | |
# page does not use AngularJS | |
@ptor.ignoreSynchronization = ignoreSync or false | |
@ptor.get @ptor.baseUrl + relativeUrl | |
element: (locator, container) -> | |
if container | |
container.findElement locator | |
else | |
@ptor.findElement locator | |
byId: (id, container) -> | |
@element protractor.By.id(id), container | |
byCss: (css, container) -> | |
@element protractor.By.css(css), container | |
byText: (text, container) -> | |
xpath = "//*[text()[contains(.,'#{text}')]]" | |
@element protractor.By.xpath(xpath), container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment