1
1
const apiPrefix = Cypress . env ( 'apiPrefix' ) ;
2
2
const uiPrefix = Cypress . env ( 'uiPrefix' ) ;
3
- const insightsLogin = Cypress . env ( 'insightsLogin' ) ;
4
3
5
4
describe ( 'Collection Upload Tests' , ( ) => {
6
5
const userName = 'testUser' ;
@@ -9,61 +8,57 @@ describe('Collection Upload Tests', () => {
9
8
before ( ( ) => {
10
9
cy . deleteNamespacesAndCollections ( ) ;
11
10
12
- if ( ! insightsLogin ) {
13
- cy . login ( ) ;
14
- cy . deleteTestGroups ( ) ;
15
- cy . deleteTestUsers ( ) ;
16
- cy . createUser ( userName , userPassword ) ;
17
- }
11
+ cy . login ( ) ;
12
+ cy . deleteTestGroups ( ) ;
13
+ cy . deleteTestUsers ( ) ;
14
+ cy . createUser ( userName , userPassword ) ;
18
15
cy . createApprovedCollection ( 'testspace' , 'testcollection' ) ;
19
16
} ) ;
20
17
21
- if ( ! insightsLogin ) {
22
- it ( 'should not upload new collection version in collection list when user does not have permissions' , ( ) => {
23
- cy . login ( userName , userPassword ) ;
24
- cy . visit (
25
- `${ uiPrefix } collections?page_size=10&view_type=list&keywords=testcollection` ,
26
- ) ;
27
- cy . contains ( 'testcollection' ) ;
28
- cy . contains ( 'Upload new version' ) . should ( 'not.exist' ) ;
29
- } ) ;
30
-
31
- it ( 'should not upload new collection version in collection list/cards when user does not have permissions' , ( ) => {
32
- cy . login ( userName , userPassword ) ;
33
- cy . visit (
34
- `${ uiPrefix } collections?page_size=10&view_type=card&keywords=testcollection` ,
35
- ) ;
36
- cy . contains ( 'testcollection' ) ;
37
- cy . get ( '[aria-label="Actions"]' ) . should ( 'not.exist' ) ;
38
- } ) ;
39
-
40
- it ( 'should not upload new collection version in collection detail when user does not have permissions' , ( ) => {
41
- cy . login ( userName , userPassword ) ;
42
- cy . visit ( `${ uiPrefix } repo/published/testspace/testcollection` ) ;
43
- cy . contains ( 'testcollection' ) ;
44
- cy . get ( 'button[aria-label="Actions"]' ) . click ( ) ;
45
- cy . contains ( 'Upload new version' ) . click ( ) ;
46
- cy . contains ( "You don't have rights to do this operation." ) ;
47
- } ) ;
48
-
49
- it ( 'should see upload new collection version in collection list when user does have permissions' , ( ) => {
50
- cy . login ( ) ;
51
- cy . visit (
52
- `${ uiPrefix } collections?page_size=10&view_type=list&keywords=testcollection` ,
53
- ) ;
54
- cy . contains ( 'testcollection' ) ;
55
- cy . contains ( 'Upload new version' ) . click ( ) ;
56
- cy . contains ( 'New version of testcollection' ) ;
57
-
58
- cy . visit (
59
- `${ uiPrefix } collections?page_size=10&view_type=card&keywords=testcollection` ,
60
- ) ;
61
- cy . contains ( 'testcollection' ) ;
62
- cy . get ( 'button[aria-label="Actions"]' ) . click ( ) ;
63
- cy . contains ( 'Upload new version' ) . click ( ) ;
64
- cy . contains ( 'New version of testcollection' ) ;
65
- } ) ;
66
- }
18
+ it ( 'should not upload new collection version in collection list when user does not have permissions' , ( ) => {
19
+ cy . login ( userName , userPassword ) ;
20
+ cy . visit (
21
+ `${ uiPrefix } collections?page_size=10&view_type=list&keywords=testcollection` ,
22
+ ) ;
23
+ cy . contains ( 'testcollection' ) ;
24
+ cy . contains ( 'Upload new version' ) . should ( 'not.exist' ) ;
25
+ } ) ;
26
+
27
+ it ( 'should not upload new collection version in collection list/cards when user does not have permissions' , ( ) => {
28
+ cy . login ( userName , userPassword ) ;
29
+ cy . visit (
30
+ `${ uiPrefix } collections?page_size=10&view_type=card&keywords=testcollection` ,
31
+ ) ;
32
+ cy . contains ( 'testcollection' ) ;
33
+ cy . get ( '[aria-label="Actions"]' ) . should ( 'not.exist' ) ;
34
+ } ) ;
35
+
36
+ it ( 'should not upload new collection version in collection detail when user does not have permissions' , ( ) => {
37
+ cy . login ( userName , userPassword ) ;
38
+ cy . visit ( `${ uiPrefix } repo/published/testspace/testcollection` ) ;
39
+ cy . contains ( 'testcollection' ) ;
40
+ cy . get ( 'button[aria-label="Actions"]' ) . click ( ) ;
41
+ cy . contains ( 'Upload new version' ) . click ( ) ;
42
+ cy . contains ( "You don't have rights to do this operation." ) ;
43
+ } ) ;
44
+
45
+ it ( 'should see upload new collection version in collection list when user does have permissions' , ( ) => {
46
+ cy . login ( ) ;
47
+ cy . visit (
48
+ `${ uiPrefix } collections?page_size=10&view_type=list&keywords=testcollection` ,
49
+ ) ;
50
+ cy . contains ( 'testcollection' ) ;
51
+ cy . contains ( 'Upload new version' ) . click ( ) ;
52
+ cy . contains ( 'New version of testcollection' ) ;
53
+
54
+ cy . visit (
55
+ `${ uiPrefix } collections?page_size=10&view_type=card&keywords=testcollection` ,
56
+ ) ;
57
+ cy . contains ( 'testcollection' ) ;
58
+ cy . get ( 'button[aria-label="Actions"]' ) . click ( ) ;
59
+ cy . contains ( 'Upload new version' ) . click ( ) ;
60
+ cy . contains ( 'New version of testcollection' ) ;
61
+ } ) ;
67
62
68
63
it ( 'should see upload new collection version in collection detail when user does have permissions' , ( ) => {
69
64
cy . login ( ) ;
@@ -74,20 +69,18 @@ describe('Collection Upload Tests', () => {
74
69
cy . contains ( 'New version of testcollection' ) ;
75
70
} ) ;
76
71
77
- if ( ! insightsLogin ) {
78
- it ( 'user should not be able to upload new collection without permissions' , ( ) => {
79
- cy . login ( userName , userPassword ) ;
80
- cy . intercept (
81
- 'GET' ,
82
- `${ apiPrefix } v3/plugin/ansible/search/collection-versions/?namespace=*` ,
83
- ) . as ( 'upload' ) ;
84
- cy . galaxykit ( '-i namespace create' , 'ansible' ) ;
85
- cy . menuGo ( 'Collections > Namespaces' ) ;
86
-
87
- cy . get ( `a[href="${ uiPrefix } namespaces/ansible/"]` ) . click ( ) ;
88
- cy . contains ( 'Upload collection' ) . should ( 'not.exist' ) ;
89
- } ) ;
90
- }
72
+ it ( 'user should not be able to upload new collection without permissions' , ( ) => {
73
+ cy . login ( userName , userPassword ) ;
74
+ cy . intercept (
75
+ 'GET' ,
76
+ `${ apiPrefix } v3/plugin/ansible/search/collection-versions/?namespace=*` ,
77
+ ) . as ( 'upload' ) ;
78
+ cy . galaxykit ( '-i namespace create' , 'ansible' ) ;
79
+ cy . menuGo ( 'Collections > Namespaces' ) ;
80
+
81
+ cy . get ( `a[href="${ uiPrefix } namespaces/ansible/"]` ) . click ( ) ;
82
+ cy . contains ( 'Upload collection' ) . should ( 'not.exist' ) ;
83
+ } ) ;
91
84
92
85
it ( 'collection should be uploaded' , ( ) => {
93
86
cy . login ( ) ;
@@ -120,15 +113,13 @@ describe('Collection Upload Tests', () => {
120
113
cy . get ( '.pf-c-label__content' ) . contains ( 'Completed' ) . should ( 'exist' ) ;
121
114
} ) ;
122
115
123
- if ( ! insightsLogin ) {
124
- it ( 'should not upload new collection version when user does not have permissions' , ( ) => {
125
- cy . login ( userName , userPassword ) ;
126
- cy . visit ( `${ uiPrefix } namespaces/testspace` ) ;
116
+ it ( 'should not upload new collection version when user does not have permissions' , ( ) => {
117
+ cy . login ( userName , userPassword ) ;
118
+ cy . visit ( `${ uiPrefix } namespaces/testspace` ) ;
127
119
128
- cy . get ( '[data-cy="CollectionList-name"]' ) . contains ( 'testcollection' ) ;
129
- cy . contains ( 'Upload new version' ) . should ( 'not.exist' ) ;
130
- } ) ;
131
- }
120
+ cy . get ( '[data-cy="CollectionList-name"]' ) . contains ( 'testcollection' ) ;
121
+ cy . contains ( 'Upload new version' ) . should ( 'not.exist' ) ;
122
+ } ) ;
132
123
133
124
it ( 'should deprecate let user deprecate and undeprecate collections' , ( ) => {
134
125
cy . login ( ) ;
0 commit comments