test(cypress): clear cache after running OCC commands

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/54383/head
Ferdinand Thiessen 2 months ago
parent 866ccae542
commit 503f43f655
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
  1. 13
      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<Cypress.ExecOptions>) => {
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),
)
})

Loading…
Cancel
Save