Skip to content

Commit d6317ed

Browse files
committed
test(dashboard): Add regression test for loading unneeded data
Prevent a regression of #48403 Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 40dd2a9 commit d6317ed

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*!
2+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
/**
7+
* Regression test of https://github.com/nextcloud/server/issues/48403
8+
* Ensure that only visible widget data is loaded
9+
*/
10+
describe('dashboard: performance', () => {
11+
before(() => {
12+
cy.createRandomUser().then((user) => {
13+
cy.login(user)
14+
})
15+
})
16+
17+
it('Only load needed widgets', () => {
18+
cy.intercept('**/dashboard/api/v2/widget-items?widgets%5B%5D=user_status').as('loadedWidgets')
19+
20+
const now = new Date(2025, 0, 14, 15)
21+
cy.clock(now)
22+
23+
// The dashboard is loaded
24+
cy.visit('/apps/dashboard')
25+
cy.get('#app-dashboard')
26+
.should('be.visible')
27+
.contains('Good afternoon')
28+
.should('be.visible')
29+
30+
// Wait and check no requests are made
31+
// eslint-disable-next-line cypress/no-unnecessary-waiting
32+
cy.wait(4000, { timeout: 8000 })
33+
cy.get('@loadedWidgets.all').then((interceptions) => {
34+
expect(interceptions).to.have.length(0)
35+
})
36+
})
37+
})

0 commit comments

Comments
 (0)