From ed188d999596f3ee4f674c272427d012a1ae6b0b Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 7 Jan 2025 11:36:32 +0100 Subject: [PATCH] test(playwright): use getContainer from @nextcloud/cypress/docker Avoid hardcoding `containerName` to make reuse in other apps easier Signed-off-by: Max --- playwright/support/setup.ts | 6 ++---- playwright/support/utils/session.ts | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/playwright/support/setup.ts b/playwright/support/setup.ts index 412d4900f..c85fd2127 100644 --- a/playwright/support/setup.ts +++ b/playwright/support/setup.ts @@ -4,7 +4,7 @@ */ import { test as setup } from '@playwright/test' -import { configureNextcloud, docker } from '@nextcloud/cypress/docker' +import { configureNextcloud, getContainer } from '@nextcloud/cypress/docker' /** * We use this to ensure Nextcloud is configured correctly before running our tests @@ -13,7 +13,5 @@ import { configureNextcloud, docker } from '@nextcloud/cypress/docker' * as that only checks for the URL to be accessible which happens already before everything is configured. */ setup('Configure Nextcloud', async () => { - const containerName = 'nextcloud-cypress-tests_forms' - const container = docker.getContainer(containerName) - await configureNextcloud(['forms', 'viewer'], undefined, container) + await configureNextcloud(['forms', 'viewer'], undefined, getContainer()) }) diff --git a/playwright/support/utils/session.ts b/playwright/support/utils/session.ts index 483d82a3a..7038e8c2f 100644 --- a/playwright/support/utils/session.ts +++ b/playwright/support/utils/session.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { docker } from '@nextcloud/cypress/docker' +import { getContainer } from '@nextcloud/cypress/docker' import { expect, type APIRequestContext } from '@playwright/test' /** @@ -22,8 +22,7 @@ export async function runShell( env?: Record }, ) { - const containerName = 'nextcloud-cypress-tests_forms' - const container = docker.getContainer(containerName) + const container = getContainer() const exec = await container.exec({ Cmd: ['sh', '-c', command],