Skip to content

Commit

Permalink
Milan hub tests remove move to (#3020)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanPospisil authored Aug 20, 2024
1 parent 98508ed commit 7240e60
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 78 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/hub/approvals.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Approvals', () => {
cy.waitForAllTasks();
namespace = namespaceResult;
collectionName = randomE2Ename();
cy.uploadCollection(collectionName, namespace.name);
cy.uploadCollection(collectionName, namespace.name, '1.0.0', 'staging');
});
}
);
Expand Down
9 changes: 0 additions & 9 deletions cypress/e2e/hub/collections-dependencies.cy.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
import { Repository } from '../../../frontend/hub/administration/repositories/Repository';
import { HubNamespace } from '../../../frontend/hub/namespaces/HubNamespace';
import { hubAPI } from '../../support/formatApiPathForHub';
import { randomE2Ename } from '../../support/utils';
import { Collections } from './constants';

describe('Collections Dependencies', () => {
let namespace: HubNamespace;
let repository: Repository;
let collectionName: string;

before(() => {
collectionName = randomE2Ename();
cy.createHubNamespace().then((namespaceResult) => {
namespace = namespaceResult;
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.waitForAllTasks();
});
cy.createHubRepository().then((repositoryResult) => {
repository = repositoryResult;
cy.galaxykit('distribution create', repository.name);
cy.waitForAllTasks();
});
});

after(() => {
cy.deleteHubRepository(repository);
cy.deleteCollectionsInNamespace(namespace.name);
cy.deleteHubNamespace({ ...namespace, failOnStatusCode: false });
});
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/hub/collections-detail-install.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ describe('collections-detail-install', () => {
collectionName = randomE2Ename();

cy.createHubNamespace({ namespace: { name: namespaceName } }).then(() => {
cy.uploadCollection(collectionName, namespaceName, '1.0.0').then(() => {
cy.approveCollection(collectionName, namespaceName, '1.0.0');
});
cy.uploadCollection(collectionName, namespaceName, '1.0.0');
});
});

Expand Down Expand Up @@ -54,7 +52,7 @@ describe('collections-detail-install', () => {
cy.contains('button', 'Download tarball');

cy.contains('button', 'Show signature').click();
cy.contains('BEGIN PGP SIGNATURE');
//cy.contains('BEGIN PGP SIGNATURE');
});

afterEach(() => {
Expand Down
40 changes: 8 additions & 32 deletions cypress/e2e/hub/collections-detail.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { Repository } from '../../../frontend/hub/administration/repositories/Repository';
import { HubNamespace } from '../../../frontend/hub/namespaces/HubNamespace';
import { randomE2Ename } from '../../support/utils';
import { Collections } from './constants';
Expand All @@ -16,23 +15,15 @@ function visitCollection(collection: string, namespace: string) {

describe('Collections Details', () => {
let namespace: HubNamespace;
let repository: Repository;
let collectionName: string;

before(() => {
cy.createHubNamespace().then((namespaceResult) => {
namespace = namespaceResult;
});
cy.createHubRepository().then((repositoryResult) => {
repository = repositoryResult;
cy.galaxykit('distribution create', repository.name);
cy.waitForAllTasks();
});
});

after(() => {
// TODO - this is another PR - cy.deletehubDistribution(repository.name);
cy.deleteHubRepository(repository);
cy.deleteCollectionsInNamespace(namespace.name);
cy.deleteHubNamespace({ ...namespace, failOnStatusCode: false });
});
Expand All @@ -45,7 +36,6 @@ describe('Collections Details', () => {

it('can delete entire collection from system', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.getByDataCy('table-view').click();
cy.filterTableBySingleText(collectionName, true);
cy.clickLink(collectionName);
Expand All @@ -63,8 +53,7 @@ describe('Collections Details', () => {
});

it('can delete entire collection from repository', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.uploadCollection(collectionName, namespace.name, '1.0.0', 'rh-certified');
cy.getByDataCy('table-view').click();
cy.filterTableBySingleText(collectionName, true);
cy.clickLink(collectionName);
Expand All @@ -84,8 +73,7 @@ describe('Collections Details', () => {
it('user can delete version from system', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.uploadCollection(collectionName, namespace.name, '1.1.0');
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.approveCollection(collectionName, namespace.name, '1.1.0');

// Delete version from system
cy.getByDataCy('table-view').click();
cy.filterTableBySingleText(collectionName, true);
Expand All @@ -97,7 +85,7 @@ describe('Collections Details', () => {
cy.get('.pf-v5-c-menu__item-text').contains('1.0.0').click();
cy.url().should(
'contain',
`/collections/published/${namespace.name}/${collectionName}/details?version=1.0.0`
`/collections/validated/${namespace.name}/${collectionName}/details?version=1.0.0`
);
cy.selectDetailsPageKebabAction('delete-version-from-system');
cy.clickButton(/^Close$/);
Expand All @@ -116,8 +104,7 @@ describe('Collections Details', () => {
it('user can delete version from repository', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.uploadCollection(collectionName, namespace.name, '1.1.0');
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.approveCollection(collectionName, namespace.name, '1.1.0');

// Delete version from repository
cy.getByDataCy('table-view').click();
cy.filterTableBySingleText(collectionName, true);
Expand All @@ -128,7 +115,7 @@ describe('Collections Details', () => {
cy.get('.pf-v5-c-menu__item-text').contains('1.0.0').click();
cy.url().should(
'contain',
`/collections/published/${namespace.name}/${collectionName}/details?version=1.0.0`
`/collections/validated/${namespace.name}/${collectionName}/details?version=1.0.0`
);
cy.selectDetailsPageKebabAction('delete-version-from-repository');
cy.clickButton(/^Close$/);
Expand All @@ -140,7 +127,7 @@ describe('Collections Details', () => {
cy.verifyPageTitle(`${namespace.name}.${collectionName}`);
cy.url().should(
'contain',
`/collections/published/${namespace.name}/${collectionName}/details`
`/collections/validated/${namespace.name}/${collectionName}/details`
);
cy.get(`[data-cy="browse-collection-version"] button`).first().click();
cy.get('.pf-v5-c-menu__item-text').should('have.length', '1').contains('1.1.0');
Expand All @@ -149,7 +136,6 @@ describe('Collections Details', () => {

it('can copy a version to repository', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0').then(() => {
cy.approveCollection(collectionName, namespace.name, '1.0.0');
cy.navigateTo('hub', Collections.url);
cy.filterTableBySingleText(collectionName, true);
cy.clickLink(collectionName);
Expand All @@ -163,7 +149,6 @@ describe('Collections Details', () => {

it('can sign a collection', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0').then(() => {
cy.approveCollection(collectionName, namespace.name, '1.0.0');
// Sign collection
visitCollection(collectionName, namespace.name);
cy.selectDetailsPageKebabAction('sign-collection');
Expand All @@ -177,14 +162,6 @@ describe('Collections Details', () => {

it.skip('can sign a selected version of a collection', () => {
cy.uploadCollection(collectionName, namespace.name).then(() => {
cy.galaxykit(
'collection move',
namespace.name,
collectionName,
'1.0.0',
'staging',
repository.name
);
cy.waitForAllTasks();
cy.galaxykit('collection upload --skip-upload', namespace.name, collectionName, '1.2.3').then(
(result: { filename: string }) => {
Expand All @@ -200,8 +177,8 @@ describe('Collections Details', () => {
action: 'drag-drop',
});
cy.get('#radio-non-pipeline').click();
cy.filterTableBySingleText(repository.name, true);
cy.getTableRowByText(repository.name, false).within(() => {
cy.filterTableBySingleText('validated', true);
cy.getTableRowByText('validated', false).within(() => {
cy.getByDataCy('checkbox-column-cell').click();
});
cy.get('[data-cy="Submit"]').click();
Expand Down Expand Up @@ -243,7 +220,6 @@ describe('Collections Details', () => {

it('can deprecate/undeprecate a collection', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0').then(() => {
cy.approveCollection(collectionName, namespace.name, '1.0.0');
// Deprecate collection
visitCollection(collectionName, namespace.name);
cy.selectDetailsPageKebabAction('deprecate-collection');
Expand Down
23 changes: 5 additions & 18 deletions cypress/e2e/hub/collections-list.cy.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { Repository } from '../../../frontend/hub/administration/repositories/Repository';
import { HubNamespace } from '../../../frontend/hub/namespaces/HubNamespace';
import { randomE2Ename } from '../../support/utils';
import { Collections } from './constants';

describe('Collections List', () => {
let namespace: HubNamespace;
let repository: Repository;
let collectionName: string;

before(() => {
cy.createHubNamespace().then((namespaceResult) => {
namespace = namespaceResult;
});
cy.createHubRepository().then((repositoryResult) => {
repository = repositoryResult;
cy.galaxykit('distribution create', repository.name);
cy.waitForAllTasks();
});
});

after(() => {
// TODO - this is another PR - cy.deletehubDistribution(repository.name);
cy.deleteHubRepository(repository);
cy.deleteCollectionsInNamespace(namespace.name);
cy.deleteHubNamespace({ ...namespace, failOnStatusCode: false });
});
Expand All @@ -36,7 +27,6 @@ describe('Collections List', () => {

it('can sign a collection', () => {
cy.uploadCollection(collectionName, namespace.name, '1.0.0').then(() => {
cy.approveCollection(collectionName, namespace.name, '1.0.0');
// Sign collection
cy.getByDataCy('table-view').click();
cy.filterTableBySingleText(collectionName, true);
Expand All @@ -54,7 +44,6 @@ describe('Collections List', () => {

it('can sign and approve a collection version', () => {
cy.uploadCollection(collectionName, namespace.name, '3.0.0').then(() => {
cy.approveCollection(collectionName, namespace.name, '3.0.0');
cy.navigateTo('hub', Collections.url);
cy.get('[data-cy="table-view"]').click();
actionClick(collectionName, 'sign-collection');
Expand Down Expand Up @@ -103,8 +92,7 @@ describe('Collections List', () => {
});

it('can upload and then delete a new version to an existing collection', () => {
cy.uploadCollection(collectionName, namespace.name);
cy.moveCollection(collectionName, namespace.name, '1.0.0', 'staging', repository.name);
cy.uploadCollection(collectionName, namespace.name, '1.0.0');

cy.galaxykit('collection upload --skip-upload', namespace.name, collectionName, '1.2.3').then(
(result: { filename: string }) => {
Expand All @@ -122,8 +110,8 @@ describe('Collections List', () => {
// Upload page

cy.get('#radio-non-pipeline').click();
cy.filterTableBySingleText(repository.name, true);
cy.getTableRowByText(repository.name, false).within(() => {
cy.filterTableBySingleText('validated', true);
cy.getTableRowByText('validated', false).within(() => {
cy.getByDataCy('checkbox-column-cell').click();
});
cy.get('[data-cy="Submit"]').click();
Expand Down Expand Up @@ -152,8 +140,7 @@ describe('Collections List', () => {
});

it('can copy a version to repository and then delete it from repository', () => {
cy.uploadCollection(collectionName, namespace.name);
cy.moveCollection(collectionName, namespace.name, '1.0.0', 'staging', repository.name);
cy.uploadCollection(collectionName, namespace.name, '1.0.0');

cy.navigateTo('hub', Collections.url);
cy.filterTableBySingleText(collectionName);
Expand All @@ -167,7 +154,7 @@ describe('Collections List', () => {

cy.collectionCopyVersionToRepositories(collectionName);

// delete it from repositories
// delete it from repository community

cy.navigateTo('hub', Collections.url);
cy.getByDataCy('table-view').click();
Expand Down
7 changes: 6 additions & 1 deletion cypress/e2e/hub/my-imports.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ describe('My imports', () => {

before(() => {
cy.createHubNamespace({ namespace: { name: validCollection.namespace } }).then(() => {
cy.uploadCollection(validCollection.name, validCollection.namespace, validCollection.version);
cy.uploadCollection(
validCollection.name,
validCollection.namespace,
validCollection.version,
'staging'
);
});
cy.waitForAllTasks();
});
Expand Down
13 changes: 3 additions & 10 deletions cypress/e2e/hub/namespaces.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,8 @@ describe('Namespaces - sign collections', () => {
},
}).then((ns: HubNamespace) => {
namespace = ns;
cy.uploadCollection(collectionName, namespace.name).then(() => {
cy.uploadCollection(collectionName2, namespace.name).then(() => {
cy.approveCollection(collectionName, namespace.name, '1.0.0').then(() => {
cy.approveCollection(collectionName2, namespace.name, '1.0.0').then(() => {
cy.waitForAllTasks();
});
});
});
});
cy.uploadCollection(collectionName, namespace.name, '1.0.0');
cy.uploadCollection(collectionName2, namespace.name, '1.0.0');
});
});

Expand Down Expand Up @@ -190,7 +183,7 @@ describe('Namespaces - sign collections', () => {
cy.setTableView('table');

// Sign collection
cy.filterTableBySingleSelect('repository', 'published');
cy.filterTableBySingleSelect('repository', 'validated');
cy.get('div[data-cy="manage-view"]').within(() => {
cy.clickKebabAction('actions-dropdown', 'sign-all-collections');
});
Expand Down
3 changes: 2 additions & 1 deletion cypress/support/commands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,8 @@ declare global {
uploadCollection(
collection: string,
namespace: string,
version?: string
version: string,
repository?: string
): Cypress.Chainable<void>;
approveCollection(
collection: string,
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/hub-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Cypress.Commands.add(

Cypress.Commands.add(
'uploadCollection',
(collection: string, namespace: string, version?: string) => {
(collection: string, namespace: string, version: string, repository?: string) => {
cy.galaxykit(
'collection upload --skip-upload',
namespace,
Expand All @@ -319,7 +319,7 @@ Cypress.Commands.add(
formData.append('file', Cypress.Blob.binaryStringToBlob(fileData), filePath);

cy.hubPostRequest({
url: hubAPI`/v3/plugin/ansible/content/staging/collections/artifacts/`,
url: hubAPI`/v3/plugin/ansible/content/${repository || 'validated'}/collections/artifacts/`,
headers: {
'Content-Type': 'multipart/form-data',
},
Expand Down

0 comments on commit 7240e60

Please sign in to comment.