Skip to content

Commit d5d0091

Browse files
authored
Fix failing HUB 2.4 UI tests (#5406)
* Fix failing HUB 2.4 UI tests * add more fixes * more fixes and trying baseUrl instead of hardcoded localhost * handling baseurl in a better way * use containers instead of baseurl * rbac test fix * removing hardcode from podman pull * fixing collection_detail test * bringing waits back
1 parent ef71bc8 commit d5d0091

16 files changed

Lines changed: 175 additions & 136 deletions

test/cypress/e2e/approval/approval_process.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ describe('Approval Dashboard process', () => {
5959
).as('upload');
6060
cy.galaxykit('-i namespace create', 'ansible');
6161
cy.menuGo('Collections > Namespaces');
62-
63-
cy.get(`a[href="${uiPrefix}namespaces/ansible/"]`).click();
62+
cy.contains('ansible')
63+
.parents('.card-wrapper')
64+
.contains('View collections')
65+
.click();
6466
cy.contains('Upload collection').click();
6567
cy.fixture('collections/ansible-posix-1.4.0.tar.gz', 'binary')
6668
.then(Cypress.Blob.binaryStringToBlob)

test/cypress/e2e/collections/collection.js

Lines changed: 95 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ describe('collection tests', () => {
1616
cy.login();
1717
});
1818

19-
it('deletes an entire collection', () => {
19+
it('delete an entire collection', () => {
2020
cy.galaxykit('-i collection upload test_namespace test_collection');
2121
cy.galaxykit('task wait all');
2222

23-
cy.visit(`${uiPrefix}repo/published/test_namespace/test_collection`);
24-
23+
cy.visit(`${uiPrefix}repo/staging/test_namespace/test_collection`);
24+
cy.wait(2000);
2525
cy.openHeaderKebab();
2626
cy.get('[data-cy=delete-collection]').click();
2727
cy.get('input[id=delete_confirm]').click();
2828
cy.get('button').contains('Delete').click();
2929
cy.contains('No collections yet', { timeout: 10000 });
3030
});
3131

32-
it('deletes a collection version', () => {
32+
it('delete a collection version', () => {
3333
cy.galaxykit('-i collection upload my_namespace my_collection');
3434
cy.galaxykit('task wait all');
3535

@@ -38,9 +38,8 @@ describe('collection tests', () => {
3838
cy.intercept('GET', `${apiPrefix}_ui/v1/namespaces/my_namespace/?*`).as(
3939
'reload',
4040
);
41-
cy.get(
42-
`a[href*="${uiPrefix}repo/published/my_namespace/my_collection"]`,
43-
).click();
41+
cy.visit(`${uiPrefix}repo/staging/my_namespace/my_collection`);
42+
cy.wait(3000);
4443
cy.openHeaderKebab();
4544
cy.get('[data-cy=delete-collection-version]').click();
4645
cy.get('input[id=delete_confirm]').click();
@@ -60,16 +59,16 @@ describe('collection tests', () => {
6059
const collection = `bar_${rand}`;
6160
cy.galaxykit(`-i collection upload ${namespace} ${collection}`);
6261
cy.galaxykit('task wait all');
63-
cy.visit(`${uiPrefix}repo/published/${namespace}/${collection}`);
64-
62+
cy.visit(`${uiPrefix}repo/staging/${namespace}/${collection}`);
63+
cy.wait(2000);
6564
cy.openHeaderKebab();
6665
cy.get(
6766
'[data-cy="copy-collection-version-to-repository-dropdown"]',
6867
).click();
6968

7069
cy.contains('Select repositories');
7170
cy.get(
72-
'[data-cy="ApproveModal-CheckboxRow-row-published"] .pf-c-table__check input',
71+
'[data-cy="ApproveModal-CheckboxRow-row-staging"] .pf-c-table__check input',
7372
).should('be.disabled');
7473

7574
cy.get("[aria-label='name__icontains']").type('validate{enter}');
@@ -80,102 +79,145 @@ describe('collection tests', () => {
8079
cy.get('.pf-m-primary').contains('Select').click();
8180

8281
cy.get('[data-cy="AlertList"]').contains(
83-
`Started adding ${namespace}.${collection} v1.0.0 from "published" to repository "validated".`,
82+
`Started adding ${namespace}.${collection} v1.0.0 from "staging" to repository "validated".`,
8483
);
8584
cy.galaxykit('task wait all');
8685
cy.get('[data-cy="AlertList"]').contains('detail page').click();
8786
cy.contains('Completed');
8887
});
8988

90-
it('deletes an collection from repository', () => {
89+
it('delete a collection from repository', () => {
90+
const rand = Math.floor(Math.random() * 9999999);
91+
const namespace = `namespace_${rand}`;
92+
const collection = `collection_${rand}`;
93+
const repo = `repo_${rand}`;
9194
cy.deleteNamespacesAndCollections();
9295
cy.deleteRepositories();
93-
cy.galaxykit('-i collection upload test_namespace test_repo_collection2');
94-
cy.galaxykit('repository create repo2 --pipeline approved');
95-
cy.galaxykit('distribution create repo2');
96+
cy.galaxykit(`-i collection upload ${namespace} ${collection}`);
97+
cy.galaxykit(`repository create ${repo} --pipeline approved`);
98+
cy.galaxykit(`distribution create ${repo}`);
9699

97100
cy.galaxykit('task wait all');
98-
cy.galaxykit(
99-
'collection copy test_namespace test_repo_collection2 1.0.0 published repo2',
101+
cy.visit(`${uiPrefix}repo/staging/${namespace}/${collection}`);
102+
cy.wait(2000);
103+
cy.openHeaderKebab();
104+
cy.get(
105+
'[data-cy="copy-collection-version-to-repository-dropdown"]',
106+
).click();
107+
cy.get("[aria-label='name__icontains']").type(`${repo}{enter}`);
108+
cy.get(
109+
`[data-cy='ApproveModal-CheckboxRow-row-${repo}'] .pf-c-table__check input`,
110+
).check();
111+
112+
cy.get('.pf-m-primary').contains('Select').click();
113+
114+
cy.get('[data-cy="AlertList"]').contains(
115+
`Started adding ${namespace}.${collection} v1.0.0 from "staging" to repository "${repo}".`,
100116
);
117+
cy.galaxykit('task wait all');
118+
cy.get('[data-cy="AlertList"]').contains('detail page').click();
119+
cy.contains('Completed');
101120

102121
cy.visit(`${uiPrefix}collections?view_type=list`);
103122
cy.contains('Collections');
104-
cy.contains('[data-cy="CollectionListItem"]', 'published');
105-
cy.contains('[data-cy="CollectionListItem"]', 'repo2');
123+
cy.contains('[data-cy="CollectionListItem"]', repo);
106124

107125
cy.get('.collection-container [aria-label="Actions"]:first').click({
108126
force: true,
109127
});
110128
cy.contains('Remove collection from repository').click();
111129
cy.get('input[id=delete_confirm]').click();
112130
cy.get('button').contains('Delete').click();
113-
cy.contains(
114-
'Collection "test_repo_collection2" has been successfully deleted.',
115-
{
116-
timeout: 10000,
117-
},
118-
);
119-
cy.contains('[data-cy="CollectionListItem"]', 'repo2');
120-
cy.contains('[data-cy="CollectionListItem"]', 'published').should(
121-
'not.exist',
122-
);
123-
131+
cy.contains(`Collection "${collection}" has been successfully deleted.`, {
132+
timeout: 10000,
133+
});
134+
cy.contains('Collections');
124135
cy.deleteAllCollections();
125136
cy.deleteRepositories();
126137
});
127138

128-
it('deletes an collection version from repository', () => {
139+
it('delete a collection version from repository', () => {
140+
const rand = Math.floor(Math.random() * 9999999);
141+
const namespace = `namespace_${rand}`;
142+
const collection = `collection_${rand}`;
143+
const repo = `repo_${rand}`;
129144
cy.deleteNamespacesAndCollections();
130145
cy.deleteRepositories();
131-
cy.galaxykit('repository create repo2 --pipeline approved');
132-
cy.galaxykit('distribution create repo2');
146+
cy.galaxykit(`repository create ${repo} --pipeline approved`);
147+
cy.galaxykit(`distribution create ${repo}`);
133148

134-
cy.galaxykit(
135-
'-i collection upload test_namespace test_repo_collection_version2 1.0.0',
136-
);
149+
cy.galaxykit(`-i collection upload ${namespace} ${collection} 1.0.0`);
137150
cy.galaxykit('task wait all');
138-
cy.galaxykit(
139-
'collection copy test_namespace test_repo_collection_version2 1.0.0 published repo2',
140-
);
141151

142-
cy.galaxykit(
143-
'-i collection upload test_namespace test_repo_collection_version2 1.0.1',
152+
cy.visit(`${uiPrefix}repo/staging/${namespace}/${collection}`);
153+
cy.wait(3000);
154+
cy.openHeaderKebab();
155+
cy.get(
156+
'[data-cy="copy-collection-version-to-repository-dropdown"]',
157+
).click();
158+
cy.get("[aria-label='name__icontains']").type(`${repo}{enter}`);
159+
cy.get(
160+
`[data-cy='ApproveModal-CheckboxRow-row-${repo}'] .pf-c-table__check input`,
161+
).check();
162+
163+
cy.get('.pf-m-primary').contains('Select').click();
164+
165+
cy.get('[data-cy="AlertList"]').contains(
166+
`Started adding ${namespace}.${collection} v1.0.0 from "staging" to repository "${repo}".`,
144167
);
145168
cy.galaxykit('task wait all');
146-
cy.galaxykit(
147-
'collection copy test_namespace test_repo_collection_version2 1.0.1 published repo2',
169+
cy.get('[data-cy="AlertList"]').contains('detail page').click();
170+
cy.contains('Completed');
171+
172+
cy.galaxykit(`-i collection upload ${namespace} ${collection} 1.0.1`);
173+
cy.galaxykit('task wait all');
174+
175+
cy.visit(`${uiPrefix}repo/staging/${namespace}/${collection}`);
176+
cy.wait(3000);
177+
cy.openHeaderKebab();
178+
cy.get(
179+
'[data-cy="copy-collection-version-to-repository-dropdown"]',
180+
).click();
181+
cy.get("[aria-label='name__icontains']").type(`${repo}{enter}`);
182+
cy.get(
183+
`[data-cy='ApproveModal-CheckboxRow-row-${repo}'] .pf-c-table__check input`,
184+
).check();
185+
186+
cy.get('.pf-m-primary').contains('Select').click();
187+
188+
cy.get('[data-cy="AlertList"]').contains(
189+
`Started adding ${namespace}.${collection} v1.0.1 from "staging" to repository "${repo}".`,
148190
);
191+
cy.galaxykit('task wait all');
192+
cy.get('[data-cy="AlertList"]').contains('detail page').click();
193+
cy.contains('Completed');
149194

150195
cy.visit(`${uiPrefix}collections?view_type=list`);
151196
cy.contains('Collections');
152-
cy.contains('[data-cy="CollectionListItem"]', 'published');
153-
cy.contains('[data-cy="CollectionListItem"]', 'repo2');
154-
197+
cy.contains('[data-cy="CollectionListItem"]', repo);
155198
cy.visit(
156-
`${uiPrefix}repo/repo2/test_namespace/test_repo_collection_version2/?version=1.0.0`,
199+
`${uiPrefix}repo/${repo}/${namespace}/${collection}/?version=1.0.0`,
157200
);
158-
201+
cy.wait(3000);
159202
cy.openHeaderKebab();
160203
cy.contains('Remove version 1.0.0 from repository').click();
161204
cy.get('input[id=delete_confirm]').click();
162205
cy.get('button').contains('Delete').click();
163206
cy.contains(
164-
'Collection "test_repo_collection_version2 v1.0.0" has been successfully deleted.',
207+
`Collection "${collection} v1.0.0" has been successfully deleted.`,
165208
{
166209
timeout: 10000,
167210
},
168211
);
169212

170213
cy.visit(
171-
`${uiPrefix}repo/repo2/test_namespace/test_repo_collection_version2/?version=1.0.0`,
214+
`${uiPrefix}repo/${repo}/${namespace}/${collection}/?version=1.0.0`,
172215
);
173216
cy.contains(`We couldn't find the page you're looking for!`);
174-
175217
cy.visit(
176-
`${uiPrefix}repo/published/test_namespace/test_repo_collection_version2/?version=1.0.0`,
218+
`${uiPrefix}repo/staging/${namespace}/${collection}/?version=1.0.1`,
177219
);
178-
cy.contains('test_repo_collection_version2');
220+
cy.contains(collection);
179221
cy.contains(`We couldn't find the page you're looking for!`).should(
180222
'not.exist',
181223
);

test/cypress/e2e/collections/collection_detail.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const uiPrefix = Cypress.env('uiPrefix');
22

33
describe('Collection detail', () => {
4-
const baseURL = `${uiPrefix}repo/published/collection_detail_test_namespace/collection_detail_test_collection`;
4+
const baseURL = `${uiPrefix}repo/staging/collection_detail_test_namespace/collection_detail_test_collection`;
55

66
function deprecate() {
77
cy.openHeaderKebab();
@@ -28,19 +28,19 @@ describe('Collection detail', () => {
2828
cy.login();
2929
});
3030

31-
it('can Deprecate', () => {
31+
it('can Deprecate and then undeprecate', () => {
3232
cy.visit(baseURL);
33+
cy.wait(2000);
3334
deprecate();
34-
});
35-
36-
it('can Undeprecate', () => {
37-
cy.visit(baseURL);
3835
undeprecate();
3936
});
4037

4138
it('should change the url when clicking on the tabs', () => {
4239
cy.visit(baseURL);
43-
40+
cy.get('.title-box').should(
41+
'have.text',
42+
'collection_detail_test_collection',
43+
);
4444
const tabs = [
4545
{
4646
name: 'Documentation',
@@ -98,15 +98,15 @@ describe('Collection detail', () => {
9898

9999
it('should have working UI on install tab', () => {
100100
cy.visit(baseURL);
101+
cy.get('.title-box').should(
102+
'have.text',
103+
'collection_detail_test_collection',
104+
);
101105
// should have Install, License and Installation strings, and correct docs link
102106
cy.get('.body').contains('Install');
103107
cy.get('.body').contains('License');
104108
cy.get('.body').contains('Installation');
105-
106-
cy.get('.body').contains(
107-
`a[href="${uiPrefix}repo/published/collection_detail_test_namespace/collection_detail_test_collection/docs/"]`,
108-
'Go to documentation',
109-
);
109+
cy.get('[data-cy="toggle-signature-button"]').scrollIntoView();
110110

111111
/*
112112
* This test needs some external library and custom command to test if the download had started.

test/cypress/e2e/collections/collection_upload.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('Collection Upload Tests', () => {
1313
cy.deleteTestUsers();
1414
cy.createUser(userName, userPassword);
1515
cy.galaxykit('-i collection upload testspace testcollection');
16+
cy.galaxykit(`-i collection move testspace testcollection`);
1617
});
1718

1819
it('should not upload new collection version in collection list when user does not have permissions', () => {
@@ -46,6 +47,7 @@ describe('Collection Upload Tests', () => {
4647
cy.visit(
4748
`${uiPrefix}collections?page_size=10&view_type=list&keywords=testcollection`,
4849
);
50+
cy.wait(2000);
4951
cy.contains('testcollection');
5052
cy.contains('Upload new version').click();
5153
cy.contains('New version of testspace.testcollection');
@@ -76,8 +78,10 @@ describe('Collection Upload Tests', () => {
7678
).as('upload');
7779
cy.galaxykit('-i namespace create', 'ansible');
7880
cy.menuGo('Collections > Namespaces');
79-
80-
cy.get(`a[href="${uiPrefix}namespaces/ansible/"]`).click();
81+
cy.contains('ansible')
82+
.parents('.card-wrapper')
83+
.contains('View collections')
84+
.click();
8185
cy.contains('Upload collection').should('not.exist');
8286
});
8387

@@ -90,7 +94,11 @@ describe('Collection Upload Tests', () => {
9094
cy.galaxykit('-i namespace create', 'ansible');
9195
cy.menuGo('Collections > Namespaces');
9296

93-
cy.get(`a[href="${uiPrefix}namespaces/ansible/"]`).click();
97+
cy.contains('ansible')
98+
.parents('.card-wrapper')
99+
.contains('View collections')
100+
.click();
101+
94102
cy.contains('Upload collection').click();
95103
cy.fixture('collections/ansible-posix-1.4.0.tar.gz', 'binary')
96104
.then(Cypress.Blob.binaryStringToBlob)
@@ -113,7 +121,9 @@ describe('Collection Upload Tests', () => {
113121
cy.login(userName, userPassword);
114122
cy.visit(`${uiPrefix}namespaces/testspace`);
115123

116-
cy.get('[data-cy="CollectionList-name"]').contains('testcollection');
124+
cy.get('[data-cy="CollectionList-name"]', { timeout: 3000 }).contains(
125+
'testcollection',
126+
);
117127
cy.contains('Upload new version').should('not.exist');
118128
});
119129

0 commit comments

Comments
 (0)