-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish approval process test, move it to separate folder
- Loading branch information
1 parent
c383ec1
commit cb56aa2
Showing
3 changed files
with
388 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
test/cypress/e2e/approval_modal/approval_multiple_repos.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
import { range } from 'lodash'; | ||
|
||
const uiPrefix = Cypress.env('uiPrefix'); | ||
const apiPrefix = Cypress.env('apiPrefix'); | ||
|
||
function openModal(menu) { | ||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('Clear all filters').click(); | ||
|
||
if (menu) { | ||
cy.get('.CertificationDashboard-row [aria-label="Actions"]').click(); | ||
cy.contains('a', 'Sign and approve').click(); | ||
} else { | ||
cy.contains( | ||
'.CertificationDashboard-row button', | ||
'Sign and approve', | ||
).click(); | ||
} | ||
|
||
cy.contains('Select repositories'); | ||
} | ||
|
||
function toggleItem(name) { | ||
cy.get('.modal-body [data-cy="compound_filter"] input') | ||
.clear() | ||
.type(name + '{enter}'); | ||
cy.get(`[data-cy="ApproveModal-CheckboxRow-row-${name}"] input`).click(); | ||
} | ||
|
||
function menuActionClick(repo, action) { | ||
cy.get( | ||
`[data-cy="${repo}-namespace-collection1"] [aria-label="Actions"]`, | ||
).click(); | ||
cy.contains('[data-cy="kebab-toggle"] a', action).click(); | ||
} | ||
|
||
function rejectItem(repo) { | ||
menuActionClick(repo, 'Reject'); | ||
cy.contains( | ||
'Certification status for collection "namespace collection1 v1.0.0" has been successfully updated.', | ||
{ timeout: 10000 }, | ||
); | ||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('Clear all filters').click(); | ||
cy.contains(`[data-cy="rejected-namespace-collection1"]`, 'Rejected'); | ||
} | ||
|
||
const reposList = []; | ||
|
||
describe('Approval Dashboard process with multiple repos', () => { | ||
before(() => { | ||
cy.deleteNamespacesAndCollections(); | ||
cy.galaxykit('-i namespace create', 'namespace'); | ||
cy.galaxykit('-i collection upload', 'namespace', 'collection1'); | ||
|
||
const max = 11; | ||
range(1, max).forEach((i) => { | ||
reposList.push('repo' + i); | ||
}); | ||
|
||
reposList.push('published'); | ||
|
||
cy.login(); | ||
|
||
range(1, max).forEach((i) => { | ||
cy.galaxykit('-i distribution delete', 'repo' + i); | ||
}); | ||
|
||
cy.galaxykit('-i task wait all'); | ||
|
||
cy.request(apiPrefix + 'pulp/api/v3/repositories/ansible/ansible/').then( | ||
(data) => { | ||
const list = data.body.results; | ||
list.forEach((repo) => { | ||
if ( | ||
repo.pulp_labels?.pipeline == 'approved' && | ||
repo.name != 'published' | ||
) { | ||
cy.log('deleting repository' + repo.name); | ||
cy.galaxykit('-i repository delete', repo.name); | ||
} | ||
}); | ||
cy.galaxykit('-i task wait all'); | ||
range(1, max).forEach((i) => { | ||
cy.galaxykit( | ||
`-i repository create`, | ||
'repo' + i, | ||
'--pipeline=approved', | ||
); | ||
cy.galaxykit('-i distribution create', 'repo' + i); | ||
}); | ||
cy.galaxykit('-i task wait all'); | ||
}, | ||
); | ||
|
||
// prepare another staging | ||
cy.galaxykit('-i distribution delete', 'staging2'); | ||
cy.galaxykit('-i repository delete', 'staging2'); | ||
|
||
cy.galaxykit('-i repository create', 'staging2', '--pipeline=staging'); | ||
cy.galaxykit('-i distribution create', 'staging2'); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it('should contains no colletctions in list.', () => { | ||
cy.visit(`${uiPrefix}collections`); | ||
cy.contains('No collections yet'); | ||
}); | ||
|
||
it('should approve, reject and reapprove.', () => { | ||
openModal(); | ||
toggleItem('repo1'); | ||
toggleItem('repo2'); | ||
toggleItem('published'); | ||
cy.contains('button', 'Select').click(); | ||
cy.contains( | ||
'Certification status for collection "namespace collection1 v1.0.0" has been successfully updated.', | ||
{ timeout: 20000 }, | ||
); | ||
|
||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('No results found'); | ||
cy.contains('Clear all filters').click(); | ||
cy.contains('[aria-label="Collection versions"]', 'repo1'); | ||
cy.contains('[aria-label="Collection versions"]', 'repo2'); | ||
cy.contains('[aria-label="Collection versions"]', 'published'); | ||
|
||
rejectItem('repo1'); | ||
rejectItem('published'); | ||
|
||
// 2 items should be left there | ||
cy.contains('.toolbar', '1 - 2 of 2'); | ||
cy.get('[data-cy="rejected-namespace-collection1"]'); | ||
cy.get('[data-cy="repo2-namespace-collection1"]'); | ||
cy.get('[data-cy="repo1-namespace-collection1"]').should('not.exist'); | ||
cy.get('[data-cy="published-namespace-collection1"]').should('not.exist'); | ||
|
||
// reapprove | ||
menuActionClick('rejected', 'Sign and approve'); | ||
cy.contains('Select repositories'); | ||
cy.contains('[aria-label="Label group category"]', 'repo2'); | ||
toggleItem('repo1'); | ||
cy.contains('button', 'Select').click(); | ||
cy.contains( | ||
'Certification status for collection "namespace collection1 v1.0.0" has been successfully updated.', | ||
{ timeout: 20000 }, | ||
); | ||
|
||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('Clear all filters').click(); | ||
cy.contains('.toolbar', '1 - 2 of 2'); | ||
cy.get('[data-cy="repo2-namespace-collection1"]'); | ||
cy.get('[data-cy="repo1-namespace-collection1"]'); | ||
cy.get('[data-cy="published-namespace-collection1"]').should('not.exist'); | ||
cy.get('[data-cy="rejected-namespace-collection1"]').should('not.exist'); | ||
}); | ||
|
||
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( | ||
'-i collection move', | ||
'namespace', | ||
'collection1', | ||
'1.0.0', | ||
'staging', | ||
'staging2', | ||
); | ||
|
||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.get('[data-cy="staging2-namespace-collection1"]'); | ||
|
||
openModal(); | ||
toggleItem('repo1'); | ||
toggleItem('repo2'); | ||
toggleItem('published'); | ||
cy.contains('button', 'Select').click(); | ||
cy.contains( | ||
'Certification status for collection "namespace collection1 v1.0.0" has been successfully updated.', | ||
{ timeout: 20000 }, | ||
); | ||
|
||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('No results found'); | ||
cy.contains('Clear all filters').click(); | ||
cy.contains('[aria-label="Collection versions"]', 'repo1'); | ||
cy.contains('[aria-label="Collection versions"]', 'repo2'); | ||
cy.contains('[aria-label="Collection versions"]', 'published'); | ||
}); | ||
}); |
193 changes: 193 additions & 0 deletions
193
test/cypress/e2e/approval_modal/approval_multiple_repos_list.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
import { range } from 'lodash'; | ||
|
||
const uiPrefix = Cypress.env('uiPrefix'); | ||
const apiPrefix = Cypress.env('apiPrefix'); | ||
|
||
function openModal(menu) { | ||
cy.visit(`${uiPrefix}approval-dashboard`); | ||
cy.contains('Clear all filters').click(); | ||
|
||
if (menu) { | ||
cy.get('.CertificationDashboard-row [aria-label="Actions"]').click(); | ||
cy.contains('a', 'Sign and approve').click(); | ||
} else { | ||
cy.contains( | ||
'.CertificationDashboard-row button', | ||
'Sign and approve', | ||
).click(); | ||
} | ||
|
||
cy.contains('Select repositories'); | ||
} | ||
|
||
function toggleItem(name) { | ||
cy.get('.modal-body [data-cy="compound_filter"] input') | ||
.clear() | ||
.type(name + '{enter}'); | ||
cy.get(`[data-cy="ApproveModal-CheckboxRow-row-${name}"] input`).click(); | ||
} | ||
|
||
const reposList = []; | ||
|
||
describe('Approval Dashboard process with multiple repos', () => { | ||
before(() => { | ||
cy.deleteNamespacesAndCollections(); | ||
cy.galaxykit('-i namespace create', 'namespace'); | ||
cy.galaxykit('-i collection upload', 'namespace', 'collection1'); | ||
|
||
const max = 11; | ||
range(1, max).forEach((i) => { | ||
reposList.push('repo' + i); | ||
}); | ||
|
||
reposList.push('published'); | ||
|
||
cy.login(); | ||
|
||
range(1, max).forEach((i) => { | ||
cy.galaxykit('-i distribution delete', 'repo' + i); | ||
}); | ||
|
||
cy.galaxykit('-i task wait all'); | ||
|
||
cy.request(apiPrefix + 'pulp/api/v3/repositories/ansible/ansible/').then( | ||
(data) => { | ||
const list = data.body.results; | ||
list.forEach((repo) => { | ||
if ( | ||
repo.pulp_labels?.pipeline == 'approved' && | ||
repo.name != 'published' | ||
) { | ||
cy.log('deleting repository' + repo.name); | ||
cy.galaxykit('-i repository delete', repo.name); | ||
} | ||
}); | ||
cy.galaxykit('-i task wait all'); | ||
range(1, max).forEach((i) => { | ||
cy.galaxykit( | ||
`-i repository create`, | ||
'repo' + i, | ||
'--pipeline=approved', | ||
); | ||
cy.galaxykit('-i distribution create', 'repo' + i); | ||
}); | ||
cy.galaxykit('-i task wait all'); | ||
}, | ||
); | ||
|
||
// prepare another staging | ||
cy.galaxykit('-i distribution delete', 'staging2'); | ||
cy.galaxykit('-i repository delete', 'staging2'); | ||
|
||
cy.galaxykit('-i repository create', 'staging2', '--pipeline=staging'); | ||
cy.galaxykit('-i distribution create', 'staging2'); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it('should test paging.', () => { | ||
openModal(); | ||
cy.contains('.modal-body .toolbar', '1 - 10 of 11'); | ||
cy.contains('.modal-body', 'repo1'); | ||
cy.contains('.modal-body', 'published'); | ||
cy.get('.modal-body .toolbar [data-action="next"]').click(); | ||
cy.contains('.modal-body .toolbar', '11 - 11 of 11'); | ||
cy.contains('.modal-body', 'repo9'); | ||
}); | ||
|
||
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.', () => { | ||
openModal(); | ||
cy.contains('.modal-body', 'repo9').should('not.exist'); | ||
cy.get('.modal-body [data-cy="compound_filter"] input').type('repo{enter}'); | ||
cy.contains('.modal-body', 'repo9'); | ||
cy.contains('.modal-body', 'repo1'); | ||
cy.contains('.modal-body', 'published').should('not.exist'); | ||
|
||
cy.get('.modal-body [data-cy="compound_filter"] input') | ||
.clear() | ||
.type('repo2{enter}'); | ||
cy.contains('.modal-body', 'repo2'); | ||
cy.contains('.modal-body', 'repo1').should('not.exist'); | ||
cy.contains('.modal-body', 'published').should('not.exist'); | ||
}); | ||
|
||
it('should test select/deselect all/page.', () => { | ||
openModal(); | ||
|
||
// select all | ||
cy.get('.toolbar [aria-label="Select"] svg').click(); | ||
cy.contains('a', 'Select all (11 items)').click(); | ||
cy.contains('[aria-label="Label group category"] button', '8 more').click(); | ||
reposList.forEach((repo) => { | ||
cy.contains('[aria-label="Label group category"]', repo); | ||
}); | ||
|
||
// deselect all | ||
cy.get('.toolbar [aria-label="Select"] svg').click(); | ||
cy.contains('a', 'Deselect all (11 items)').click(); | ||
reposList.forEach((repo) => { | ||
cy.contains('[aria-label="Label group category"]', repo).should( | ||
'not.exist', | ||
); | ||
}); | ||
|
||
// select page | ||
cy.get('.toolbar [aria-label="Select"] svg').click(); | ||
cy.contains('a', 'Select page (10 items)').click(); | ||
reposList.forEach((repo) => { | ||
if (repo != 'repo9') { | ||
cy.contains('[aria-label="Label group category"]', repo); | ||
} else { | ||
cy.contains('[aria-label="Label group category"]', repo).should( | ||
'not.exist', | ||
); | ||
} | ||
}); | ||
|
||
// select repo9 | ||
toggleItem('repo9'); | ||
cy.contains('Clear all filters').click(); | ||
|
||
// deselect page and repo9 should remain here | ||
cy.get('.toolbar [aria-label="Select"] svg').click(); | ||
cy.contains('a', 'Deselect page (10 items)').click(); | ||
reposList.forEach((repo) => { | ||
if (repo != 'repo9') { | ||
cy.contains('[aria-label="Label group category"]', repo).should( | ||
'not.exist', | ||
); | ||
} else { | ||
cy.contains('[aria-label="Label group category"]', repo); | ||
} | ||
}); | ||
}); | ||
|
||
it('should test selection.', () => { | ||
openModal(); | ||
toggleItem('repo1'); | ||
toggleItem('published'); | ||
cy.contains('[aria-label="Label group category"]', 'repo1'); | ||
cy.contains('[aria-label="Label group category"]', 'published'); | ||
|
||
toggleItem('published'); | ||
cy.contains('[aria-label="Label group category"]', 'published').should( | ||
'not.exist', | ||
); | ||
|
||
toggleItem('published'); | ||
cy.get('[aria-label="Close published"]').click(); | ||
cy.contains('[aria-label="Label group category"]', 'published').should( | ||
'not.exist', | ||
); | ||
}); | ||
}); |