diff --git a/src/test/cypress/cypress/integration/Timeline.spec.js b/src/test/cypress/cypress/integration/Timeline.spec.js index dcba04c088..4d9696161c 100644 --- a/src/test/cypress/cypress/integration/Timeline.spec.js +++ b/src/test/cypress/cypress/integration/Timeline.spec.js @@ -33,9 +33,23 @@ describe('Time line moves', function () { cy.get("#opfab-timeline-link-move-left").click(); } - function checkHaveCircle(nb) { - cy.get("of-custom-timeline-chart").find("circle").should('have.length', nb); + cy.get("of-custom-timeline-chart").find("ellipse").should('have.length', nb); + } + + function checkNthCircleContains(nb,value) { + cy.get('#opfab-timelineCircle-' + nb ).within(() => { + cy.get("text").contains(value); + }) + } + + function hoverNthCircle(nb) { + cy.get('#opfab-timelineCircle-' + nb).trigger('mouseenter'); + } + + + function clickNthCircle(nb) { + cy.get('#opfab-timelineCircle-' + nb).click(); } function checkTitle(title) { @@ -54,7 +68,9 @@ describe('Time line moves', function () { cy.get(".axis").find("text").first().should("have.text", label); } - + function checkDisplayedCardTitle(title) { + cy.get("#opfab-card-title").should("have.text", title); + } before('Set up configuration and cards', function () { cy.loadTestConf(); @@ -833,4 +849,47 @@ describe('Time line moves', function () { }); + + it('Check timeline circles have valid popover', function () { + + cy.loginOpFab("operator1_fr", "test"); + const currentDate = new Date(); + + checkHaveCircle(0); + + cy.sendCard('cypress/feed/customEvent.json', currentDate.getTime() + 2 * HOURS, currentDate.getTime() + 5 * HOURS); + checkHaveCircle(1); + checkNthCircleContains(0,"1"); + + hoverNthCircle(0); + cy.get(".popover-body").find('button').should("have.length", 1); + cy.get("#opfab-div-card-template").should("not.exist"); + + clickNthCircle(0); + cy.get("#opfab-div-card-template").should("exist"); + checkDisplayedCardTitle("State to test template rendering features"); + + cy.sendCard('defaultProcess/chartLine.json'); + cy.sendCard('cypress/feed/customAlarm.json', currentDate.getTime() + 1 * HOURS, currentDate.getTime() + 5 * HOURS); + + // wait we receive the cards (when we have 3 cards in the feed) + cy.get('of-light-card').should('have.length',3); + checkHaveCircle(2); + checkNthCircleContains(0,"1"); + checkNthCircleContains(1,"2"); + + // Clicking on a circle with several cards should not change the currently displayed card + clickNthCircle(1); + cy.get("#opfab-div-card-template").should("exist"); + checkDisplayedCardTitle("State to test template rendering features"); + + + hoverNthCircle(1); + cy.get(".popover-body").find('button').should("have.length", 2); + cy.get(".popover-body").find('button').eq(1).click(); + + + checkDisplayedCardTitle("Electricity consumption forecast"); + }); + }) \ No newline at end of file diff --git a/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.html b/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.html index 226592cdda..3e51eb1005 100644 --- a/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.html +++ b/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.html @@ -115,9 +115,9 @@ > - + - + @@ -128,17 +128,6 @@ [attr.font-size]="15" dy=".3em">{{circle.count}} - - - {{circle.count}} - diff --git a/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.ts b/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.ts index 7c04659060..3b77354530 100644 --- a/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.ts +++ b/ui/main/src/app/modules/feed/components/time-line/custom-timeline-chart/custom-timeline-chart.component.ts @@ -511,7 +511,14 @@ export class CustomTimelineChartComponent extends BaseChartComponent implements return ''; } - showCard(cardId): void { + onCircleClick(circle) { + if (circle.count==1) { + let cardId = circle.summary[0].cardId + this.showCard(cardId); + } + } + + showCard(cardId): void { this.router.navigate(['/' + this.currentPath, 'cards', cardId]); this.scrollToSelectedCard(); }