Skip to content

Commit 8fcfd8a

Browse files
authored
Merge 8cccc96 into 0bdf564
2 parents 0bdf564 + 8cccc96 commit 8fcfd8a

6 files changed

Lines changed: 36 additions & 13 deletions

File tree

cypress.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'
1+
import { configureNextcloud, runOcc, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'
22
// eslint-disable-next-line n/no-extraneous-import
33
import { defineConfig } from 'cypress'
44

@@ -89,6 +89,8 @@ export default defineConfig({
8989
config.baseUrl = `http://${ip}/index.php`
9090
await waitOnNextcloud(ip)
9191
await configureNextcloud(['viewer'])
92+
// Cypress uses Electron 118 which NC32 considers unsupported — disable the check
93+
await runOcc(['config:system:set', 'no_unsupported_browser_warning', '--value', 'true', '--type', 'boolean'])
9294
return config
9395
},
9496
},

cypress/e2e/filesUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ export function toggleMenuAction(filename: string, action: 'details'|'favorite'|
128128
.find('[data-cy-files-list-row-actions]')
129129
.findByRole('button', { name: 'Actions' })
130130
.should('be.visible')
131-
.click()
131+
.click({ force: true })
132132

133-
cy.get(`[data-cy-files-list-row-action="${CSS.escape(action)}"]`)
133+
cy.get(`[data-cy-files-list-row-action="${CSS.escape(action)}"]`, { timeout: 10000 })
134134
.should('be.visible')
135135
.findByRole('menuitem')
136-
.click()
136+
.click({ force: true })
137137
}

cypress/e2e/settings.cy.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,23 @@ describe('Check that user\'s settings survive a reload', () => {
1616
beforeEach(() => {
1717
cy.login(user)
1818
cy.visit('/settings/user/notifications')
19+
// The notification settings are rendered by a Vue component after page load.
20+
// On slow CI runners for older NC versions this can exceed the default 4s timeout.
21+
cy.get("#app-content input[type='checkbox']", { timeout: 10000 })
22+
.should('have.length.at.least', 1)
1923
})
2024

2125
it('Form survive a reload', () => {
26+
cy.intercept({ method: 'POST', url: '**/activity/settings' }).as('apiCall')
27+
2228
cy.get("#app-content input[type='checkbox']").uncheck({ force: true })
2329
cy.get("#app-content input[type='checkbox']").should('not.be.checked')
2430

31+
cy.wait('@apiCall')
2532
cy.reload()
2633

34+
cy.intercept({ method: 'POST', url: '**/activity/settings' }).as('apiCall')
35+
2736
cy.get("#app-content input[type='checkbox']").uncheck({ force: true })
2837
cy.get("#app-content input[type='checkbox']").should('not.be.checked')
2938

@@ -34,6 +43,7 @@ describe('Check that user\'s settings survive a reload', () => {
3443
cy.get('#calendar_notification').check({ force: true })
3544
cy.get('#personal_settings_email').check({ force: true })
3645
cy.get('#personal_settings_notification').check({ force: true })
46+
cy.wait('@apiCall')
3747
cy.reload()
3848

3949
cy.get('#file_changed_email').should('not.be.checked')

cypress/e2e/sidebar.cy.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ describe('Check activity listing in the sidebar', { testIsolation: true }, () =>
1111
cy.createRandomUser()
1212
.then((user) => {
1313
cy.login(user)
14+
cy.intercept('PROPFIND', /\/remote\.php\/dav\/files\//).as('initialFiles')
1415
cy.visit('/apps/files')
15-
// Wait for page loaded
16+
// Wait for the PROPFIND to complete before asserting the file row —
17+
// NC32/33 Docker containers can be slow and exceed the default 4s timeout.
18+
cy.wait('@initialFiles')
1619
getFileListRow('welcome.txt')
1720
.should('be.visible')
1821
})
@@ -38,9 +41,9 @@ describe('Check activity listing in the sidebar', { testIsolation: true }, () =>
3841

3942
it('Has share activity', () => {
4043
createPublicShare('welcome.txt')
41-
cy.visit('/apps/files')
42-
getFileListRow('welcome.txt').should('be.visible')
43-
44+
// No re-navigation needed — createPublicShare already waits for the share API
45+
// and closes the sidebar, so the activity is recorded and the page is stable.
46+
// Re-navigating triggers an async share-badge update that closes the Actions menu.
4447
showActivityTab('welcome.txt')
4548
cy.get('.activity-entry').first().should('contains.text', 'Shared as public link')
4649
})

cypress/e2e/sidebarUtils.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ export function toggleFavorite(fileName: string) {
5454
* @param fileName Name of the file to share
5555
*/
5656
export function createPublicShare(fileName: string) {
57-
cy.intercept('POST', '/ocs/v2.php/apps/files_sharing/api/v1/shares').as('createPublicShare')
58-
5957
showSidebarForFile(fileName)
6058
cy.get('#app-sidebar-vue')
6159
.findByRole('tab', { name: 'Sharing' })
@@ -71,11 +69,16 @@ export function createPublicShare(fileName: string) {
7169

7270
cy.wait('@createShare')
7371
closeSidebar()
74-
75-
cy.wait('@createPublicShare')
72+
// NC32 updates the file-row share badge asynchronously after the sidebar closes;
73+
// give Vue time to settle before the caller interacts with the file list.
74+
cy.wait(500)
7675
}
7776

7877
export function addTag(fileName: string, tag: string) {
78+
cy.get(`[data-cy-files-list-row-name="${CSS.escape(fileName)}"]`)
79+
.find('.files-list__row-icon-preview--loaded')
80+
.should('exist')
81+
7982
showSidebarForFile(fileName)
8083

8184
cy.get('#app-sidebar-vue .app-sidebar-header')

cypress/support/e2e.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
import './commands'
66

77
// Ignore resize observer errors of Chrome, they are unrelated and save to ignore
8-
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver'))
8+
// Also ignore a NC32 files-app TypeError in Electron 118 caused by a keyboard-handling
9+
// module accessing an undefined export — the page still loads correctly.
10+
Cypress.on('uncaught:exception', err =>
11+
!err.message.includes('ResizeObserver')
12+
&& !err.message.includes("Cannot read properties of undefined (reading 'Tab')")
13+
)

0 commit comments

Comments
 (0)