From 43b3ad13e085f031a909c79c9d5cc368c1da923b Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Fri, 3 Jan 2025 10:24:30 +0100 Subject: [PATCH 1/2] fix(cypress): flaky live photo test grid_view trigger issue Signed-off-by: skjnldsv --- cypress/e2e/files/FilesUtils.ts | 6 ++++++ cypress/e2e/files/LivePhotosUtils.ts | 22 ++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/files/FilesUtils.ts b/cypress/e2e/files/FilesUtils.ts index 932897918de..37c2b1eff7e 100644 --- a/cypress/e2e/files/FilesUtils.ts +++ b/cypress/e2e/files/FilesUtils.ts @@ -208,3 +208,9 @@ export const triggerFileListAction = (actionId: string) => { cy.get(`button[data-cy-files-list-action="${CSS.escape(actionId)}"]`).last() .should('exist').click({ force: true }) } + +export const reloadCurrentFolder = () => { + cy.intercept('PROPFIND', /\/remote.php\/dav\//).as('propfind') + cy.get('[data-cy-files-content-breadcrumbs]').findByRole('button', { description: 'Reload current directory' }).click() + cy.wait('@propfind') +} diff --git a/cypress/e2e/files/LivePhotosUtils.ts b/cypress/e2e/files/LivePhotosUtils.ts index 6b0015affce..9b4f1dbbf3f 100644 --- a/cypress/e2e/files/LivePhotosUtils.ts +++ b/cypress/e2e/files/LivePhotosUtils.ts @@ -49,14 +49,20 @@ function setMetadata(user: User, fileName: string, requesttoken: string, metadat * @param enable */ export function setShowHiddenFiles(enable: boolean) { - cy.get('[data-cy-files-navigation-settings-button]').click() - // Force:true because the checkbox is hidden by the pretty UI. - if (enable) { - cy.get('[data-cy-files-settings-setting="show_hidden"] input').check({ force: true }) - } else { - cy.get('[data-cy-files-settings-setting="show_hidden"] input').uncheck({ force: true }) - } - cy.get('[data-cy-files-navigation-settings]').type('{esc}') + cy.request('/csrftoken').then(({ body }) => { + const requestToken = body.token + const url = `${Cypress.config('baseUrl')}/apps/files/api/v1/config/show_hidden` + cy.request({ + method: 'PUT', + url, + headers: { + 'Content-Type': 'application/json', + requesttoken: requestToken, + }, + body: { value: enable }, + }) + }) + cy.reload() } /** From bc523f6441ca5fd2192a0506582ace9e23640294 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Fri, 3 Jan 2025 10:28:49 +0100 Subject: [PATCH 2/2] chore: enable cypress video recording in debug mode Signed-off-by: skjnldsv --- .github/workflows/cypress.yml | 8 +++++--- cypress.config.ts | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 8bfb9c00a5f..8d058acf81f 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -142,12 +142,14 @@ jobs: SPLIT: ${{ matrix.total-containers }} SPLIT_INDEX: ${{ matrix.containers == 'component' && 0 || matrix.containers }} - - name: Upload snapshots + - name: Upload snapshots and videos uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 if: always() with: - name: snapshots_${{ matrix.containers }} - path: cypress/snapshots + name: snapshots_videos_${{ matrix.containers }} + path: | + cypress/snapshots + cypress/videos - name: Extract NC logs if: failure() && matrix.containers != 'component' diff --git a/cypress.config.ts b/cypress.config.ts index 2d798bbfa6c..1e83c0b7f5d 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -34,8 +34,10 @@ export default defineConfig({ // Needed to trigger `after:run` events with cypress open experimentalInteractiveRunEvents: true, + // disabled if running in CI but enabled in debug mode + video: !process.env.CI || !!process.env.RUNNER_DEBUG, + // faster video processing - video: !process.env.CI, videoCompression: false, // Prevent elements to be scrolled under a top bar during actions (click, clear, type, etc). Default is 'top'.