1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/**
* 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()
})
it('Oracle', () => {
cy.runCommand('cp /var/www/html/tests/databases-all-config.php /var/www/html/config/config.php')
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-oci"] input').check({ force: true })
// Fill in the DB form
cy.get('[data-cy-setup-form-field="dbuser"]').type('{selectAll}system')
cy.get('[data-cy-setup-form-field="dbpass"]').type('{selectAll}oracle')
cy.get('[data-cy-setup-form-field="dbname"]').type('{selectAll}FREE')
cy.get('[data-cy-setup-form-field="dbhost"]').type('{selectAll}oracle:1521')
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')
// See the apps setup
cy.get('[data-cy-setup-recommended-apps]')
.should('be.visible')
.within(() => {
cy.findByRole('heading', { name: 'Recommended apps' })
.should('be.visible')
cy.findByRole('button', { name: 'Skip' })
.should('be.visible')
cy.findByRole('button', { name: 'Install recommended apps' })
.should('be.visible')
})
// Skip the setup apps
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')
}
|