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 7, 2025
1 parent 300b4be commit 5b3847a
Show file tree
Hide file tree
Showing 129 changed files with 5,230 additions and 6,031 deletions.
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;
39 changes: 3 additions & 36 deletions cypress/e2e/1_cluster-welcome.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions cypress/e2e/1_data-container.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.get('[data-cy=navigationTabs]').should('exist');
Expand Down Expand Up @@ -310,7 +310,7 @@ 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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/1_rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ 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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=navigationTabs]').should('exist');
cy.contains(/^\d+ Caches$/);
Expand Down Expand Up @@ -344,7 +344,7 @@ describe('RBAC Functionality Tests', () => {
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()
Expand Down
10 changes: 5 additions & 5 deletions cypress/e2e/3_cache-crud-wizard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Cache Creation Wizard', () => {
cy.get('[data-cy=option-typeahead-persistence]').click();
cy.get('[data-cy=menu-toogle-categorySelector]').click();

//Filling alias
//Filling alias
cy.get('[data-cy=menu-toogle-aliasesSelector]').click().type('securedAlias').type('{enter}');

// Next
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('Cache Creation Wizard', () => {
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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.contains('asuper-cache');
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('Cache Creation Wizard', () => {
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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.contains(cacheName);
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('Cache Creation Wizard', () => {
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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.contains('aSimpleCache');
Expand Down Expand Up @@ -229,7 +229,7 @@ describe('Cache Creation Wizard', () => {
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=cluster-manager-header]').should('exist');
cy.get('[data-cy=cacheManagerStatus]').should('exist');
cy.get('[data-cy=rebalancingSwitch]').should('exist');
cy.contains('aSimpleXmlCache');
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ Cypress.Commands.add('login', (username, password, url = '/') => {
password: password
}
});
cy.get('#nav-toggle').click();
cy.get('[data-cy=sideBarToggle]').click();
});
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ module.exports = {
"@app/(.*)": '<rootDir>/src/app/$1',
'@services/(.*)': '<rootDir>/src/services/$1',
'@utils/(.*)': '<rootDir>/src/app/utils/$1',
'^keycloak-js$': '<rootDir>/__mocks__/keycloak-js.js',
},

// A preset that is used as a base for Jest's configuration
preset: 'ts-jest/presets/js-with-ts',
setupFilesAfterEnv: ['<rootDir>/test-setup.js'],

transformIgnorePatterns: ['/node_modules/(?!(react-syntax-highlighter)/)'],

// The test environment that will be used for testing.
transformIgnorePatterns: ['/node_modules/(?!(react-syntax-highlighter|keycloak-js)/)'],
testEnvironment: "jsdom",
};
Loading

0 comments on commit 5b3847a

Please # to comment.