1
0

cypress-e2e.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /**
  48. * Run an occ command in the docker container.
  49. */
  50. runOccCommand(command: string, options?: Partial<Cypress.ExecOptions>): Cypress.Chainable<Cypress.Exec>,
  51. userFileExists(user: string, path: string): Cypress.Chainable<number>
  52. /**
  53. * Create a snapshot of the current database
  54. */
  55. backupDB(): Cypress.Chainable<string>,
  56. /**
  57. * Restore a snapshot of the database
  58. * Default is the post-setup state
  59. */
  60. restoreDB(snapshot?: string): Cypress.Chainable
  61. backupData(users?: string[]): Cypress.Chainable<string>
  62. restoreData(snapshot?: string): Cypress.Chainable
  63. }
  64. }
  65. }