Skip to content

Commit

Permalink
add test to check if badge override is working
Browse files Browse the repository at this point in the history
  • Loading branch information
wildone committed Oct 29, 2019
1 parent e593697 commit fdb034a
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,29 @@
</pagelist>
</par>
</contentblock38>
<contentblock39
jcr:primaryType="nt:unstructured"
sling:resourceType="aemdesign/components/layout/contentblock"
componentId="contentblock39"
title="Badge: Card with Title, Description and Action with override for Card Style and Link Style"
variant="componentConfig">
<par
jcr:primaryType="nt:unstructured"
sling:resourceType="aemdesign/components/layout/container">
<pagelist
jcr:primaryType="nt:unstructured"
sling:resourceType="aemdesign/components/lists/pagelist"
badgeLinkStyle="[aemdesign-showcase:component-style-modifier/button/normal/link,aemdesign-showcase:component-style-modifier/button/primary-red]"
badgeLinkText="[READ MORE]"
cardStyle="[aemdesign-showcase:component-style-modifier/card/promoted,aemdesign-showcase:component-style-modifier/background/bg-c3]"
componentId="pagelist39"
detailsBadge="cardTitleDescriptionAction"
limit="3"
listFrom="children"
listType="list"
parentPage="/content/aemdesign-showcase/au/en/component/lists/page-list/cards"/>
</par>
</contentblock39>
</par>
</article>
</jcr:content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,46 @@ class PageListPublishSpec extends ComponentSpec {
viewport << getViewPorts()
}


@Unroll("Badge: Card with Title, Description and Action with override for Card Style and Link Style in #viewport.label")
def "Badge: Card with Title, Description and Action with override for Card Style and Link Style"() {

given: '>the page hierarchy is created as "Components" > "Lists" > "Page List"'
and: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#pagelist39"

when: "I am on the component showcase page"
setWindowSize(viewport)
waitForAuthorPreviewPage()

then: "The component should be on the page"
def component = waitForComponent(selector)
takeScreenshot($(selector).firstElement(), "The component should be on the page")

and: "List Component Does not have attribute data-layer-label"
assert $("${selector}").getAttribute("data-layer-label").size() == 0

and: "List Has three items"
assert $("${selector} li").size() == 3

and: "First Items - Has image"
assert $("${selector} > div > ul > li.first > div > div.card-img-top > img").attr("alt") == "Page1"

and: "First Items - Has title"
assert $("${selector} > div > ul > li.first > div > div.card-body > h3").text() == "Page1"

and: "First Items - Has description"
assert $("${selector} > div > ul > li.first > div > div.card-body > div.card-text").text() == "Page with Licensed Page Image, with non-Licensed Secondary Image and with Background non-Licensed Image"

and: "First Items - Has call to action with overridden text"
assert $("${selector} > div > ul > li.first > div > div.card-body > div > a").text().toUpperCase() == "READ MORE"

and: "First Items - Has call to action with custom css"
assert $("${selector} > div > ul > li.first > div > div.card-body > div > a").getAttribute("class").contains("btn-primary-red")

where: "Browser size width: #viewport.width and height: #viewport.height"
viewport << getViewPorts()
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package specs.component.lists.pagelist

import spock.lang.IgnoreRest
import spock.lang.Stepwise
import spock.lang.Unroll
import support.ComponentSpec
Expand Down Expand Up @@ -277,8 +278,8 @@ class PageListScreenshotSpec extends ComponentSpec {
}
@Unroll("Appearance of Component as Promoted Cards in #viewport.label")
def "Appearance of Component as Promoted Cards"() {
@Unroll("Appearance of Component as Card with Title, Description and Action with override on Badge CTA in #viewport.label")
def "Appearance of Component as Card with Title, Description and Action with override on Badge CTA"() {
given: '>I am in the component showcase page'
and: '>the component is on the showcase page'
Expand Down Expand Up @@ -507,4 +508,28 @@ class PageListScreenshotSpec extends ComponentSpec {
}
@Unroll("Appearance of Component as Card with Title, Description and Action with override for Card Style and Link Style in #viewport.label")
def "Appearance of Component as Card with Title, Description and Action with override for Card Style and Link Style"() {
given: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#pagelist39"
when: 'I am in the component showcase page'
setWindowSize(viewport)
waitForAuthorPreviewPage()
then: 'The component should appear on the page'
def component = waitForComponent(selector)
then: "It should match the #viewport.width and height: #viewport.height reference image."
designRef(selector)
where: "Browser size width: #viewport.width and height: #viewport.height"
viewport << getViewPorts()
}
}

0 comments on commit fdb034a

Please sign in to comment.