Skip to content

Commit

Permalink
Add additional cypress config; Add appropriateness step to e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkrida committed Mar 5, 2021
1 parent 3b4d8f6 commit 43cd6ea
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
root: true,

plugins: ['cypress'],

env: {
node: true,
browser: true,
Expand Down Expand Up @@ -39,5 +41,6 @@ module.exports = {
'@vue/standard',
'prettier',
'prettier/vue',
"plugin:cypress/recommended"
],
}
3 changes: 3 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"types": ["cypress"]
}
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"cypress": "^6.3.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.3.1",
Expand Down
14 changes: 13 additions & 1 deletion tests/cypress/integration/AttributionDetails._spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// type definitions for Cypress object "cy"
/// <reference types="cypress" />

// type definitions for custom commands like "createDefaultTodos"
/// <reference types="../support/commands.js" />

/* This Source Code Form is subject to the terms of the Creative Commons
* License Chooser
*/
Expand Down Expand Up @@ -47,9 +53,14 @@ describe('Attribution Details Step.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()

cy.makeAChoice('.BY', 'yes')
cy.hasRecommendedLicense('CC BY 4.0')
cy.hasStepsCount(6)
cy.hasStepsCount(7)
cy.clickNext()
cy.makeAChoice('.NC', 'yes')
cy.clickNext()
Expand All @@ -68,6 +79,7 @@ describe('Attribution Details Step.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'yes')
cy.clickNext()

cy.get('select').select('CC0 1.0')
cy.hasRecommendedLicense('CC0 1.0 Universal')
cy.hasStepsCount(4)
Expand Down
42 changes: 38 additions & 4 deletions tests/cypress/integration/Stepper._spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ describe('Stepper.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()


cy.makeAChoice('.BY', 'no')
cy.hasRecommendedLicense('CC0 1.0 Universal')
cy.hasStepsCount(7)
cy.hasStepsCount(8)
cy.clickNext()
cy.get('.NC').should('have.class', 'disabled')
cy.get('.ND').should('have.class', 'disabled')
Expand All @@ -50,9 +56,14 @@ describe('Stepper.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()

cy.makeAChoice('.BY', 'yes')
cy.hasRecommendedLicense('CC BY 4.0')
cy.hasStepsCount(6)
cy.hasStepsCount(7)
cy.clickNext()
cy.makeAChoice('.NC', 'yes')
cy.clickNext()
Expand All @@ -68,6 +79,11 @@ describe('Stepper.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()

cy.makeAChoice('.BY', 'yes')
cy.hasRecommendedLicense('CC BY 4.0')
cy.clickNext()
Expand All @@ -85,6 +101,11 @@ describe('Stepper.vue', () => {
cy.visit('/')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()

cy.makeAChoice('.BY', 'yes')
cy.hasRecommendedLicense('CC BY 4.0')
cy.clickNext()
Expand All @@ -103,6 +124,7 @@ describe('Stepper.vue', () => {
cy.clickBack()
cy.makeAChoice('.ND', 'yes')
cy.clickNext()
cy.makeAChoice('.SA', 'yes') // @todo Fix this bug, must click yes before no to get it to switch
cy.makeAChoice('.SA', 'no')
cy.clickNext()
cy.hasRecommendedLicense('CC BY-SA 4.0')
Expand All @@ -125,6 +147,12 @@ describe('Stepper.vue', () => {
cy.clickBack()
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()


cy.makeAChoice('.BY', 'yes')
cy.hasRecommendedLicense('CC BY 4.0')
cy.clickNext()
Expand Down Expand Up @@ -153,6 +181,12 @@ describe('Stepper.vue', () => {
cy.viewport('iphone-x')
cy.makeAChoice('.FS', 'no')
cy.clickNext()

// Appropriate license step
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check())
cy.clickNext()


cy.makeAChoice('.BY', 'yes')
cy.clickNext()
cy.makeAChoice('.NC', 'yes')
Expand All @@ -162,12 +196,12 @@ describe('Stepper.vue', () => {
cy.get('.SA').should('have.class', 'disabled')
cy.hasRecommendedLicense('CC BY-ND 4.0')
cy.window().then(($window) => {
expect($window.scrollY).to.be.closeTo(800, 300)
expect($window.scrollY).to.be.closeTo(800, 500)
})
cy.get('button').contains('DONE').click()
cy.hasLicenseInAttributionCode('CC BY-ND 4.0')
cy.window().then(($window) => {
expect($window.scrollY).to.be.closeTo(1400, 300)
expect($window.scrollY).to.be.closeTo(1400, 500)
})
})
})
Expand Down

0 comments on commit 43cd6ea

Please sign in to comment.