This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4cc3ab
commit d6927b2
Showing
26 changed files
with
568 additions
and
27 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
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,20 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.AboutPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class AboutBlock extends AbstractBlock<AboutBlock, AboutPage> { | ||
|
||
private static final SelenideElement ABOUT_HEADER = Selenide.$("#about"); | ||
|
||
public AboutBlock(AboutPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Gets about header element") | ||
public SelenideElement getAboutHeaderElement() { | ||
return ABOUT_HEADER; | ||
} | ||
} |
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,38 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.AboutPage; | ||
import com.duallab.verapdf.pages.HomePage; | ||
import com.duallab.verapdf.pages.PrivacyPolicyPage; | ||
import com.duallab.verapdf.pages.UploadFilePage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class HomeBlock extends AbstractBlock<HomeBlock, HomePage> { | ||
|
||
private static final SelenideElement TRY_NOW_BUTTON = Selenide.$("#try-now-button"); | ||
private static final SelenideElement PRIVACY_POLICY_BUTTON = Selenide.$("a[href='/validate/privacy-policy']"); | ||
private static final SelenideElement READ_MORE_BUTTON = Selenide.$("a[href='/validate/about']"); | ||
|
||
public HomeBlock(HomePage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Clicks try now button") | ||
public UploadFilePage goToUploadFilePage() { | ||
TRY_NOW_BUTTON.click(); | ||
return UploadFilePage.openToUploadFromComputer(); | ||
} | ||
|
||
@Step("Clicks privacy policy button") | ||
public PrivacyPolicyPage clickPrivacyPolicyButton() { | ||
PRIVACY_POLICY_BUTTON.click(); | ||
return PrivacyPolicyPage.open(); | ||
} | ||
|
||
@Step("Clicks read more button") | ||
public AboutPage clickReadMoreButton() { | ||
READ_MORE_BUTTON.click(); | ||
return AboutPage.open(); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/com/duallab/verapdf/blocks/PdfViewerBlock.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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.ElementsCollection; | ||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.blocks.dialog.ErrorDialog; | ||
import com.duallab.verapdf.pages.PdfViewerPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class PdfViewerBlock extends AbstractBlock<PdfViewerBlock, PdfViewerPage> { | ||
|
||
private static final SelenideElement RULE_ITEM = Selenide.$(".rule-item__chip"); | ||
private static final SelenideElement RULE_ITEM_CONTENT = Selenide.$(".rule-item_error"); | ||
private static final SelenideElement CHECK_ITEM = Selenide.$(".check-item"); | ||
private static final SelenideElement SELECTED_BOX = Selenide.$("div.pdf-bbox_selected"); | ||
private static final SelenideElement INFO_BUTTON = Selenide.$("button[aria-label='info']"); | ||
private static final ElementsCollection CONTEXT_TEXT = Selenide.$$(".content-text"); | ||
|
||
public PdfViewerBlock(PdfViewerPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Expands rule item content") | ||
public PdfViewerPage clickRuleItemContent() { | ||
RULE_ITEM_CONTENT.click(); | ||
return getParentElement(); | ||
} | ||
|
||
@Step("Clicks check item content") | ||
public PdfViewerPage clickCheckItemContent() { | ||
CHECK_ITEM.click(); | ||
return getParentElement(); | ||
} | ||
|
||
@Step("Clicks info button") | ||
public ErrorDialog clickInfoButton() { | ||
INFO_BUTTON.click(); | ||
return ErrorDialog.openErrorDialog(getParentElement()); | ||
} | ||
|
||
@Step("Gets rule item element") | ||
public SelenideElement getRuleItemElement() { | ||
return RULE_ITEM; | ||
} | ||
|
||
@Step("Gets content text elements") | ||
public ElementsCollection getContextTextElements() { | ||
return CONTEXT_TEXT; | ||
} | ||
|
||
@Step("Gets selected box element") | ||
public SelenideElement getSelectedBoxElement() { | ||
return SELECTED_BOX; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/duallab/verapdf/blocks/PrivacyPolicyBlock.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.PrivacyPolicyPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class PrivacyPolicyBlock extends AbstractBlock<PrivacyPolicyBlock, PrivacyPolicyPage> { | ||
|
||
private static final SelenideElement PRIVACY_POLICY_HEADER = Selenide.$("#privacy-policy"); | ||
|
||
public PrivacyPolicyBlock(PrivacyPolicyPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Gets privacy policy element") | ||
public SelenideElement getPrivacyPolicyHeaderElement() { | ||
Selenide.switchTo().window(1); | ||
return PRIVACY_POLICY_HEADER; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/duallab/verapdf/blocks/ResultSummaryBlock.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.ElementsCollection; | ||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.PdfViewerPage; | ||
import com.duallab.verapdf.pages.ResultSummaryPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class ResultSummaryBlock extends AbstractBlock<ResultSummaryBlock, ResultSummaryPage> { | ||
|
||
private static final SelenideElement JOB_FILENAME = Selenide.$(".job-filename"); | ||
private static final SelenideElement MACHINE_AND_HUMAN_PROFILE_NAME = | ||
Selenide.$x("//p[text()='WCAG 2.2 Machine & Human (experimental)']"); | ||
private static final SelenideElement SUMMARY_RESULT = Selenide.$(".legend"); | ||
private static final SelenideElement INSPECT_ERRORS_BUTTON = Selenide.$x("//span[text()='Inspect errors']"); | ||
private static final ElementsCollection SUMMARY_LIST = Selenide.$$(".summary__list ul li"); | ||
|
||
public ResultSummaryBlock(ResultSummaryPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Clicks inspect errors button") | ||
public PdfViewerPage goToPdfViewerPage() { | ||
INSPECT_ERRORS_BUTTON.click(); | ||
return PdfViewerPage.open(); | ||
} | ||
|
||
@Step("Gets job file name element") | ||
public SelenideElement getJobFilenameElement() { | ||
return JOB_FILENAME; | ||
} | ||
|
||
@Step("Gets profile name element") | ||
public SelenideElement getMachineAndHumanProfileNameElement() { | ||
return MACHINE_AND_HUMAN_PROFILE_NAME; | ||
} | ||
|
||
@Step("Gets summary list elements") | ||
public ElementsCollection getSummaryListElements() { | ||
return SUMMARY_LIST; | ||
} | ||
|
||
@Step("Gets summary result element") | ||
public SelenideElement getSummaryResultElement() { | ||
return SUMMARY_RESULT; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/duallab/verapdf/blocks/SettingsBlock.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.ResultSummaryPage; | ||
import com.duallab.verapdf.pages.SettingsPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class SettingsBlock extends AbstractBlock<SettingsBlock, SettingsPage> { | ||
|
||
private static final SelenideElement VALIDATE_BUTTON = Selenide.$x("//span[text()='Validate']"); | ||
|
||
public SettingsBlock(SettingsPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Clicks validate button") | ||
public ResultSummaryPage goToResultSummaryPage() { | ||
VALIDATE_BUTTON.click(); | ||
return ResultSummaryPage.open(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/duallab/verapdf/blocks/UploadDropzoneBlock.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.UploadFilePage; | ||
import io.qameta.allure.Step; | ||
import java.io.File; | ||
|
||
public final class UploadDropzoneBlock extends AbstractBlock<UploadDropzoneBlock, UploadFilePage> { | ||
|
||
private static final SelenideElement DROPZONE = Selenide.$("input[accept='application/pdf']"); | ||
|
||
public UploadDropzoneBlock(UploadFilePage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Uploads file") | ||
public UploadFilePage uploadFile(File file) { | ||
DROPZONE.uploadFile(file); | ||
return getParentElement(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/duallab/verapdf/blocks/UploadFileBlock.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.duallab.verapdf.blocks; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.SettingsPage; | ||
import com.duallab.verapdf.pages.UploadFilePage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class UploadFileBlock extends AbstractBlock<UploadFileBlock, UploadFilePage> { | ||
|
||
private static final SelenideElement CONFIGURE_JOB_BUTTON = Selenide.$x("//span[text()='Configure job']"); | ||
|
||
public UploadFileBlock(UploadFilePage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
@Step("Clicks configure job button") | ||
public SettingsPage goToSettingsPage() { | ||
CONFIGURE_JOB_BUTTON.click(); | ||
return SettingsPage.open(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/duallab/verapdf/blocks/dialog/AbstractDialog.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.duallab.verapdf.blocks.dialog; | ||
|
||
import com.duallab.verapdf.base.AbstractElement; | ||
import com.duallab.verapdf.blocks.AbstractBlock; | ||
|
||
public abstract class AbstractDialog<T, P extends AbstractElement<P>> extends AbstractBlock<T, P> { | ||
|
||
protected AbstractDialog(P baseElement) { | ||
super(baseElement); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/duallab/verapdf/blocks/dialog/ErrorDialog.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.duallab.verapdf.blocks.dialog; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.duallab.verapdf.pages.PdfViewerPage; | ||
import io.qameta.allure.Step; | ||
|
||
public final class ErrorDialog extends AbstractDialog<ErrorDialog, PdfViewerPage> { | ||
|
||
private static final SelenideElement DIALOG_TITLE = Selenide.$("#alert-dialog-title"); | ||
private static final SelenideElement DIALOG_DESCRIPTION = Selenide.$("#alert-dialog-description"); | ||
private static final SelenideElement CLOSE_BUTTON = Selenide.$("div[title='Close']"); | ||
|
||
private ErrorDialog(PdfViewerPage baseElement) { | ||
super(baseElement); | ||
} | ||
|
||
public static ErrorDialog openErrorDialog(PdfViewerPage pdfViewerPage) { | ||
return new ErrorDialog(pdfViewerPage); | ||
} | ||
|
||
@Step("Clicks close button") | ||
public PdfViewerPage clickCloseButton() { | ||
CLOSE_BUTTON.click(); | ||
return getParentElement(); | ||
} | ||
|
||
@Step("Gets dialog title element") | ||
public SelenideElement getDialogTitleElement() { | ||
return DIALOG_TITLE; | ||
} | ||
|
||
@Step("Gets dialog description element") | ||
public SelenideElement getDialogDescriptionElement() { | ||
return DIALOG_DESCRIPTION; | ||
} | ||
} |
Oops, something went wrong.