Skip to content

Commit

Permalink
add tests for form components
Browse files Browse the repository at this point in the history
  • Loading branch information
wildone committed Dec 7, 2019
1 parent a849d2e commit cda12dd
Show file tree
Hide file tree
Showing 16 changed files with 1,148 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package specs.component.forms.button

import spock.lang.Stepwise
import support.ComponentSpec
import support.page.ui.touch.TouchUIEditor

@Stepwise
class ButtonAuthorSpec extends ComponentSpec {

String pathPage = "component/forms/button"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/button"

def setupSpec() {
loginAsAdmin()
}

def cleanupSpec() {
analyzeLog()
}

def "Authoring of Component"() {

given: "Component has already been inserted"
def selector = "#button1"

when: "I am on the Component showcase page"
TouchUIEditor page = waitForTouchUIPage(language)

then: "The component should be on showcase page"
waitFor { withFrame(TouchUIEditor.PAGE_FRAME_CONTENT) { $(selector) } }

and: "All dialogs are closed"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("All dialogs are closed")

and: "I open the dialog box"
page.Editor.showDialog(compileComponentPath())

then: "I should be able to see component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == true
report("I should be able to see component author dialog")

when: "I close the dialog box"
page.Editor.closeDialog(compileComponentPath())

then: "I should be able to close component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("I should be able to close component author dialog")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package specs.component.forms.button

import spock.lang.Stepwise
import spock.lang.Unroll
import support.ComponentSpec

@Stepwise
class ButtonPublishSpec extends ComponentSpec {

String pathPage = "component/forms/button"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/button"

def setupSpec() {
loginAsAdmin()
}

@Unroll("Functionality of Component Variant: Default in #viewport.label")
def "Functionality of Component Variant: Default"() {

given: '>the page hierarchy is created as "Components" > "Forms" > "Button"'
and: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#button1"

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

then: "The component should be on the page"
def component = waitForComponent(selector)

and: "Should have sample content"
assert compareInnerTextIgnoreCase("${selector}","Submit")
takeScreenshot($(selector).firstElement(), "Should have sample content Submit")

where:
viewport << getViewPorts()
}

@Unroll("Functionality of Component Variant: Button in #viewport.label")
def "Functionality of Component Variant: Button"() {

given: '>the page hierarchy is created as "Components" > "Forms" > "Button"'
and: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#button2"

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

then: "The component should be on the page"
def component = waitForComponent(selector)

and: "Should have sample content"
assert compareInnerTextIgnoreCase("${selector}","Button")
takeScreenshot($(selector).firstElement(), "Should have sample content Button")

where:
viewport << getViewPorts()
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package specs.component.forms.button

import spock.lang.Stepwise
import spock.lang.Unroll
import support.ComponentSpec

@Stepwise
class ButtonScreenshotSpec extends ComponentSpec {

String pathPage = "component/forms/button"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/button"

def setupSpec() {
loginAsAdmin()
}

@Unroll("Appearance of Component Variant: Default in #viewport.label")
def "Appearance of Component Variant: Default"() {

given: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#button1"

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:
viewport << getViewPorts()

}

@Unroll("Appearance of Component Variant: Button in #viewport.label")
def "Appearance of Component Variant: Button"() {

given: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#button2"

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:
viewport << getViewPorts()

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package specs.component.forms.form

import spock.lang.Stepwise
import support.ComponentSpec
import support.page.ui.touch.TouchUIEditor

@Stepwise
class FormAuthorSpec extends ComponentSpec {

String pathPage = "component/forms/form"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/form"

def setupSpec() {
loginAsAdmin()
}

def cleanupSpec() {
analyzeLog()
}

def "Authoring of Component"() {

given: "Component has already been inserted"
def selector = "#form1"

when: "I am on the Component showcase page"
TouchUIEditor page = waitForTouchUIPage(language)

then: "The component should be on showcase page"
waitFor { withFrame(TouchUIEditor.PAGE_FRAME_CONTENT) { $(selector) } }

and: "All dialogs are closed"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("All dialogs are closed")

and: "I open the dialog box"
page.Editor.showDialog(compileComponentPath())

then: "I should be able to see component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == true
report("I should be able to see component author dialog")

when: "I close the dialog box"
page.Editor.closeDialog(compileComponentPath())

then: "I should be able to close component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("I should be able to close component author dialog")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package specs.component.forms.form

import spock.lang.Stepwise
import spock.lang.Unroll
import support.ComponentSpec

@Stepwise
class FormPublishSpec extends ComponentSpec {

String pathPage = "component/forms/form"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/form"

def setupSpec() {
loginAsAdmin()
}

@Unroll("Functionality of Component Variant: Default in #viewport.label")
def "Functionality of Component Variant: Default"() {

given: '>the page hierarchy is created as "Components" > "Forms" > "Form"'
and: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#form1"

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

then: "The component should be on the page"
def component = waitForComponent(selector)

and: "Should have default fields"
assert $(selector).children().size() == 2

where:
viewport << getViewPorts()
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package specs.component.forms.form

import spock.lang.Ignore
import spock.lang.Stepwise
import spock.lang.Unroll
import support.ComponentSpec

@Stepwise
class FormScreenshotSpec extends ComponentSpec {

String pathPage = "component/forms/form"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/form"

def setupSpec() {
loginAsAdmin()
}

@Ignore
@Unroll("Appearance of Component Variant: Default in #viewport.label")
def "Appearance of Component Variant: Default"() {

given: '>I am in the component showcase page'
and: '>the component is on the showcase page'
def selector = "#form1"

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:
viewport << getViewPorts()

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package specs.component.forms.hidden

import spock.lang.Stepwise
import support.ComponentSpec
import support.page.ui.touch.TouchUIEditor

@Stepwise
class HiddenAuthorSpec extends ComponentSpec {

String pathPage = "component/forms/hidden"
String pathSite = "content/aemdesign-showcase"
String language = "au/en"
String componentPath = "jcr:content/article/par/contentblock1/par/hidden"

def setupSpec() {
loginAsAdmin()
}

def cleanupSpec() {
analyzeLog()
}

def "Authoring of Component"() {

given: "Component has already been inserted"
def selector = "#hidden1"

when: "I am on the Component showcase page"
TouchUIEditor page = waitForTouchUIPage(language)

then: "The component should be on showcase page"
waitFor { withFrame(TouchUIEditor.PAGE_FRAME_CONTENT) { $(selector) } }

and: "All dialogs are closed"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("All dialogs are closed")

and: "I open the dialog box"
page.Editor.showDialog(compileComponentPath())

then: "I should be able to see component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == true
report("I should be able to see component author dialog")

when: "I close the dialog box"
page.Editor.closeDialog(compileComponentPath())

then: "I should be able to close component author dialog"
page.Editor.isDialogOpen(compileComponentPath()) == false
report("I should be able to close component author dialog")
}

}
Loading

0 comments on commit cda12dd

Please sign in to comment.