Skip to content

Commit a2ee2c1

Browse files
test: Update row action tests
AI-assistant: Claude Code v2.1.101 (Claude Sonnet 4.6) Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent c81ee7c commit a2ee2c1

15 files changed

Lines changed: 93 additions & 73 deletions

cypress/component/ContentReferenceWidget.cy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ describe('ContentReferenceWidget', () => {
8080
cy.reply('**/index.php/apps/tables/row/*', rowData)
8181
})
8282

83-
// Click the edit button on the first row
84-
cy.get('@rows').first().find('td.sticky button').click({ force: true })
83+
// Open the row action menu on the first row, then click Edit
84+
cy.get('@rows').first().find('[data-cy="rowActionMenu"] button').click({ force: true })
85+
cy.get('[data-cy="editRowBtn"]').click()
8586

8687
// Get the first field of the Edit Row modal
8788
cy.get('.modal__content').as('editRowModal')

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ describe('Filtering in a view by selection columns (Cypress supplement – row r
170170
// # edit checked row
171171
// ## uncheck
172172
cy.intercept({ method: 'PUT', url: '**/apps/tables/row/*' }).as('updateCheckedRow')
173-
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'checked row').closest('[data-cy="customTableRow"]').find('[data-cy="editRowBtn"]').click()
173+
cy.contains('[data-cy="ncTable"] [data-cy="customTableRow"]', 'checked row').closest('[data-cy="customTableRow"]').find('[data-cy="rowActionMenu"] button').click()
174+
cy.get('[data-cy="editRowBtn"]').click()
174175
cy.get('[data-cy="editRowModal"] .checkbox-radio-switch').click()
175176
cy.get('[data-cy="editRowSaveButton"]').click()
176177

playwright/e2e/column-datetime.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createDatetimeColumn, createTable, loadTable, removeColumn } from '../support/commands'
7+
import { createDatetimeColumn, createTable, loadTable, openRowActionMenu, removeColumn } from '../support/commands'
88

99
const columnTitle = 'date and time'
1010
const tableTitle = 'Test datetime'
@@ -32,9 +32,10 @@ test.describe('Test column ' + columnTitle, () => {
3232
await expect(page.locator('.custom-table table tr td div').filter({ hasText: '5:15' }).first()).toBeVisible()
3333

3434
// delete row
35-
await page.locator('.NcTable tr td button').first().click()
36-
await page.locator('button').filter({ hasText: 'Delete' }).click()
37-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
35+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
36+
await page.locator('[data-cy="deleteRowBtn"]').click()
37+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
38+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
3839

3940
await removeColumn(page, columnTitle)
4041
})

playwright/e2e/column-datetimeDate.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createDatetimeDateColumn, createTable, loadTable, removeColumn } from '../support/commands'
7+
import { createDatetimeDateColumn, createTable, loadTable, openRowActionMenu, removeColumn } from '../support/commands'
88

99
const columnTitle = 'date'
1010
const tableTitle = 'Test datetimeDate'
@@ -29,9 +29,10 @@ test.describe('Test column ' + columnTitle, () => {
2929
await expect(page.locator('.custom-table table tr td div').filter({ hasText: '2023' }).first()).toBeVisible()
3030

3131
// delete row
32-
await page.locator('.NcTable tr td button').first().click()
33-
await page.locator('button').filter({ hasText: 'Delete' }).click()
34-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
32+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
33+
await page.locator('[data-cy="deleteRowBtn"]').click()
34+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
35+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
3536

3637
await removeColumn(page, columnTitle)
3738
})

playwright/e2e/column-datetimeTime.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createDatetimeTimeColumn, createTable, loadTable, removeColumn } from '../support/commands'
7+
import { createDatetimeTimeColumn, createTable, loadTable, openRowActionMenu, removeColumn } from '../support/commands'
88

99
const columnTitle = 'time'
1010
const tableTitle = 'Test datetimeTime'
@@ -27,9 +27,10 @@ test.describe('Test column ' + columnTitle, () => {
2727
await expect(page.locator('.custom-table table tr td div').filter({ hasText: '5:15' }).first()).toBeVisible()
2828

2929
// delete row
30-
await page.locator('.NcTable tr td button').first().click()
31-
await page.locator('button').filter({ hasText: 'Delete' }).click()
32-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
30+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
31+
await page.locator('[data-cy="deleteRowBtn"]').click()
32+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
33+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
3334

3435
await removeColumn(page, columnTitle)
3536
})

playwright/e2e/column-number.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createNumberColumn, createTable, loadTable, removeColumn } from '../support/commands'
7+
import { createNumberColumn, createTable, loadTable, openRowActionMenu, removeColumn } from '../support/commands'
88

99
const columnTitle = 'num1'
1010
const tableTitle = 'Test number column'
@@ -26,9 +26,10 @@ test.describe('Test column number', () => {
2626
await expect(page.locator('.custom-table table tr td div').filter({ hasText: '21.00' }).first()).toBeVisible()
2727

2828
// delete row
29-
await page.locator('.NcTable tr td button').first().click()
30-
await page.locator('button').filter({ hasText: 'Delete' }).click()
31-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
29+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
30+
await page.locator('[data-cy="deleteRowBtn"]').click()
31+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
32+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
3233

3334
// insert row with float value
3435
await page.locator('button').filter({ hasText: 'Create row' }).click()
@@ -38,9 +39,10 @@ test.describe('Test column number', () => {
3839
await expect(page.locator('.custom-table table tr td div').filter({ hasText: '21.30' }).first()).toBeVisible()
3940

4041
// delete row
41-
await page.locator('.NcTable tr td button').first().click()
42-
await page.locator('button').filter({ hasText: 'Delete' }).click()
43-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
42+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
43+
await page.locator('[data-cy="deleteRowBtn"]').click()
44+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
45+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
4446

4547
await removeColumn(page, columnTitle)
4648
})

playwright/e2e/column-selection-multi.spec.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createSelectionMultiColumn, createTable, loadTable, removeColumn } from '../support/commands'
7+
import { createSelectionMultiColumn, createTable, loadTable, openRowActionMenu, removeColumn } from '../support/commands'
88

99
const columnTitle = 'multi selection'
1010
const tableTitle = 'Test number column'
@@ -42,15 +42,17 @@ test.describe('Test column ' + columnTitle, () => {
4242
await expect(page.locator('.custom-table table tr td .cell-multi-selection').filter({ hasText: 'third option' }).first()).toBeVisible()
4343

4444
// delete first row
45-
await page.locator('.NcTable tr td button').first().click()
46-
await page.locator('button').filter({ hasText: 'Delete' }).click()
47-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
45+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
46+
await page.locator('[data-cy="deleteRowBtn"]').click()
47+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
48+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(1, { timeout: 10000 })
4849

4950
await expect(page.locator('.custom-table table tr td .cell-multi-selection', { hasText: 'first option' })).toBeHidden()
5051
await expect(page.locator('.custom-table table tr td .cell-multi-selection', { hasText: 'second option' })).toBeHidden()
5152

5253
// edit second row (which is now first row)
53-
await page.locator('.NcTable tr td button').first().click()
54+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
55+
await page.locator('[data-cy="editRowBtn"]').click()
5456
await page.locator('.modal__content .slot input').first().click()
5557
await page.locator('ul.vs__dropdown-menu li span[title="first option"]').first().click()
5658
await page.locator('.modal__content .title').first().click()
@@ -60,9 +62,10 @@ test.describe('Test column ' + columnTitle, () => {
6062
await expect(page.locator('.custom-table table tr td .cell-multi-selection').filter({ hasText: 'third option' }).first()).toBeVisible()
6163

6264
// delete first row
63-
await page.locator('.NcTable tr td button').first().click()
64-
await page.locator('button').filter({ hasText: 'Delete' }).click()
65-
await page.locator('button').filter({ hasText: /I really/ }).click({ force: true })
65+
await openRowActionMenu(page, page.locator('[data-cy="customTableRow"]').first())
66+
await page.locator('[data-cy="deleteRowBtn"]').click()
67+
await page.locator('[data-cy="confirmDialog"]').getByRole('button', { name: 'Confirm' }).click()
68+
await expect(page.locator('[data-cy="customTableRow"]')).toHaveCount(0, { timeout: 10000 })
6669

6770
await removeColumn(page, columnTitle)
6871
})
@@ -79,6 +82,6 @@ test.describe('Test column ' + columnTitle, () => {
7982
await page.locator('button').filter({ hasText: 'Save' }).click()
8083

8184
await expect(page.locator('.custom-table table tr td .cell-multi-selection').first()).toBeVisible()
82-
await expect(page.locator('.NcTable tr td button').first()).toBeVisible()
85+
await expect(page.locator('[data-cy="customTableRow"]').first()).toBeVisible()
8386
})
8487
})

playwright/e2e/column-selection.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { test, expect } from '../support/fixtures'
7-
import { createSelectionColumn, createTable, deleteTable, loadTable } from '../support/commands'
7+
import { createSelectionColumn, createTable, deleteTable, loadTable, openRowActionMenu } from '../support/commands'
88

99
const columnTitle = 'single selection'
1010
const tableTitle = 'Test number column'
@@ -37,7 +37,9 @@ test.describe('Test column ' + columnTitle, () => {
3737
await expect(page.locator('[data-cy="ncTable"] tr td div').filter({ hasText: 'third option' }).first()).toBeVisible()
3838

3939
// edit the explicitly created row
40-
await page.locator('[data-cy="ncTable"] [data-cy="customTableRow"]:has-text("👋 third option")').locator('[data-cy="editRowBtn"]').click()
40+
const thirdOptionRow = page.locator('[data-cy="ncTable"] [data-cy="customTableRow"]').filter({ hasText: '👋 third option' }).first()
41+
await openRowActionMenu(page, thirdOptionRow)
42+
await page.locator('[data-cy="editRowBtn"]').click()
4143
await page.locator('[data-cy="editRowModal"] .slot input').first().click()
4244
await page.locator('ul.vs__dropdown-menu li span[title="first option"]').first().click()
4345
await page.locator('[data-cy="editRowSaveButton"]').click()
@@ -59,6 +61,6 @@ test.describe('Test column ' + columnTitle, () => {
5961
await page.locator('[data-cy="createRowSaveButton"]').click()
6062

6163
await expect(page.locator('[data-cy="ncTable"] tr td div').first()).toBeVisible()
62-
await expect(page.locator('[data-cy="ncTable"] [data-cy="editRowBtn"]').first()).toBeVisible()
64+
await expect(page.locator('[data-cy="ncTable"] [data-cy="customTableRow"]').first()).toBeVisible()
6365
})
6466
})

playwright/e2e/column-text-link.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as fs from 'fs'
88
import * as path from 'path'
99
import { fileURLToPath } from 'url'
1010
import { uploadFile } from '../support/api'
11-
import { createTable, createTextLinkColumn, loadTable } from '../support/commands'
11+
import { createTable, createTextLinkColumn, loadTable, openRowActionMenu } from '../support/commands'
1212
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1313

1414
test.describe('Test column text-link', () => {
@@ -44,7 +44,9 @@ test.describe('Test column text-link', () => {
4444
await expect(page.locator('tr td a').filter({ hasText: 'nextcloud' }).first()).toBeVisible()
4545
await expect(page.locator('tr td a').filter({ hasText: 'NC_server_test' }).first()).toBeVisible()
4646

47-
await page.locator('[data-cy="ncTable"] [data-cy="editRowBtn"]').first().click({ force: true })
47+
const firstRow = page.locator('[data-cy="ncTable"] [data-cy="customTableRow"]').first()
48+
await openRowActionMenu(page, firstRow)
49+
await page.locator('[data-cy="editRowBtn"]').click()
4850
const editDialog = page.getByRole('dialog', { name: 'Edit row' })
4951
await editDialog.waitFor({ state: 'visible' })
5052

playwright/e2e/column-usergroup.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { test, expect } from '../support/fixtures'
77
import { createRandomUser } from '../support/api'
8-
import { createTable, createUsergroupColumn, loadTable } from '../support/commands'
8+
import { createTable, createUsergroupColumn, loadTable, openRowActionMenu } from '../support/commands'
99

1010
const columnTitle = 'usergroup'
1111
const tableTitlePrefix = 'Test usergroup'
@@ -59,7 +59,9 @@ test.describe('Test column ' + columnTitle, () => {
5959
await page.locator('[data-cy="createRowSaveButton"]').click()
6060
await expect(page.locator('[data-cy="ncTable"] table tr td .user-bubble__name').filter({ hasText: user.userId }).first()).toBeVisible()
6161

62-
await page.locator('[data-cy="ncTable"] [data-cy="editRowBtn"]').first().click()
62+
const firstRow = page.locator('[data-cy="ncTable"] [data-cy="customTableRow"]').first()
63+
await openRowActionMenu(page, firstRow)
64+
await page.locator('[data-cy="editRowBtn"]').click()
6365
// deselect all
6466
const deselectButtons = await page.locator('[data-cy="usergroupRowSelect"] .vs__deselect').all()
6567
for (const button of deselectButtons) {

0 commit comments

Comments
 (0)