This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Cognifide/core-components-form-components…
…-tests Core components form components tests
- Loading branch information
Showing
25 changed files
with
1,004 additions
and
46 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...fide/qa/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormButtonComponent.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,32 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import org.openqa.selenium.WebElement; | ||
|
||
import com.cognifide.qa.bb.qualifier.CurrentScope; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
import com.google.inject.Inject; | ||
|
||
@PageObject(css = "button.cmp-form-button") | ||
public class FormButtonComponent { | ||
|
||
@CurrentScope | ||
@Inject | ||
private WebElement component; | ||
|
||
public String getType() { | ||
return component.getAttribute("type"); | ||
} | ||
|
||
public String getTitle() { | ||
return component.getText(); | ||
} | ||
|
||
public String getName() { | ||
return component.getAttribute("name"); | ||
} | ||
|
||
public String getValue() { | ||
return component.getAttribute("value"); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...e/qa/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormContainerComponent.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,29 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import com.cognifide.qa.bb.constants.HtmlTags.Attributes; | ||
import com.cognifide.qa.bb.qualifier.CurrentScope; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
import com.google.inject.Inject; | ||
|
||
@PageObject(css = "form.cmp-form") | ||
public class FormContainerComponent { | ||
|
||
@CurrentScope | ||
@Inject | ||
private WebElement component; | ||
|
||
@FindBy(css = "input[name=':redirect']") | ||
private WebElement thankYouPagePathPropertyElement; | ||
|
||
public boolean isDisplayed() { | ||
return component.isDisplayed(); | ||
} | ||
|
||
public String getThankYouPagePath() { | ||
return thankYouPagePathPropertyElement.getAttribute(Attributes.VALUE); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...fide/qa/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormHiddenComponent.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,28 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import org.openqa.selenium.WebElement; | ||
|
||
import com.cognifide.qa.bb.qualifier.CurrentScope; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
import com.google.inject.Inject; | ||
|
||
@PageObject(css = ".hidden > input") | ||
public class FormHiddenComponent { | ||
|
||
@CurrentScope | ||
@Inject | ||
private WebElement component; | ||
|
||
public String getId() { | ||
return component.getAttribute("id"); | ||
} | ||
|
||
public String getName() { | ||
return component.getAttribute("name"); | ||
} | ||
|
||
public String getValue() { | ||
return component.getAttribute("value"); | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...ide/qa/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormOptionsComponent.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.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import com.cognifide.qa.bb.qualifier.FindPageObject; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
|
||
@PageObject(css = "fieldset.cmp-form-options") | ||
public class FormOptionsComponent { | ||
|
||
@FindBy(css = "legend") | ||
private WebElement title; | ||
|
||
@FindBy(css = "p.cmp-form-options__help-message") | ||
private WebElement helpMessage; | ||
|
||
@FindPageObject | ||
private List<FormOptionsComponentField> fields; | ||
|
||
public String getTitle() { | ||
return title.getText(); | ||
} | ||
|
||
public String getHelpMessage() { | ||
return helpMessage.getText(); | ||
} | ||
|
||
public List<String> getFieldTypes() { | ||
return fields.stream().map(FormOptionsComponentField::getType).collect(Collectors.toList()); | ||
} | ||
|
||
public List<String> getFieldNames() { | ||
return fields.stream().map(FormOptionsComponentField::getName).collect(Collectors.toList()); | ||
} | ||
|
||
public List<String> getFieldValues() { | ||
return fields.stream().map(FormOptionsComponentField::getValue).collect(Collectors.toList()); | ||
} | ||
|
||
public List<String> getFieldTexts() { | ||
return fields.stream().map(FormOptionsComponentField::getText).collect(Collectors.toList()); | ||
} | ||
|
||
public boolean isFieldSelected(int fieldNumber) { | ||
return fields.get(fieldNumber).isSelected(); | ||
} | ||
|
||
public boolean isFieldEnabled(int fieldNumber) { | ||
return fields.get(fieldNumber).isEnabled(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...a/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormOptionsComponentField.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,40 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
|
||
@PageObject(css = "label.cmp-form-options__field-label") | ||
public class FormOptionsComponentField { | ||
|
||
@FindBy(css = "input") | ||
private WebElement input; | ||
|
||
@FindBy(css = "span") | ||
private WebElement label; | ||
|
||
public String getType() { | ||
return input.getAttribute("type"); | ||
} | ||
|
||
public String getName() { | ||
return input.getAttribute("name"); | ||
} | ||
|
||
public String getValue() { | ||
return input.getAttribute("value"); | ||
} | ||
|
||
public String getText() { | ||
return label.getText(); | ||
} | ||
|
||
public boolean isSelected() { | ||
return input.isSelected(); | ||
} | ||
|
||
public boolean isEnabled() { | ||
return input.isEnabled(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...nifide/qa/bb/aem65/tests/pageobjects/corecomponents/formcomponents/FormTextComponent.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,51 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.formcomponents; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import com.cognifide.qa.bb.qualifier.CurrentScope; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
import com.google.inject.Inject; | ||
|
||
@PageObject(css = "input.cmp-form-text__text") | ||
public class FormTextComponent { | ||
|
||
@CurrentScope | ||
@Inject | ||
private WebElement component; | ||
|
||
@FindBy(xpath = "./..") | ||
private WebElement wrapper; | ||
|
||
public String getConstraint() { | ||
return component.getAttribute("type"); | ||
} | ||
|
||
public String getAriaLabel() { | ||
return component.getAttribute("aria-label"); | ||
} | ||
|
||
public String getElementName() { | ||
return component.getAttribute("name"); | ||
} | ||
|
||
public String getValue() { | ||
return component.getAttribute("value"); | ||
} | ||
|
||
public String getPlaceholder() { | ||
return component.getAttribute("placeholder"); | ||
} | ||
|
||
public boolean isReadOnly() { | ||
return Boolean.parseBoolean(component.getAttribute("readonly")); | ||
} | ||
|
||
public String getConstraintMessage() { | ||
return wrapper.getAttribute("data-cmp-constraint-message"); | ||
} | ||
|
||
public String getRequiredMessage() { | ||
return wrapper.getAttribute("data-cmp-required-message"); | ||
} | ||
} |
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
Oops, something went wrong.