-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add the openFooterLinks.feature, which checks all the links in the footer - Add SeleniumUtil.java for Selenium Wrapper methods
- Loading branch information
Showing
10 changed files
with
488 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
package ui.components; | ||
|
||
import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
import ui.pages.BasePage; | ||
import ui.util.SeleniumUtil; | ||
|
||
/** | ||
* Page Object encapsulates the Footer component. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
@Lazy | ||
@Component | ||
@Scope(SCOPE_CUCUMBER_GLUE) | ||
public class FooterComponent extends BasePage { | ||
|
||
@FindBy(linkText = "Project Catalog") | ||
private WebElement projectCatalogLink; | ||
|
||
@FindBy(linkText = "Help / Knowledge Base") | ||
private WebElement helpLink; | ||
|
||
@FindBy(linkText = "About") | ||
private WebElement aboutLink; | ||
|
||
@FindBy(id = "footer-img") | ||
private WebElement footerFoldOutElement; | ||
|
||
@FindBy(linkText = "About Keeper") | ||
private WebElement aboutKeeperLink; | ||
|
||
@FindBy(linkText = "Cared Data Commitment") | ||
private WebElement caredDataCommitmentLink; | ||
|
||
@FindBy(linkText = "Terms of Service") | ||
private WebElement termsOfServiceLink; | ||
|
||
@FindBy(linkText = "Download the Keeper client for Windows, Linux, Mac, Android and iPhone") | ||
private WebElement downloadClientLink; | ||
|
||
@FindBy(id = "seafile-logo") | ||
private WebElement seafileLogo; | ||
|
||
@FindBy(id = "MPDL-logo") | ||
private WebElement mpdlLogo; | ||
|
||
@FindBy(linkText = "Contact Keeper Support") | ||
private WebElement contactKeeperSupportLink; | ||
|
||
@FindBy(linkText = "Impressum") | ||
private WebElement impressumLink; | ||
|
||
@FindBy(linkText = "Privacy Policy") | ||
private WebElement privacyPolicyLink; | ||
|
||
@Autowired | ||
public FooterComponent(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
public void openProjectCatalog() { | ||
this.projectCatalogLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.titleContains("Catalog")); | ||
} | ||
|
||
public void openHelpPage() { | ||
this.helpLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.titleIs("Keeper – Max Planck Digital Library")); | ||
} | ||
|
||
public void openAboutDialog() { | ||
this.aboutLink.click(); | ||
|
||
wait.until(ExpectedConditions.elementToBeClickable(By.id("simplemodal-container"))); | ||
} | ||
|
||
public void openAboutKeeper() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.aboutKeeperLink)); | ||
this.aboutKeeperLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h2[@title='About.markdown']"))); | ||
} | ||
|
||
public void openCaredDataCommitment() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.caredDataCommitmentLink)); | ||
this.caredDataCommitmentLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until( | ||
ExpectedConditions.visibilityOfElementLocated(By.xpath("//h2[@title='CaredDataPrinciples.markdown']"))); | ||
} | ||
|
||
public void openTermsOfService() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.termsOfServiceLink)); | ||
this.termsOfServiceLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h2[@title='TermsOfService.markdown']"))); | ||
} | ||
|
||
public void openDownloadClientPage() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.downloadClientLink)); | ||
this.downloadClientLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.titleIs("Download - KEEPER")); | ||
} | ||
|
||
public String getSeafileLink() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.seafileLogo)); | ||
String onclick = this.seafileLogo.getAttribute("onclick"); | ||
|
||
String seafileLink = onclick.replace("window.open('", "").replace("');", ""); | ||
return seafileLink; | ||
} | ||
|
||
public String getMpdlLink() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.mpdlLogo)); | ||
String onclick = this.mpdlLogo.getAttribute("onclick"); | ||
|
||
String mpdlLink = onclick.replace("window.open('", "").replace("');", ""); | ||
return mpdlLink; | ||
} | ||
|
||
public String getKeeperEmail() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.contactKeeperSupportLink)); | ||
String href = this.contactKeeperSupportLink.getAttribute("href"); | ||
|
||
String keeperEmail = href.replace("mailto:", ""); | ||
return keeperEmail; | ||
} | ||
|
||
public void openImpressum() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.impressumLink)); | ||
this.impressumLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h2[@title='Impressum.markdown']"))); | ||
} | ||
|
||
public void openPrivacyPolicy() { | ||
this.footerFoldOutElement.click(); | ||
wait.until(ExpectedConditions.elementToBeClickable(this.privacyPolicyLink)); | ||
this.privacyPolicyLink.click(); | ||
SeleniumUtil.switchToSecondTab(driver, wait); | ||
|
||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h2[@title='DSGVO_Keeper.md']"))); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ui.pages; | ||
|
||
import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Page Object encapsulates the Download Client page. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
@Lazy | ||
@Component | ||
@Scope(SCOPE_CUCUMBER_GLUE) | ||
public class DownloadClientPage extends BasePage { | ||
|
||
@Autowired | ||
public DownloadClientPage(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
public String getTitle() { | ||
return driver.getTitle(); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package ui.pages; | ||
|
||
import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Page Object encapsulates the File viewer page. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
@Lazy | ||
@Component | ||
@Scope(SCOPE_CUCUMBER_GLUE) | ||
public class FileViewer extends BasePage { | ||
|
||
@FindBy(xpath = "//*[@id='shared-file-view-hd']//h2") | ||
private WebElement fileTitle; | ||
|
||
@Autowired | ||
public FileViewer(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
public String getFileTitle() { | ||
return this.fileTitle.getAttribute("title"); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ui.pages; | ||
|
||
import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Page Object encapsulates the Help page. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
@Lazy | ||
@Component | ||
@Scope(SCOPE_CUCUMBER_GLUE) | ||
public class HelpPage extends BasePage { | ||
|
||
@Autowired | ||
public HelpPage(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
public String getURL() { | ||
return driver.getCurrentUrl(); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ui.util; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
/** | ||
* Utility class to enhance basic Selenium actions with additional | ||
* functionality. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
public class SeleniumUtil { | ||
|
||
private SeleniumUtil() { | ||
// SeleniumUtil should not be instantiated | ||
} | ||
|
||
public static void switchToSecondTab(WebDriver driver, WebDriverWait wait) { | ||
wait.until(ExpectedConditions.numberOfWindowsToBe(2)); | ||
ArrayList<String> tabs = new ArrayList<>(driver.getWindowHandles()); | ||
driver.switchTo().window(tabs.get(1)); | ||
} | ||
|
||
} |
Oops, something went wrong.