-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Selenium HomePage can be one of two urls.
- clean up the rest of the pageObjects package Signed-off-by: Duane May <[email protected]>
- Loading branch information
Showing
11 changed files
with
105 additions
and
70 deletions.
There are no files selected for viewing
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
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
15 changes: 0 additions & 15 deletions
15
uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/DnsErrorPage.java
This file was deleted.
Oops, something went wrong.
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
21 changes: 15 additions & 6 deletions
21
uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/HomePage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
package org.cloudfoundry.identity.uaa.integration.pageObjects; | ||
|
||
import org.cloudfoundry.identity.uaa.home.HomeController; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.springframework.ui.Model; | ||
|
||
import java.security.Principal; | ||
|
||
import static org.hamcrest.Matchers.anyOf; | ||
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.endsWith; | ||
|
||
// TODO extend LoggedInPage | ||
/** | ||
* The HomePage class represents the home page on the UAA server. | ||
* It can have either url: `/home` or just `/`. | ||
* {@link HomeController#home(Model, Principal)} | ||
*/ | ||
public class HomePage extends Page { | ||
static final private String urlPath = "/"; | ||
static final private String slashUrlPath = "/"; | ||
static final private String homeUrlPath = "/home"; | ||
|
||
public HomePage(WebDriver driver) { | ||
super(driver); | ||
validateUrl(driver, endsWith(urlPath)); | ||
validateUrl(driver, anyOf(endsWith(slashUrlPath), endsWith(homeUrlPath))); | ||
validatePageSource(driver, containsString("Where to?")); | ||
} | ||
|
||
static public LoginPage tryToGoHome_redirectsToLoginPage(WebDriver driver, String baseUrl) { | ||
driver.get(baseUrl + urlPath); | ||
driver.get(baseUrl + slashUrlPath); | ||
return new LoginPage(driver); | ||
} | ||
|
||
public boolean hasLastLoginTime() { | ||
WebElement lastLoginTime = driver.findElement(By.id("last_login_time")); | ||
String loginTime = lastLoginTime.getText(); | ||
return loginTime != null && ! loginTime.isBlank(); | ||
return loginTime != null && !loginTime.isBlank(); | ||
} | ||
} | ||
|
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
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
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
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
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
9 changes: 4 additions & 5 deletions
9
uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/SamlWelcomePage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
package org.cloudfoundry.identity.uaa.integration.pageObjects; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.endsWith; | ||
|
||
/** | ||
* The SamlWelcomePage class represents the welcome page on the SimpleSAML server. | ||
* It has url matching: `/module.php/core/welcome`. | ||
*/ | ||
public class SamlWelcomePage extends Page { | ||
static final private String urlPath = "module.php/core/welcome"; | ||
|
||
public SamlWelcomePage(WebDriver driver) { | ||
super(driver); | ||
validateUrl(driver, endsWith(urlPath)); | ||
} | ||
|
||
} | ||
|