aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-01-14 15:35:34 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-01-16 10:22:32 +0000
commit60f205c78439c48c46193748e4d4e30eb892d948 (patch)
tree5223bb8b065679dcea1796c02c8c5f489588d2d8
parent9f2b0f73d7765abc8e31391a19dd838dc2b213f0 (diff)
downloadnextcloud-server-backport/50179/stable30.tar.gz
nextcloud-server-backport/50179/stable30.zip
test(dashboard): Add regression test for loading unneeded databackport/50179/stable30
Prevent a regression of https://github.com/nextcloud/server/issues/48403 Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r--cypress/e2e/dashboard/widget-performance.cy.ts37
1 files changed, 37 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..e5793fa40e1
--- /dev/null
+++ b/cypress/e2e/dashboard/widget-performance.cy.ts
@@ -0,0 +1,37 @@
+/*!
+ * 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) => {
+ cy.login(user)
+ })
+ })
+
+ it('Only load needed widgets', () => {
+ cy.intercept('**/dashboard/api/v2/widget-items?widgets%5B%5D=user_status').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 and check no requests are made
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
+ cy.wait(4000, { timeout: 8000 })
+ cy.get('@loadedWidgets.all').then((interceptions) => {
+ expect(interceptions).to.have.length(0)
+ })
+ })
+})