diff options
Diffstat (limited to 'cypress/support/commonUtils.ts')
-rw-r--r-- | cypress/support/commonUtils.ts | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cypress/support/commonUtils.ts b/cypress/support/commonUtils.ts index a00a6a4c740..8d02ace151b 100644 --- a/cypress/support/commonUtils.ts +++ b/cypress/support/commonUtils.ts @@ -3,6 +3,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { basename } from 'path' + /** * Get the header navigation bar */ @@ -49,8 +51,12 @@ export function installTestApp() { cy.runOccCommand('-V').then((output) => { const version = output.stdout.match(/(\d\d+)\.\d+\.\d+/)?.[1] cy.wrap(version).should('not.be.undefined') - cy.exec(`docker cp '${testAppPath}' nextcloud-cypress-tests-server:/var/www/html/apps`, { log: true }) - cy.exec(`docker exec nextcloud-cypress-tests-server sed -i -e 's|-version="[0-9]\\+|-version="${version}|g' apps/testapp/appinfo/info.xml`) + getContainerName() + .then(containerName => { + cy.exec(`docker cp '${testAppPath}' ${containerName}:/var/www/html/apps`, { log: true }) + cy.exec(`docker exec --workdir /var/www/html ${containerName} chown -R www-data:www-data /var/www/html/apps/testapp`) + }) + cy.runCommand(`sed -i -e 's|-version=\\"[0-9]\\+|-version=\\"${version}|g' apps/testapp/appinfo/info.xml`) cy.runOccCommand('app:enable --force testapp') }) } @@ -60,5 +66,15 @@ export function installTestApp() { */ export function uninstallTestApp() { cy.runOccCommand('app:remove testapp', { failOnNonZeroExit: false }) - cy.exec('docker exec nextcloud-cypress-tests-server rm -fr apps/testapp/appinfo/info.xml') + cy.runCommand('rm -fr apps/testapp/appinfo/info.xml') +} + +/** + * + */ +export function getContainerName(): Cypress.Chainable<string> { + return cy.exec('pwd') + .then(({ stdout }) => { + return cy.wrap(`nextcloud-cypress-tests_${basename(stdout).replace(' ', '')}`) + }) } |