Skip to content

Commit

Permalink
ISPN-15198 Cache detail broken for non admin
Browse files Browse the repository at this point in the history
  • Loading branch information
karesti committed Oct 10, 2023
1 parent 5dc4e2d commit e481568
Show file tree
Hide file tree
Showing 41 changed files with 1,080 additions and 893 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,13 +57,13 @@ jobs:
docker exec $(docker ps -q -l) /opt/infinispan/bin/cli.sh install org.ow2.asm:asm-tree:9.4
docker exec $(docker ps -q -l) /opt/infinispan/bin/cli.sh install org.ow2.asm:asm-util:9.4
- name: Restarting Infnispan Server After Nashorn Installation
- name: Restarting Infinispan Server After Nashorn Installation
run: |
docker restart $(docker ps -q -l)
# 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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ Integration tests don't run by default locally. They always run in CI.

To run Cypress integration tests locally, follow these steps:

1. Run the Infinispan server using `./run-server-for-e2e.sh`, which will download and run the server.
2. Run the following command with the `-De2e=true` flag:
```bash
mvn clean install -De2e=true
```shell
npm run build # build the console
./run-server-for-e2e-container.sh # will run the latest image of Infinispan for this branch version and the built console
npm run cy:e2e # will run cypress locally
```

## Configurations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Data Container Overview', () => {
const numberOfCaches = 18;
const numberOfCaches = 15;

beforeEach(() => {
cy.login(Cypress.env('username'), Cypress.env('password'));
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');

Expand All @@ -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) => {
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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();
Expand All @@ -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');
});
Expand All @@ -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/);
});
Expand All @@ -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();
Expand All @@ -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
Expand Down
Loading

0 comments on commit e481568

Please sign in to comment.