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
373 provdiding CRUD tests for Breadcrumb v2 component, adding needed … #15
Merged
Danon9111
merged 4 commits into
master
from
feature/373-core-components-breadcrumbs-tests
Oct 23, 2019
+145
−0
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
681d4e7
373 provdiding CRUD tests for Breadcrumb v2 component, adding needed …
Danon9111 eb87274
Merge branch 'master' into feature/373-core-components-breadcrumbs-tests
Danon9111 628ef9b
373 - addressing code review comments - removing one of the test for …
Danon9111 951e5fc
adding missing assertion for checkbox test
Danon9111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
.../java/com/cognifide/qa/bb/aem65/tests/pageobjects/corecomponents/BreadcrumbComponent.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,19 @@ | ||
package com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents; | ||
|
||
import com.cognifide.qa.bb.qualifier.CurrentScope; | ||
import com.cognifide.qa.bb.qualifier.PageObject; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import com.google.inject.Inject; | ||
|
||
@PageObject(css = ".cmp-breadcrumb") | ||
public class BreadcrumbComponent { | ||
|
||
@Inject | ||
@CurrentScope | ||
private WebElement component; | ||
|
||
public String getText() { | ||
return component.getText(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...src/test/java/com/cognifide/qa/bb/aem65/tests/corecomponents/BreadcrumbComponentTest.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,79 @@ | ||
package com.cognifide.qa.bb.aem65.tests.corecomponents; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.cognifide.qa.bb.aem.core.api.AemActions; | ||
import com.cognifide.qa.bb.aem.core.component.actions.ConfigureComponentData; | ||
import com.cognifide.qa.bb.aem.core.component.configuration.ResourceFileLocation; | ||
import com.cognifide.qa.bb.aem.core.pages.sling.SlingDataXMLBuilder; | ||
import com.cognifide.qa.bb.aem.core.pages.sling.SlingPageData; | ||
import com.cognifide.qa.bb.aem65.tests.AbstractAemAuthorTest; | ||
import com.cognifide.qa.bb.aem65.tests.pageobjects.corecomponents.BreadcrumbComponent; | ||
import com.cognifide.qa.bb.aem65.tests.pages.TestPage; | ||
import com.cognifide.qa.bb.api.actions.ActionException; | ||
import com.cognifide.qa.bb.junit5.guice.Modules; | ||
import com.cognifide.qa.bb.modules.BobcatRunModule; | ||
|
||
import io.qameta.allure.Epic; | ||
import io.qameta.allure.Feature; | ||
|
||
@Modules(BobcatRunModule.class) | ||
@Epic("Core Components authoring tests") | ||
@Feature("Breadcrumb Component configuration") | ||
@DisplayName("Author can configure for Breadcrumb Component the...") | ||
public class BreadcrumbComponentTest extends AbstractAemAuthorTest { | ||
|
||
private static final String HIDDEN_PAGE_PATH = "/content/core-components-examples/breadcrumbhiddentestpage"; | ||
private static final String COMPONENT_PAGE_PATH = | ||
"/content/core-components-examples/breadcrumbhiddentestpage/breadcrumbtestpage"; | ||
|
||
private TestPage testPage; | ||
private BreadcrumbComponent component; | ||
|
||
@BeforeEach | ||
public void createAndOpenTestPage() throws ActionException { | ||
controller.execute(AemActions.CREATE_PAGE_VIA_SLING, new SlingPageData(HIDDEN_PAGE_PATH, | ||
SlingDataXMLBuilder.buildFromFile( | ||
"testpages/core-components/breadcrumb/breadcrumbComponentHiddenTestPage.xml"))); | ||
|
||
controller.execute(AemActions.CREATE_PAGE_VIA_SLING, new SlingPageData(COMPONENT_PAGE_PATH, | ||
SlingDataXMLBuilder.buildFromFile( | ||
"testpages/core-components/breadcrumb/breadcrumbComponentTestPage.xml"))); | ||
|
||
testPage = bobcatPageFactory.create("/editor.html" + COMPONENT_PAGE_PATH + ".html", TestPage.class); | ||
testPage.open(); | ||
} | ||
|
||
@Test | ||
@DisplayName("navigation start level - decrease default value") | ||
public void decreaseNavigationStartLevel() throws ActionException { | ||
controller.execute(AemActions.CONFIGURE_COMPONENT, | ||
new ConfigureComponentData("container", "Breadcrumb (v2)", 0, | ||
new ResourceFileLocation("component-configs/core-components/breadcrumb/navigation-start-level.yaml"))); | ||
component = testPage.getContent(BreadcrumbComponent.class, 0); | ||
assertThat(component.getText()).as("Check if breadcrumb value contains first level page") | ||
.contains("Core Components"); | ||
} | ||
|
||
@Test | ||
@DisplayName("checkbox values change to true") | ||
public void changeCheckboxesToTrue() throws ActionException { | ||
controller.execute(AemActions.CONFIGURE_COMPONENT, | ||
new ConfigureComponentData("container", "Breadcrumb (v2)", 0, | ||
new ResourceFileLocation("component-configs/core-components/breadcrumb/checkbox-configuration.yaml"))); | ||
component = testPage.getContent(BreadcrumbComponent.class, 0); | ||
assertThat(component.getText()).as("Check if current page is not present in breadcrumb") | ||
.doesNotContain("breadcrumbTestPage").contains("breadcrumbHiddenTestPage"); | ||
} | ||
|
||
@AfterEach | ||
public void deleteTestPage() throws ActionException { | ||
controller.execute(AemActions.DELETE_PAGE_VIA_SLING, new SlingPageData(COMPONENT_PAGE_PATH)); | ||
controller.execute(AemActions.DELETE_PAGE_VIA_SLING, new SlingPageData(HIDDEN_PAGE_PATH)); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...c/test/resources/component-configs/core-components/breadcrumb/checkbox-configuration.yaml
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,7 @@ | ||
Properties: | ||
- label: Show hidden navigation items | ||
type: CHECKBOX | ||
value: true | ||
- label: Hide current page | ||
type: CHECKBOX | ||
value: true |
4 changes: 4 additions & 0 deletions
4
...c/test/resources/component-configs/core-components/breadcrumb/navigation-start-level.yaml
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,4 @@ | ||
Properties: | ||
- label: Navigation Start Level | ||
type: TEXTFIELD | ||
value: 1 |
16 changes: 16 additions & 0 deletions
16
...test/resources/testpages/core-components/breadcrumb/breadcrumbComponentHiddenTestPage.xml
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jcr:root jcr:primaryType="cq:Page" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" | ||
xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"> | ||
<jcr:content jcr:title="breadcrumbHiddenTestPage" jcr:primaryType="cq:PageContent" hideInNav="true" | ||
sling:resourceType="core-components-examples/components/page" | ||
cq:template="/conf/core-components-examples/settings/wcm/templates/content-page" | ||
cq:lastModifiedBy="admin" cq:lastModified="{Date}2019-10-18T14:26:02.995+02:00"> | ||
<root jcr:primaryType="nt:unstructured" sling:resourceType="wcm/foundation/components/responsivegrid"> | ||
<responsivegrid jcr:primaryType="nt:unstructured" | ||
sling:resourceType="wcm/foundation/components/responsivegrid" jcr:lastModifiedBy="admin" | ||
jcr:lastModified="{Date}2018-12-20T14:47:57.433Z" jcr:createdBy="admin" | ||
jcr:created="{Date}2018-12-20T12:31:03.201Z" cq:styleIds="[1545309110033]"/> | ||
</root> | ||
</jcr:content> | ||
<breadcrumbmiddletestpage/> | ||
</jcr:root> |
20 changes: 20 additions & 0 deletions
20
...5/src/test/resources/testpages/core-components/breadcrumb/breadcrumbComponentTestPage.xml
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jcr:root jcr:primaryType="cq:Page" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" | ||
xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"> | ||
<jcr:content jcr:title="breadcrumbTestPage" jcr:primaryType="cq:PageContent" | ||
sling:resourceType="core-components-examples/components/page" | ||
cq:template="/conf/core-components-examples/settings/wcm/templates/content-page" | ||
cq:lastModifiedBy="admin" cq:lastModified="{Date}2019-10-18T14:27:29.269+02:00"> | ||
<root jcr:primaryType="nt:unstructured" sling:resourceType="wcm/foundation/components/responsivegrid"> | ||
<responsivegrid jcr:primaryType="nt:unstructured" | ||
sling:resourceType="wcm/foundation/components/responsivegrid" jcr:lastModifiedBy="admin" | ||
jcr:lastModified="{Date}2018-12-20T14:47:57.433Z" jcr:createdBy="admin" | ||
jcr:created="{Date}2018-12-20T12:31:03.201Z" cq:styleIds="[1545309110033]"> | ||
<breadcrumb jcr:primaryType="nt:unstructured" | ||
sling:resourceType="core/wcm/components/breadcrumb/v2/breadcrumb" jcr:lastModifiedBy="admin" | ||
jcr:lastModified="{Date}2019-10-18T14:27:29.265+02:00" jcr:createdBy="admin" | ||
jcr:created="{Date}2019-10-18T14:27:29.265+02:00"/> | ||
</responsivegrid> | ||
</root> | ||
</jcr:content> | ||
</jcr:root> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You assert that the current page is not displayed in the breadcrumb component, but you don't check if the hidden page is displayed in it, right? If so, then an assertion is missing