Skip to content

Commit

Permalink
Upgrades to Patternfly 6
Browse files Browse the repository at this point in the history
  • Loading branch information
karesti committed Jan 9, 2025
1 parent 300b4be commit e10293f
Show file tree
Hide file tree
Showing 143 changed files with 5,399 additions and 6,215 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
name: Start 2 Cross-site Infinispan Servers Latest Version
shell: bash
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/e2eTestsConfigLON.xml:/user-config/e2eTestsConfigLON.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m -Dinfinispan.site.name=LON -Djgroups.mcast_port=46656" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main -c "infinispan-xsite.xml" -c "/user-config/e2eTestsConfigLON.xml"
docker run -d -p 31222:11222 -v ${{ github.workspace }}/scripts/identities.batch:/user-config/identities.batch -v ${{ github.workspace }}/dist:/opt/infinispan/static/console -v ${{ github.workspace }}/scripts/e2eTestsConfigNYC.xml:/user-config/e2eTestsConfigNYC.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m -Dinfinispan.site.name=NYC -Djgroups.mcast_port=46666" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main -c "infinispan-xsite.xml" -c "/user-config/e2eTestsConfigNYC.xml"
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/e2eTestsConfigLON.xml:/user-config/e2eTestsConfigLON.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m -Dinfinispan.site.name=LON -Djgroups.mcast_port=46656" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main --node-name=infinispan-4-lon-e2e -c "infinispan-xsite.xml" -c "/user-config/e2eTestsConfigLON.xml"
docker run -d -p 31222:11222 -v ${{ github.workspace }}/scripts/identities.batch:/user-config/identities.batch -v ${{ github.workspace }}/dist:/opt/infinispan/static/console -v ${{ github.workspace }}/scripts/e2eTestsConfigNYC.xml:/user-config/e2eTestsConfigNYC.xml -e JAVA_OPTIONS="-Xms1024m -Xmx3072m -XX:MetaspaceSize=1024m -XX:MaxMetaspaceSize=2048m -Dinfinispan.site.name=NYC -Djgroups.mcast_port=46666" -e IDENTITIES_BATCH="/user-config/identities.batch" quay.io/infinispan-test/server:main --node-name=infinispan-4-nyc-e2e -c "infinispan-xsite.xml" -c "/user-config/e2eTestsConfigNYC.xml"
# 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
curl --fail --silent --show-error --retry-all-errors --retry 240 --retry-delay 1 http://localhost:31222/rest/v2/cache-managers/default/health/status > /dev/null
Expand Down
17 changes: 17 additions & 0 deletions __mocks__/keycloak-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// __mocks__/keycloak-js.js

// Mock implementation of the Keycloak class
const Keycloak = jest.fn(() => ({
init: jest.fn().mockResolvedValue(true), // Mocks successful initialization
login: jest.fn().mockResolvedValue(true), // Mocks successful login
logout: jest.fn().mockResolvedValue(true), // Mocks successful logout
authenticated: true, // Mocks that the user is authenticated
accountManagement: jest.fn(), // Mocks account management
token: 'mock-token', // Mocks a token
updateToken: jest.fn().mockResolvedValue(true), // Mocks token refresh
authServerUrl: 'http://mock-server-url', // Mocks the auth server URL
realm: 'mock-realm', // Mocks the realm
}));

// Export the mock class
module.exports = Keycloak;
4 changes: 2 additions & 2 deletions cypress/e2e/1_acess_management.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('Global stats', () => {
describe('Access Management', () => {
beforeEach(() => {
cy.login(Cypress.env('username'), Cypress.env('password'), '/access-management');
});

it('successfully loads Access Management page', () => {
it('successfully loads the page', () => {
cy.get('h1').should('contain', 'Access management');
cy.contains('admin');
cy.contains('Superuser');
Expand Down
41 changes: 4 additions & 37 deletions cypress/e2e/1_cluster-welcome.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Welcome page', () => {
cy.contains('Tracing is enabled'); // tracing status
cy.contains('16 Caches');
cy.contains('10 Counters');
cy.contains('1 Tasks');
// cy.contains('1 Tasks');
cy.contains('13 Schemas');
cy.contains('invalidationCache');

Expand All @@ -44,46 +44,13 @@ describe('Welcome page', () => {
cy.contains('Data container');
cy.contains('Running'); // cluster status

//Checks if navigation menu is hidden
cy.contains('Data Container').should('not.be.visible');
cy.contains('Global Statistics').should('not.be.visible');
cy.contains('Cluster Membership').should('not.be.visible');

cy.get('#nav-toggle').click();
cy.get('[data-cy=sideBarToggle]').click();
//Checks if navigation menu is visible
cy.contains('Data Container').should('be.visible');
cy.contains('Global Statistics').should('be.visible');
cy.contains('Cluster Membership').should('be.visible');

//Clicks the Cluster Membership link and should go to Cluster Membership page
cy.contains('Cluster Membership').click();
cy.contains('Cluster membership').should('be.visible');
cy.contains('Healthy');
cy.contains('infinispan-4-e2e');

//Clicks the Global statistics link and should go to Global statistics page
cy.contains('Global Statistics').click();
cy.contains('Global statistics').should('be.visible');
cy.contains('Cluster-wide statistics');
cy.contains('Cache Manager lifecycle values');

//Clicks the Access management link and should go to Access management page
cy.contains('Access Management').click();
cy.contains('Access management').should('be.visible');
cy.contains('Access control');
cy.contains('Create role');

//Clicks the Connected clients link and should go to Connected clients page
cy.contains('Connected Clients').click();
cy.contains('Connected clients').should('be.visible');
cy.contains('Client library');
cy.contains('Server node');

//Clicks the Data Container link and should go to Data Container page
cy.contains('Data Container').click();
cy.contains('Data container').should('be.visible');
cy.contains('Running'); // cluster status
cy.contains('Cluster rebalancing on'); // rebalancing status
cy.contains('Access Management').should('be.visible');
cy.contains('Connected Clients').should('be.visible');
});

it('successfully opens and views About page', () => {
Expand Down
65 changes: 17 additions & 48 deletions cypress/e2e/1_data-container.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe('Data Container Overview', () => {
cy.contains('Running'); // cluster status
cy.contains('Tracing is enabled');
cy.contains('Cluster rebalancing on'); // rebalancing status
cy.get('#cluster-manager-header').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy="statusInfo-clusterManager"]').should('exist');
cy.get('[data-ouia-component-id=cluster-manager-header-title]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.get('[data-cy=navigationTabs]').should('exist');
cy.get('#cache-table-toolbar').should('exist');
Expand All @@ -23,11 +23,12 @@ describe('Data Container Overview', () => {
cy.get('[data-cy=cachesTable]').should('exist');
cy.contains('default'); // cache default
cy.contains('octet-stream-cache').should('not.exist'); // cache octet-stream-cache is already on the next page

//make sure there are total 4 tabs (0,1,2,3)
cy.get('a[aria-label="nav-item-Caches"]').click();
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Caches"]').click({multiple: true, force: true});
cy.get('[data-cy="tab-Tasks"]').click({multiple: true, force: true});
cy.get('[data-cy="tab-Counters"]').click({multiple: true, force: true});
cy.get('[data-cy="tab-Schemas"]').click({multiple: true, force: true});
});

//Testing pagination and navigation
Expand Down Expand Up @@ -60,53 +61,21 @@ describe('Data Container Overview', () => {
cy.contains('xml-cache').should('not.exist');

//Changing the number of items on the page
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[data-action=per-page-10] .pf-v5-c-menu__item-select-icon').should('exist'); //Verifying the selected option
cy.get('[data-action=per-page-20] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-50] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-100] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.contains('1 - 10 of 16');
cy.get('[id^="pagination-caches-top-toggle"]').first().click();
cy.get('[data-action=per-page-10]').should('exist');
cy.get('[data-action=per-page-20]').should('exist');
cy.get('[data-action=per-page-50]').should('exist');
cy.get('[data-action=per-page-100]').should('exist');
cy.get('[data-action=per-page-20]').click();

//Verifying that all caches are shown and navigation buttons are disabled
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[data-action=per-page-10] .pf-v5-c-menu__item-select-icon').should('not.exist'); //Verifying the selected option
cy.get('[data-action=per-page-20] .pf-v5-c-menu__item-select-icon').should('exist');
cy.get('[data-action=per-page-50] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-100] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.contains('1 - 16 of 16');
cy.get('[data-cy=cachesTable] tr').should('have.length', numberOfCaches + 1); // including header row
cy.get('[data-action=next]').first().should('be.disabled');
cy.get('[data-action=previous]').first().should('be.disabled');
cy.contains('java-serialized-cache');
cy.contains('people');
cy.contains('xml-cache');

//Changing the number of items on the page to 3rd option
cy.get('[data-action=per-page-50]').click();
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[data-action=per-page-10] .pf-v5-c-menu__item-select-icon').should('not.exist'); //Verifying the selected option
cy.get('[data-action=per-page-20] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-50] .pf-v5-c-menu__item-select-icon').should('exist');
cy.get('[data-action=per-page-100] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-cy=cachesTable] tr').should('have.length', numberOfCaches + 1); //including header row
cy.get('[data-action=next]').first().should('be.disabled');
cy.get('[data-action=previous]').first().should('be.disabled');
cy.contains('java-serialized-cache');
cy.contains('people');
cy.contains('xml-cache');

//Changing the number of items on the page to 4th option
cy.get('[data-action=per-page-100]').click();
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[data-action=per-page-10] .pf-v5-c-menu__item-select-icon').should('not.exist'); //Verifying the selected option
cy.get('[data-action=per-page-20] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-50] .pf-v5-c-menu__item-select-icon').should('not.exist');
cy.get('[data-action=per-page-100] .pf-v5-c-menu__item-select-icon').should('exist');
cy.get('[data-cy=cachesTable] tr').should('have.length', numberOfCaches + 1); //including header row
cy.get('[data-action=next]').first().should('be.disabled');
cy.get('[data-action=previous]').first().should('be.disabled');
cy.contains('java-serialized-cache');
cy.contains('people');
cy.contains('xml-cache');
});

//Testing the filters
Expand Down Expand Up @@ -182,7 +151,7 @@ describe('Data Container Overview', () => {
cy.contains('java-serialized-cache').should('not.exist');

//Changing the number of caches on the page to view them all
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[id^="pagination-caches-top-toggle"]').first().click();
cy.get('[data-action=per-page-20]').click();
cy.contains('not-encoded');
cy.contains('xml-cache');
Expand Down Expand Up @@ -310,8 +279,8 @@ describe('Data Container Overview', () => {
cy.get('[data-cy=dataContainerLink]').click(); //Clicking on breadcrumb link.

//Is redirected to Data Container page
cy.get('#cluster-manager-header').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-ouia-component-id=cluster-manager-header-title]').should('exist');
cy.get('[data-cy="statusInfo-clusterManager"]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');

//Go to Config page again
Expand Down
47 changes: 20 additions & 27 deletions cypress/e2e/1_rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('RBAC Functionality Tests', () => {
cy.login(monitorUserName, Cypress.env('password'), '/cache/indexed-cache');
checkNoEntriesTabView(false);
cy.login(monitorUserName, Cypress.env('password'), '/global-stats');
checkGlobalStatsView(false)
checkGlobalStatsView()
});

it('successfully logins and performs actions with observer user', () => {
Expand All @@ -30,7 +30,6 @@ describe('RBAC Functionality Tests', () => {
cy.get('button[aria-label=searchButton]').click();
cy.contains('1 - 1 of 1');
cy.contains('Elaia');
``
checkNotOwnSecuredCache('a-rbac-test-cache');
checkNonSecuredCacheDetailView(false, false);
//Go to tasks (@TODO at the moment for observer no tasks are shown, add after fix)
Expand All @@ -39,7 +38,7 @@ describe('RBAC Functionality Tests', () => {
cy.login(observerUserName, Cypress.env('password'), '/cache/not-encoded');
checkNoEntriesTabView(false);
cy.login(observerUserName, Cypress.env('password'), '/global-stats');
checkGlobalStatsView(false)
checkGlobalStatsView()
});

it('successfully logins and performs actions with application user', () => {
Expand All @@ -58,7 +57,7 @@ describe('RBAC Functionality Tests', () => {
cy.login(applicationUserName, Cypress.env('password'), '/cache/not-encoded');
checkNoEntriesTabView(false);
cy.login(applicationUserName, Cypress.env('password'), '/global-stats');
checkGlobalStatsView(false)
checkGlobalStatsView()
});

it('successfully logins and performs actions with deployer user', () => {
Expand All @@ -77,7 +76,7 @@ describe('RBAC Functionality Tests', () => {
cy.login(deployerUserName, Cypress.env('password'), '/cache/not-encoded');
checkNoEntriesTabView(false);
cy.login(deployerUserName, Cypress.env('password'), '/global-stats');
checkGlobalStatsView(false)
checkGlobalStatsView()
});

it('successfully logins and performs actions with admin user', () => {
Expand All @@ -99,6 +98,7 @@ describe('RBAC Functionality Tests', () => {
});

function checkMenu(isSuperAdmin) {
cy.get('[data-cy=sideBarToggle]').click();
cy.contains('Data Container').should('exist');
cy.contains('Global Statistics').should('exist');
cy.contains('Cluster Membership').should('exist');
Expand All @@ -109,6 +109,7 @@ describe('RBAC Functionality Tests', () => {
cy.contains('Connected Clients').should('not.exist');
cy.contains('Access Management').should('not.exist');
}
cy.get('[data-cy=sideBarToggle]').click();
}

function checkDataContainerView(isMonitor, isDeployer, isAdmin, isSuperAdmin) {
Expand All @@ -121,8 +122,8 @@ describe('RBAC Functionality Tests', () => {
cy.get('[data-cy=rebalancingSwitch]').should('not.exist'); // rebalancing status
}

cy.get('#cluster-manager-header').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-ouia-component-id=cluster-manager-header-title]').should('exist');
cy.get('[data-cy="statusInfo-clusterManager"]').should('exist');
cy.get('[data-cy=navigationTabs]').should('exist');
cy.contains(/^\d+ Caches$/);
cy.contains('Counters');
Expand Down Expand Up @@ -162,7 +163,7 @@ describe('RBAC Functionality Tests', () => {
}

function checkSecuredCacheDetailsView(isMonitor, isAdmin, isSuperAdmin, roleName, cacheName) {
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[id^="pagination-caches-top-toggle"]').first().click();
cy.get('[data-action=per-page-100]').click();
//Going to secured cache details page
cy.get('[data-cy=detailButton-' + cacheName + ']').click();
Expand Down Expand Up @@ -223,7 +224,7 @@ describe('RBAC Functionality Tests', () => {
function checkNotOwnSecuredCache(cacheName) {
//Checking not owned cache to be invisible for the current user.
cy.contains('Data container').click();
cy.get('[id^="pagination-caches-top-pagination"]').first().click();
cy.get('[id^="pagination-caches-top-toggle"]').first().click();
cy.get('[data-action=per-page-100]').click();
cy.contains('/' + cacheName +'$/').should('not.exist');
}
Expand Down Expand Up @@ -317,7 +318,7 @@ describe('RBAC Functionality Tests', () => {
function checkSchemasPageView(isAdmin) {
//Go to schemas and check that no create/edit/delete buttons available
cy.contains('Data container').click();
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Schemas"]').click({multiple: true, force: true});
cy.contains('people');
cy.contains('test-6.proto');
cy.get('[data-cy="people.protoConfig"]').click();
Expand All @@ -337,23 +338,19 @@ describe('RBAC Functionality Tests', () => {

function checkCountersPageView(isSuperAdmin) {
//Checking counters page
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click({multiple: true, force: true});
cy.contains('strong-1');
cy.get('body').then(($body) => {
if ($body.find('button[aria-label="Show Filters"]').length) {
cy.get('button[aria-label="Show Filters"]').click();
}
})

cy.get('[data-cy=counterFilterSelectExpanded]').should('exist');
//Checking delete counter functionality
cy.contains('td', 'strong-1').parent()
.within($tr => {
cy.get('td button').should('exist');
cy.get('td button').click();
cy.get('[aria-label="deleteCounter"]').should('exist');
cy.get('[aria-label="deleteCounter"]').click();
});
cy.get('[data-cy=actions-strong-1]').click();
cy.get('[aria-label="deleteCounter"]').click();
// Delete Counter Modal Opens
cy.get('[data-cy="deleteCounterButton"]').should('exist');
if (isSuperAdmin) {
cy.get('[data-cy="deleteCounterButton"]').should('not.be.disabled');
Expand All @@ -362,13 +359,9 @@ describe('RBAC Functionality Tests', () => {
}
cy.get('[data-cy="cancelCounterDeleteButton"]').click();
//Checking edit for counter functionality
cy.contains('td', 'strong-1').parent()
.within($tr => {
cy.get('td button').should('exist');
cy.get('td button').click();
cy.get('[aria-label="setCounterAction"]').should('exist');
cy.get('[aria-label="setCounterAction"]').click();
});
cy.get('[data-cy=actions-strong-1]').click();
cy.get('[aria-label="setCounterAction"]').click();
// Set Counter Modal Opens
cy.get('[data-cy="confirmSetbutton"]').should('exist');
cy.get('[data-cy="confirmSetbutton"]').should('not.be.disabled');
cy.get('[data-cy="cancelSetButton"]').click();
Expand Down Expand Up @@ -436,7 +429,7 @@ describe('RBAC Functionality Tests', () => {

function checkTasksPage() {
//Checking Tasks page
cy.get('a[aria-label="nav-item-Tasks"]').click();
cy.get('[data-cy="tab-Tasks"]').click({multiple: true, force: true});
cy.contains('hello');
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/2_cache-detail.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,6 @@ describe('Cache Detail Overview', () => {
}

function closePopup() {
cy.get('.pf-v5-c-alert__action > .pf-v5-c-button').click(); //Closing alert popup.
cy.get('[name=close-alert-button]').click(); //Closing alert popup.
}
});
Loading

0 comments on commit e10293f

Please sign in to comment.