Merge pull request #50025 from nextcloud/fix/flaky-cypress

pull/49903/head
John Molakvoæ 2025-01-03 11:11:15 +07:00 committed by GitHub
commit 99147b8747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 12 deletions

@ -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'

@ -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'.

@ -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')
}

@ -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()
}
/**