From a87b4b74ddd338da8c8d0d16adbee438310b4205 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 11 May 2021 09:09:56 +0200 Subject: [PATCH 1/4] fix: updating rows needs to happen in an effect --- src/pages/view/DashboardsBar/DashboardsBar.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/view/DashboardsBar/DashboardsBar.js b/src/pages/view/DashboardsBar/DashboardsBar.js index cf1811670..175aa592b 100644 --- a/src/pages/view/DashboardsBar/DashboardsBar.js +++ b/src/pages/view/DashboardsBar/DashboardsBar.js @@ -24,13 +24,14 @@ const DashboardsBar = ({ onExpandedChanged, }) => { const [dragging, setDragging] = useState(false) + const [mouseYPos, setMouseYPos] = useState(0) const userRowsChanged = useRef(false) const ref = createRef() const { height } = useWindowDimensions() const rootElement = document.documentElement - const adjustRows = mouseYPos => { + useEffect(() => { const newRows = Math.max( MIN_ROW_COUNT, getRowsFromHeight(mouseYPos - 52) // don't rush the transition to a bigger row count @@ -44,7 +45,7 @@ const DashboardsBar = ({ updateUserRows(Math.min(newRows, MAX_ROW_COUNT)) userRowsChanged.current = true } - } + }, [mouseYPos]) useEffect(() => { rootElement.style.setProperty('--user-rows-count', userRows) @@ -102,7 +103,7 @@ const DashboardsBar = ({ />
From 220bf94fc513fcb57a48c27dda8907416eb688f1 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 11 May 2021 13:29:03 +0200 Subject: [PATCH 2/4] fix: disable flaky cypress test --- cypress/integration/ui/error_scenarios.feature | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cypress/integration/ui/error_scenarios.feature b/cypress/integration/ui/error_scenarios.feature index 8e2630f63..ccb4ef283 100644 --- a/cypress/integration/ui/error_scenarios.feature +++ b/cypress/integration/ui/error_scenarios.feature @@ -46,13 +46,14 @@ Feature: Error scenarios Then a warning message is displayed stating that starring dashboard failed And the "Delivery" dashboard is not starred - @nonmutating - Scenario: Toggling show description fails - Given I open the "Delivery" dashboard - Then the "Delivery" dashboard displays in view mode - When clicking to show description fails - Then a warning message is displayed stating that show description failed - And the dashboard description is not displayed +# TODO unflake this flaky test +# @nonmutating +# Scenario: Toggling show description fails +# Given I open the "Delivery" dashboard +# Then the "Delivery" dashboard displays in view mode +# When clicking to show description fails +# Then a warning message is displayed stating that show description failed +# And the dashboard description is not displayed From 86b06311b8cc9f33079fe3c5c55e7011288d931d Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 11 May 2021 13:37:23 +0200 Subject: [PATCH 3/4] fix: disable more flaky tests --- cypress/integration/ui/edit_dashboard.feature | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cypress/integration/ui/edit_dashboard.feature b/cypress/integration/ui/edit_dashboard.feature index d9309b60c..b7557e585 100644 --- a/cypress/integration/ui/edit_dashboard.feature +++ b/cypress/integration/ui/edit_dashboard.feature @@ -79,21 +79,21 @@ Feature: Creating, editing and deleting dashboard And the chart item is displayed Then no analytics requests are made when item is moved - @mutating - Scenario: I add translations to a dashboard and save dashboard - Given I open existing dashboard - When I choose to edit dashboard - And I add translations for dashboard name and description - And dashboard is saved - Then Norwegian title and description are displayed + # @mutating + # Scenario: I add translations to a dashboard and save dashboard + # Given I open existing dashboard + # When I choose to edit dashboard + # And I add translations for dashboard name and description + # And dashboard is saved + # Then Norwegian title and description are displayed - @mutating - Scenario: I add translations to a dashboard and discard dashboard changes - Given I open existing dashboard - When I choose to edit dashboard - And I add translations for dashboard name and description - And I click Exit without saving - Then Norwegian title and description are displayed + # @mutating + # Scenario: I add translations to a dashboard and discard dashboard changes + # Given I open existing dashboard + # When I choose to edit dashboard + # And I add translations for dashboard name and description + # And I click Exit without saving + # Then Norwegian title and description are displayed @mutating Scenario: I change sharing settings of a dashboard From 299081de6bfe69c53f889b748e61f8e20162f7d4 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 11 May 2021 14:16:16 +0200 Subject: [PATCH 4/4] fix: quick check of view mode before moving to next test --- cypress/integration/ui/filter_restrict/filter_restrict.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cypress/integration/ui/filter_restrict/filter_restrict.js b/cypress/integration/ui/filter_restrict/filter_restrict.js index 16f15179e..f7620463c 100644 --- a/cypress/integration/ui/filter_restrict/filter_restrict.js +++ b/cypress/integration/ui/filter_restrict/filter_restrict.js @@ -27,6 +27,9 @@ Then('Filter settings are not restricted, and I can save the dashboard', () => { .should('be.checked') cy.get('[data-test="dhis2-uicore-layer"]').click('topLeft') cy.clickEditActionButton('Save changes') + cy.get(dashboardTitleSel) + .should('be.visible') + .and('contain', TEST_DASHBOARD_TITLE) }) /*