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 AbstractSeleniumTest { | |
// configurable base URL | |
private final String baseUrl = System.getProperty("selenium.baseUrl", | |
"http://localhost:8080/contextRoot/"); | |
private final WebDriver driver; | |
public AbstractSeleniumTest() { | |
// create desired WebDriver |
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
import org.openqa.selenium.support.ui.WebDriverWait; | |
import org.junit.Assert; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.Keys; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.interactions.Actions; | |
import org.openqa.selenium.support.PageFactory; | |
import org.openqa.selenium.support.ui.ExpectedCondition; | |
import org.openqa.selenium.support.ui.LoadableComponent; |
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
/** | |
* Path of the URL without the context root for this page. | |
* | |
* @return String path of the URL | |
*/ | |
protected abstract String getUrlPath(); | |
/*** | |
* Specific check which has to be implemented by every page object. | |
* A rudimentary check on the basis of URL is undertaken by the super class. |
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 TimetablePage extends LoadablePage<TimetablePage> { | |
@FindBy(id = "...") | |
private Autocomplete from; | |
@FindBy(id = "...") | |
private Autocomplete to; | |
@FindBy(id = "...") | |
private Datepicker date; | |
@FindBy(id = "...") | |
private TimeInput time; |
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 HintTravelerIT extends AbstractSeleniumTest { | |
@FlowOnPage(step = 1, desc = "Seach a connection from Bern to Zürich and click on the first 'Buy' button") | |
void flowTimetable(TimetablePage timetablePage) { | |
// Type from, to, date and time | |
timetablePage.typeFrom("Bern").typeTo("Zürich"); | |
Date date = DateUtils.addDays(new Date(), 2); | |
timetablePage.typeDate(date); | |
timetablePage.typeTime(date); | |
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 MultiSelect extends EditableWrapper implements EditableMultiValue<String> { | |
protected MultiSelect(WebElement element) { | |
super(element); | |
} | |
public static MultiSelect create(WebElement element) { | |
assertNotNull(element); | |
return new MultiSelect(element); | |
} |
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 Message extends HtmlWrapper { | |
public enum Severity { | |
INFO("info"), | |
WARNING("warn"), | |
ERROR("error"); | |
Severity(String severity) { | |
this.severity = severity; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
</head> | |
<body ng-app="app"> | |
<h1>Magical $parse service</h1> | |
<div ng-controller="ParseController as vm">{{vm.parsedMsg}}</div> |
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() { | |
angular.module('app', []).controller('ParseController', ParseController); | |
function ParseController($scope, $parse) { | |
this.libs = {}; | |
this.libs.angular = { | |
version: '1.4.3' | |
}; | |
var template = $parse("'This example uses AngularJS ' + libs.angular.version"); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
</head> | |
<body ng-app="app"> | |
<h1>Magical $parse service</h1> | |
<div ng-controller="ParseController as vm" ng-bind-html="vm.parsedMsg"></div> |