Skip to content

Commit

Permalink
Sorted the entities in realtime screen and set the clusters' titles t…
Browse files Browse the repository at this point in the history
…o uppercase (#6014)

Signed-off-by: ClementBouvierN <clement.bouvierneveu@rte-france.com>
  • Loading branch information
ClementBouvierN committed Feb 28, 2024
1 parent 35a7431 commit b31affc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
38 changes: 19 additions & 19 deletions src/test/cypress/cypress/integration/1-RealTimeUsers.spec.js
Expand Up @@ -41,14 +41,14 @@ describe ('RealTimeUsersPage',()=>{
cy.get('.badge').should('have.length', 10);
cy.get('.bg-primary').should('have.length', 1);
cy.get('.bg-secondary').should('have.length', 9);
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(2).find('td').eq(0).should('contain.text', 'operator3_fr');
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(0).find('td').eq(0).should('contain.text', 'operator3_fr');

// we choose another screen (French Control Centers screen) and we check the titles
cy.get('#of-realtimeusers-screen-selector').find('.vscomp-option-text').eq(1).click({force: true});
cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'French Control Centers');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'European Supervision Centers');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'FRENCH CONTROL CENTERS');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'EUROPEAN SUPERVISION CENTERS');
})

it('Connection of operator2_fr, which is not in the ADMIN group, and check Real time users screen is authorized and screen is ok', ()=> {
Expand All @@ -60,14 +60,14 @@ describe ('RealTimeUsersPage',()=>{
cy.get('.badge').should('have.length', 10);
cy.get('.bg-primary').should('have.length', 1);
cy.get('.bg-secondary').should('have.length', 9);
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(1).find('td').eq(0).should('contain.text', 'operator2_fr');
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(2).find('td').eq(0).should('contain.text', 'operator2_fr');

// we choose another screen (French Control Centers screen) and we check the titles
cy.get('#of-realtimeusers-screen-selector').find('.vscomp-option-text').eq(1).click({force: true});
cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'French Control Centers');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'European Supervision Centers');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'FRENCH CONTROL CENTERS');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'EUROPEAN SUPERVISION CENTERS');
})

it('Connection of operator4_fr, which is connected to ENTITY1_FR, ENTITY2_FR, ENTITY3_FR, ENTITY4_FR, ' +
Expand Down Expand Up @@ -99,9 +99,9 @@ describe ('RealTimeUsersPage',()=>{

// we choose another screen (French Control Centers screen) and we check the titles
cy.get('#of-realtimeusers-screen-selector').find('.vscomp-option-text').eq(1).click({force: true});
cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'French Control Centers');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'European Supervision Centers');

cy.get('.opfab-realtimeusers-entitiesgroups').eq(0).find('span').eq(0).should('have.text', 'FRENCH CONTROL CENTERS');
cy.get('.opfab-realtimeusers-entitiesgroups').eq(1).find('span').eq(0).should('have.text', 'EUROPEAN SUPERVISION CENTERS');
// we should have 5 disconnected entities and 4 connected (operator4_fr for ENTITY1_FR, ENTITY2_FR, ENTITY3_FR and ENTITY4_FR)
cy.get('.badge').should('have.length', 5);
cy.get('.bg-primary').should('have.length', 4);
Expand Down Expand Up @@ -135,13 +135,13 @@ describe ('RealTimeUsersPage',()=>{
cy.get('.bg-secondary').should('have.length', 4);

// we check the connected/disconnected badges
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(0).find('td').eq(0).should('contain.text', 'operator4_fr');
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('.bg-secondary').should('have.length', 1);
cy.get('table').first().find('tr').eq(0).find('td').eq(0).find('span').eq(0).should('have.text', '0');
cy.get('table').first().find('tr').eq(0).find('td').eq(0).should('contain.text', '');
// second row
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('.bg-secondary').should('have.length', 1);
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('span').eq(0).should('have.text', '0');
cy.get('table').first().find('tr').eq(1).find('td').eq(0).should('contain.text', '');
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('.bg-primary').should('have.length', 1);
cy.get('table').first().find('tr').eq(1).find('td').eq(0).find('span').eq(0).should('have.text', '1 ');
cy.get('table').first().find('tr').eq(1).find('td').eq(0).should('contain.text', 'operator4_fr');
// third row
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('.bg-secondary').should('have.length', 1);
cy.get('table').first().find('tr').eq(2).find('td').eq(0).find('span').eq(0).should('have.text', '0');
Expand Down
Expand Up @@ -113,14 +113,14 @@ describe('Realtimeusers', () => {
view.setSelectedScreen('1');
expect(page.currentScreen.name).toEqual('French Control Centers');
expect(page.currentScreen.columns.length).toEqual(2);
expect(page.currentScreen.columns[0].entityPages[0].name).toEqual('French Control Centers');
expect(page.currentScreen.columns[0].entityPages[0].name).toEqual('FRENCH CONTROL CENTERS');
expect(page.currentScreen.columns[0].entityPages[0].lines[0].entityId).toEqual('ENTITY1_FR');
expect(page.currentScreen.columns[0].entityPages[0].lines[0].entityName).toEqual('ENTITY1_FR_NAME');

view.setSelectedScreen('2');
expect(page.currentScreen.name).toEqual('Italian Control Centers');
expect(page.currentScreen.columns.length).toEqual(2);
expect(page.currentScreen.columns[0].entityPages[0].name).toEqual('Italian Control Centers');
expect(page.currentScreen.columns[0].entityPages[0].name).toEqual('ITALIAN CONTROL CENTERS');
expect(page.currentScreen.columns[0].entityPages[0].lines[0].entityId).toEqual('ENTITY1_IT');
expect(page.currentScreen.columns[0].entityPages[0].lines[0].entityName).toEqual('ENTITY1_IT_NAME');
});
Expand Down
Expand Up @@ -21,6 +21,7 @@ import {
RealtimePageEntityGroup,
RealtimePageLine
} from './realtimePage';
import {Utilities} from 'app/business/common/utilities';

export class RealtimeUsersView {
private realtimePage: RealtimePage;
Expand Down Expand Up @@ -57,7 +58,7 @@ export class RealtimeUsersView {
configColumn.entitiesGroups.forEach((configEntityGroupId) => {
// entitiesGroups
const entityGroup = new RealtimePageEntityGroup();
entityGroup.name = EntitiesService.getEntityName(configEntityGroupId);
entityGroup.name = EntitiesService.getEntityName(configEntityGroupId).toUpperCase();
EntitiesService.resolveChildEntities(configEntityGroupId).forEach((childEntity) => {
// lines
const line = new RealtimePageLine();
Expand All @@ -67,6 +68,7 @@ export class RealtimeUsersView {
line.connectedUsers = '';
entityGroup.lines.push(line);
});
entityGroup.lines.sort((a, b) => Utilities.compareObj(a.entityName, b.entityName));
screenColumn.entityPages.push(entityGroup);
});
screen.columns.push(screenColumn);
Expand Down

0 comments on commit b31affc

Please sign in to comment.