Skip to content

Commit e20ba5e

Browse files
authored
Merge pull request #354 from creativecommons/fix-step-order
Move Accept License step to allow user to first review license criteria
2 parents 541b06b + bc2eef5 commit e20ba5e

File tree

3 files changed

+106
-40
lines changed

3 files changed

+106
-40
lines changed

src/utils/steps.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,56 +29,56 @@ export const initialSteps = [
2929
},
3030
{
3131
id: 1,
32-
name: 'AL',
32+
name: 'BY',
3333
visible: true,
3434
enabled: true,
3535
status: 'inactive',
3636
selected: undefined,
3737
},
3838
{
3939
id: 2,
40-
name: 'BY',
40+
name: 'NC',
4141
visible: true,
4242
enabled: true,
4343
status: 'inactive',
4444
selected: undefined,
4545
},
4646
{
4747
id: 3,
48-
name: 'NC',
48+
name: 'ND',
4949
visible: true,
5050
enabled: true,
5151
status: 'inactive',
5252
selected: undefined,
5353
},
5454
{
5555
id: 4,
56-
name: 'ND',
56+
name: 'SA',
5757
visible: true,
5858
enabled: true,
5959
status: 'inactive',
6060
selected: undefined,
6161
},
6262
{
6363
id: 5,
64-
name: 'SA',
65-
visible: true,
64+
name: 'DD',
65+
visible: false,
6666
enabled: true,
6767
status: 'inactive',
6868
selected: undefined,
6969
},
7070
{
7171
id: 6,
72-
name: 'DD',
72+
name: 'CW',
7373
visible: false,
7474
enabled: true,
7575
status: 'inactive',
7676
selected: undefined,
7777
},
7878
{
7979
id: 7,
80-
name: 'CW',
81-
visible: false,
80+
name: 'AL',
81+
visible: true,
8282
enabled: true,
8383
status: 'inactive',
8484
selected: undefined,

tests/cypress/integration/AttributionDetails._spec.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,35 @@ describe('Attribution Details Step.vue', () => {
5050

5151
describe('Mark Your Work section correctly shows the license in the correct format:', () => {
5252
it('When the user selects "CC BY", the license is shown correctly in all tabs', () => {
53+
// First step
5354
cy.visit('/');
5455
cy.makeAChoice('.FS', 'no');
5556
cy.clickNext();
5657

57-
// Appropriate license step
58-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
59-
cy.clickNext();
60-
58+
// Attribution step
6159
cy.makeAChoice('.BY', 'yes');
6260
cy.hasRecommendedLicense('CC BY 4.0');
6361
cy.hasStepsCount(7);
6462
cy.clickNext();
63+
64+
// Non-commercial step
6565
cy.makeAChoice('.NC', 'yes');
6666
cy.clickNext();
67+
68+
// No-derivatives step
6769
cy.makeAChoice('.ND', 'yes');
6870
cy.clickNext();
71+
72+
// Share-alike step
6973
cy.makeAChoice('.SA', 'yes');
7074
cy.get('.AD').should('be.visible');
7175
cy.clickNext();
76+
77+
// Appropriate license step
78+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
79+
cy.clickNext();
80+
81+
// Ensure license is correct
7282
cy.hasLicenseInAttributionCode('CC BY 4.0');
7383
cy.headerTitle('CC BY 4.0');
7484
cy.readableStringTitle('BY');

tests/cypress/integration/Stepper._spec.js

Lines changed: 83 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ describe('Stepper.vue', () => {
5252
cy.makeAChoice('.FS', 'no');
5353
cy.clickNext();
5454

55-
// Appropriate license step
56-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
57-
cy.clickNext();
58-
5955
cy.makeAChoice('.BY', 'no');
6056
cy.hasRecommendedLicense('CC0 1.0 Universal');
6157
cy.hasStepsCount(8);
@@ -65,6 +61,11 @@ describe('Stepper.vue', () => {
6561
cy.get('.SA').should('have.class', 'disabled');
6662
cy.waiveCopyright();
6763
cy.clickNext();
64+
65+
// Appropriate license step
66+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
67+
cy.clickNext();
68+
6869
cy.hasLicenseInAttributionCode(' CC0 1.0 ');
6970
});
7071

@@ -73,21 +74,26 @@ describe('Stepper.vue', () => {
7374
cy.makeAChoice('.FS', 'no');
7475
cy.clickNext();
7576

76-
// Appropriate license step
77-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
78-
cy.clickNext();
79-
8077
cy.makeAChoice('.BY', 'yes');
8178
cy.hasRecommendedLicense('CC BY 4.0');
8279
cy.hasStepsCount(7);
8380
cy.clickNext();
81+
8482
cy.makeAChoice('.NC', 'yes');
8583
cy.clickNext();
84+
8685
cy.makeAChoice('.ND', 'yes');
8786
cy.clickNext();
87+
8888
cy.makeAChoice('.SA', 'yes');
89+
8990
cy.get('.AD').should('be.visible');
9091
cy.clickNext();
92+
93+
// Appropriate license step
94+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
95+
cy.clickNext();
96+
9197
cy.hasLicenseInAttributionCode('CC BY 4.0');
9298
});
9399

@@ -96,19 +102,22 @@ describe('Stepper.vue', () => {
96102
cy.makeAChoice('.FS', 'no');
97103
cy.clickNext();
98104

99-
// Appropriate license step
100-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
101-
cy.clickNext();
102-
103105
cy.makeAChoice('.BY', 'yes');
104106
cy.hasRecommendedLicense('CC BY 4.0');
105107
cy.clickNext();
108+
106109
cy.makeAChoice('.NC', 'no');
107110
cy.hasRecommendedLicense('CC BY-NC 4.0');
108111
cy.clickNext();
112+
109113
cy.makeAChoice('.ND', 'no');
110114
cy.hasRecommendedLicense('CC BY-NC-ND 4.0');
111115
cy.clickNext();
116+
117+
// Appropriate license step
118+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
119+
cy.clickNext();
120+
112121
cy.get('.SA').should('have.class', 'disabled');
113122
cy.hasLicenseInAttributionCode('CC BY-NC-ND 4.0');
114123
});
@@ -118,33 +127,64 @@ describe('Stepper.vue', () => {
118127
cy.makeAChoice('.FS', 'no');
119128
cy.clickNext();
120129

121-
// Appropriate license step
122-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
123-
cy.clickNext();
124-
125130
cy.makeAChoice('.BY', 'yes');
126131
cy.hasRecommendedLicense('CC BY 4.0');
127132
cy.clickNext();
133+
128134
cy.makeAChoice('.NC', 'yes');
129135
cy.clickNext();
136+
130137
cy.makeAChoice('.ND', 'no');
131138
cy.hasRecommendedLicense('CC BY-ND 4.0');
132139
cy.clickNext();
140+
141+
// Appropriate license step
142+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
143+
cy.clickNext();
144+
133145
cy.get('.SA').should('have.class', 'disabled');
134146
cy.hasLicenseInAttributionCode('CC BY-ND 4.0');
135147
});
136148
});
137149

138150
describe('"Back", "Done" and "Start again" buttons work correctly', () => {
139151
it('User can select CC BY-ND, go back and change selection to CC BY-SA', () => {
152+
// Front screen
153+
cy.visit('/');
154+
cy.makeAChoice('.FS', 'yes');
155+
cy.clickNext();
156+
157+
// Choose own license
158+
cy.get('select').select('CC BY-ND 4.0');
159+
cy.hasRecommendedLicense('CC BY-ND 4.0');
140160
cy.clickBack();
161+
162+
// Front screen
163+
cy.makeAChoice('.FS', 'no');
164+
cy.clickNext();
165+
166+
// Attribution
167+
cy.makeAChoice('.BY', 'yes');
168+
cy.hasRecommendedLicense('CC BY-ND 4.0');
169+
cy.clickNext();
170+
171+
// Non-commercial
172+
cy.makeAChoice('.NC', 'yes');
173+
cy.clickNext();
174+
175+
// No-derivs
141176
cy.makeAChoice('.ND', 'yes');
142177
cy.clickNext();
143-
cy.makeAChoice('.SA', 'yes'); // @todo Fix this bug, must click yes before no to get it to switch
178+
179+
// Share-alike
144180
cy.makeAChoice('.SA', 'no');
145-
cy.clickNext();
146181
cy.hasRecommendedLicense('CC BY-SA 4.0');
147-
cy.get('.AD').should('be.visible');
182+
cy.clickNext();
183+
184+
// Appropriate license step
185+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
186+
cy.clickNext();
187+
148188
cy.hasLicenseInAttributionCode('CC BY-SA 4.0');
149189
});
150190

@@ -164,20 +204,28 @@ describe('Stepper.vue', () => {
164204
cy.makeAChoice('.FS', 'no');
165205
cy.clickNext();
166206

167-
// Appropriate license step
168-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
169-
cy.clickNext();
170-
207+
// Attribution
171208
cy.makeAChoice('.BY', 'yes');
172209
cy.hasRecommendedLicense('CC BY 4.0');
173210
cy.clickNext();
211+
212+
// Non-commercial
174213
cy.makeAChoice('.NC', 'yes');
175214
cy.clickNext();
215+
216+
// No-derivs
176217
cy.makeAChoice('.ND', 'yes');
177218
cy.clickNext();
219+
220+
// Share-alike
178221
cy.makeAChoice('.SA', 'no');
179222
cy.hasRecommendedLicense('CC BY-SA 4.0');
180223
cy.clickNext();
224+
225+
// Appropriate license step
226+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
227+
cy.clickNext();
228+
181229
cy.hasLicenseInAttributionCode('CC BY-SA 4.0');
182230
});
183231

@@ -203,18 +251,26 @@ describe('Stepper.vue', () => {
203251
cy.makeAChoice('.FS', 'no');
204252
cy.clickNext();
205253

206-
// Appropriate license step
207-
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
208-
cy.clickNext();
209-
254+
// Attribution
210255
cy.makeAChoice('.BY', 'yes');
211256
cy.clickNext();
257+
258+
// Commercial uses
212259
cy.makeAChoice('.NC', 'yes');
213260
cy.clickNext();
261+
262+
// Derivative-works
214263
cy.makeAChoice('.ND', 'no');
215264
cy.clickNext();
265+
266+
// Share-alike
216267
cy.get('.SA').should('have.class', 'disabled');
217268
cy.hasRecommendedLicense('CC BY-ND 4.0');
269+
270+
// Appropriate license step
271+
cy.get('.AL [type="checkbox"]').each($el => cy.wrap($el).check());
272+
cy.clickNext();
273+
218274
cy.window().then($window => {
219275
expect($window.scrollY).to.be.closeTo(800, 500);
220276
});

0 commit comments

Comments
 (0)