diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index c73aa8985..87aa302e6 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18.17.0 + node-version: 18.18.0 cache: 'npm' - name: Install @@ -35,6 +35,7 @@ jobs: name: Start Infinispan Server Latest Version run: | docker run -d -p 11222:11222 -v ${{ github.workspace }}/scripts/identities.batch:/user-config/identities.batch -v ${{ github.workspace }}/dist:/opt/infinispan/static/console -v ${{ github.workspace }}/scripts/infinispan-basic-auth.xml:/opt/infinispan/server/conf/infinispan.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main --node-name=infinispan-4-e2e +# docker run -d -p 11222:11222 -v /Users/karestig/REDHAT/INFINISPAN/infinispan-console/scripts/identities.batch:/user-config/identities.batch -v /Users/karestig/REDHAT/INFINISPAN/infinispan-console/dist:/opt/infinispan/static/console -v /Users/karestig/REDHAT/INFINISPAN/infinispan-console/scripts/infinispan-basic-auth.xml:/opt/infinispan/server/conf/infinispan.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main --node-name=infinispan-4-e2e # Wait for server to startup curl --fail --silent --show-error --retry-all-errors --retry 240 --retry-delay 1 http://localhost:11222/rest/v2/cache-managers/default/health/status > /dev/null #Installing Nashorn dependencies @@ -63,7 +64,7 @@ jobs: # Wait for server to startup curl --fail --silent --show-error --retry-all-errors --retry 240 --retry-delay 1 http://localhost:11222/rest/v2/cache-managers/default/health/status > /dev/null - - name: Initialize Infnispan Server + - name: Initialize Infinispan Server run: cd data; bash ./create-data.sh admin password - name: Cypress run diff --git a/cypress/e2e/cluster-welcome.cy.js b/cypress/e2e/1_cluster-welcome.cy.js similarity index 98% rename from cypress/e2e/cluster-welcome.cy.js rename to cypress/e2e/1_cluster-welcome.cy.js index cd6613502..5144fbd8c 100644 --- a/cypress/e2e/cluster-welcome.cy.js +++ b/cypress/e2e/1_cluster-welcome.cy.js @@ -17,7 +17,7 @@ describe('Welcome page', () => { cy.contains('Default'); // cluster name cy.contains('Running'); // cluster status cy.contains('Cluster rebalancing on'); // rebalancing status - cy.contains('18 Caches'); + cy.contains('15 Caches'); cy.contains('10 Counters'); cy.contains('1 Tasks'); cy.contains('13 Schemas'); @@ -72,7 +72,7 @@ describe('Welcome page', () => { cy.login(Cypress.env('username'), Cypress.env('password')); cy.get('[data-cy=aboutInfoQuestionMark]').click(); cy.contains('Documentation'); - + //Clicks the About link and should go to About dialog cy.contains('About').click(); cy.get('[role=dialog]').should('be.visible'); diff --git a/cypress/e2e/data-container.cy.js b/cypress/e2e/2_data-container.cy.js similarity index 87% rename from cypress/e2e/data-container.cy.js rename to cypress/e2e/2_data-container.cy.js index aff34ffe4..3814a2a38 100644 --- a/cypress/e2e/data-container.cy.js +++ b/cypress/e2e/2_data-container.cy.js @@ -1,5 +1,5 @@ describe('Data Container Overview', () => { - const numberOfCaches = 18; + const numberOfCaches = 15; beforeEach(() => { cy.login(Cypress.env('username'), Cypress.env('password')); @@ -32,7 +32,7 @@ describe('Data Container Overview', () => { //Testing pagination and navigation it('successfully navigates through the caches as well as changes number of viewed caches on the page', () => { cy.contains(numberOfCaches + ' Caches'); - cy.contains('12 Counters'); + cy.contains('10 Counters'); cy.contains('1 Tasks'); cy.contains('13 Schemas'); @@ -121,7 +121,7 @@ describe('Data Container Overview', () => { //Verifying that only local caches are shown cy.contains('default'); - cy.get('[data-cy=cachesTable] tr').should('have.length', 3); //3 including header row + cy.get('[data-cy=cachesTable] tr').should('have.length', 2); //2 including header row //Verifying that all entries are local caches cy.get('[data-cy^=type-]').each((badge) => { cy.wrap(badge).contains('Local'); @@ -171,12 +171,12 @@ describe('Data Container Overview', () => { cy.get('[data-cy=cacheFilterSelect]').click(); //Verifying that only distributed caches are shown - cy.contains('1 - 10 of 14'); + cy.contains('1 - 10 of 12'); cy.contains('java-serialized-cache'); cy.get('[data-cy=cachesTable] tr').should('have.length', 11); //11 including header row //Navigating to the next page to see the rest of the caches cy.get('[data-action=next]').first().click(); - cy.get('[data-cy=cachesTable] tr').should('have.length', 5); //5 including header row + cy.get('[data-cy=cachesTable] tr').should('have.length', 3); //3 including header row cy.contains('xml-cache'); cy.contains('java-serialized-cache').should('not.exist'); @@ -185,8 +185,8 @@ describe('Data Container Overview', () => { cy.get('[data-action=per-page-20]').click(); cy.contains('not-encoded'); cy.contains('xml-cache'); - cy.contains('1 - 14 of 14'); - cy.get('[data-cy=cachesTable] tr').should('have.length', 15); //15 including header row + cy.contains('1 - 12 of 12'); + cy.get('[data-cy=cachesTable] tr').should('have.length', 13); //13 including header row //Verifying that all entries are distributed caches cy.get('[data-cy^=type-]').each((badge) => { @@ -198,7 +198,7 @@ describe('Data Container Overview', () => { cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="transactionalFeature"]').find('input:checkbox').click(); //Filtering transactional caches (already on filtered distributed caches) cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); //Closing filter selectbox - cy.get('[data-cy=cachesTable] tr').should('have.length', 5); //5 including header row + cy.get('[data-cy=cachesTable] tr').should('have.length', 4); //4 including header row // //Verifying that all entries are distributed and transactional caches cy.get('[data-cy^=type-]').each((badge) => { cy.wrap(badge).contains('Distributed'); @@ -209,13 +209,12 @@ describe('Data Container Overview', () => { cy.contains('heap-test'); cy.contains('off-heap-test'); cy.contains('people'); - cy.contains('super-cache'); // //Adding Replicated type filter cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="replicatedType"]').find('input:checkbox').click(); //Filtering transactional caches (already on filtered distributed caches)+replicated cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); //Closing filter selectbox - cy.get('[data-cy=cachesTable] tr').should('have.length', 5); //5 including header row - nothing is changed + cy.get('[data-cy=cachesTable] tr').should('have.length', 4); //4 including header row - nothing is changed //Verifying that all entries are distributed and transactional caches cy.get('[data-cy^=type-]').each((badge) => { cy.wrap(badge).contains('Distributed'); @@ -226,7 +225,6 @@ describe('Data Container Overview', () => { cy.contains('heap-test'); cy.contains('off-heap-test'); cy.contains('people'); - cy.contains('super-cache'); //Removing Distributed filter cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); @@ -239,7 +237,7 @@ describe('Data Container Overview', () => { cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="replicatedType"]').find('input:checkbox').click(); //Filtering transactional caches & replicated ones cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); //Closing filter selectbox - cy.get('[data-cy=cachesTable] tr').should('have.length', 5); //5 including header row - nothing is changed + cy.get('[data-cy=cachesTable] tr').should('have.length', 4); //4 including header row - nothing is changed cy.get('[data-cy^=feature-]').each((badge) => { cy.wrap(badge).contains('Transactional'); }); @@ -248,7 +246,7 @@ describe('Data Container Overview', () => { cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="indexedFeature"]').find('input:checkbox').click(); //Filtering transactional caches & replicated ones cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); //Closing filter selectbox - cy.get('[data-cy=cachesTable] tr').should('have.length', 7); //7 including header row - nothing is changed + cy.get('[data-cy=cachesTable] tr').should('have.length', 7); //5 including header row - nothing is changed cy.get('[data-cy^=feature-]').each((badge) => { cy.wrap(badge).contains(/Transactional|Indexed/); }); @@ -269,7 +267,6 @@ describe('Data Container Overview', () => { cy.wrap(badge).contains(/Secured/); }); cy.contains('indexed-cache'); - cy.contains('super-cache'); //Clearing all filters and setting Persistence cy.get('button:contains("Clear all filters"):visible').click(); @@ -280,94 +277,66 @@ describe('Data Container Overview', () => { cy.get('[data-cy^=feature-]').each((badge) => { cy.wrap(badge).contains(/Persistent/); }); - cy.contains('super-cache'); //Adding Bounded filter cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="boundedFeature"]').find('input:checkbox').click(); //Filtering bounded caches cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); //Closing filter selectbox - cy.get('[data-cy=cachesTable] tr').should('have.length', 4); //4 including header row - nothing is changed + cy.get('[data-cy=cachesTable] tr').should('have.length', 3); //3 including header row - nothing is changed cy.get('[data-cy^=feature-]').each((badge) => { cy.wrap(badge).contains(/Bounded/); }); - cy.contains('super-cache'); cy.contains('heap-test'); }); //Hide created cache and check the hidden filter it('successfully ignores the cache', () => { - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=ignoreCacheAction]').click(); cy.get('[data-cy=ignoreCacheModal]').should('exist'); cy.get('#hideShowModal [aria-label=Close]').click(); //Closing modal with close button cy.get('[data-cy=ignoreCacheModal]').should('not.exist'); - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=ignoreCacheAction]').click(); cy.get('[data-cy=ignoreCacheModal]').should('exist'); cy.get('[data-cy=cancelAction]').click(); //Closing modal with Cancel button cy.get('[data-cy=ignoreCacheModal]').should('not.exist'); - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=ignoreCacheAction]').click(); cy.get('[data-cy=hideCacheButton]').click(); //Hiding cache - cy.contains('Cache aCache hidden.').should('exist'); - cy.get('[data-cy=ignoreBadge-aCache]').should('exist'); + cy.contains('Cache default hidden.').should('exist'); + cy.get('[data-cy=ignoreBadge-default]').should('exist'); cy.get('[data-cy=cacheFilterSelect]').click(); cy.get('[data-cy=cacheFilterSelectExpanded] div > button').click(); cy.get('[data-cy="hiddenStatus"]').find('input:checkbox').click(); //Filtering hidden caches cy.get('[data-cy=cacheFilterSelect]').click(); //Closing filter selectbox cy.get('[data-cy=cachesTable] tr').should('have.length', 2); //2 including header row - nothing is changed - cy.get('[data-cy=ignoreBadge-aCache]').should('exist'); - cy.contains('aCache'); + cy.get('[data-cy=ignoreBadge-default]').should('exist'); + cy.contains('default'); }); //Show (undo ignored cache) created cache it('successfully undos the ignore the cache action', () => { - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=showCacheAction]').click(); cy.get('[data-cy=undoCacheModal]').should('exist'); cy.get('#hideShowModal [aria-label=Close]').click(); //Closing modal with close button cy.get('[data-cy=undoCacheModal]').should('not.exist'); - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=showCacheAction]').click(); cy.get('[data-cy=undoCacheModal]').should('exist'); cy.get('[data-cy=cancelAction]').click(); //Closing modal with Cancel button cy.get('[data-cy=undoCacheModal]').should('not.exist'); - cy.get('[data-cy=actions-aCache]').click(); + cy.get('[data-cy=actions-default]').click(); cy.get('[aria-label=showCacheAction]').click(); cy.get('[data-cy=showCacheButton]').click(); //Hiding cache - cy.contains('Cache aCache is now visible.').should('exist'); - cy.get('[data-cy=ignoreBadge-aCache]').should('not.exist'); - }); - - //Delete created cache - it('successfully deletes a cache', () => { - cy.get('[data-cy=actions-aCache]').click(); - cy.get('[aria-label=deleteCacheAction]').click(); - cy.get('#deleteCacheModal').should('exist'); - cy.contains('Permanently delete cache?'); - cy.get('#deleteCacheModal [aria-label=Close]').click(); //Closing modal with close button - cy.contains('Permanently delete cache?').should('not.exist'); - - cy.get('[data-cy=actions-aCache]').click(); - cy.get('[aria-label=deleteCacheAction]').click(); - cy.contains('Permanently delete cache?'); - cy.get('[data-cy=cancelCacheDeleteButton]').click(); //Closing modal with Cancel button - cy.contains('Permanently delete cache?').should('not.exist'); - - cy.get('[data-cy=actions-aCache]').click(); - cy.get('[aria-label=deleteCacheAction]').click(); - cy.get('#cache-to-delete').click(); - cy.get('#cache-to-delete').type('aCache'); - cy.get('[data-cy=deleteCacheButton]').click(); //Deleting cache aCache - - cy.contains('Cache aCache deleted.'); - cy.get('.pf-v5-c-alert__action > .pf-v5-c-button').click(); //Closing alert popup. - cy.get('aCache').should('not.exist'); //Checking that deleted cache is not visible + cy.contains('Cache default is now visible.').should('exist'); + cy.get('[data-cy=ignoreBadge-default]').should('not.exist'); }); // Displays templates page diff --git a/cypress/e2e/rbac_func.cy.js b/cypress/e2e/3_rbac_func.cy.js similarity index 95% rename from cypress/e2e/rbac_func.cy.js rename to cypress/e2e/3_rbac_func.cy.js index be720be96..4b95ef8ff 100644 --- a/cypress/e2e/rbac_func.cy.js +++ b/cypress/e2e/3_rbac_func.cy.js @@ -8,7 +8,7 @@ describe('RBAC Functionlity Tests', () => { cy.login(monitorUserName, Cypress.env('password')); checkDataContainerView(true, false, false, false); checkSecuredCacheDetailsView(true, false, false, 'monitor', 'indexed-cache'); - checkNotOwnSecuredCache('super-cache'); + checkNotOwnSecuredCache('a-rbac-test-cache'); checkNonSecuredCacheDetailView(true, false); }); @@ -26,7 +26,7 @@ describe('RBAC Functionlity Tests', () => { cy.contains('1 - 1 of 1'); cy.contains('Elaia'); - checkNotOwnSecuredCache('super-cache'); + checkNotOwnSecuredCache('a-rbac-test-cache'); checkNonSecuredCacheDetailView(false, false); //Go to tasks (@TODO at the moment for observer no tasks are shown, add after fix) checkSchemasPageView(false); @@ -37,7 +37,7 @@ describe('RBAC Functionlity Tests', () => { cy.login(applicationUserName, Cypress.env('password')); checkDataContainerView(false, false, false, false); - checkSecuredCacheDetailsView(false, true, false, 'application', 'super-cache'); + checkSecuredCacheDetailsView(false, true, false, 'application', 'a-rbac-test-cache'); checkActionsOnSuperCache(); checkNotOwnSecuredCache('indexed-cache'); @@ -51,7 +51,7 @@ describe('RBAC Functionlity Tests', () => { cy.login(deployerUserName, Cypress.env('password')); checkDataContainerView(false, true, true, false); - checkSecuredCacheDetailsView(false, true, false, 'deployer', 'super-cache'); + checkSecuredCacheDetailsView(false, true, false, 'deployer', 'a-rbac-test-cache'); checkActionsOnSuperCache(); checkNotOwnSecuredCache('indexed-cache'); @@ -65,7 +65,7 @@ describe('RBAC Functionlity Tests', () => { cy.login(Cypress.env('username'), Cypress.env('password')); checkDataContainerView(false, true, true, true); - checkSecuredCacheDetailsView(false, true, true, 'admin', 'super-cache'); + checkSecuredCacheDetailsView(false, true, true, 'admin', 'a-rbac-test-cache'); checkActionsOnSuperCache(); checkNotOwnSecuredCache('text-cache'); @@ -90,13 +90,13 @@ describe('RBAC Functionlity Tests', () => { cy.get('[data-cy=cacheManagerStatus]').should('exist'); cy.get('[data-cy=navigationTabs]').should('exist'); cy.contains(/^\d+ Caches$/); - cy.contains('10 Counters'); + cy.contains('Counters'); if (isMonitor) { - cy.contains('1 Tasks').should('not.exist'); - cy.contains('13 Schemas').should('not.exist'); + cy.contains('Tasks').should('not.exist'); + cy.contains('Schemas').should('not.exist'); } else { //cy.contains('1 Tasks'); //Should be uncommented after feature is implemented - cy.contains('13 Schemas'); + cy.contains('Schemas'); } cy.get('#cache-table-toolbar').should('exist'); cy.get('[data-cy=paginationArea]').should('exist'); @@ -183,7 +183,7 @@ describe('RBAC Functionlity Tests', () => { cy.contains('Data container').click(); cy.get('[id^="pagination-caches-top-pagination"]').first().click(); cy.get('[data-action=per-page-100]').click(); - cy.contains(/cacheName$/).should('not.exist'); + cy.contains('/' + cacheName +'$/').should('not.exist'); } function checkNonSecuredCacheDetailView(isMonitor, isSuperAdmin) { @@ -314,7 +314,7 @@ describe('RBAC Functionlity Tests', () => { parseSpecialCharSequences: false }); cy.get('[data-cy=addButton]').click(); - cy.contains('Entry added to cache super-cache.'); + cy.contains('Entry added to cache a-rbac-test-cache.'); cy.get('[data-cy=actions-fordCar]').should('exist'); //Adding one more entry cy.get('[data-cy=addEntryButton]').click(); @@ -327,7 +327,7 @@ describe('RBAC Functionlity Tests', () => { parseSpecialCharSequences: false }); cy.get('[data-cy=addButton]').click(); - cy.contains('Entry added to cache super-cache.'); + cy.contains('Entry added to cache a-rbac-test-cache.'); cy.get('[data-cy=actions-kiaCar]').should('exist'); //Editing entry cy.get('[data-cy=actions-kiaCar] > button').click(); @@ -339,7 +339,7 @@ describe('RBAC Functionlity Tests', () => { parseSpecialCharSequences: false }); cy.get('[data-cy=addButton]').click(); - cy.contains('Entry updated in cache super-cache.'); + cy.contains('Entry updated in cache a-rbac-test-cache.'); cy.contains('2016'); //Deleting entry cy.get('[data-cy=actions-kiaCar] > button').click(); diff --git a/cypress/e2e/global-stats.cy.js b/cypress/e2e/4_global-stats.cy.js similarity index 100% rename from cypress/e2e/global-stats.cy.js rename to cypress/e2e/4_global-stats.cy.js diff --git a/cypress/e2e/cache-detail.cy.js b/cypress/e2e/5_cache-detail.cy.js similarity index 100% rename from cypress/e2e/cache-detail.cy.js rename to cypress/e2e/5_cache-detail.cy.js diff --git a/cypress/e2e/cache-metrics.cy.js b/cypress/e2e/6_cache-metrics.cy.js similarity index 100% rename from cypress/e2e/cache-metrics.cy.js rename to cypress/e2e/6_cache-metrics.cy.js diff --git a/cypress/e2e/cache-templates.cy.js b/cypress/e2e/7_cache-templates.cy.js similarity index 100% rename from cypress/e2e/cache-templates.cy.js rename to cypress/e2e/7_cache-templates.cy.js diff --git a/cypress/e2e/cluster-membership.cy.js b/cypress/e2e/8_cluster-membership.cy.js similarity index 100% rename from cypress/e2e/cluster-membership.cy.js rename to cypress/e2e/8_cluster-membership.cy.js diff --git a/cypress/e2e/counters.cy.js b/cypress/e2e/9_counters.cy.js similarity index 100% rename from cypress/e2e/counters.cy.js rename to cypress/e2e/9_counters.cy.js diff --git a/cypress/e2e/cache-create-wizard-template.cy.js b/cypress/e2e/cache-create-wizard-template.cy.js deleted file mode 100644 index 797de0e99..000000000 --- a/cypress/e2e/cache-create-wizard-template.cy.js +++ /dev/null @@ -1,82 +0,0 @@ -describe('Cache Creation Wizard', () => { - beforeEach(() => { - cy.login(Cypress.env('username'), Cypress.env('password')); - }); - - it('successfully creates with a template', () => { - const cacheName = 'aCache'; - //go to create cache page - cy.get('[data-cy=createCacheButton]').click(); - cy.get('#edit').click(); - //Checking that the Next button is disabled until the cache name is entered - cy.get('[data-cy=wizardNextButton]').should('be.disabled'); - - cy.get('#cache-name').click(); - cy.get('#cache-name').type(cacheName); - - cy.get('[data-cy=wizardNextButton]').click(); - - cy.get('#template-selector').click(); - cy.contains('e2e-test-template').parent().find('button').click(); - cy.get('[data-cy=wizardNextButton]').click(); - cy.contains('Cache ' + cacheName + ' successfully created with e2e-test-template.'); - // Once the cache created, redirection to main page is done and the cache should be visible - //Is redirected to Data Container page - cy.get('#cluster-manager-header').should('exist'); - cy.get('[data-cy=cacheManagerStatus]').should('exist'); - cy.get('[data-cy=rebalancingSwitch]').should('exist'); - cy.contains(cacheName); - }); - - it('successfully creates without a template a JSON config', () => { - //go to create cache page - cy.get('[data-cy=createCacheButton]').click(); - cy.get('#cache-name').click(); - cy.get('#cache-name').type('aSimpleCache'); - cy.get('#edit').click(); - cy.get('[data-cy=wizardNextButton]').click(); - cy.get('[data-cy=provideConfigArea] > button').click(); - - cy.get('.pf-v5-c-code-editor__code textarea:first').click({force: true}).focused().type( '{downArrow}' ) - .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") - .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") - .type("{shift}{end}").type("{del}{del}").type("{enter}{upArrow}").type('"distributed-cache": {{}"mode": "ASYNC", "statistics": true }{del}'); - - cy.get('[data-cy=wizardNextButton]').click(); - cy.contains('Cache aSimpleCache created with the provided configuration.'); - // Once the cache created, redirection to main page is done and the cache should be visible - cy.get('#cluster-manager-header').should('exist'); - cy.get('[data-cy=cacheManagerStatus]').should('exist'); - cy.get('[data-cy=rebalancingSwitch]').should('exist'); - cy.contains('aSimpleCache'); - }); - - it('successfully creates without a template a XML config', () => { - //go to create cache page - cy.get('[data-cy=createCacheButton]').click(); - cy.get('#cache-name').click(); - cy.get('#cache-name').type('aSimpleXmlCache'); - cy.get('#edit').click(); - cy.get('[data-cy=wizardNextButton]').click(); - cy.get('[data-cy=provideConfigArea] > button').click(); - - cy.get('.pf-v5-c-code-editor__code textarea:first').click({force: true}).focused().type( '{downArrow}' ) - .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") - .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") - .type("{shift}{end}").type("{del}{del}").type("{enter}{upArrow}") - .type( - '\ - \ - \ - ', - { parseSpecialCharSequences: false } - ).type("{del}{del}").type("{upArrow}{backspace}"); - cy.get('[data-cy=wizardNextButton]').click(); - cy.contains('Cache aSimpleXmlCache created with the provided configuration.'); - // Once the cache created, redirection to main page is done and the cache should be visible - cy.get('#cluster-manager-header').should('exist'); - cy.get('[data-cy=cacheManagerStatus]').should('exist'); - cy.get('[data-cy=rebalancingSwitch]').should('exist'); - cy.contains('aSimpleXmlCache'); - }); -}); diff --git a/cypress/e2e/cache-create-wizard.cy.js b/cypress/e2e/cache-create-wizard.cy.js deleted file mode 100644 index b6b32430d..000000000 --- a/cypress/e2e/cache-create-wizard.cy.js +++ /dev/null @@ -1,135 +0,0 @@ -function createRandomCacheName() { - return (Math.random() + 1).toString(36).substring(3); -} - -describe('Cache Creation Wizard', () => { - beforeEach(() => { - cy.login(Cypress.env('username'), Cypress.env('password')); - }); - - it('successfully creates cache with all building options', () => { - //go to create cache page - cy.get('[data-cy=createCacheButton]').click(); - cy.get('#cache-name').click(); - cy.get('#cache-name').type('super-cache'); - cy.get('#configure').click(); - cy.get('[data-cy=wizardNextButton]').click(); - cy.get('#sync').click(); - cy.get('[data-cy=wizardNextButton]').click(); - - //Filling bounded cache properties - cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('boun'); - cy.get('#BOUNDED > button').click(); - cy.get('#size').click(); - cy.get('[data-cy=memorySizeInput]').clear().type('1'); - cy.get('#memorySizeUnit').click(); - cy.get('#KB').click(); - cy.get('#evictionStrategy').click(); - cy.get('#REMOVE').click(); - - //Filling indexed cache properties - cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('ind'); - cy.get('#INDEXED > button').click(); - cy.get('#persistent').click(); - cy.get('#auto').click(); - cy.get('#volatile').click(); - cy.get('#startupModeSelector').click(); - cy.get('#reindex').click(); - cy.get('[data-cy=indexSharding]').type(10); - cy.get('[data-cy=wizardNextButton]').should('be.disabled'); - cy.get('#entitiesSelector').click(); - cy.get('[id$="org.infinispan.Car"]').click(); - - //Filling auth cache properties - cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('auth'); - cy.get('#SECURED > button').click(); - cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('admin'); - cy.get('#admin > button').click(); - cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('application'); - cy.get('#application > button').click(); - cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('deployer'); - cy.get('#deployer > button').click(); - - //Filling persistant cache properties - cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('pers'); - cy.get('#PERSISTENCE > button').click(); - cy.get('[data-cy=passivationSwitch]').next().click(); - cy.get('[data-cy=connectionAttempts]').type(5); - cy.get('[data-cy=connectionInterval]').type(60); - cy.get('[data-cy=availabilityInterval]').type(5000); - cy.get('#persistentStorage').click(); - cy.get('#FileStore').click(); - - //Filling transactional cache properties - cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('trans'); - cy.get('#TRANSACTIONAL > button').click(); - cy.get('#non_xa').click(); - cy.get('#pessimistic').click(); - cy.get('[data-cy=wizardNextButton]').click(); - - cy.get('#storageSelector').click(); - cy.get('#HEAP').click(); - cy.get('[data-cy=concurencyLevel]').clear().type(40); - cy.get('[data-cy=lockTimeout]').clear().type(15); - cy.get('#striping').next().click(); - //Indexing tuning - cy.get('[data-cy=indexReaderExpand] button').click(); - cy.get('[data-cy=refreshInterval]').type(10); - cy.get('[data-cy=indexWriterExpand] button').click(); - cy.get('#low-level-trace').next().click(); - cy.get('[data-cy=commitInterval]').type(1001); - cy.get('[data-cy=ramBufferSize]').type(33); - cy.get('[data-cy=maxBufferedEntries]').type(33); - cy.get('[data-cy=threadPoolSize]').type(10); - cy.get('[data-cy=queueCount]').type(10); - cy.get('[data-cy=queueSize]').type(1050); - cy.get('[data-cy=indexMerge] button').click(); - cy.get('#calibrate-by-deletes').next().click(); - cy.get('[data-cy=factor]').type(10); - cy.get('[data-cy=maxEntries]').type(1000); - cy.get('[data-cy=minSize]').type(1000); - cy.get('[data-cy=maxSize]').type(10000); - cy.get('[data-cy=maxForcedSize]').type(10000); - //Transaction tuning - cy.get('#read-committed').click(); - cy.get('[data-cy=stopTimeout]').type(10000); - cy.get('[data-cy=completeTimeout]').type(50000); - cy.get('[data-cy=reaperInterval]').type(20000); - cy.get('[data-cy=wizardNextButton]').click(); - - //Verify before submitting and downloading file - cy.contains('super-cache'); - cy.get('[data-cy=downloadModal]').click(); - cy.get('[data-cy=downloadButton]').click(); - cy.wait(2000); - var downloadedFile = cy.readFile('./cypress/downloads/super-cache.json'); - downloadedFile.should('exist'); - downloadedFile.its('distributed-cache.mode').should('eq', 'SYNC'); - - cy.get('[data-cy=downloadModal]').click(); - cy.get('#XML').click(); - cy.get('[data-cy=downloadButton]').click(); - downloadedFile = cy.readFile('./cypress/downloads/super-cache.xml'); - downloadedFile.should('exist'); - - cy.get('[data-cy=downloadModal]').click(); - cy.get('#YAML').click(); - cy.get('[data-cy=downloadButton]').click(); - downloadedFile = cy.readFile('./cypress/downloads/super-cache.yaml'); - downloadedFile.should('exist'); - - cy.get('[data-cy=wizardNextButton]').click(); - - // Once the cache created, redirection to main page is done and the cache should be visible - cy.get('#cluster-manager-header').should('exist'); - cy.get('[data-cy=cacheManagerStatus]').should('exist'); - cy.get('[data-cy=rebalancingSwitch]').should('exist'); - cy.get('[data-action=next]').first().click(); - cy.contains('super-cache'); - cy.get('[data-cy=feature-super-cache]').contains('Bounded'); - cy.get('[data-cy=feature-super-cache]').contains('Indexed'); - cy.get('[data-cy=feature-super-cache]').contains('Secured'); - cy.get('[data-cy=feature-super-cache]').contains('Persistent'); - cy.get('[data-cy=feature-super-cache]').contains('Transactional'); - }); -}); diff --git a/cypress/e2e/cache-crud-wizard.cy.js b/cypress/e2e/cache-crud-wizard.cy.js new file mode 100644 index 000000000..f580b0ff0 --- /dev/null +++ b/cypress/e2e/cache-crud-wizard.cy.js @@ -0,0 +1,237 @@ +describe('Cache Creation Wizard', () => { + beforeEach(() => { + cy.login(Cypress.env('username'), Cypress.env('password')); + }); + + it('successfully creates cache with all building options', () => { + //go to create cache page + cy.get('[data-cy=createCacheButton]').click(); + cy.get('#cache-name').click(); + cy.get('#cache-name').type('asuper-cache'); + cy.get('#configure').click(); + cy.get('[data-cy=wizardNextButton]').click(); + cy.get('#sync').click(); + cy.get('[data-cy=wizardNextButton]').click(); + + //Filling bounded cache properties + cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('boun'); + cy.get('#BOUNDED > button').click(); + cy.get('#size').click(); + cy.get('[data-cy=memorySizeInput]').clear().type('1'); + cy.get('#memorySizeUnit').click(); + cy.get('#KB').click(); + cy.get('#evictionStrategy').click(); + cy.get('#REMOVE').click(); + + //Filling indexed cache properties + cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('ind'); + cy.get('#INDEXED > button').click(); + cy.get('#persistent').click(); + cy.get('#auto').click(); + cy.get('#volatile').click(); + cy.get('#startupModeSelector').click(); + cy.get('#reindex').click(); + cy.get('[data-cy=indexSharding]').type(10); + cy.get('[data-cy=wizardNextButton]').should('be.disabled'); + cy.get('#entitiesSelector').click(); + cy.get('[id$="org.infinispan.Car"]').click(); + + //Filling auth cache properties + cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('auth'); + cy.get('#SECURED > button').click(); + cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('admin'); + cy.get('#admin > button').click(); + cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('application'); + cy.get('#application > button').click(); + cy.get('#roleSelector-select-multi-typeahead-typeahead').click().type('deployer'); + cy.get('#deployer > button').click(); + + //Filling persistant cache properties + cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('pers'); + cy.get('#PERSISTENCE > button').click(); + cy.get('[data-cy=passivationSwitch]').next().click(); + cy.get('[data-cy=connectionAttempts]').type(5); + cy.get('[data-cy=connectionInterval]').type(60); + cy.get('[data-cy=availabilityInterval]').type(5000); + cy.get('#persistentStorage').click(); + cy.get('#FileStore').click(); + + //Filling transactional cache properties + cy.get('#featuresSelect-select-multi-typeahead-typeahead').click().type('trans'); + cy.get('#TRANSACTIONAL > button').click(); + cy.get('#non_xa').click(); + cy.get('#pessimistic').click(); + cy.get('[data-cy=wizardNextButton]').click(); + + cy.get('#storageSelector').click(); + cy.get('#HEAP').click(); + cy.get('[data-cy=concurencyLevel]').clear().type(40); + cy.get('[data-cy=lockTimeout]').clear().type(15); + cy.get('#striping').next().click(); + //Indexing tuning + cy.get('[data-cy=indexReaderExpand] button').click(); + cy.get('[data-cy=refreshInterval]').type(10); + cy.get('[data-cy=indexWriterExpand] button').click(); + cy.get('#low-level-trace').next().click(); + cy.get('[data-cy=commitInterval]').type(1001); + cy.get('[data-cy=ramBufferSize]').type(33); + cy.get('[data-cy=maxBufferedEntries]').type(33); + cy.get('[data-cy=threadPoolSize]').type(10); + cy.get('[data-cy=queueCount]').type(10); + cy.get('[data-cy=queueSize]').type(1050); + cy.get('[data-cy=indexMerge] button').click(); + cy.get('#calibrate-by-deletes').next().click(); + cy.get('[data-cy=factor]').type(10); + cy.get('[data-cy=maxEntries]').type(1000); + cy.get('[data-cy=minSize]').type(1000); + cy.get('[data-cy=maxSize]').type(10000); + cy.get('[data-cy=maxForcedSize]').type(10000); + //Transaction tuning + cy.get('#read-committed').click(); + cy.get('[data-cy=stopTimeout]').type(10000); + cy.get('[data-cy=completeTimeout]').type(50000); + cy.get('[data-cy=reaperInterval]').type(20000); + cy.get('[data-cy=wizardNextButton]').click(); + + //Verify before submitting and downloading file + cy.contains('asuper-cache'); + cy.get('[data-cy=downloadModal]').click(); + cy.get('[data-cy=downloadButton]').click(); + cy.wait(2000); + var downloadedFile = cy.readFile('./cypress/downloads/asuper-cache.json'); + downloadedFile.should('exist'); + downloadedFile.its('distributed-cache.mode').should('eq', 'SYNC'); + + cy.get('[data-cy=downloadModal]').click(); + cy.get('#XML').click(); + cy.get('[data-cy=downloadButton]').click(); + downloadedFile = cy.readFile('./cypress/downloads/asuper-cache.xml'); + downloadedFile.should('exist'); + + cy.get('[data-cy=downloadModal]').click(); + cy.get('#YAML').click(); + cy.get('[data-cy=downloadButton]').click(); + downloadedFile = cy.readFile('./cypress/downloads/asuper-cache.yaml'); + downloadedFile.should('exist'); + + cy.get('[data-cy=wizardNextButton]').click(); + + // Once the cache created, redirection to main page is done and the cache should be visible + cy.get('#cluster-manager-header').should('exist'); + cy.get('[data-cy=cacheManagerStatus]').should('exist'); + cy.get('[data-cy=rebalancingSwitch]').should('exist'); + cy.contains('asuper-cache'); + cy.get('[data-cy=feature-asuper-cache]').contains('Bounded'); + cy.get('[data-cy=feature-asuper-cache]').contains('Indexed'); + cy.get('[data-cy=feature-asuper-cache]').contains('Secured'); + cy.get('[data-cy=feature-asuper-cache]').contains('Persistent'); + cy.get('[data-cy=feature-asuper-cache]').contains('Transactional'); + deleteCache('asuper-cache'); + }); + + it('successfully creates with a template', () => { + const cacheName = 'aCache'; + //go to create cache page + cy.get('[data-cy=createCacheButton]').click(); + cy.get('#edit').click(); + //Checking that the Next button is disabled until the cache name is entered + cy.get('[data-cy=wizardNextButton]').should('be.disabled'); + + cy.get('#cache-name').click(); + cy.get('#cache-name').type(cacheName); + + cy.get('[data-cy=wizardNextButton]').click(); + + cy.get('#template-selector').click(); + cy.contains('e2e-test-template').parent().find('button').click(); + cy.get('[data-cy=wizardNextButton]').click(); + cy.contains('Cache ' + cacheName + ' successfully created with e2e-test-template.'); + // Once the cache created, redirection to main page is done and the cache should be visible + //Is redirected to Data Container page + cy.get('#cluster-manager-header').should('exist'); + cy.get('[data-cy=cacheManagerStatus]').should('exist'); + cy.get('[data-cy=rebalancingSwitch]').should('exist'); + cy.contains(cacheName); + deleteCache(cacheName); + }); + + it('successfully creates without a template a JSON config', () => { + //go to create cache page + cy.get('[data-cy=createCacheButton]').click(); + cy.get('#cache-name').click(); + cy.get('#cache-name').type('aSimpleCache'); + cy.get('#edit').click(); + cy.get('[data-cy=wizardNextButton]').click(); + cy.get('[data-cy=provideConfigArea] > button').click(); + + cy.get('.pf-v5-c-code-editor__code textarea:first').click({force: true}).focused().type( '{downArrow}' ) + .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") + .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") + .type("{shift}{end}").type("{del}{del}").type("{enter}{upArrow}").type('"distributed-cache": {{}"mode": "ASYNC", "statistics": true }{del}'); + + cy.get('[data-cy=wizardNextButton]').click(); + cy.contains('Cache aSimpleCache created with the provided configuration.'); + // Once the cache created, redirection to main page is done and the cache should be visible + cy.get('#cluster-manager-header').should('exist'); + cy.get('[data-cy=cacheManagerStatus]').should('exist'); + cy.get('[data-cy=rebalancingSwitch]').should('exist'); + cy.contains('aSimpleCache'); + deleteCache('aSimpleCache'); + }); + + it('successfully creates without a template a XML config', () => { + //go to create cache page + cy.get('[data-cy=createCacheButton]').click(); + cy.get('#cache-name').click(); + cy.get('#cache-name').type('aSimpleXmlCache'); + cy.get('#edit').click(); + cy.get('[data-cy=wizardNextButton]').click(); + cy.get('[data-cy=provideConfigArea] > button').click(); + + cy.get('.pf-v5-c-code-editor__code textarea:first').click({force: true}).focused().type( '{downArrow}' ) + .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") + .type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}").type("{shift}{end}").type("{del}{del}") + .type("{shift}{end}").type("{del}{del}").type("{enter}{upArrow}") + .type( + '\ + \ + \ + ', + { parseSpecialCharSequences: false } + ).type("{del}{del}").type("{upArrow}{backspace}"); + cy.get('[data-cy=wizardNextButton]').click(); + cy.contains('Cache aSimpleXmlCache created with the provided configuration.'); + // Once the cache created, redirection to main page is done and the cache should be visible + cy.get('#cluster-manager-header').should('exist'); + cy.get('[data-cy=cacheManagerStatus]').should('exist'); + cy.get('[data-cy=rebalancingSwitch]').should('exist'); + cy.contains('aSimpleXmlCache'); + deleteCache('aSimpleXmlCache'); + }); + + function deleteCache(cacheName) { + cy.login(Cypress.env('username'), Cypress.env('password')); + cy.get(`[data-cy=actions-${cacheName}]`).click(); + cy.get('[aria-label=deleteCacheAction]').click(); + cy.get('#deleteCacheModal').should('exist'); + cy.contains('Permanently delete cache?'); + cy.get('#deleteCacheModal [aria-label=Close]').click(); //Closing modal with close button + cy.contains('Permanently delete cache?').should('not.exist'); + + cy.get(`[data-cy=actions-${cacheName}]`).click(); + cy.get('[aria-label=deleteCacheAction]').click(); + cy.contains('Permanently delete cache?'); + cy.get('[data-cy=cancelCacheDeleteButton]').click(); //Closing modal with Cancel button + cy.contains('Permanently delete cache?').should('not.exist'); + + cy.get(`[data-cy=actions-${cacheName}]`).click(); + cy.get('[aria-label=deleteCacheAction]').click(); + cy.get('#cache-to-delete').click(); + cy.get('#cache-to-delete').type(cacheName); + cy.get('[data-cy=deleteCacheButton]').click(); //Deleting cache aCache + + cy.contains(`Cache ${cacheName} deleted.`); + cy.get('.pf-v5-c-alert__action > .pf-v5-c-button').click(); //Closing alert popup. + cy.get('aCache').should('not.exist'); //Checking that deleted cache is not visible + } +}); diff --git a/run-server-for-e2e.sh b/run-server-for-e2e.sh index 206d44596..48eb04d89 100755 --- a/run-server-for-e2e.sh +++ b/run-server-for-e2e.sh @@ -106,11 +106,11 @@ function startServer() ${SERVER_TMP}/bin/cli.sh user create ${DEPLOYER_USER_NAME} -p ${PASSWORD} -s ${nodeName} -g deployer #Installing nashorn engine before server startup - ${SERVER_TMP}/bin/cli.sh install org.openjdk.nashorn:nashorn-core:15.4 --server-root=infinispan-4-e2e - ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm:9.4 --server-root=infinispan-4-e2e - ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-commons:9.4 --server-root=infinispan-4-e2e - ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-tree:9.4 --server-root=infinispan-4-e2e - ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-util:9.4 --server-root=infinispan-4-e2e + ${SERVER_TMP}/bin/cli.sh install org.openjdk.nashorn:nashorn-core:15.4 + ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm:9.4 + ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-commons:9.4 + ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-tree:9.4 + ${SERVER_TMP}/bin/cli.sh install org.ow2.asm:asm-util:9.4 if [[ ${isCi} = "--ci" ]]; then nohup $SERVER_TMP/bin/server.sh -Djavax.net.debug -Dorg.infinispan.openssl=false -c ${confPath} -s ${SERVER_TMP}/${nodeName} ${portStr:-""} --node-name=${nodeName} ${jvmParam:-} & diff --git a/scripts/infinispan-basic-auth.xml b/scripts/infinispan-basic-auth.xml index 98012aba7..b0d1de570 100644 --- a/scripts/infinispan-basic-auth.xml +++ b/scripts/infinispan-basic-auth.xml @@ -32,6 +32,24 @@ + + + + + + + + org.infinispan.Car + + + + + + + + + + diff --git a/src/__tests__/views/CacheConfiguration.test.tsx b/src/__tests__/views/CacheConfiguration.test.tsx index da9ead6c1..d0af515ea 100644 --- a/src/__tests__/views/CacheConfiguration.test.tsx +++ b/src/__tests__/views/CacheConfiguration.test.tsx @@ -49,7 +49,6 @@ describe('Configuration Page', () => { configuration: yamlConfig }; }); - renderWithRouter(); expect(screen.getByText('JSON')).toBeInTheDocument(); expect(screen.getByText('XML')).toBeInTheDocument(); diff --git a/src/app/AppLayout/AppLayout.tsx b/src/app/AppLayout/AppLayout.tsx index 24a2f9079..fe71a9413 100644 --- a/src/app/AppLayout/AppLayout.tsx +++ b/src/app/AppLayout/AppLayout.tsx @@ -36,7 +36,7 @@ import { } from '@patternfly/react-core/deprecated'; import icon from '!!url-loader!@app/assets/images/brand.svg'; import { Link, NavLink, Redirect } from 'react-router-dom'; -import { routes } from '@app/routes'; +import { IAppRoute, routes } from '@app/routes'; import { APIAlertProvider } from '@app/providers/APIAlertProvider'; import { ActionResponseAlert } from '@app/Common/ActionResponseAlert'; import { useHistory } from 'react-router'; @@ -131,8 +131,8 @@ const AppLayout: React.FunctionComponent = ({ init, children }) => { return ( {connectedUser.name} - Close the browser or open an incognito window to log again.}> - + {t('layout.close-browser-message')}}> + @@ -142,14 +142,14 @@ const AppLayout: React.FunctionComponent = ({ init, children }) => { const helpDropdownItems = [ window.open('https://infinispan.org/documentation/', '_blank')} + onClick={() => window.open(t('brandname.documentation-link'), '_blank')} key="documentation" icon={} > - Documentation + {t('layout.documentation-name')} , setIsAboutOpen(!isAboutOpen)} key="about" component="button"> - About + {t('layout.about-name')} ]; @@ -204,13 +204,20 @@ const AppLayout: React.FunctionComponent = ({ init, children }) => { // The menu for non admin users const filteredRoutes = routes.filter((route) => !route.readonlyUser || (!create && route.readonlyUser)); + const displayNavMenu = (route: IAppRoute): boolean => { + return ( + route.menu == true && + route.label !== undefined && + (!route.admin || (route.admin && ConsoleServices.security().hasConsoleACL(ConsoleACL.ADMIN, connectedUser))) + ); + }; + const Navigation = (