|
| 1 | +/* This Source Code Form is subject to the terms of the Creative Commons |
| 2 | + * License Chooser |
| 3 | +*/ |
| 4 | + |
| 5 | +describe('Attribution Details Step.vue', () => { |
| 6 | + describe('Mark Your Work section appears and is hidden at the correct moments', () => { |
| 7 | + it('The "Mark Your Work" section should be invisible at the beginning', () => { |
| 8 | + cy.visit('/') |
| 9 | + cy.missingLicenseInAttributionCode() |
| 10 | + }) |
| 11 | + |
| 12 | + it('It should appear when the user selects a license from the dropdown and clicks Next', () => { |
| 13 | + cy.visit('/') |
| 14 | + cy.makeAChoice('.FS', 'yes') |
| 15 | + cy.clickNext() |
| 16 | + cy.get('select').select('CC0 1.0') |
| 17 | + cy.hasRecommendedLicense('CC0 1.0 Universal') |
| 18 | + cy.hasStepsCount(4) |
| 19 | + cy.clickNext() |
| 20 | + cy.waiveCopyright() |
| 21 | + cy.clickNext() |
| 22 | + cy.hasLicenseInAttributionCode(' CC0 1.0 ') |
| 23 | + }) |
| 24 | + |
| 25 | + it('It should disappear when the user clicks Back.', () => { |
| 26 | + cy.clickBack() |
| 27 | + cy.missingLicenseInAttributionCode() |
| 28 | + }) |
| 29 | + |
| 30 | + it('When the user clicks back again, and then uses the steps (i.e. clicking I need help on the first step) to choose the license, the "Mark Your Work" section should appear again when the last step is selected.', () => { |
| 31 | + cy.clickBack() |
| 32 | + cy.clickBack() |
| 33 | + cy.makeAChoice('.FS', 'yes') |
| 34 | + cy.clickNext() |
| 35 | + cy.get('select').select('CC0 1.0') |
| 36 | + cy.hasRecommendedLicense('CC0 1.0 Universal') |
| 37 | + cy.hasStepsCount(4) |
| 38 | + cy.clickNext() |
| 39 | + cy.waiveCopyright() |
| 40 | + cy.clickNext() |
| 41 | + cy.hasLicenseInAttributionCode(' CC0 1.0 ') |
| 42 | + }) |
| 43 | + }) |
| 44 | + |
| 45 | + describe('Mark Your Work section correctly shows the license in the correct format:', () => { |
| 46 | + it('When the user selects "CC BY", the license is shown correctly in all tabs', () => { |
| 47 | + cy.visit('/') |
| 48 | + cy.makeAChoice('.FS', 'no') |
| 49 | + cy.clickNext() |
| 50 | + cy.makeAChoice('.BY', 'yes') |
| 51 | + cy.hasRecommendedLicense('CC BY 4.0') |
| 52 | + cy.hasStepsCount(6) |
| 53 | + cy.clickNext() |
| 54 | + cy.makeAChoice('.NC', 'yes') |
| 55 | + cy.clickNext() |
| 56 | + cy.makeAChoice('.ND', 'yes') |
| 57 | + cy.clickNext() |
| 58 | + cy.makeAChoice('.SA', 'yes') |
| 59 | + cy.get('.AD').should('be.visible') |
| 60 | + cy.clickNext() |
| 61 | + cy.hasLicenseInAttributionCode('CC BY 4.0') |
| 62 | + cy.headerTitle('CC BY 4.0') |
| 63 | + cy.readableStringTitle('BY') |
| 64 | + cy.licenseText(' CC BY 4.0') |
| 65 | + }) |
| 66 | + |
| 67 | + it('When the user changes attribution type, the license changes from Short to Full, accordingly', () => { |
| 68 | + cy.visit('/') |
| 69 | + cy.makeAChoice('.FS', 'yes') |
| 70 | + cy.clickNext() |
| 71 | + cy.get('select').select('CC0 1.0') |
| 72 | + cy.hasRecommendedLicense('CC0 1.0 Universal') |
| 73 | + cy.hasStepsCount(4) |
| 74 | + cy.clickNext() |
| 75 | + cy.waiveCopyright() |
| 76 | + cy.clickNext() |
| 77 | + cy.hasLicenseInAttributionCode(' CC0 1.0 ') |
| 78 | + cy.toggleButton() |
| 79 | + cy.licenseText(' CC0 1.0 Universal') |
| 80 | + }) |
| 81 | + }) |
| 82 | + |
| 83 | + describe('The license code can be copied to the clipboard', () => { |
| 84 | + it('When the user clicks on "Copy", the button text changes to "Copied", and the clipboard contains the license text.', () => { |
| 85 | + cy.visit('/') |
| 86 | + cy.makeAChoice('.FS', 'yes') |
| 87 | + cy.clickNext() |
| 88 | + cy.get('select').select('CC0 1.0') |
| 89 | + cy.hasRecommendedLicense('CC0 1.0 Universal') |
| 90 | + cy.hasStepsCount(4) |
| 91 | + cy.clickNext() |
| 92 | + cy.waiveCopyright() |
| 93 | + cy.clickNext() |
| 94 | + cy.hasLicenseInAttributionCode(' CC0 1.0 ') |
| 95 | + cy.copyButton('Copy') |
| 96 | + cy.copyButton('Copied') |
| 97 | + }) |
| 98 | + }) |
| 99 | + |
| 100 | + describe('Attribution details are updated correctly', () => { |
| 101 | + it('When the user adds information in the attribution details, the license code is updated accordingly', () => { |
| 102 | + cy.visit('/') |
| 103 | + cy.makeAChoice('.FS', 'yes') |
| 104 | + cy.clickNext() |
| 105 | + cy.get('select').select('CC0 1.0') |
| 106 | + cy.hasRecommendedLicense('CC0 1.0 Universal') |
| 107 | + cy.hasStepsCount(4) |
| 108 | + cy.clickNext() |
| 109 | + cy.waiveCopyright() |
| 110 | + cy.clickNext() |
| 111 | + cy.selectInputField(1, 'foo') |
| 112 | + cy.selectInputField(2, 'bar') |
| 113 | + cy.selectInputField(3, 'https://creativecommons.org ') |
| 114 | + cy.selectInputField(4, 'https://creativecommons.org ') |
| 115 | + cy.valueOfInputField(1, '[property="dct:title"]') |
| 116 | + cy.valueOfInputField(2, '[property="cc:attributionName"]') |
| 117 | + }) |
| 118 | + }) |
| 119 | +}) |
0 commit comments