Browse Source
chore(cypress): add setup tests
chore(cypress): add setup tests
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>pull/52703/head
7 changed files with 207 additions and 16 deletions
-
48.github/workflows/cypress.yml
-
6core/src/components/setup/RecommendedApps.vue
-
24cypress.config.ts
-
25cypress/dockerNode.ts
-
114cypress/e2e/core/setup.ts
-
4dist/core-recommendedapps.js
-
2dist/core-recommendedapps.js.map
@ -0,0 +1,114 @@ |
|||
/** |
|||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
/** |
|||
* DO NOT RENAME THIS FILE to .cy.ts ⚠️ |
|||
* This is not following the pattern of the other files in this folder |
|||
* because it is manually added to the tests by the cypress config. |
|||
*/ |
|||
describe('Can install Nextcloud', { testIsolation: true, retries: 0 }, () => { |
|||
beforeEach(() => { |
|||
// Move the config file and data folder
|
|||
cy.runCommand('rm /var/www/html/config/config.php', { failOnNonZeroExit: false }) |
|||
cy.runCommand('rm /var/www/html/data/owncloud.db', { failOnNonZeroExit: false }) |
|||
}) |
|||
|
|||
it('Sqlite', () => { |
|||
cy.visit('/') |
|||
cy.get('[data-cy-setup-form]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminlogin"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminpass"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="directory"]').should('have.value', '/var/www/html/data') |
|||
|
|||
// Select the SQLite database
|
|||
cy.get('[data-cy-setup-form-field="dbtype-sqlite"] input').check({ force: true }) |
|||
|
|||
sharedSetup() |
|||
}) |
|||
|
|||
it('MySQL', () => { |
|||
cy.visit('/') |
|||
cy.get('[data-cy-setup-form]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminlogin"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminpass"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="directory"]').should('have.value', '/var/www/html/data') |
|||
|
|||
// Select the SQLite database
|
|||
cy.get('[data-cy-setup-form-field="dbtype-mysql"] input').check({ force: true }) |
|||
|
|||
// Fill in the DB form
|
|||
cy.get('[data-cy-setup-form-field="dbuser"]').type('{selectAll}oc_autotest') |
|||
cy.get('[data-cy-setup-form-field="dbpass"]').type('{selectAll}nextcloud') |
|||
cy.get('[data-cy-setup-form-field="dbname"]').type('{selectAll}oc_autotest') |
|||
cy.get('[data-cy-setup-form-field="dbhost"]').type('{selectAll}mysql:3306') |
|||
|
|||
sharedSetup() |
|||
}) |
|||
|
|||
it('MariaDB', () => { |
|||
cy.visit('/') |
|||
cy.get('[data-cy-setup-form]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminlogin"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminpass"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="directory"]').should('have.value', '/var/www/html/data') |
|||
|
|||
// Select the SQLite database
|
|||
cy.get('[data-cy-setup-form-field="dbtype-mysql"] input').check({ force: true }) |
|||
|
|||
// Fill in the DB form
|
|||
cy.get('[data-cy-setup-form-field="dbuser"]').type('{selectAll}oc_autotest') |
|||
cy.get('[data-cy-setup-form-field="dbpass"]').type('{selectAll}nextcloud') |
|||
cy.get('[data-cy-setup-form-field="dbname"]').type('{selectAll}oc_autotest') |
|||
cy.get('[data-cy-setup-form-field="dbhost"]').type('{selectAll}mariadb:3306') |
|||
|
|||
sharedSetup() |
|||
}) |
|||
|
|||
it('PostgreSQL', () => { |
|||
cy.visit('/') |
|||
cy.get('[data-cy-setup-form]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminlogin"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="adminpass"]').should('be.visible') |
|||
cy.get('[data-cy-setup-form-field="directory"]').should('have.value', '/var/www/html/data') |
|||
|
|||
// Select the SQLite database
|
|||
cy.get('[data-cy-setup-form-field="dbtype-pgsql"] input').check({ force: true }) |
|||
|
|||
// Fill in the DB form
|
|||
cy.get('[data-cy-setup-form-field="dbuser"]').type('{selectAll}root') |
|||
cy.get('[data-cy-setup-form-field="dbpass"]').type('{selectAll}rootpassword') |
|||
cy.get('[data-cy-setup-form-field="dbname"]').type('{selectAll}nextcloud') |
|||
cy.get('[data-cy-setup-form-field="dbhost"]').type('{selectAll}postgres:5432') |
|||
|
|||
sharedSetup() |
|||
}) |
|||
|
|||
}) |
|||
|
|||
/** |
|||
* Shared admin setup function for the Nextcloud setup |
|||
*/ |
|||
function sharedSetup() { |
|||
const randAdmin = 'admin-' + Math.random().toString(36).substring(2, 15) |
|||
|
|||
// Fill in the form
|
|||
cy.get('[data-cy-setup-form-field="adminlogin"]').type(randAdmin) |
|||
cy.get('[data-cy-setup-form-field="adminpass"]').type(randAdmin) |
|||
|
|||
// Nothing more to do on sqlite, let's continue
|
|||
cy.get('[data-cy-setup-form-submit]').click() |
|||
|
|||
// Wait for the setup to finish
|
|||
cy.location('pathname', { timeout: 10000 }) |
|||
.should('include', '/core/apps/recommended') |
|||
|
|||
// Skip the setup apps
|
|||
cy.get('[data-cy-setup-recommended-apps]').should('be.visible') |
|||
cy.get('[data-cy-setup-recommended-apps-skip]').click() |
|||
|
|||
// Go to files
|
|||
cy.visit('/apps/files/') |
|||
cy.get('[data-cy-files-content]').should('be.visible') |
|||
} |
|||
4
dist/core-recommendedapps.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
dist/core-recommendedapps.js.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue