Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karesti committed Jan 7, 2025
1 parent 5b3847a commit c18b2a2
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 81 deletions.
2 changes: 1 addition & 1 deletion 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 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('[data-cy=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,18 +23,19 @@ 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
it('successfully navigates through the caches as well as changes number of viewed caches on the page', () => {
cy.contains(numberOfCaches + ' Caches');
cy.contains('10 Counters');
cy.contains('1 Tasks');
// cy.contains('1 Tasks');
cy.contains('13 Schemas');

cy.contains('1 - 10 of ' + numberOfCaches);
Expand All @@ -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 @@ -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('[data-cy=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
12 changes: 6 additions & 6 deletions cypress/e2e/1_rbac_func.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ describe('RBAC Functionality Tests', () => {
cy.get('[data-cy=rebalancingSwitch]').should('not.exist'); // rebalancing status
}

cy.get('[data-cy=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 @@ -223,7 +223,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 +317,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();
cy.contains('people');
cy.contains('test-6.proto');
cy.get('[data-cy="people.protoConfig"]').click();
Expand All @@ -337,7 +337,7 @@ 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();
cy.contains('strong-1');
cy.get('body').then(($body) => {
if ($body.find('button[aria-label="Show Filters"]').length) {
Expand Down Expand Up @@ -436,7 +436,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();
cy.contains('hello');
}

Expand Down
16 changes: 8 additions & 8 deletions cypress/e2e/3_cache-crud-wizard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ 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('[data-cy=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');
cy.contains('asuper-cache');
cy.contains('securedAlias');
Expand Down Expand Up @@ -167,8 +167,8 @@ 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('[data-cy=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');
cy.contains(cacheName);
deleteCache(cacheName);
Expand All @@ -195,8 +195,8 @@ 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('[data-cy=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');
cy.contains('aSimpleCache');
deleteCache('aSimpleCache');
Expand Down Expand Up @@ -229,8 +229,8 @@ 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('[data-cy=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');
cy.contains('aSimpleXmlCache');
deleteCache('aSimpleXmlCache');
Expand Down
24 changes: 12 additions & 12 deletions cypress/e2e/3_counters.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Counters CRUD', () => {
});

it('successfully creates weak & volatile counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
//Creating new weak counter
cy.get('button[data-cy="createCounterButton"]').click();
cy.get("[aria-label=counter-name-input]").type("TestWeakVolatileCounter");
Expand All @@ -17,7 +17,7 @@ describe('Counters CRUD', () => {
});

it('successfully shows error while creating counter with duplicate name', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
//Creating new weak counter
cy.get('button[data-cy="createCounterButton"]').click();
cy.get("[aria-label=counter-name-input]").type("TestWeakVolatileCounter");
Expand All @@ -30,7 +30,7 @@ describe('Counters CRUD', () => {
});

it('successfully creates weak & persistent counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
//Creating new weak counter
cy.get('button[data-cy="createCounterButton"]').click();
cy.get("[aria-label=counter-name-input]").type("TestWeakPersistentCounter");
Expand All @@ -43,7 +43,7 @@ describe('Counters CRUD', () => {
});

it ('successfully creates strong & persistent counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
//Creating new strong counter
cy.get('button[data-cy="createCounterButton"]').click();
cy.get("[aria-label=counter-name-input]").type("TestStrongPersistentCounter");
Expand All @@ -57,7 +57,7 @@ describe('Counters CRUD', () => {
});

it ('successfully creates strong & volatile counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
//Creating new strong counter
cy.get('button[data-cy="createCounterButton"]').click();
cy.get("[aria-label=counter-name-input]").type("TestStrongVolatileCounter");
Expand All @@ -71,7 +71,7 @@ describe('Counters CRUD', () => {
});

it ('successfully adds delta to strong counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('strong-5');
cy.contains('td', 'strong-5').parent()
.within($tr => {
Expand All @@ -93,7 +93,7 @@ describe('Counters CRUD', () => {
});

it ('successfully resets strong counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('td', 'strong-5').parent()
.within($tr => {
cy.get('[data-label="Current value"]').contains('4');
Expand All @@ -115,7 +115,7 @@ describe('Counters CRUD', () => {
});

it ('successfully deletes weak counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('weak-5');
cy.contains('td', 'weak-5').parent()
.within($tr => {
Expand All @@ -135,7 +135,7 @@ describe('Counters CRUD', () => {
});

it ('successfully deletes strong counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('strong-5');
cy.contains('td', 'strong-5').parent()
.within($tr => {
Expand All @@ -154,7 +154,7 @@ describe('Counters CRUD', () => {

// it ('successfully filters counters', () => {
// // There is an issue in Patternfly with size
// cy.get('a[aria-label="nav-item-Counters"]').click();
// cy.get('[data-cy="tab-Counters"]').click();
// cy.contains('strong-4');
// cy.contains('weak-4');
//
Expand Down Expand Up @@ -242,7 +242,7 @@ describe('Counters CRUD', () => {
// });

it ('successfully sets value to strong counter', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('strong-4');
cy.contains('td', 'strong-4').parent()
.within($tr => {
Expand All @@ -264,7 +264,7 @@ describe('Counters CRUD', () => {
});

it('successully shows error while setting value to strong counter with value out of bounds', () => {
cy.get('a[aria-label="nav-item-Counters"]').click();
cy.get('[data-cy="tab-Counters"]').click();
cy.contains('TestStrongPersistentCounter');
cy.contains('td', 'TestStrongPersistentCounter').parent()
.within($tr => {
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/3_proto-schema.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Proto Schema CRUD', () => {
});

it('successfully navigates through schemas', () => {
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Schemas"]').click();
cy.contains('people');
cy.contains('test-6.proto');
cy.contains('test-10.proto');
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('Proto Schema CRUD', () => {
});

it('successfully creates, edits and deletes a proto schema', () => {
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Schemas"]').click();

//Creating new schema
cy.get('button[aria-label="create-schema-button"]').click();
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Proto Schema CRUD', () => {
});

it('gives error if duplicate name is used while creating new schema', () => {
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Schemas"]').click();
cy.get('button[aria-label="create-schema-button"]').click();
cy.get('#schema-name').click().type('people');
cy.get('#schema').click().type('schemaValue');
Expand All @@ -109,7 +109,7 @@ describe('Proto Schema CRUD', () => {
});

it('gives error if special symbols are used in the name field', () => {
cy.get('a[aria-label="nav-item-Schemas"]').click();
cy.get('[data-cy="tab-Schemas"]').click();
cy.get('button[aria-label="create-schema-button"]').click();
cy.get('#schema-name').click().type('1234567890+-*/name!@#$with%^&*special()_+symbols{}|":isnot?><saved>');
cy.get('#schema').click().type('1234567890+-*/value!@#$with%^&*special()_+symbols{}|":is?><saved>');
Expand Down
5 changes: 3 additions & 2 deletions src/app/CacheManagers/CacheManagers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const CacheManagers = () => {
<>
{tabs.map((tab) => (
<Tab
data-cy={'tab-' + tab.name}
aria-label={'nav-item-' + tab.name}
key={'nav-item-' + tab.key}
eventKey={tab.key}
Expand Down Expand Up @@ -156,7 +157,7 @@ const CacheManagers = () => {

return (
<>
<PageHeader data-cy="cluster-manager-header" title={title} subtitle={''} />
<PageHeader ouiaId="cluster-manager-header" title={title} subtitle={''} />
<PageSection>
<Toolbar id="cluster-manager-sub-header">
<ToolbarContent>
Expand All @@ -176,7 +177,7 @@ const CacheManagers = () => {
</>
)}
<ToolbarItem>
<InfinispanComponentStatus status={cm.cache_manager_status} />
<InfinispanComponentStatus name="clusterManager" status={cm.cache_manager_status} />
</ToolbarItem>
{cm.tracing_enabled && (
<React.Fragment>
Expand Down

0 comments on commit c18b2a2

Please sign in to comment.