Skip to content

Commit

Permalink
ISPN-15125 Error page is shown for non-admin user if accesses cache t…
Browse files Browse the repository at this point in the history
…o which has permission
  • Loading branch information
karesti committed Oct 10, 2023
1 parent f37cb89 commit d0d50d3
Show file tree
Hide file tree
Showing 21 changed files with 401 additions and 521 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-function": "off",
"prettier/prettier": "off",
"import/no-unresolved": "off",
"import/extensions": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ Unit test run by default. To skip them use 'skipTests' property.

#### Run Cypress IT Tests
Integration tests don't run by default locally. They always run in CI.
To run integration tests locally:
You need to run first `./run-server-for-e2e.sh` that will download and run the infinispan server.
Then `mvn clean install -De2e=true`
To run integration tests locally, you need Docker:

```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
* [TypeScript Config](./tsconfig.json)
Expand Down
80 changes: 80 additions & 0 deletions cypress/e2e/cache-detail-search.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const { CandyCaneIcon } = require('@patternfly/react-icons');

describe('Cache Detail Overview', () => {
beforeEach(() => {
cy.login(Cypress.env('username'), Cypress.env('password'), '/cache/people');
});

it('successfully searches by values', () => {
//Opening indexed-cache cache page.
cy.login(Cypress.env('username'), Cypress.env('password'), '/cache/indexed-cache');

// Going back to cache entries page
cy.get('[data-cy=cacheEntriesTab]').click();
cy.get('[data-cy=queriesTab]').click();
cy.get('#textSearchByQuery').click().type('from org.infinispan.Person where age>2');
cy.get('[data-cy=searchButton]').click();
cy.contains('1 - 1 of 1');
cy.contains('Elaia');

// Going back to cache entries page
cy.get('[data-cy=cacheEntriesTab]').click();
cy.get('[data-cy=queriesTab]').click();

cy.get('#textSearchByQuery').click().clear().type("from org.infinispan.Person where name = 'Elaia'");
cy.get('[data-cy=searchButton]').click();
cy.contains('1 - 1 of 1');
cy.contains('Elaia');

// Going back to cache entries page
cy.get('[data-cy=cacheEntriesTab]').click();
cy.get('[data-cy=queriesTab]').click();

cy.get('#textSearchByQuery').click().clear().type('from org.infinispan.Person where age=2');
cy.get('[data-cy=searchButton]').click();
cy.contains('Values not found.');

cy.get('[data-cy=viewQueryMetricsButton]').click();
//Verify query metrics available
cy.contains('Query metrics');
cy.contains('from org.infinispan.Person');
cy.get('[data-cy=clearQueryMetricsButton]').click();
cy.get('[data-cy=confirmButton]').click();
cy.contains('from org.infinispan.Person').should('not.exist');
});

it('successfully manages indexes', () => {
//Opening indexed-cache cache page.
cy.login(Cypress.env("username"), Cypress.env("password"), '/cache/indexed-cache');

cy.get("[data-cy=manageIndexesLink]").click();
cy.contains("org.infinispan.Person");
cy.contains("3 k");
cy.get("[data-cy=backButton]").click();
cy.contains("Elaia");

cy.get("[data-cy=manageIndexesLink]").click();
cy.get("[data-cy=clearIndexButton]").click();
cy.contains("Permanently clear index?");
cy.get("[data-cy=cancelButton]").click();
cy.contains("Permanently clear index?").should("not.exist");

cy.get("[data-cy=clearIndexButton]").click();
cy.get("[data-cy=clearIndex]").click();
cy.contains("Index of cache indexed-cache cleared.");
cy.contains("0");

cy.get("[data-cy=rebuildIndexButton]").click();
cy.contains("Rebuild index?");
cy.get("[data-cy=cancelReindexButton]").click();

cy.get("[data-cy=rebuildIndexButton]").click();
cy.get("[data-cy=reindexButton]").click();
cy.contains("1").should("not.exist");

cy.get("[data-cy=backButton]").click();
cy.contains("Elaia");
cy.get("[data-cy=manageIndexesLink]").click();
cy.contains("3 k");
})
});
Loading

0 comments on commit d0d50d3

Please sign in to comment.