diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index ad486a8a8f7..b09a165451f 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -246,3 +246,16 @@ Cypress.Commands.add('userFileExists', (user: string, path: string) => { return cy.runCommand(`stat --printf="%s" "data/${user}/files/${path}"`, { failOnNonZeroExit: true }) .then((exec) => Number.parseInt(exec.stdout || '0')) }) + +Cypress.Commands.add('runOccCommand', (command: string, options?: Partial) => { + return cy.runCommand(`php ./occ ${command}`, options) + .then((context) => + // OCC cannot clear the APCu cache + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait( + command.startsWith('app:') || command.startsWith('config:') + ? 3000 // clear APCu cache + : 0, + ).then(() => context), + ) +})