Skip to content

Commit

Permalink
Merge pull request #50025 from nextcloud/fix/flaky-cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jan 3, 2025
2 parents 9e18d34 + bc523f6 commit 99147b8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/files/FilesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
22 changes: 14 additions & 8 deletions cypress/e2e/files/LivePhotosUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

/**
Expand Down

0 comments on commit 99147b8

Please sign in to comment.