Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve tests
  • Loading branch information
obulat committed Dec 4, 2020
commit 06efd69706b8b0d1928dab31bea8dfaa478f7e9e
15 changes: 7 additions & 8 deletions tests/e2e/page-objects/chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

const stepperCommands = {
clickYes: function() {
this.click('.step-actions .field:first-of-type .check')
this.click('.radio-input[value="yes"]')
return this
},
clickNo: function() {
this.click('.step-actions .field:last-of-type .check')
this.click('.radio-input[value="no"]')
return this
},
clickNext: function() {
Expand All @@ -30,8 +30,8 @@ const stepperCommands = {
return this
},
clickWaiver: function() {
this.click('.checkbox:first-of-type input[type=checkbox]')
.click('.checkbox:last-of-type input[type=checkbox]')
this.click('.v-checkbox:first-child')
.click('.v-checkbox:last-child')
.click('.next-button')
return this
},
Expand All @@ -52,7 +52,6 @@ const chooserCommands = {
assertSelectedLicenseDisplayed: function(licenseName) {
this
.assert.containsText('.license-name', licenseName)
.assert.containsText('p.license-text a', licenseName)
return this
}
}
Expand All @@ -62,17 +61,17 @@ module.exports = {

elements: {
appContainer: '#app',
stepper: '.stepper-container',
stepper: '.stepper__container',
selectedLicenseCard: '.selected-license-card',
licenseUseCard: '.license-use-card'
},

sections: {
stepper: {
selector: '.stepper-container',
selector: '.stepper__container',
elements: {
currentStep: {
selector: '.step-container.current'
selector: '.step-container.active'
}
},
commands: [stepperCommands]
Expand Down
29 changes: 12 additions & 17 deletions tests/e2e/specs/AttributionDetailsStep.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
module.exports = {
'@tags': ['att'],
'AttributionDetailsStep'(browser) {
const knowLicenseSelector = '.b-radio'
const knowLicenseSelector = '.v-radio'
const nextButton = '.next-button'
const select = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div > div > span > select'
const selectOpt = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div > div > span > select > option:nth-child(4)'
const stepTitle = '.step-title'
const attributionDetailsInstructions = '.attribution-details-instructions'
const workAuthorLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(1) > label'
const workAuthorInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(1) > div > input'
const urlCreatorProfileLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(2) > label'
const urlCreatorProfileInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(2) > div > input'
const workUrlLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(3) > label'
const workUrlInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(4) > div > input'
const workTitleLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(3) > label'
const workTitleInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(3) > div > input'
const stepTitle = '.step-header__title'
const workAuthorLabel = '.step-content > div > form > div:nth-child(1) > label'
const workAuthorInput = 'form > div:nth-child(1) input'
const urlCreatorProfileLabel = 'form > div:nth-child(2) > label'
const urlCreatorProfileInput = 'form > div:nth-child(2) input'
const workUrlLabel = 'form > div:nth-child(3) label'
const workUrlInput = 'form > div:nth-child(4) input'
const workTitleLabel = 'form > div:nth-child(3) label'
const workTitleInput = 'form > div:nth-child(3) input'
const backBtn = '.previous-button'
const paginationFinish = '.pagination-finish'

browser
.init()
.click(knowLicenseSelector)
.click(nextButton)
.click(select, () => {
browser.click(selectOpt)
})
.click('.select > select')
.click('option[value="CC BY 4.0"]')
.click(nextButton)
.assert.visible(stepTitle, 'Title is visible')
.assert.visible(attributionDetailsInstructions, 'Atrribution Details Instructions block is visible')
.assert.visible(workAuthorLabel, 'Work Author Label is visible')
.assert.visible(workAuthorInput, 'Work Author Input is visible')
.assert.visible(urlCreatorProfileLabel, 'URL of Creator Profile Label is visible')
Expand Down
31 changes: 14 additions & 17 deletions tests/e2e/specs/CopyrightWaiverStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,28 @@ module.exports = {
'Check if CopyrightWaiver is rendered correctly'(browser) {
browser
.init()
.assert.elementPresent('.control-label > span')
.click('.control-label > span')
.assert.not.cssClassPresent('.next-button', 'disabled')
.click('.control-label')
.click('.v-radio')
.click('.next-button')
.assert.elementPresent('.select > select')
.click('.select > select')
.click('option[value="CC0 1.0"]')
.assert.not.cssClassPresent('.next-button', 'disabled')
.click('.next-button')
.assert.elementPresent('.control-label')
.assert.elementPresent('.waiver-textarea')
.assert.elementPresent('label:nth-child(1)')
.assert.elementPresent('label:nth-child(3)')
.assert.elementPresent('.v-checkbox:nth-child(1)')
.assert.elementPresent('.v-checkbox:nth-child(3)')
},

'Check if user can check and uncheck checkboxes'(browser) {
browser
.click('label:nth-child(1)>span.control-label')
.click('label:nth-child(3)>span.control-label')
.assert.not.cssClassPresent('.next-button', 'disabled', 'Next Button visible when user checks agreed and confirmed')
.click('label:nth-child(1)>span.control-label')
.assert.cssClassPresent('.next-button', 'disabled', 'Next button disabled when user unchecks agreed')
.click('label:nth-child(1)>span.control-label')
.assert.not.cssClassPresent('.next-button', 'disabled', 'Next Button visible when user re-checks agreed')
.click('label:nth-child(3)>span.control-label')
.assert.cssClassPresent('.next-button', 'disabled', 'Next button disabled when user unchecks confirmed')
.assert.attributeEquals('.next-button', 'disabled', 'true', 'Next Button disabled when checkboxes not checked')
.click('.v-checkbox:nth-child(1)')
.click('.v-checkbox:nth-child(3)')
.assert.attributeEquals('.next-button', 'disabled', null, 'Next Button enabled when user checks agreed and confirmed')
.click('.v-checkbox:nth-child(1)')
.assert.attributeEquals('.next-button', 'disabled', 'true', 'Next button disabled when user unchecks agreed')
.click('.v-checkbox:nth-child(1)')
.assert.attributeEquals('.next-button', 'disabled', null, 'Next Button enabled when user re-checks agreed')
.click('.v-checkbox:nth-child(3)')
.assert.attributeEquals('.next-button', 'disabled', 'true', 'Next button disabled when user unchecks confirmed')
}
}
11 changes: 5 additions & 6 deletions tests/e2e/specs/DropdownStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ module.exports = {
'DropdownStep'(browser) {
browser
.init()
.assert.elementPresent('.control-label > span')
.click('.control-label > span')
.assert.not.cssClassPresent('.next-button', 'disabled')
.assert.elementPresent('.v-radio')
.click('.v-radio')
.click('.next-button')
.assert.elementPresent('.select > select')
.click('.select > select')
.click('option[value="CC BY 4.0"]')
.assert.not.cssClassPresent('.next-button', 'disabled')
.assert.attributeEquals('.next-button', 'disabled', null, 'Next Button enabled after user selects license from dropdown ')
.click('.next-button')
.assert.visible('.step-description')
// .assert.containsText('div.step-description', 'Attribution 4.0 International')
.assert.visible('.DD .step-header__caption')
.assert.containsText('.DD .step-header__caption', 'Attribution 4.0 International')
.end()
}
}
27 changes: 0 additions & 27 deletions tests/e2e/specs/FirstStep.js

This file was deleted.

2 changes: 1 addition & 1 deletion tests/e2e/specs/LicenseDetailsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
browser
.assert.elementPresent('a[class="license-name"]')
.getAttribute('a[class="license-name"]', 'href', function(result) {
this.assert.equal(result.value, 'https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1')
this.assert.equal(result.value, 'https://creativecommons.org/licenses/by-sa/4.0?ref=chooser-v1')
})
}
}
Loading