1
- import { click , fillIn , currentURL , currentRouteName , visit , waitFor } from '@ember/test-helpers' ;
1
+ import { click , currentURL , currentRouteName , visit , waitFor } from '@ember/test-helpers' ;
2
2
import { setupApplicationTest } from 'ember-qunit' ;
3
3
import { module , test , skip } from 'qunit' ;
4
4
@@ -13,43 +13,6 @@ module('Acceptance | crate page', function (hooks) {
13
13
setupApplicationTest ( hooks ) ;
14
14
setupMirage ( hooks ) ;
15
15
16
- test ( '/crates/:crate is accessible' , async function ( assert ) {
17
- assert . expect ( 0 ) ;
18
-
19
- this . server . create ( 'crate' , { name : 'nanomsg' } ) ;
20
- this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.0' } ) ;
21
- this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.1' } ) ;
22
-
23
- await visit ( '/crates/nanomsg' ) ;
24
- await percySnapshot ( assert ) ;
25
-
26
- await a11yAudit ( axeConfig ) ;
27
- } ) ;
28
-
29
- test ( '/crates/:crate/:version is accessible' , async function ( assert ) {
30
- assert . expect ( 0 ) ;
31
-
32
- this . server . create ( 'crate' , { name : 'nanomsg' } ) ;
33
- this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.0' } ) ;
34
- this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.1' } ) ;
35
-
36
- await visit ( '/crates/nanomsg/0.6.0' ) ;
37
- await percySnapshot ( assert ) ;
38
-
39
- await a11yAudit ( axeConfig ) ;
40
- } ) ;
41
-
42
- test ( '/crates/:crate/owners is accessible' , async function ( assert ) {
43
- assert . expect ( 0 ) ;
44
-
45
- this . server . loadFixtures ( ) ;
46
-
47
- await visit ( '/crates/nanomsg/owners' ) ;
48
- await percySnapshot ( assert ) ;
49
-
50
- await a11yAudit ( axeConfig ) ;
51
- } ) ;
52
-
53
16
test ( 'visiting a crate page from the front page' , async function ( assert ) {
54
17
this . server . create ( 'crate' , { name : 'nanomsg' , newest_version : '0.6.1' } ) ;
55
18
this . server . create ( 'version' , { crateId : 'nanomsg' , num : '0.6.1' } ) ;
@@ -78,6 +41,9 @@ module('Acceptance | crate page', function (hooks) {
78
41
assert . dom ( '[data-test-heading] [data-test-crate-name]' ) . hasText ( 'nanomsg' ) ;
79
42
assert . dom ( '[data-test-heading] [data-test-crate-version]' ) . hasText ( '0.6.1' ) ;
80
43
assert . dom ( '[data-test-crate-stats-label]' ) . hasText ( 'Stats Overview' ) ;
44
+
45
+ await percySnapshot ( assert ) ;
46
+ await a11yAudit ( axeConfig ) ;
81
47
} ) ;
82
48
83
49
test ( 'visiting /crates/nanomsg/' , async function ( assert ) {
@@ -110,6 +76,9 @@ module('Acceptance | crate page', function (hooks) {
110
76
assert . dom ( '[data-test-heading] [data-test-crate-name]' ) . hasText ( 'nanomsg' ) ;
111
77
assert . dom ( '[data-test-heading] [data-test-crate-version]' ) . hasText ( '0.6.0' ) ;
112
78
assert . dom ( '[data-test-crate-stats-label]' ) . hasText ( 'Stats Overview for 0.6.0 (see all)' ) ;
79
+
80
+ await percySnapshot ( assert ) ;
81
+ await a11yAudit ( axeConfig ) ;
113
82
} ) ;
114
83
115
84
test ( 'unknown versions fall back to latest version and show an error message' , async function ( assert ) {
@@ -167,23 +136,23 @@ module('Acceptance | crate page', function (hooks) {
167
136
test ( 'crates having normal dependencies' , async function ( assert ) {
168
137
this . server . loadFixtures ( ) ;
169
138
170
- await visit ( 'crates/nanomsg' ) ;
139
+ await visit ( '/ crates/nanomsg' ) ;
171
140
172
141
assert . dom ( '[data-test-dependencies] li' ) . exists ( { count : 2 } ) ;
173
142
} ) ;
174
143
175
144
test ( 'crates having build dependencies' , async function ( assert ) {
176
145
this . server . loadFixtures ( ) ;
177
146
178
- await visit ( 'crates/nanomsg' ) ;
147
+ await visit ( '/ crates/nanomsg' ) ;
179
148
180
149
assert . dom ( '[data-test-build-dependencies] li' ) . exists ( { count : 1 } ) ;
181
150
} ) ;
182
151
183
152
test ( 'crates having dev dependencies' , async function ( assert ) {
184
153
this . server . loadFixtures ( ) ;
185
154
186
- await visit ( 'crates/nanomsg' ) ;
155
+ await visit ( '/ crates/nanomsg' ) ;
187
156
188
157
assert . dom ( '[data-test-dev-dependencies] li' ) . exists ( { count : 1 } ) ;
189
158
} ) ;
@@ -268,73 +237,4 @@ module('Acceptance | crate page', function (hooks) {
268
237
269
238
assert . equal ( currentURL ( ) , '/crates/nanomsg/owners' ) ;
270
239
} ) ;
271
-
272
- test ( 'listing crate owners' , async function ( assert ) {
273
- this . server . loadFixtures ( ) ;
274
-
275
- await visit ( '/crates/nanomsg/owners' ) ;
276
-
277
- assert . dom ( '[data-test-owners] [data-test-owner-team]' ) . exists ( { count : 2 } ) ;
278
- assert . dom ( '[data-test-owners] [data-test-owner-user]' ) . exists ( { count : 2 } ) ;
279
- assert . dom ( 'a[href="/teams/github:org:thehydroimpulse"]' ) . exists ( ) ;
280
- assert . dom ( 'a[href="/teams/github:org:blabaere"]' ) . exists ( ) ;
281
- assert . dom ( 'a[href="/users/thehydroimpulse"]' ) . exists ( ) ;
282
- assert . dom ( 'a[href="/users/blabaere"]' ) . exists ( ) ;
283
- } ) ;
284
-
285
- test ( 'attempting to add owner without username' , async function ( assert ) {
286
- this . server . loadFixtures ( ) ;
287
-
288
- await visit ( '/crates/nanomsg/owners' ) ;
289
- await fillIn ( 'input[name="username"]' , '' ) ;
290
- assert . dom ( '[data-test-save-button]' ) . isDisabled ( ) ;
291
- } ) ;
292
-
293
- test ( 'attempting to add non-existent owner' , async function ( assert ) {
294
- this . server . loadFixtures ( ) ;
295
-
296
- await visit ( '/crates/nanomsg/owners' ) ;
297
- await fillIn ( 'input[name="username"]' , 'spookyghostboo' ) ;
298
- await click ( '[data-test-save-button]' ) ;
299
-
300
- assert
301
- . dom ( '[data-test-notification-message="error"]' )
302
- . hasText ( 'Error sending invite: could not find user with login `spookyghostboo`' ) ;
303
- assert . dom ( '[data-test-owners] [data-test-owner-team]' ) . exists ( { count : 2 } ) ;
304
- assert . dom ( '[data-test-owners] [data-test-owner-user]' ) . exists ( { count : 2 } ) ;
305
- } ) ;
306
-
307
- test ( 'add a new owner' , async function ( assert ) {
308
- this . server . loadFixtures ( ) ;
309
-
310
- await visit ( '/crates/nanomsg/owners' ) ;
311
- await fillIn ( 'input[name="username"]' , 'iain8' ) ;
312
- await click ( '[data-test-save-button]' ) ;
313
-
314
- assert . dom ( '[data-test-notification-message="success"]' ) . hasText ( 'An invite has been sent to iain8' ) ;
315
- assert . dom ( '[data-test-owners] [data-test-owner-team]' ) . exists ( { count : 2 } ) ;
316
- assert . dom ( '[data-test-owners] [data-test-owner-user]' ) . exists ( { count : 2 } ) ;
317
- } ) ;
318
-
319
- test ( 'remove a crate owner when owner is a user' , async function ( assert ) {
320
- this . server . loadFixtures ( ) ;
321
-
322
- await visit ( '/crates/nanomsg/owners' ) ;
323
- await click ( '[data-test-owner-user="thehydroimpulse"] [data-test-remove-owner-button]' ) ;
324
-
325
- assert . dom ( '[data-test-notification-message="success"]' ) . hasText ( 'User thehydroimpulse removed as crate owner' ) ;
326
- assert . dom ( '[data-test-owner-user]' ) . exists ( { count : 1 } ) ;
327
- } ) ;
328
-
329
- test ( 'remove a crate owner when owner is a team' , async function ( assert ) {
330
- this . server . loadFixtures ( ) ;
331
-
332
- await visit ( '/crates/nanomsg/owners' ) ;
333
- await click ( '[data-test-owner-team="github:org:thehydroimpulse"] [data-test-remove-owner-button]' ) ;
334
-
335
- assert
336
- . dom ( '[data-test-notification-message="success"]' )
337
- . hasText ( 'Team org/thehydroimpulseteam removed as crate owner' ) ;
338
- assert . dom ( '[data-test-owner-team]' ) . exists ( { count : 1 } ) ;
339
- } ) ;
340
240
} ) ;
0 commit comments