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
module.exports = function Page(driver, endpoint) { | |
this.driver = driver; | |
this.get = function() { | |
driver.get(endpoint + this.getPagePath()); | |
return this; | |
}; | |
}; |
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
module.exports = function SearchWidget() { | |
var SEARCH_WIDGET_SUBMIT_BUTTON_SELECTOR = '#searchWidgetSubmitButtonSelector'; | |
this.clickSearchWidgetButton = function() { | |
this.driver.findElement(By.id(SEARCH_WIDGET_SUBMIT_BUTTON_SELECTOR)).click(); | |
return this; | |
}; | |
}; |
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
var SearchWidget = require('./widgets/SearchWidget'); | |
var Page = require('./Page'); | |
module.exports = function HomePage() { | |
Page.call(this); | |
SearchWidget.call(this); | |
this.doSomethingOnTheHomePage = function() { | |
// do something | |
return this; |
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
public class HomePageITest { | |
@Test | |
public we_should_be_able_to_search_from_the_homepage() { | |
pageFactory.getHomePage() | |
.get() | |
.doSomethingOnTheHomePage() | |
.clickSearchWidgetSubmitButton() | |
.doSomethingElseOnTheHomePage() | |
; | |
} |
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
public abstract class Page<T extends Page> | |
implements HasDriver, HasPage<T> { | |
protected WebDriver driver; | |
private String endpoint; | |
protected String getPagePath(); | |
@Override | |
public WebDriver getDriver() { |
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
public class HomePage extends Page<HomePage> | |
implements SearchWidget { | |
// package private contructor | |
HomePage () {} | |
// Home Page specific methods | |
public HomePage doSomethingOnTheHomePage() { | |
// do something | |
return this; |
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
public interface SearchWidget<T extends Page> | |
extends HasPage<T>, HasDriver { | |
String SEARCH_WIDGET_BUTTON_SELECTOR = "#searchWidgetButton"; | |
default T clickSearchWidgetButton() { | |
getDriver() | |
.findElement(By.id(SEARCH_WIDGET_BUTTON_SELECTOR)) | |
.click(); | |
return getPage(); |
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
function SignInCtrl( | |
$rootScope, | |
$scope, | |
credentials, | |
events, | |
handleUser, | |
User | |
){ | |
$scope.isLoading = false; | |
$scope.generalError = ''; |
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
#!/bin/bash | |
host="`hostname`" | |
if [ -z "`grep -o "$host" /etc/hosts`" ];then | |
sed -i "s|\(127.0.0.1.*\)$|\1 $host|" /etc/hosts | |
fi |
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
var equal = require('assert').equal; | |
var instance = this; | |
var lengthFacade = 0; | |
this.push = function(value){ | |
this[getLength()] = value; | |
}; | |
Object.defineProperty(this, 'length', { |