cypress-e2e.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*!
  2. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. // eslint-disable-next-line n/no-extraneous-import
  6. import type { AxiosResponse } from 'axios'
  7. declare global {
  8. // eslint-disable-next-line @typescript-eslint/no-namespace
  9. namespace Cypress {
  10. // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
  11. interface Chainable<Subject = any> {
  12. /**
  13. * Enable or disable a given user
  14. */
  15. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  16. enableUser(user: User, enable?: boolean): Cypress.Chainable<Cypress.Response<any>>,
  17. /**
  18. * Upload a file from the fixtures folder to a given user storage.
  19. * **Warning**: Using this function will reset the previous session
  20. */
  21. uploadFile(user: User, fixture?: string, mimeType?: string, target?: string): Cypress.Chainable<void>,
  22. /**
  23. * Upload a raw content to a given user storage.
  24. * **Warning**: Using this function will reset the previous session
  25. */
  26. uploadContent(user: User, content: Blob, mimeType: string, target: string, mtime?: number): Cypress.Chainable<AxiosResponse>,
  27. /**
  28. * Create a new directory
  29. * **Warning**: Using this function will reset the previous session
  30. */
  31. mkdir(user: User, target: string): Cypress.Chainable<void>,
  32. /**
  33. * Set a file as favorite (or remove from favorite)
  34. */
  35. setFileAsFavorite(user: User, target: string, favorite?: boolean): Cypress.Chainable<void>,
  36. /**
  37. * Reset the admin theming entirely.
  38. * **Warning**: Using this function will reset the previous session
  39. */
  40. resetAdminTheming(): Cypress.Chainable<void>,
  41. /**
  42. * Reset the user theming settings.
  43. * If provided, will clear session and login as the given user.
  44. * **Warning**: Providing a user will reset the previous session.
  45. */
  46. resetUserTheming(user?: User): Cypress.Chainable<void>,
  47. userFileExists(user: string, path: string): Cypress.Chainable<number>
  48. }
  49. }
  50. }