Skip to content

Commit 8607112

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/1840-expose-columns
2 parents 1da66b6 + 9ff8e52 commit 8607112

File tree

6 files changed

+451
-370
lines changed

6 files changed

+451
-370
lines changed

.github/workflows/pr-feedback.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
blocklist=$(curl https://raw.githubusercontent.com/nextcloud/.github/master/non-community-usernames.txt | paste -s -d, -)
3737
echo "blocklist=$blocklist" >> "$GITHUB_OUTPUT"
3838
39-
- uses: nextcloud/pr-feedback-action@e397f3c7e655092b746e3610d121545530c6a90e # main
39+
- uses: nextcloud/pr-feedback-action@5227c55be184087d0aef6338bee210d8620b6297 # main
4040
with:
4141
feedback-message: |
4242
Hello there,

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cypress/e2e/tables-import.cy.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,26 @@ describe('Import csv', () => {
104104
})
105105

106106
describe('Import csv from Files file action', () => {
107+
const rowActionsButton = '[data-cy-files-list-row-name="test-import.csv"] [data-cy-files-list-row-actions] .action-item button'
108+
const importToTablesAction = '[data-cy-files-list-row-action="import-to-tables"]'
109+
110+
const openImportToTablesAction = (retries = 8) => {
111+
cy.get(rowActionsButton).click()
112+
cy.get('body').then($body => {
113+
if ($body.find(importToTablesAction).length > 0) {
114+
cy.get(importToTablesAction).first().click()
115+
return
116+
}
117+
118+
if (retries <= 0) {
119+
throw new Error('Import to Tables action did not become available in file actions menu')
120+
}
121+
122+
cy.get('body').click(0, 0)
123+
cy.wait(1000)
124+
openImportToTablesAction(retries - 1)
125+
})
126+
}
107127

108128
before(function() {
109129
cy.createRandomUser().then(user => {
@@ -115,15 +135,12 @@ describe('Import csv from Files file action', () => {
115135

116136
beforeEach(function() {
117137
cy.login(localUser)
118-
// Tables file actions register via init script; wait for the bundle before opening menus.
119-
cy.intercept({ method: 'GET', url: '**/tables-files*' }).as('tablesFilesBundle')
120-
cy.visit('apps/files/files')
121-
cy.wait('@tablesFilesBundle', { timeout: 120000 })
138+
cy.visit('apps/files/files', { timeout: 120000 })
139+
cy.get('[data-cy-files-list-row-name="test-import.csv"]', { timeout: 120000 }).should('be.visible')
122140
})
123141

124142
it('Import to new table', () => {
125-
cy.get('[data-cy-files-list-row-name="test-import.csv"] [data-cy-files-list-row-actions] .action-item button').click()
126-
cy.get('[data-cy-files-list-row-action="import-to-tables"]').click()
143+
openImportToTablesAction()
127144

128145
cy.intercept({
129146
method: 'POST',
@@ -141,8 +158,7 @@ describe('Import csv from Files file action', () => {
141158
})
142159

143160
it('Import to existing table', () => {
144-
cy.get('[data-cy-files-list-row-name="test-import.csv"] [data-cy-files-list-row-actions] .action-item button').click()
145-
cy.get('[data-cy-files-list-row-action="import-to-tables"]').click()
161+
openImportToTablesAction()
146162

147163
cy.get('.modal__content [data-cy="importAsNewTableSwitch"] input').uncheck({ force: true })
148164
cy.get('[data-cy="selectExistingTableDropdown"]').type('Welcome to Nextcloud Tables!')

cypress/e2e/view-filtering-selection-row-removal.cy.js

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,31 @@ describe('Filtering in a view by selection columns (Cypress supplement – row r
8585
})
8686

8787
it('Filter view remove row when it no longer matches filter', () => {
88+
const waitForRowPresenceCheck = (alias, rowId, expectedPresent, retries = 20) => {
89+
cy.wait(alias, { timeout: 20000 }).then(({ request, response }) => {
90+
if (request.url.includes(`/row/${rowId}/present`)) {
91+
if (response.body.present === expectedPresent) {
92+
return
93+
}
94+
95+
if (retries <= 0) {
96+
expect(response.body.present).to.equal(expectedPresent)
97+
}
98+
99+
waitForRowPresenceCheck(alias, rowId, expectedPresent, retries - 1)
100+
return
101+
}
102+
103+
if (retries <= 0) {
104+
throw new Error(`Did not receive /present check for row ${rowId}`)
105+
}
106+
107+
waitForRowPresenceCheck(alias, rowId, expectedPresent, retries - 1)
108+
})
109+
}
110+
111+
let checkedRowId = null
112+
88113
// # create view with filter
89114
// ## create view and set title
90115
const title = 'Filter for check enabled'
@@ -110,30 +135,32 @@ describe('Filtering in a view by selection columns (Cypress supplement – row r
110135
cy.contains('.app-navigation-entry-link span', title).should('exist')
111136

112137
// # insert a checked row
138+
cy.intercept({ method: 'POST', url: '**/apps/tables/api/2/views/*/rows' }).as('insertRowInView')
139+
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresentChecked')
113140
cy.get('[data-cy="createRowBtn"]').click()
114141
cy.fillInValueTextLine('title', 'checked row')
115142
cy.fillInValueSelectionCheck('check')
116-
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresent')
117143
cy.get('[data-cy="createRowSaveButton"]').click()
118144

119-
// ## check server response for /view/{viewId}/row/{id}/present
120-
cy.wait('@isRowInViewPresent').then(({ response: { body: { present } } }) => {
121-
expect(present).to.equal(true)
145+
cy.wait('@insertRowInView').then(({ response }) => {
146+
checkedRowId = response.body.ocs.data.id
147+
waitForRowPresenceCheck('@isRowInViewPresentChecked', checkedRowId, true)
122148
})
123149

124150
// ## check if row is visible
125151
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'checked row').should('be.visible')
126152
cy.get('[data-cy="createRowModal"]').should('not.exist')
127153

128154
// # insert a unchecked row
155+
cy.intercept({ method: 'POST', url: '**/apps/tables/api/2/views/*/rows' }).as('insertUncheckedRowInView')
156+
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresentUnchecked')
129157
cy.get('[data-cy="createRowBtn"]').click()
130158
cy.fillInValueTextLine('title', 'unchecked row')
131-
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresent')
132159
cy.get('[data-cy="createRowSaveButton"]').click()
133160

134-
// ## check server response for /view/{viewId}/row/{id}/present
135-
cy.wait('@isRowInViewPresent').then(({ response: { body: { present } } }) => {
136-
expect(present).to.equal(false)
161+
cy.wait('@insertUncheckedRowInView').then(({ response }) => {
162+
const uncheckedRowId = response.body.ocs.data.id
163+
waitForRowPresenceCheck('@isRowInViewPresentUnchecked', uncheckedRowId, false)
137164
})
138165

139166
// ## check if row does not exist
@@ -142,29 +169,23 @@ describe('Filtering in a view by selection columns (Cypress supplement – row r
142169

143170
// # edit checked row
144171
// ## uncheck
172+
cy.intercept({ method: 'PUT', url: '**/apps/tables/row/*' }).as('updateCheckedRow')
145173
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'checked row').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
146174
cy.get('[data-cy="editRowModal"] .checkbox-radio-switch').click()
147-
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresent')
148175
cy.get('[data-cy="editRowSaveButton"]').click()
149176

150-
// ## check server response for /view/{viewId}/row/{id}/present
151-
cy.wait('@isRowInViewPresent').then(({ response: { body: { present } } }) => {
152-
expect(present).to.equal(false)
153-
})
177+
cy.wait('@updateCheckedRow')
154178

155179
// ## check if row does not exist
156180
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'checked row').should('not.exist')
157181
cy.get('[data-cy="editRowModal"]').should('not.exist')
158182

159183
// # inline edit row
160184
// ## uncheck row
161-
cy.intercept({ method: 'GET', url: '**/apps/tables/view/*/row/*/present' }).as('isRowInViewPresent')
185+
cy.intercept({ method: 'PUT', url: '**/apps/tables/row/*' }).as('inlineUpdateRow')
162186
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'first row').closest('[data-cy="customTableRow"]').find('.inline-editing-container input').click({ force: true })
163187

164-
// ## check server response for /view/{viewId}/row/{id}/present
165-
cy.wait('@isRowInViewPresent').then(({ response: { body: { present } } }) => {
166-
expect(present).to.equal(false)
167-
})
188+
cy.wait('@inlineUpdateRow')
168189

169190
// ## check if row does not exist
170191
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'first row').should('not.exist')

0 commit comments

Comments
 (0)