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

Cleanup _oc_webroot stubs where possible #5378

Merged
merged 5 commits into from
Apr 4, 2024
Merged

Conversation

max-nextcloud
Copy link
Collaborator

  • test(jest): remove internal _oc_webroot stub
  • test(cy): introduce cy.prepareWindowForSessionApi
  • test(cy): refactor to use aliases
  • test(cy): introduce cy.sessionUsers() for users endpoint
  • test(api): split test and use .its and .should

@max-nextcloud max-nextcloud added the tests If you write them we ♥ you label Feb 11, 2024
@max-nextcloud max-nextcloud force-pushed the test/cleanup-oc-webroot branch from 95b9b35 to 71627c0 Compare February 11, 2024 13:21
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.

Looks good

just one failure remaining


FAIL src/tests/services/AttachmentResolver.spec.js
  Image resolver
    ✓ is a class with one constructor argument (29 ms)
    ✓ handles .attachments urls to own fileId via Text API (2 ms)
    ✓ leaves urls unchanged if they can be loaded directly (1 ms)
    ✓ handles .attachments urls to different fileId via webdav with text API fallback
    ✕ handles non-native urls wia webdav (3 ms)

  ● Image resolver › handles non-native urls wia webdav

    expect(received).toBe(expected) // Object.is equality

    Expected: "http://localhost/remote.php/dav/files/user-uid/parentDir/path/to/some%20image.png"
    Received: "http://localhost//remote.php/dav/files/user-uid/parentDir/path/to/some%20image.png"

      88 | 		const attachment = await resolver.resolve(src)
      89 | 		expect(attachment.isImage).toBe(true)
    > 90 | 		expect(attachment.previewUrl).toBe('http://localhost/remote.php/dav/files/user-uid/parentDir/path/to/some%20image.png')
         | 		                              ^
      91 | 	})
      92 |
      93 | })

      at Object.toBe (src/tests/services/AttachmentResolver.spec.js:90:33)

We do not need to test functionality internal to `@nextcloud/router`.

Signed-off-by: Max <max@nextcloud.com>
* Prevent @nextcloud/router from reading `window.location.pathname`
  which would include `cypress/_iframe`.
* Keep the `window.OC` stub for now for easier backports.
  Tests pass without it these days.

Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
@juliusknorr juliusknorr force-pushed the test/cleanup-oc-webroot branch from 71627c0 to 9dc6291 Compare April 4, 2024 07:48
@juliusknorr juliusknorr enabled auto-merge April 4, 2024 08:05
@juliusknorr juliusknorr merged commit 474369d into main Apr 4, 2024
59 checks passed
@juliusknorr juliusknorr deleted the test/cleanup-oc-webroot branch April 4, 2024 08:05
@mejo-
Copy link
Member

mejo- commented May 28, 2024

/backport to stable29

@mejo-
Copy link
Member

mejo- commented May 28, 2024

/backport to stable28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review tests If you write them we ♥ you
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants