Skip to content

Conversation

@susnux
Copy link
Contributor

@susnux susnux commented Jun 5, 2022

Summary

Fix the scripts for local cypress runs,
they need to be run within the npm run environment,
as the nextcloud webpack config requires the npm_package_name
variable to be set.

Also a up-to-date nextcloud instance is required for testing
text at the current git head, so updated the dockerfile
and docker-compose files to create a nextcloud image from current git head.
(To get it work I modified the docker part to create a similar image as the one used by the github CI)

Additionally updated the tests to use cypress 10.x and
added missing documentation on how to run the cypress tests.

Fix the scripts for local cypress runs,
they need to be run within the `npm run` environment,
as the nextcloud webpack config requires the `npm_package_name`
variable to be set.

Also a up-to-date nextcloud instance is required for testing
text at the current git head, so updated the dockerfile
and docker-compose files to create a nextcloud image from current git head.

Additionally updated the tests to use cypress 10.x and
added missing documentation on how to run the cypress tests.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@vinicius73 vinicius73 added enhancement New feature or request tests If you write them we ♥ you dependencies Pull requests that update a dependency file 3. to review labels Jun 6, 2022
@vinicius73
Copy link
Member

Thanks a lot for this @susnux
I've adjusted some parts of your PR

  • The speed of build test image build (using --depth)
  • Apply ShellCheck in runLocal.sh
  • Fix apps folder permission

@susnux
Copy link
Contributor Author

susnux commented Jun 7, 2022

Thanks a lot for this @susnux I've adjusted some parts of your PR

* The speed of build test image build (using [`--depth`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt))

* Apply [ShellCheck](https://www.shellcheck.net/) in `runLocal.sh`

* Fix apps folder permission

Looks good, it's only important to mount into custom apps, because docker will otherwise remove your current directory (or more precisely the nextcloud entry point)

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks for documenting those parts and the improvements :)

@juliusknorr juliusknorr merged commit 87e7386 into nextcloud:master Jun 7, 2022
@susnux susnux deleted the fix/local_cypress_tests branch June 7, 2022 10:36
@susnux
Copy link
Contributor Author

susnux commented Jun 14, 2022

Thanks a lot for this @susnux I've adjusted some parts of your PR

Have you tried it? For me it works the first time but then stops working

nextcloud_cypress_1  | An unhandled exception has been thrown:
nextcloud_cypress_1  | Exception: Environment not properly prepared. in /var/www/html/lib/private/Console/Application.php:164
nextcloud_cypress_1  | Stack trace:
nextcloud_cypress_1  | #0 /var/www/html/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_cypress_1  | #1 /var/www/html/occ(11): require_once('/var/www/html/c...')
nextcloud_cypress_1  | #2 {main}Retrying install...
nextcloud_cypress_1  | Cannot write into "apps" directory.
nextcloud_cypress_1  | This can usually be fixed by giving the web server write access to the apps directory or disabling the App Store in the config file.

@vinicius73
Copy link
Member

Very strange @susnux
Works every time for me, I've spent a long time adjusting it :/

@susnux
Copy link
Contributor Author

susnux commented Jun 14, 2022

@vinicius73 Not sure why but the custom_apps directory gets created with root as the owner, see #2515 which works for me by forcefully chown the directory.
I tried to debug it but not sure if it is caused by docker while bind-mount the directory or the nexcloud entrypoint script.

Fails reproducible with a fresh system e.g.

docker system prune --all
npm run test:cypress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review dependencies Pull requests that update a dependency file enhancement New feature or request tests If you write them we ♥ you

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants