-
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.
#2 Add "Open archive metadata" Feature
- Add: openArchiveMetadata.feature, FileSteps, MarkdownViewer - Enhance: LibrarySteps, HomePage, LibraryPage
- Loading branch information
Showing
6 changed files
with
200 additions
and
1 deletion.
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
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,83 @@ | ||
package ui.pages; | ||
|
||
import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.openqa.selenium.By; | ||
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 Markdown viewer page. | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
@Lazy | ||
@Component | ||
@Scope(SCOPE_CUCUMBER_GLUE) | ||
public class MarkdownViewer extends BasePage { | ||
|
||
@FindBy(className = "file-name") | ||
private WebElement fileName; | ||
|
||
@FindBy(className = "file-modifier-name") | ||
private WebElement modifierName; | ||
|
||
@FindBy(className = "file-modifier-time") | ||
private WebElement modifierTime; | ||
|
||
@FindBy(id = "shareBtn") | ||
private WebElement shareButton; | ||
|
||
@FindBy(id = "parentDirectory") | ||
private WebElement parentDirectroyButton; | ||
|
||
@FindBy(id = "editButton") | ||
private WebElement editButton; | ||
|
||
@FindBy(className = "seafile-viewer-outline") | ||
private WebElement outline; | ||
|
||
@Autowired | ||
public MarkdownViewer(WebDriver driver) { | ||
super(driver); | ||
} | ||
|
||
public String getFileName() { | ||
return fileName.getText(); | ||
} | ||
|
||
public String getModifierName() { | ||
return modifierName.getText(); | ||
} | ||
|
||
public String getModifierTime() { | ||
return modifierTime.getText(); | ||
} | ||
|
||
public boolean buttonsPresent() { | ||
return (shareButton.isDisplayed() && this.parentDirectroyButton.isDisplayed() && this.editButton.isDisplayed()); | ||
} | ||
|
||
public List<String> getOutline() { | ||
List<String> headings = new ArrayList<>(); | ||
|
||
List<WebElement> outlineHeadings = this.outline.findElements(By.tagName("div")); | ||
|
||
for (WebElement heading : outlineHeadings) { | ||
String headingTitle = heading.getText(); | ||
headings.add(headingTitle); | ||
} | ||
|
||
return headings; | ||
} | ||
|
||
} |
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,49 @@ | ||
package stepdefinitions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Lazy; | ||
|
||
import io.cucumber.java.en.Then; | ||
import ui.pages.MarkdownViewer; | ||
|
||
/** | ||
* Tests steps: Files domain | ||
* | ||
* @author helk | ||
* | ||
*/ | ||
public class FileSteps { | ||
|
||
@Autowired | ||
WebDriver driver; | ||
|
||
@Lazy | ||
@Autowired | ||
MarkdownViewer markdownViewer; | ||
|
||
@Then("Archive metadata is displayed correctly") | ||
public void archiveMetadataDisplayedCorrectly() { | ||
String fileName = markdownViewer.getFileName(); | ||
String modifierName = markdownViewer.getModifierName(); | ||
// TODO: Handle Check for modifier time correctly | ||
// String modifierTime = markdownViewer.getModifierTime(); | ||
|
||
boolean buttonsPresent = markdownViewer.buttonsPresent(); | ||
|
||
List<String> outline = markdownViewer.getOutline(); | ||
|
||
assertThat(fileName).isEqualTo("archive-metadata.md"); | ||
assertThat(modifierName).isEqualTo("keeper"); | ||
// assertThat(modifierTime).isEqualTo("archive-metadata.md"); | ||
|
||
assertThat(outline).contains("Title", "Author", "Description", "Year", "Institute", "DOI"); | ||
|
||
assertThat(buttonsPresent).isTrue(); | ||
} | ||
|
||
} |
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,12 @@ | ||
Feature: Open Archive Metadata | ||
Logged in user can open the Archive Metadata of a newly created library. | ||
|
||
@KP-18 | ||
@openArchiveMetadata | ||
Scenario: Open archive metadata | ||
Given Logged in as User | ||
And Create new Library | ||
And Open new Library | ||
When Open archive metadata | ||
Then Archive metadata is displayed correctly | ||
# @After LibrariesSteps.deleteLibrary() |