33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6+ import { basename } from 'path'
7+
68/**
79 * Get the header navigation bar
810 */
@@ -49,8 +51,12 @@ export function installTestApp() {
4951 cy . runOccCommand ( '-V' ) . then ( ( output ) => {
5052 const version = output . stdout . match ( / ( \d \d + ) \. \d + \. \d + / ) ?. [ 1 ]
5153 cy . wrap ( version ) . should ( 'not.be.undefined' )
52- cy . exec ( `docker cp '${ testAppPath } ' nextcloud-cypress-tests-server:/var/www/html/apps` , { log : true } )
53- cy . exec ( `docker exec nextcloud-cypress-tests-server sed -i -e 's|-version="[0-9]\\+|-version="${ version } |g' apps/testapp/appinfo/info.xml` )
54+ getContainerName ( )
55+ . then ( containerName => {
56+ cy . exec ( `docker cp '${ testAppPath } ' ${ containerName } :/var/www/html/apps` , { log : true } )
57+ cy . exec ( `docker exec --workdir /var/www/html ${ containerName } chown -R www-data:www-data /var/www/html/apps/testapp` )
58+ } )
59+ cy . runCommand ( `sed -i -e 's|-version=\\"[0-9]\\+|-version=\\"${ version } |g' apps/testapp/appinfo/info.xml` )
5460 cy . runOccCommand ( 'app:enable --force testapp' )
5561 } )
5662}
@@ -60,5 +66,15 @@ export function installTestApp() {
6066 */
6167export function uninstallTestApp ( ) {
6268 cy . runOccCommand ( 'app:remove testapp' , { failOnNonZeroExit : false } )
63- cy . exec ( 'docker exec nextcloud-cypress-tests-server rm -fr apps/testapp/appinfo/info.xml' )
69+ cy . runCommand ( 'rm -fr apps/testapp/appinfo/info.xml' )
70+ }
71+
72+ /**
73+ *
74+ */
75+ export function getContainerName ( ) : Cypress . Chainable < string > {
76+ return cy . exec ( 'pwd' )
77+ . then ( ( { stdout } ) => {
78+ return cy . wrap ( `nextcloud-cypress-tests_${ basename ( stdout ) . replace ( ' ' , '' ) } ` )
79+ } )
6480}
0 commit comments