Skip to content

Commit bd5fd38

Browse files
committed
test: add workaround for e2e-test-server setup
ref: nextcloud-libraries/nextcloud-e2e-test-server#1051 Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent e432f62 commit bd5fd38

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

tests/playwright/start-nextcloud-server.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,30 @@ async function start() {
4242
forceRecreate: true,
4343
})
4444

45-
// The installer (setup) tests need to reach the database service containers
46-
// (mysql, mariadb, …) that CI exposes on the GitHub Actions network. Join it
47-
// when present; a no-op locally and in the normal test job where it is absent.
48-
await connectToActionsNetwork()
45+
if (process.env.PLAYWRIGHT_SETUP) {
46+
// The installer (setup) tests need to reach the database service containers
47+
// (mysql, mariadb, …) that CI exposes on the GitHub Actions network. Join it
48+
// when present; a no-op locally and in the normal test job where it is absent.
49+
await connectToActionsNetwork()
50+
}
4951

5052
await waitOnNextcloud(ip)
5153
await configureNextcloud(process.env.PLAYWRIGHT_SETUP ? [] : ['viewer'])
5254

55+
if (process.env.PLAYWRIGHT_SETUP) {
56+
// When the apps folder is mounted, configureNextcloud writes an
57+
// apps.config.php declaring a writable apps path at
58+
// `/var/www/html/apps_writable`, but it only creates that directory as a
59+
// side effect of installing an app into it. The setup job installs no
60+
// apps (empty list above), so the directory is never created. The setup
61+
// tests remove config.php in beforeEach — leaving apps.config.php — and
62+
// the wizard then fails to boot with `App directory
63+
// "/var/www/html/apps_writable" not found`. Create it up front.
64+
await runExec(['mkdir', '-p', '/var/www/html/apps_writable'], { user: 'root' })
65+
await runExec(['chown', 'www-data:www-data', '/var/www/html/apps_writable'], { user: 'root' })
66+
process.stdout.write('├─ Created writable apps folder for the setup tests\n')
67+
}
68+
5369
process.stdout.write('\nApply custom configuration for Playwright tests\n')
5470
await runExec(['php', '-r', '$db = new SQLite3("data/owncloud.db");$db->busyTimeout(5000);$db->exec("PRAGMA journal_mode = wal;");'])
5571
process.stdout.write('├─ Enabled SQLite WAL mode for better performance\n')

0 commit comments

Comments
 (0)