Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make docker integration available for other projects #157

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Feb 11, 2023

Resolves #97

  • Provide the docker helpers as @nextcloud/cypress/docker import.
  • Allow installing custom required apps for testing
    • Handle text app which is not in the appstore but also not bundled
  • Allow to auto-detect current app, or set one, and bind mount the directory for testing the app

@susnux susnux added enhancement New feature request 2. developing Work in progress labels Feb 11, 2023
@susnux susnux requested a review from skjnldsv February 11, 2023 21:55
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 11, 2023
@susnux
Copy link
Contributor Author

susnux commented Feb 11, 2023

@skjnldsv Added an additional commit fixing the flaky cypress tests by ensuring the user is logged out after the tests.
(because otherwise the session tests fail if they run second).

@max-nextcloud
Copy link
Contributor

@skjnldsv Added an additional commit fixing the flaky cypress tests by ensuring the user is logged out after the tests. (because otherwise the session tests fail if they run second).

I think it would be nice to find a different solution there.

If you run a test locally and it fails it's nice to be able to inspect the state of the browser. If the test logs you out in an after block you cannot access the session anymore. Cypress docs also have a section about this.

I'm happy to brainstorm alternative solutions or try out some things.

@susnux
Copy link
Contributor Author

susnux commented Feb 21, 2023

@max-nextcloud I changed it to before hooks as suggested on that page from the cypress documentation, seems to work fine :)

cypress.config.ts Outdated Show resolved Hide resolved
cypress/e2e/sessions.cy.ts Outdated Show resolved Hide resolved
cypress/e2e/users.cy.ts Outdated Show resolved Hide resolved
lib/docker.ts Outdated Show resolved Hide resolved
lib/docker.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
rollup.config.mjs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9d1a7a0) 96.47% compared to head (e008cf6) 96.47%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #157   +/-   ##
=======================================
  Coverage   96.47%   96.47%           
=======================================
  Files           5        5           
  Lines          85       85           
  Branches        4        4           
=======================================
  Hits           82       82           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@susnux susnux requested a review from skjnldsv July 6, 2023 02:43
@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 7, 2023
@skjnldsv
Copy link
Contributor

skjnldsv commented Jul 7, 2023

You seem to be doing some changes still, so I set it to 2. developing, please ping again when/if ready :)

@susnux susnux added 3. to review Waiting for reviews 2. developing Work in progress and removed 2. developing Work in progress 3. to review Waiting for reviews labels Jul 7, 2023
@susnux susnux removed the 2. developing Work in progress label Oct 23, 2023
@susnux susnux added the 3. to review Waiting for reviews label Oct 23, 2023
@susnux
Copy link
Contributor Author

susnux commented Oct 25, 2023

Anything I need to do here? :)
Would be great if we can reuse it in apps (then I maybe have motivation to add Cypress to forms 😆 )

.then(waitOnNextcloud)
// configure Nextcloud, also install and enable the `viewer` app
.then(() => configureNextcloud(['viewer']))
Copy link
Contributor

Choose a reason for hiding this comment

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

How can I mount the local Viewer if I'm running Cypress in https://github.com/nextcloud/viewer though?

Copy link
Contributor Author

@susnux susnux Oct 26, 2023

Choose a reason for hiding this comment

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

Edit: No just leave it as it is, because viewer is mounted (as it is the app, see startNextcloud).
Then later on in configureNextcloud it checks for the app to be preset locally first and will detect the local viewer and enable it.

As this is your target app it will be mounted automatically, but as viewer is installed by default you need to make sure to disable mounting of the vendored one

Copy link
Contributor

Choose a reason for hiding this comment

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

So, I can't use this configureNextcloud and have to keep mine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you mean? If you want to test the local viewer you do not need to adjust anything simply do as the readme says and the local viewer will be used

Copy link
Contributor

Choose a reason for hiding this comment

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

Aaaah, if you specify it, it will not be cloned with git.
I didn't realized that. I think the jsdoc could reflect that,
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I updated the jsdocs here to reflect this.

Copy link
Contributor

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

Tested this when adding cypress tests to the data_request app here: nextcloud/data_request#197. Works like a charm 🪄

Also replaced the imports in the viewers cypress.config.js and it runs fine.

Thanks a lot for making this available to everyone! ❤️

susnux and others added 3 commits January 4, 2024 08:58
* Provide the docker helpers as `@nextcloud/cypress/docker` import.
* Allow installing custom required apps for testing
  * Handle `text` app which is not in the appstore but also not bundled
* Allow to autodetect current app, or set one, and bind mount the directory
  for testing the app

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Vendored apps are apps which are not provided with the appstore
but released with the server, for the shallow server those apps
have to be cloned.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Signed-off-by: Max <max@nextcloud.com>
@max-nextcloud max-nextcloud dismissed skjnldsv’s stale review January 4, 2024 08:01

From my point of view everything was addressed.

@max-nextcloud max-nextcloud merged commit c35a40d into master Jan 4, 2024
10 of 11 checks passed
@max-nextcloud max-nextcloud deleted the feat/docker-node branch January 4, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer dockerNode config helper from this library
3 participants