Skip to content

Commit

Permalink
Tests: remove need for PULP_GALAXY_REQUIRE_CONTENT_APPROVAL='false' o…
Browse files Browse the repository at this point in the history
…utside community (#5045)

* cleanup

* remove PULP_GALAXY_REQUIRE_CONTENT_APPROVAL=false from non-community tests

* collections,namespaces - upload & approve

for all uses of `galaxykit collection upload`

No-Issue

* more cleanup

* fixup

* more cleanup

* fixup

* fixup

* use .at where appropriate

    sg -p '$A[$A.length - $B]' -r '$A.at(-$B)' -i

* fixup

* fix ordering
  • Loading branch information
himdel authored May 17, 2024
1 parent 2259185 commit ac47508
Show file tree
Hide file tree
Showing 30 changed files with 148 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ExecutionEnvironmentDetailActivities extends Component<
),
});
} else {
const lastActivity = activities[activities.length - 1];
const lastActivity = activities.at(-1);
if (lastActivity) {
activities.push({
created: lastActivity.created,
Expand Down
12 changes: 6 additions & 6 deletions test/cypress/e2e/approval-modal/approval-multiple-repos-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Approval Dashboard process with multiple repos', () => {
before(() => {
cy.deleteNamespacesAndCollections();
cy.galaxykit('-i namespace create', 'namespace');
cy.galaxykit('-i collection upload', 'namespace', 'collection1');
cy.galaxykit('collection upload', 'namespace', 'collection1');

const max = 11;
range(1, max).forEach((i) => {
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Approval Dashboard process with multiple repos', () => {
cy.login();
});

it('should test paging.', () => {
it('should test paging', () => {
openModal();
cy.contains('.modal-body .hub-toolbar', '1 - 10 of 11');
cy.contains('.modal-body', 'repo1');
Expand All @@ -89,15 +89,15 @@ describe('Approval Dashboard process with multiple repos', () => {
cy.contains('.modal-body', 'repo9');
});

it('should test ordering.', () => {
it('should test ordering', () => {
openModal();
cy.contains('.modal-body', 'repo9').should('not.exist');
cy.get('.modal-body [data-cy="sort_name"]').click();
cy.contains('.modal-body', 'repo9');
cy.contains('.modal-body', 'published').should('not.exist');
});

it('should test filtering.', () => {
it('should test filtering', () => {
openModal();
cy.contains('.modal-body', 'repo9').should('not.exist');
cy.get('.modal-body [data-cy="compound_filter"] input').type('repo{enter}');
Expand All @@ -113,7 +113,7 @@ describe('Approval Dashboard process with multiple repos', () => {
cy.contains('.modal-body', 'published').should('not.exist');
});

it('should test select/deselect all/page.', () => {
it('should test select/deselect all/page', () => {
openModal();

// deselect all
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('Approval Dashboard process with multiple repos', () => {
});
});

it('should test selection.', () => {
it('should test selection', () => {
openModal();
toggleItem('repo1');
toggleItem('published');
Expand Down
8 changes: 4 additions & 4 deletions test/cypress/e2e/approval-modal/approval-multiple-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Approval Dashboard process with multiple repos', () => {
before(() => {
cy.deleteNamespacesAndCollections();
cy.galaxykit('-i namespace create', 'namespace');
cy.galaxykit('-i collection upload', 'namespace', 'collection1');
cy.galaxykit('collection upload', 'namespace', 'collection1');

const max = 11;
range(1, max).forEach((i) => {
Expand Down Expand Up @@ -100,12 +100,12 @@ describe('Approval Dashboard process with multiple repos', () => {
cy.login();
});

it('should contains no colletctions in list.', () => {
it('should contains no colletctions in list', () => {
cy.visit(`${uiPrefix}collections`);
cy.contains('No collections yet');
});

it('should approve, reject and reapprove.', () => {
it('should approve, reject and reapprove', () => {
openModal();
toggleItem('repo1');
toggleItem('repo2');
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('Approval Dashboard process with multiple repos', () => {
it('should be able to approve from different staging repo', () => {
cy.deleteNamespacesAndCollections();
cy.galaxykit('-i namespace create', 'namespace');
cy.galaxykit('-i collection upload', 'namespace', 'collection1');
cy.galaxykit('collection upload', 'namespace', 'collection1');
cy.galaxykit(
'-i collection move',
'namespace',
Expand Down
42 changes: 20 additions & 22 deletions test/cypress/e2e/approval/approval-dashboard-list.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { range, sortBy } from 'lodash';
import { range } from 'lodash';

const apiPrefix = Cypress.env('apiPrefix');
const uiPrefix = Cypress.env('uiPrefix');

describe('Approval Dashboard list tests for sorting, paging and filtering', () => {
let items = [];
const items = [];

function createData() {
cy.galaxykit('-i namespace create approval_dashboard_namespace_test');
range(9).forEach((i) => {
cy.galaxykit(
'-i collection upload',
'collection upload',
'approval_dashboard_namespace_test',
'approval_dashboard_collection_test' + i,
);
});

cy.galaxykit(
'-i collection upload',
'collection upload',
'approval_dashboard_namespace_test_additional_data',
'approval_dashboard_collection_test_additional1',
);
cy.galaxykit(
'-i collection upload',
'collection upload',
'approval_dashboard_namespace_test_additional_data',
'approval_dashboard_collection_test_additional2',
);
Expand All @@ -39,9 +39,9 @@ describe('Approval Dashboard list tests for sorting, paging and filtering', () =

cy.wait('@data').then(({ response: { body } }) => {
body.data.forEach((record) => {
items.push({ name: record.collection_version.name });
items.push(record.collection_version.name);
});
items = sortBy(items, 'name');
items.sort();
});
}

Expand All @@ -62,42 +62,40 @@ describe('Approval Dashboard list tests for sorting, paging and filtering', () =
cy.contains('button', 'Clear all filters').click();
});

it('should contains all columns.', () => {
it('should contains all columns', () => {
['Namespace', 'Collection', 'Version', 'Date created', 'Status'].forEach(
(item) => {
cy.get('[data-cy="SortTable-headers"]').contains(item);
},
);
});

it('should sort alphabetically and paging is working.', () => {
it('should sort & page', () => {
cy.get('[data-cy="sort_name"]').click();
cy.get('[data-cy="sort_name"]').click();

cy.get('[data-cy="body"]').contains(items[0].name);
cy.get('[data-cy="body"]').contains(items[0]);

cy.get('[data-cy="body"]')
.get('[aria-label="Go to next page"]:first')
.click();
cy.get('[data-cy="body"]').contains(items[10].name);
cy.get('[data-cy="body"]').contains(items[10]);
});

it('should sort collection.', () => {
it('should sort collection', () => {
cy.get('[data-cy="sort_name"]').click();
cy.get('[data-cy="body"]').contains('approval');

cy.get('[data-cy^="ApprovalRow"]:first').contains(
items[items.length - 1].name,
);
cy.get('[data-cy^="ApprovalRow"]').contains(items[items.length - 2].name);
cy.get('[data-cy^="ApprovalRow"]').contains(items[items.length - 3].name);
cy.get('[data-cy^="ApprovalRow"]:first').contains(items.at(-1));
cy.get('[data-cy^="ApprovalRow"]').contains(items.at(-2));
cy.get('[data-cy^="ApprovalRow"]').contains(items.at(-3));
});

it('should see time informations.', () => {
it('should see time informations', () => {
cy.contains('[data-cy="body"]', 'a few seconds ago');
});

it('should filter collection.', () => {
it('should filter collection', () => {
cy.get('[data-cy="body"] [data-cy="compound_filter"] button:first').click();
cy.contains(
'[data-cy="body"] [data-cy="compound_filter"] a',
Expand All @@ -115,7 +113,7 @@ describe('Approval Dashboard list tests for sorting, paging and filtering', () =
.should('not.exist');
});

it('should filter collection and namespace together.', () => {
it('should filter collection and namespace together', () => {
cy.get('[data-cy="body"] [data-cy="compound_filter"] button:first').click();
cy.contains(
'[data-cy="body"] [data-cy="compound_filter"] a',
Expand Down Expand Up @@ -169,11 +167,11 @@ describe('Approval Dashboard list tests for sorting, paging and filtering', () =
cy.get('[data-cy="sort_name"]').click();

range(11).forEach((i) => {
cy.get('[data-cy="body"]').contains(items[i].name);
cy.get('[data-cy="body"]').contains(items[i]);
});
});

it('should redirect to import logs.', () => {
it('should redirect to import logs', () => {
cy.get(
'[data-cy="kebab-toggle"]:first button[aria-label="Actions"]',
).click();
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/approval/approval-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('Approval Dashboard process', () => {
cy.login();
});

it('should test the whole approval process.', () => {
it('should test the whole approval process', () => {
cy.galaxykit('-i namespace create', 'appp_n_test');
cy.galaxykit('-i collection upload', 'appp_n_test', 'appp_c_test1');
cy.galaxykit('collection upload', 'appp_n_test', 'appp_c_test1');
cy.galaxykit('task wait all');
cy.visit(`${uiPrefix}collections`);
cy.contains('No collections yet');
Expand Down
4 changes: 2 additions & 2 deletions test/cypress/e2e/approval/collection-approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('tests the approval list screen ', () => {
cy.login();
cy.deleteNamespacesAndCollections();
cy.galaxykit('-i namespace create', 'ansible');
cy.galaxykit('-i collection upload ansible network');
cy.galaxykit('collection upload ansible network');
cy.visit(`${uiPrefix}approval-dashboard`);
});

Expand Down Expand Up @@ -41,7 +41,7 @@ describe('tests the approval list screen ', () => {
cy.get('.pf-v5-c-chip button[data-ouia-component-id="close"]').click();
cy.wait('@reload');

//imports page
// imports page

cy.get('button[aria-label="Actions"]:first').click();
cy.intercept(
Expand Down
4 changes: 1 addition & 3 deletions test/cypress/e2e/approval/signing.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('signing versions - auto sign on approval', () => {
cy.deleteNamespacesAndCollections();

cy.galaxykit('-i namespace create', 'autosign_test');
cy.galaxykit('-i collection upload autosign_test test_collection');
cy.galaxykit('collection upload autosign_test test_collection');
});

after(() => {
Expand All @@ -32,8 +32,6 @@ describe('signing versions - auto sign on approval', () => {

// Sign the first collection
cy.get('[data-cy="approve-button"]').first().click();

// TODO: Maybe we can wait on some specific event?
cy.wait(10000);

// Go and check if it is signed in the collections
Expand Down
5 changes: 4 additions & 1 deletion test/cypress/e2e/collections/collection-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ describe('Collection detail', () => {
before(() => {
cy.deleteNamespacesAndCollections();
cy.galaxykit(
'-i collection upload collection_detail_test_namespace collection_detail_test_collection',
'collection upload collection_detail_test_namespace collection_detail_test_collection',
);
cy.galaxykit(
'collection approve collection_detail_test_namespace collection_detail_test_collection 1.0.0',
);
});

Expand Down
3 changes: 2 additions & 1 deletion test/cypress/e2e/collections/collection-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ describe('Collection Upload Tests', () => {
cy.deleteTestGroups();
cy.deleteTestUsers();

cy.galaxykit('-i collection upload testspace testcollection');
cy.galaxykit('collection upload testspace testcollection');
cy.galaxykit('collection approve testspace testcollection 1.0.0');
cy.galaxykit('user create', userName, userPassword);
});

Expand Down
31 changes: 18 additions & 13 deletions test/cypress/e2e/collections/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('collection tests', () => {
});

it('deletes an entire collection', () => {
cy.galaxykit('-i collection upload test_namespace test_collection');
cy.galaxykit('task wait all');
cy.galaxykit('collection upload test_namespace test_collection');
cy.galaxykit('collection approve test_namespace test_collection 1.0.0');

cy.visit(`${uiPrefix}repo/published/test_namespace/test_collection`);

Expand All @@ -30,8 +30,8 @@ describe('collection tests', () => {
});

it('deletes a collection version', () => {
cy.galaxykit('-i collection upload my_namespace my_collection');
cy.galaxykit('task wait all');
cy.galaxykit('collection upload my_namespace my_collection');
cy.galaxykit('collection approve my_namespace my_collection 1.0.0');

cy.visit(`${uiPrefix}collections`);

Expand All @@ -58,8 +58,8 @@ describe('collection tests', () => {
const rand = Math.floor(Math.random() * 9999999);
const namespace = `foo_${rand}`;
const collection = `bar_${rand}`;
cy.galaxykit(`-i collection upload ${namespace} ${collection}`);
cy.galaxykit('task wait all');
cy.galaxykit(`collection upload ${namespace} ${collection}`);
cy.galaxykit('collection approve', namespace, collection, '1.0.0');
cy.visit(`${uiPrefix}repo/published/${namespace}/${collection}`);

cy.openHeaderKebab();
Expand Down Expand Up @@ -90,11 +90,12 @@ describe('collection tests', () => {
it('deletes a collection from repository', () => {
cy.deleteNamespacesAndCollections();
cy.deleteRepositories();
cy.galaxykit('-i collection upload test_namespace test_repo_collection2');
cy.galaxykit('collection upload test_namespace test_repo_collection2');
cy.galaxykit(
'collection approve test_namespace test_repo_collection2 1.0.0',
);
cy.galaxykit('repository create repo2 --pipeline approved');
cy.galaxykit('distribution create repo2');

cy.galaxykit('task wait all');
cy.galaxykit(
'collection copy test_namespace test_repo_collection2 1.0.0 published repo2',
);
Expand Down Expand Up @@ -132,17 +133,21 @@ describe('collection tests', () => {
cy.galaxykit('distribution create repo2');

cy.galaxykit(
'-i collection upload test_namespace test_repo_collection_version2 1.0.0',
'collection upload test_namespace test_repo_collection_version2 1.0.0',
);
cy.galaxykit(
'collection approve test_namespace test_repo_collection_version2 1.0.0',
);
cy.galaxykit('task wait all');
cy.galaxykit(
'collection copy test_namespace test_repo_collection_version2 1.0.0 published repo2',
);

cy.galaxykit(
'-i collection upload test_namespace test_repo_collection_version2 1.0.1',
'collection upload test_namespace test_repo_collection_version2 1.0.1',
);
cy.galaxykit(
'collection approve test_namespace test_repo_collection_version2 1.0.1',
);
cy.galaxykit('task wait all');
cy.galaxykit(
'collection copy test_namespace test_repo_collection_version2 1.0.1 published repo2',
);
Expand Down
Loading

0 comments on commit ac47508

Please sign in to comment.