From 85271b95f6f12a95a50590ccb84ccd10d5515e9b Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 30 Sep 2025 12:32:53 +0200 Subject: [PATCH] test: mock appstore response in Cypress tests Signed-off-by: Ferdinand Thiessen --- REUSE.toml | 2 +- cypress/e2e/core/setup.ts | 3 ++ cypress/fixtures/appstore/apps.json | 46 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 cypress/fixtures/appstore/apps.json diff --git a/REUSE.toml b/REUSE.toml index f5c25fd1ace85..b5b6ba4e8945a 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -178,7 +178,7 @@ SPDX-FileCopyrightText = "2020 Nextcloud GmbH and Nextcloud contributors" SPDX-License-Identifier = "AGPL-3.0-or-later" [[annotations]] -path = ["cypress/tsconfig.json", "dist/icons.css"] +path = ["cypress/tsconfig.json", "cypress/fixtures/appstore/apps.json", "dist/icons.css"] precedence = "aggregate" SPDX-FileCopyrightText = "2022 Nextcloud GmbH and Nextcloud contributors" SPDX-License-Identifier = "AGPL-3.0-or-later" diff --git a/cypress/e2e/core/setup.ts b/cypress/e2e/core/setup.ts index a9174a3ebe723..d8201194663c3 100644 --- a/cypress/e2e/core/setup.ts +++ b/cypress/e2e/core/setup.ts @@ -113,6 +113,9 @@ describe('Can install Nextcloud', { testIsolation: true, retries: 0 }, () => { function sharedSetup() { const randAdmin = 'admin-' + Math.random().toString(36).substring(2, 15) + // mock appstore + cy.intercept('**/settings/apps/list', { fixture: 'appstore/apps.json' }) + // Fill in the form cy.get('[data-cy-setup-form-field="adminlogin"]').type(randAdmin) cy.get('[data-cy-setup-form-field="adminpass"]').type(randAdmin) diff --git a/cypress/fixtures/appstore/apps.json b/cypress/fixtures/appstore/apps.json new file mode 100644 index 0000000000000..db23c9a74eb38 --- /dev/null +++ b/cypress/fixtures/appstore/apps.json @@ -0,0 +1,46 @@ +{ + "apps": [ + { + "id": "calendar", + "name": "Calendar", + "isCompatible": true, + "canInstall": true + }, + { + "id": "contacts", + "name": "Contacts", + "isCompatible": true, + "canInstall": true + }, + { + "id": "mail", + "name": "Mail", + "isCompatible": true, + "canInstall": true + }, + { + "id": "spreed", + "name": "Talk", + "isCompatible": true, + "canInstall": true + }, + { + "id": "richdocuments", + "name": "Richdocuments", + "isCompatible": true, + "canInstall": true + }, + { + "id": "notes", + "name": "Notes", + "isCompatible": true, + "canInstall": true + }, + { + "id": "richdocumentscode", + "name": "Richdocuments Code", + "isCompatible": true, + "canInstall": true + } + ] +} \ No newline at end of file