aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-01-14 15:35:34 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2025-01-16 11:36:37 +0100
commit2556da595708a51e9dbbfa06b1c3239f35fa78ac (patch)
treef20da4a577af638d345f147d68f696db680faf2a /cypress/e2e
parentb2d1df7f875277bec1b59f824ee0ec082fb27bf8 (diff)
downloadnextcloud-server-2556da595708a51e9dbbfa06b1c3239f35fa78ac.tar.gz
nextcloud-server-2556da595708a51e9dbbfa06b1c3239f35fa78ac.zip
test(dashboard): Add regression test for loading unneeded data
Prevent a regression of https://github.com/nextcloud/server/issues/48403 Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress/e2e')
-rw-r--r--cypress/e2e/dashboard/widget-performance.cy.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/cypress/e2e/dashboard/widget-performance.cy.ts b/cypress/e2e/dashboard/widget-performance.cy.ts
new file mode 100644
index 00000000000..99e46d7b0ae
--- /dev/null
+++ b/cypress/e2e/dashboard/widget-performance.cy.ts
@@ -0,0 +1,41 @@
+/*!
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+/**
+ * Regression test of https://github.com/nextcloud/server/issues/48403
+ * Ensure that only visible widget data is loaded
+ */
+describe('dashboard: performance', () => {
+ before(() => {
+ cy.createRandomUser().then((user) => {
+ // Enable one widget
+ cy.runOccCommand(`user:setting -- '${user.userId}' dashboard layout files-favorites`)
+ cy.login(user)
+ })
+ })
+
+ it('Only load needed widgets', () => {
+ cy.intercept('**/dashboard/api/v2/widget-items?widgets*').as('loadedWidgets')
+
+ const now = new Date(2025, 0, 14, 15)
+ cy.clock(now)
+
+ // The dashboard is loaded
+ cy.visit('/apps/dashboard')
+ cy.get('#app-dashboard')
+ .should('be.visible')
+ .contains('Good afternoon')
+ .should('be.visible')
+
+ // Wait that one data is loaded (ensure the API works), this should be the favorite files.
+ cy.wait('@loadedWidgets')
+ // Wait and check no requests are made (ensure that the user statuses data is NOT loaded)
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(4000, { timeout: 8000 })
+ cy.get('@loadedWidgets.all').then((interceptions) => {
+ expect(interceptions).to.have.length(1)
+ })
+ })
+})