From 26e7538a6fad3ae87f0874f33865e8ac09e490e7 Mon Sep 17 00:00:00 2001 From: Martin Hradil Date: Thu, 27 Jun 2024 21:52:56 +0000 Subject: [PATCH] Update tests to run with gateway (when CYPRESS_HUB_GATEWAY=true) (#5136) * Update tests to run with gateway (when CYPRESS_HUB_GATEWAY=true) User Access > Users no create, no edit, no delete User Access > Groups no create, no delete no add/remove users yes add/remove roles User Access > Roles yes add/edit/delete No-Issue * add feature flag tests * prettier * increase defaltCommandTimeout, remove some custom timeouts * handle no source.parameter in namespace modal * more tests as only standalone - where creating users * community ci: disable signatures * ignore text in modal --- src/components/namespace-modal.tsx | 12 +- test/cypress.config.js | 1 + .../approval-modal/approval-multiple-repos.js | 4 - .../e2e/approval-modal/feature-flags.js | 21 +++ test/cypress/e2e/approval/approval-process.js | 4 +- test/cypress/e2e/approval/signing.js | 5 +- .../e2e/collections/collection-detail.js | 10 +- .../e2e/collections/collection-upload.js | 2 +- test/cypress/e2e/collections/collection.js | 8 +- .../e2e/collections/collections-list.js | 14 +- test/cypress/e2e/community/compose.env | 5 +- test/cypress/e2e/community/feature-flags.js | 22 +++ test/cypress/e2e/namespaces/docs-menu.js | 1 - .../e2e/namespaces/group-management.js | 4 +- test/cypress/e2e/namespaces/login.js | 17 ++- test/cypress/e2e/namespaces/profile.js | 2 +- test/cypress/e2e/namespaces/rbac-access.js | 2 +- test/cypress/e2e/namespaces/rbac.js | 90 ++++++------ test/cypress/e2e/namespaces/user-detail.js | 137 ++++++++++-------- test/cypress/e2e/repo/container-signing.js | 25 ++-- test/cypress/e2e/repo/imports-filter.js | 6 +- test/cypress/e2e/repo/remote-registry.js | 2 +- test/cypress/e2e/repo/repository.js | 4 +- test/cypress/support/e2e.js | 10 ++ 24 files changed, 229 insertions(+), 179 deletions(-) create mode 100644 test/cypress/e2e/approval-modal/feature-flags.js create mode 100644 test/cypress/e2e/community/feature-flags.js diff --git a/src/components/namespace-modal.tsx b/src/components/namespace-modal.tsx index 30eae9d0c7..01e96fdc88 100644 --- a/src/components/namespace-modal.tsx +++ b/src/components/namespace-modal.tsx @@ -60,8 +60,18 @@ export const NamespaceModal = ({ onCreateSuccess(data); }) .catch((error) => { + const nofield = []; + for (const e of error.response.data.errors) { - errorMessages[e.source.parameter] = e.detail; + if (e.source) { + errorMessages[e.source.parameter] = e.detail; + } else { + nofield.push(e.detail || e.title); + } + } + + if (nofield.length) { + errorMessages.__nofield = nofield.join('\n'); } setNameValid(!('name' in errorMessages)); diff --git a/test/cypress.config.js b/test/cypress.config.js index 3678548599..baffd100ae 100644 --- a/test/cypress.config.js +++ b/test/cypress.config.js @@ -4,6 +4,7 @@ module.exports = defineConfig({ viewportWidth: 1280, viewportHeight: 800, e2e: { + defaultCommandTimeout: 20000, setupNodeEvents(on, _config) { if (process.env.CONSOLE_LOG_TO_TERMINAL) { return require('./cypress/plugins/console-logger').install(on); diff --git a/test/cypress/e2e/approval-modal/approval-multiple-repos.js b/test/cypress/e2e/approval-modal/approval-multiple-repos.js index c4af2548f3..2e0d5b6f01 100644 --- a/test/cypress/e2e/approval-modal/approval-multiple-repos.js +++ b/test/cypress/e2e/approval-modal/approval-multiple-repos.js @@ -36,7 +36,6 @@ 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(); @@ -113,7 +112,6 @@ describe('Approval Dashboard process with multiple repos', () => { 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`); @@ -144,7 +142,6 @@ describe('Approval Dashboard process with multiple repos', () => { 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`); @@ -183,7 +180,6 @@ describe('Approval Dashboard process with multiple repos', () => { 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`); diff --git a/test/cypress/e2e/approval-modal/feature-flags.js b/test/cypress/e2e/approval-modal/feature-flags.js new file mode 100644 index 0000000000..af7ad364e7 --- /dev/null +++ b/test/cypress/e2e/approval-modal/feature-flags.js @@ -0,0 +1,21 @@ +const apiPrefix = Cypress.env('apiPrefix'); + +describe('Feature flags', () => { + it('match expectations', () => { + cy.request(`${apiPrefix}_ui/v1/feature-flags/`).then(({ body }) => { + expect(body._messages).to.be.empty; + expect(body).to.include({ ai_deny_index: false }); + expect(body).to.include({ can_create_signatures: true }); + expect(body).to.include({ can_upload_signatures: false }); + expect(body).to.include({ collection_auto_sign: true }); + expect(body).to.include({ collection_signing: true }); + expect(body).to.include({ container_signing: true }); + expect(body).to.include({ display_repositories: true }); + expect(body).to.include({ display_signatures: true }); + expect(body).to.include({ execution_environments: true }); + expect(body).to.include({ legacy_roles: false }); + expect(body).to.include({ require_upload_signatures: false }); + expect(body).to.include({ signatures_enabled: true }); + }); + }); +}); diff --git a/test/cypress/e2e/approval/approval-process.js b/test/cypress/e2e/approval/approval-process.js index 90b8168d1e..0872b52329 100644 --- a/test/cypress/e2e/approval/approval-process.js +++ b/test/cypress/e2e/approval/approval-process.js @@ -25,7 +25,7 @@ describe('Approval Dashboard process', () => { cy.visit(`${uiPrefix}approval-dashboard`); cy.contains('[data-cy^="ApprovalRow"]', 'Needs review'); cy.contains('[data-cy^="ApprovalRow"] button', 'Sign and approve').click(); - cy.contains('.body', 'No results found', { timeout: 8000 }); + cy.contains('.body', 'No results found'); cy.visit(`${uiPrefix}approval-dashboard`); cy.contains('button', 'Clear all filters').click(); cy.contains('[data-cy^="ApprovalRow"]', 'Signed and approved'); @@ -77,7 +77,7 @@ describe('Approval Dashboard process', () => { cy.wait(10000); cy.contains('My imports'); cy.get('.pf-v5-c-label__content').contains('Running').should('exist'); - cy.wait('@upload', { timeout: 10000 }); + cy.wait('@upload'); cy.wait(5000); cy.get('.pf-v5-c-label__content').contains('Failed').should('not.exist'); cy.get('.pf-v5-c-label__content').contains('Completed').should('exist'); diff --git a/test/cypress/e2e/approval/signing.js b/test/cypress/e2e/approval/signing.js index 6214afdcda..5f88e6b7e9 100644 --- a/test/cypress/e2e/approval/signing.js +++ b/test/cypress/e2e/approval/signing.js @@ -36,10 +36,7 @@ describe('signing versions - auto sign on approval', () => { // Go and check if it is signed in the collections cy.visit(`${uiPrefix}collections`); - cy.get('[data-cy="signature-badge"]', { timeout: 20000 }).should( - 'have.length', - 1, - ); + cy.get('[data-cy="signature-badge"]').should('have.length', 1); cy.get('[data-cy="signature-badge"]').first().should('contain', 'Signed'); // Optimization: check the signature button too here diff --git a/test/cypress/e2e/collections/collection-detail.js b/test/cypress/e2e/collections/collection-detail.js index 1e2f804d5b..716f5c5f2e 100644 --- a/test/cypress/e2e/collections/collection-detail.js +++ b/test/cypress/e2e/collections/collection-detail.js @@ -6,15 +6,13 @@ describe('Collection detail', () => { function deprecate() { cy.openHeaderKebab(); cy.contains('Deprecate').click(); - cy.contains('This collection has been deprecated.', { timeout: 10000 }); + cy.contains('This collection has been deprecated.'); } function undeprecate() { cy.openHeaderKebab(); cy.contains('Undeprecate').click(); - cy.contains('This collection has been deprecated.', { - timeout: 10000, - }).should('not.exist'); + cy.contains('This collection has been deprecated.').should('not.exist'); } before(() => { @@ -80,9 +78,7 @@ describe('Collection detail', () => { } if (tab.name == 'Import log') { - cy.contains('.body', 'Approval status', { - timeout: 10000, - }); + cy.contains('.body', 'Approval status'); } if (tab.name == 'Contents') { diff --git a/test/cypress/e2e/collections/collection-upload.js b/test/cypress/e2e/collections/collection-upload.js index 980ee08152..897f3dce0d 100644 --- a/test/cypress/e2e/collections/collection-upload.js +++ b/test/cypress/e2e/collections/collection-upload.js @@ -104,7 +104,7 @@ describe('Collection Upload Tests', () => { cy.get('[data-cy="confirm-upload"]').click(); cy.wait('@upload'); cy.contains('My imports'); - cy.get('.pf-v5-c-label__content').contains('Completed', { timeout: 15000 }); + cy.get('.pf-v5-c-label__content').contains('Completed'); cy.get('.pf-v5-c-label__content').contains('Failed').should('not.exist'); cy.get('.pf-v5-c-label__content').contains('Running').should('not.exist'); }); diff --git a/test/cypress/e2e/collections/collection.js b/test/cypress/e2e/collections/collection.js index c19a984a63..c09bc66bfd 100644 --- a/test/cypress/e2e/collections/collection.js +++ b/test/cypress/e2e/collections/collection.js @@ -26,7 +26,7 @@ describe('collection tests', () => { cy.get('[data-cy=delete-collection]').click(); cy.get('input[id=delete_confirm]').click(); cy.get('button').contains('Delete').click(); - cy.contains('No collections yet', { timeout: 10000 }); + cy.contains('No collections yet'); }); it('deletes a collection version', () => { @@ -113,9 +113,6 @@ describe('collection tests', () => { cy.get('button').contains('Delete').click(); cy.contains( 'Collection "test_repo_collection2" has been successfully deleted.', - { - timeout: 10000, - }, ); cy.contains('[data-cy="CollectionListItem"]', 'repo2'); cy.contains('[data-cy="CollectionListItem"]', 'Published').should( @@ -167,9 +164,6 @@ describe('collection tests', () => { cy.get('button').contains('Delete').click(); cy.contains( 'Collection "test_repo_collection_version2 v1.0.0" has been successfully deleted.', - { - timeout: 10000, - }, ); cy.visit( diff --git a/test/cypress/e2e/collections/collections-list.js b/test/cypress/e2e/collections/collections-list.js index 5c65f704a9..4e2f7f6977 100644 --- a/test/cypress/e2e/collections/collections-list.js +++ b/test/cypress/e2e/collections/collections-list.js @@ -15,7 +15,7 @@ describe('Collections list Tests', () => { cy.get('.collection-container [aria-label="Actions"]').click(); cy.contains('Deprecate').click(); - cy.contains('No results found', { timeout: 10000 }); + cy.contains('No results found'); } function undeprecate() { @@ -23,9 +23,7 @@ describe('Collections list Tests', () => { cy.contains('This collection has been deprecated.'); cy.openHeaderKebab(); cy.contains('Undeprecate').click(); - cy.contains('This collection has been deprecated.', { - timeout: 10000, - }).should('not.exist'); + cy.contains('This collection has been deprecated.').should('not.exist'); } function undeprecateIfDeprecated() { @@ -138,9 +136,7 @@ describe('Collections list Tests', () => { cy.contains('Delete collection from system').click(); cy.get('[data-cy=modal_checkbox] input').click(); cy.get('[data-cy=delete-button] button').click(); - cy.contains('Collection "my_collection0" has been successfully deleted.', { - timeout: 15000, - }); + cy.contains('Collection "my_collection0" has been successfully deleted.'); cy.contains('No results found'); }); @@ -156,9 +152,7 @@ describe('Collections list Tests', () => { cy.get('[data-cy=modal_checkbox] input').click(); cy.get('[data-cy=delete-button] button').click(); - cy.contains('Collection "my_collection1" has been successfully deleted.', { - timeout: 15000, - }); + cy.contains('Collection "my_collection1" has been successfully deleted.'); cy.contains('No results found'); }); }); diff --git a/test/cypress/e2e/community/compose.env b/test/cypress/e2e/community/compose.env index 7dd1f8f424..6e82c00219 100644 --- a/test/cypress/e2e/community/compose.env +++ b/test/cypress/e2e/community/compose.env @@ -1,7 +1,10 @@ PULP_GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_ACCESS='true' PULP_GALAXY_ENABLE_UNAUTHENTICATED_COLLECTION_DOWNLOAD='true' -PULP_GALAXY_REQUIRE_CONTENT_APPROVAL='false' PULP_GALAXY_FEATURE_FLAGS__ai_deny_index='true' +PULP_GALAXY_FEATURE_FLAGS__collection_signing='false' +PULP_GALAXY_FEATURE_FLAGS__container_signing='false' PULP_GALAXY_FEATURE_FLAGS__display_repositories='false' PULP_GALAXY_FEATURE_FLAGS__execution_environments='false' PULP_GALAXY_FEATURE_FLAGS__legacy_roles='true' +PULP_GALAXY_FEATURE_FLAGS__signatures_enabled='false' +PULP_GALAXY_REQUIRE_CONTENT_APPROVAL='false' diff --git a/test/cypress/e2e/community/feature-flags.js b/test/cypress/e2e/community/feature-flags.js new file mode 100644 index 0000000000..418652b3f9 --- /dev/null +++ b/test/cypress/e2e/community/feature-flags.js @@ -0,0 +1,22 @@ +const apiPrefix = Cypress.env('apiPrefix'); + +describe('Feature flags', () => { + it('match expectations', () => { + cy.request(`${apiPrefix}_ui/v1/feature-flags/`).then(({ body }) => { + expect(body._messages).to.be.empty; + expect(body).to.include({ ai_deny_index: true }); + expect(body).to.include({ can_create_signatures: false }); + expect(body).to.include({ can_upload_signatures: false }); + expect(body).to.include({ collection_auto_sign: false }); + expect(body).to.include({ collection_signing: false }); + expect(body).to.include({ container_signing: false }); + expect(body).to.include({ display_repositories: false }); + expect(body).to.include({ display_signatures: false }); + expect(body).to.include({ execution_environments: false }); + expect(body).to.include({ external_authentication: true }); + expect(body).to.include({ legacy_roles: true }); + expect(body).to.include({ require_upload_signatures: false }); + expect(body).to.include({ signatures_enabled: false }); + }); + }); +}); diff --git a/test/cypress/e2e/namespaces/docs-menu.js b/test/cypress/e2e/namespaces/docs-menu.js index 24364e79cb..12c655279d 100644 --- a/test/cypress/e2e/namespaces/docs-menu.js +++ b/test/cypress/e2e/namespaces/docs-menu.js @@ -28,7 +28,6 @@ describe('Documentation dropdown', () => { cy.get('[data-cy="docs-dropdown"]').click(); cy.get('.pf-v5-c-dropdown__menu').contains('About').click(); cy.get('.pf-v5-c-about-modal-box').should('be.visible'); - cy.get('h1').contains('Galaxy NG'); cy.get('[aria-label="Close Dialog"]').click(); cy.get('.pf-v5-c-about-modal-box').should('not.exist'); }); diff --git a/test/cypress/e2e/namespaces/group-management.js b/test/cypress/e2e/namespaces/group-management.js index 96b8a8e779..4980ec0b19 100644 --- a/test/cypress/e2e/namespaces/group-management.js +++ b/test/cypress/e2e/namespaces/group-management.js @@ -79,7 +79,7 @@ describe('Hub Group Management Tests', () => { cy.login(); }); - it('admin user can create/delete a group', () => { + it.standalone('admin user can create/delete a group', () => { const name = 'testGroup'; createGroupManually(name); @@ -87,7 +87,7 @@ describe('Hub Group Management Tests', () => { cy.contains('No groups yet').should('exist'); }); - it('admin user can add/remove a user to/from a group', () => { + it.standalone('admin user can add/remove a user to/from a group', () => { const groupName = 'testGroup'; const userName = 'testUser'; diff --git a/test/cypress/e2e/namespaces/login.js b/test/cypress/e2e/namespaces/login.js index d43fc16933..5bb2393a84 100644 --- a/test/cypress/e2e/namespaces/login.js +++ b/test/cypress/e2e/namespaces/login.js @@ -37,13 +37,16 @@ describe('Login helpers', () => { cy.galaxykit('user create', username, password); }); - it('can login manually and logout as admin or different user', () => { - manualLogin(username, password); - cy.contains(username); - manualLogout(); - manualLogin(adminUsername, adminPassword); - cy.contains(adminUsername); - }); + it.standalone( + 'can login manually and logout as admin or different user', + () => { + manualLogin(username, password); + cy.contains(username); + manualLogout(); + manualLogin(adminUsername, adminPassword); + cy.contains(adminUsername); + }, + ); it('can use api login', () => { cy.login(); diff --git a/test/cypress/e2e/namespaces/profile.js b/test/cypress/e2e/namespaces/profile.js index dcdc498728..0c0ec279cb 100644 --- a/test/cypress/e2e/namespaces/profile.js +++ b/test/cypress/e2e/namespaces/profile.js @@ -6,7 +6,7 @@ const helperText = (id) => .parents('.pf-v5-c-form__group') .find('.pf-v5-c-helper-text__item-text'); -describe('My Profile Tests', () => { +describe.standalone('My Profile Tests', () => { const username = 'nopermission'; const password = 'n0permissi0n'; diff --git a/test/cypress/e2e/namespaces/rbac-access.js b/test/cypress/e2e/namespaces/rbac-access.js index ec1539ed41..d38a1255b9 100644 --- a/test/cypress/e2e/namespaces/rbac-access.js +++ b/test/cypress/e2e/namespaces/rbac-access.js @@ -154,7 +154,7 @@ function testAccessTab({ cy.get( `[data-cy="RoleListTable-ExpandableRow-row-${role}"] .pf-v5-c-table__toggle button`, ).click(); - cy.contains('.pf-v5-c-label', permissionLabel, { timeout: 10000 }); + cy.contains('.pf-v5-c-label', permissionLabel); // role list view, remove cy.get( diff --git a/test/cypress/e2e/namespaces/rbac.js b/test/cypress/e2e/namespaces/rbac.js index 97ba185a3e..3518aa9815 100644 --- a/test/cypress/e2e/namespaces/rbac.js +++ b/test/cypress/e2e/namespaces/rbac.js @@ -145,7 +145,7 @@ describe('RBAC test for user without permissions', () => { }); }); -describe('RBAC test for user with permissions', () => { +describe.standalone('RBAC test for user with permissions', () => { const allPerms = [ { group: 'namespaces', @@ -291,47 +291,53 @@ describe('RBAC test for user with permissions', () => { cy.contains('Delete collection from system'); }); - it('should let view, add, change and delete users when user has permissions', () => { - cy.galaxykit('-i group role add', groupName, 'galaxy.test_users'); - cy.login(userName, userPassword); - - // can View user - cy.menuPresent('User Access > Users'); - cy.visit(`${uiPrefix}users`); - cy.contains('Users'); - - // can Add user - cy.contains('Create'); - cy.visit(`${uiPrefix}users/create`); - cy.contains('Create new user'); - - // can Change and Delete user - cy.visit(`${uiPrefix}users`); - cy.get( - '[data-cy="UserList-row-testUser"] [data-cy=kebab-toggle] > .pf-v5-c-dropdown', - ).click(); - cy.contains('Edit').should('exist'); - cy.contains('Delete').should('exist'); - }); - - it('should let view, add, change and delete groups when user has permissions', () => { - cy.galaxykit('-i group role add', groupName, 'galaxy.test_groups'); - cy.login(userName, userPassword); - - // can View group - cy.menuPresent('User Access > Groups'); - cy.visit(`${uiPrefix}group-list`); - cy.contains('Groups'); - - // can Add group - cy.contains('Create').should('exist'); - - // can Change and Delete group - cy.get( - '[data-cy="GroupList-row-testgroup"] [data-cy=kebab-toggle] > .pf-v5-c-dropdown', - ).click(); - cy.contains('Delete').should('exist'); - }); + it.standalone( + 'should let view, add, change and delete users when user has permissions', + () => { + cy.galaxykit('-i group role add', groupName, 'galaxy.test_users'); + cy.login(userName, userPassword); + + // can View user + cy.menuPresent('User Access > Users'); + cy.visit(`${uiPrefix}users`); + cy.contains('Users'); + + // can Add user + cy.contains('Create'); + cy.visit(`${uiPrefix}users/create`); + cy.contains('Create new user'); + + // can Change and Delete user + cy.visit(`${uiPrefix}users`); + cy.get( + '[data-cy="UserList-row-testUser"] [data-cy=kebab-toggle] > .pf-v5-c-dropdown', + ).click(); + cy.contains('Edit').should('exist'); + cy.contains('Delete').should('exist'); + }, + ); + + it.standalone( + 'should let view, add, change and delete groups when user has permissions', + () => { + cy.galaxykit('-i group role add', groupName, 'galaxy.test_groups'); + cy.login(userName, userPassword); + + // can View group + cy.menuPresent('User Access > Groups'); + cy.visit(`${uiPrefix}group-list`); + cy.contains('Groups'); + + // can Add group + cy.contains('Create').should('exist'); + + // can Change and Delete group + cy.get( + '[data-cy="GroupList-row-testgroup"] [data-cy=kebab-toggle] > .pf-v5-c-dropdown', + ).click(); + cy.contains('Delete').should('exist'); + }, + ); it('should let create, edit or delete container when user has permission', () => { cy.galaxykit('-i group role add', groupName, 'galaxy.test_containers'); diff --git a/test/cypress/e2e/namespaces/user-detail.js b/test/cypress/e2e/namespaces/user-detail.js index 7fdd368921..1c5a7acd00 100644 --- a/test/cypress/e2e/namespaces/user-detail.js +++ b/test/cypress/e2e/namespaces/user-detail.js @@ -1,80 +1,89 @@ const apiPrefix = Cypress.env('apiPrefix'); const uiPrefix = Cypress.env('uiPrefix'); -describe('user detail tests all fields, editing, and deleting', () => { - const num = (~~(Math.random() * 1000000)).toString(); +describe.standalone( + 'user detail tests all fields, editing, and deleting', + () => { + const num = (~~(Math.random() * 1000000)).toString(); - const selectInput = (id) => cy.get(`input[id=${id}]`).click().clear(); + const selectInput = (id) => cy.get(`input[id=${id}]`).click().clear(); - before(() => { - cy.deleteTestUsers(); - cy.deleteTestGroups(); + before(() => { + cy.deleteTestUsers(); + cy.deleteTestGroups(); - cy.galaxykit('group create', `alphaGroup${num}`); - cy.galaxykit('user create', 'testUser', 'testUserpassword'); - cy.galaxykit('user group add', 'testUser', `alphaGroup${num}`); - }); + cy.galaxykit('group create', `alphaGroup${num}`); + cy.galaxykit('user create', 'testUser', 'testUserpassword'); + cy.galaxykit('user group add', 'testUser', `alphaGroup${num}`); + }); - after(() => { - cy.deleteTestUsers(); - cy.deleteTestGroups(); - }); + after(() => { + cy.deleteTestUsers(); + cy.deleteTestGroups(); + }); - beforeEach(() => { - cy.login(); - }); + beforeEach(() => { + cy.login(); + }); - it('checks all fields', () => { - cy.visit(`${uiPrefix}users`); - cy.contains('testUser').click(); - cy.contains('Edit').click(); - selectInput('first_name').type('first_name'); - selectInput('last_name').type('last_name'); - selectInput('email').type('example@example.com'); - cy.get('button[type=submit]').click(); + it('checks all fields', () => { + cy.visit(`${uiPrefix}users`); + cy.contains('testUser').click(); + cy.contains('Edit').click(); + selectInput('first_name').type('first_name'); + selectInput('last_name').type('last_name'); + selectInput('email').type('example@example.com'); + cy.get('button[type=submit]').click(); - cy.visit(`${uiPrefix}users`); - cy.intercept('GET', `${apiPrefix}_ui/v1/users/*/`).as('testUser'); - cy.contains('testUser').click(); - cy.wait('@testUser'); + cy.visit(`${uiPrefix}users`); + cy.intercept('GET', `${apiPrefix}_ui/v1/users/*/`).as('testUser'); + cy.contains('testUser').click(); + cy.wait('@testUser'); - cy.get('[data-cy="DataForm-field-username"]').contains('testUser'); - cy.get('[data-cy="DataForm-field-first_name"]').contains('first_name'); - cy.get('[data-cy="DataForm-field-last_name"]').contains('last_name'); - cy.get('[data-cy="DataForm-field-email"]').contains('example@example.com'); - cy.get('[data-cy="UserForm-readonly-groups"]').contains(`alphaGroup${num}`); - }); + cy.get('[data-cy="DataForm-field-username"]').contains('testUser'); + cy.get('[data-cy="DataForm-field-first_name"]').contains('first_name'); + cy.get('[data-cy="DataForm-field-last_name"]').contains('last_name'); + cy.get('[data-cy="DataForm-field-email"]').contains( + 'example@example.com', + ); + cy.get('[data-cy="UserForm-readonly-groups"]').contains( + `alphaGroup${num}`, + ); + }); - it('edits user', () => { - cy.visit(`${uiPrefix}users`); - cy.contains('testUser').click(); + it('edits user', () => { + cy.visit(`${uiPrefix}users`); + cy.contains('testUser').click(); - // edits some fields - cy.contains('Edit').click(); - selectInput('first_name').type('new_first_name'); - selectInput('last_name').type('new_last_name'); - selectInput('email').type('new_example@example.com'); - cy.get('button[type=submit]').click(); - cy.reload(); + // edits some fields + cy.contains('Edit').click(); + selectInput('first_name').type('new_first_name'); + selectInput('last_name').type('new_last_name'); + selectInput('email').type('new_example@example.com'); + cy.get('button[type=submit]').click(); + cy.reload(); - // checks those fields - cy.visit(`${uiPrefix}users`); - cy.intercept('GET', `${apiPrefix}_ui/v1/users/*/`).as('user'); - cy.contains('testUser').click(); - cy.wait('@user'); - cy.get('[data-cy="DataForm-field-first_name"]').contains('new_first_name'); - cy.get('[data-cy="DataForm-field-last_name"]').contains('new_last_name'); - cy.get('[data-cy="DataForm-field-email"]').contains( - 'new_example@example.com', - ); - }); + // checks those fields + cy.visit(`${uiPrefix}users`); + cy.intercept('GET', `${apiPrefix}_ui/v1/users/*/`).as('user'); + cy.contains('testUser').click(); + cy.wait('@user'); + cy.get('[data-cy="DataForm-field-first_name"]').contains( + 'new_first_name', + ); + cy.get('[data-cy="DataForm-field-last_name"]').contains('new_last_name'); + cy.get('[data-cy="DataForm-field-email"]').contains( + 'new_example@example.com', + ); + }); - it('deletes user', () => { - cy.visit(`${uiPrefix}users`); - cy.contains('testUser').click(); - cy.contains('Delete').click(); - cy.get('[data-cy="delete-button"]').click(); + it('deletes user', () => { + cy.visit(`${uiPrefix}users`); + cy.contains('testUser').click(); + cy.contains('Delete').click(); + cy.get('[data-cy="delete-button"]').click(); - cy.contains('testUser').should('not.exist'); - }); -}); + cy.contains('testUser').should('not.exist'); + }); + }, +); diff --git a/test/cypress/e2e/repo/container-signing.js b/test/cypress/e2e/repo/container-signing.js index ce451a2b24..598d092769 100644 --- a/test/cypress/e2e/repo/container-signing.js +++ b/test/cypress/e2e/repo/container-signing.js @@ -1,9 +1,6 @@ const uiPrefix = Cypress.env('uiPrefix'); describe('Container Signing', () => { - const user = 'EESignTestUser'; - const password = 'MyPassword123'; - function deleteAll() { cy.deleteRegistries(); cy.deleteContainers(); @@ -14,9 +11,6 @@ describe('Container Signing', () => { cy.login(); deleteAll(); - // user without sign privilleges - cy.galaxykit('-i user create', user, password); - cy.galaxykit( 'registry create', `docker`, @@ -52,9 +46,7 @@ describe('Container Signing', () => { cy.login(); cy.visit(`${uiPrefix}containers/remote1`); cy.contains('[data-cy="column-section"]', 'remote1'); - cy.contains('.hub-header-bottom', 'Unsigned', { - timeout: 10000, - }); + cy.contains('.hub-header-bottom', 'Unsigned'); cy.contains('Last updated from registry'); @@ -70,9 +62,7 @@ describe('Container Signing', () => { cy.login(); cy.visit(`${uiPrefix}containers/remote2`); cy.contains('[data-cy="column-section"]', 'remote2'); - cy.contains('.hub-header-bottom', 'Unsigned', { - timeout: 10000, - }); + cy.contains('.hub-header-bottom', 'Unsigned'); cy.get('button[aria-label="Actions"]').click(); cy.contains('.pf-v5-c-dropdown ul li a', 'Sign').click(); @@ -83,9 +73,7 @@ describe('Container Signing', () => { cy.login(); cy.visit(`${uiPrefix}containers/local1`); cy.contains('[data-cy="column-section"]', 'local1'); - cy.contains('.hub-header-bottom', 'Unsigned', { - timeout: 10000, - }); + cy.contains('.hub-header-bottom', 'Unsigned'); cy.get('button[aria-label="Actions"]').click(); cy.contains('.pf-v5-c-dropdown ul li a', 'Sign').click(); @@ -95,7 +83,12 @@ describe('Container Signing', () => { }); }); - it('cant see sign button when user has no rights', () => { + it.standalone('cant see sign button when user has no rights', () => { + // user without sign privilleges + const user = 'EESignTestUser'; + const password = 'MyPassword123'; + cy.galaxykit('-i user create', user, password); + cy.login(user, password); cy.visit(`${uiPrefix}containers/local1`); // this is now covered by alert that should not be here in the future diff --git a/test/cypress/e2e/repo/imports-filter.js b/test/cypress/e2e/repo/imports-filter.js index e3071c2344..b900437231 100644 --- a/test/cypress/e2e/repo/imports-filter.js +++ b/test/cypress/e2e/repo/imports-filter.js @@ -38,7 +38,7 @@ describe('Imports filter test', () => { ); cy.get( '[data-cy="MyImports"] [data-cy="ImportConsole"] .title-bar', - ).contains('Completed', { timeout: 10000 }); + ).contains('Completed'); cy.get( '[data-cy="MyImports"] [data-cy="ImportConsole"] .message-list', ).contains('Done'); @@ -46,9 +46,7 @@ describe('Imports filter test', () => { it('should be able to switch between namespaces', () => { cy.get('button[aria-label="Clear all"]').click(); - cy.contains('[data-cy="import-list-data"]', 'No namespace selected.', { - timeout: 8000, - }); + cy.contains('[data-cy="import-list-data"]', 'No namespace selected.'); cy.intercept( 'GET', diff --git a/test/cypress/e2e/repo/remote-registry.js b/test/cypress/e2e/repo/remote-registry.js index 3030c91a4d..2fb87287fa 100644 --- a/test/cypress/e2e/repo/remote-registry.js +++ b/test/cypress/e2e/repo/remote-registry.js @@ -82,7 +82,7 @@ describe('Remote Registry Tests', () => { cy.get( '[data-cy="ExecutionEnvironmentRegistryList-row-New remote registry1"]', - ).contains('Completed', { timeout: 10000 }); + ).contains('Completed'); }); it('users can index only redhat.registry.io', () => { diff --git a/test/cypress/e2e/repo/repository.js b/test/cypress/e2e/repo/repository.js index 18624a8a33..2d1b572484 100644 --- a/test/cypress/e2e/repo/repository.js +++ b/test/cypress/e2e/repo/repository.js @@ -116,9 +116,7 @@ function versionCheck(version) { cy.contains('Sync started for repository "repo1Test".'); cy.contains('a', 'detail page').click(); - cy.get('.pf-v5-c-label__content').contains('Failed', { - timeout: 15000, - }); + cy.get('.pf-v5-c-label__content').contains('Failed'); } }); diff --git a/test/cypress/support/e2e.js b/test/cypress/support/e2e.js index 05f42f7cb4..ae0962aafb 100644 --- a/test/cypress/support/e2e.js +++ b/test/cypress/support/e2e.js @@ -2,3 +2,13 @@ import 'cypress-file-upload'; import './commands'; import './login'; + +// standalone-only tests, skipped on gateway (when CYPRESS_HUB_GATEWAY=true) +describe.standalone = (...args) => + ['0', 'false'].includes(Cypress.env('HUB_GATEWAY') || 'false') + ? describe(...args) + : describe.skip(...args); +it.standalone = (...args) => + ['0', 'false'].includes(Cypress.env('HUB_GATEWAY') || 'false') + ? it(...args) + : it.skip(...args);