Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions playwright/e2e/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,55 @@
await expect(page.locator('h1', { hasText: tableTitle })).toBeVisible({ timeout: 30000 })
})

test('The overview lists the tables the application uses, its members and its counts', async ({ userPage: { page, user } }) => {
const requests = await (await ocsRequest(page.request, user, { method: 'POST', url: '/index.php/apps/tables/api/1/tables', data: { title: 'Requests' } })).json()
const invoices = await (await ocsRequest(page.request, user, { method: 'POST', url: '/index.php/apps/tables/api/1/tables', data: { title: 'Invoices' } })).json()
const contextResponse = await ocsRequest(page.request, user, {
method: 'POST',
url: `${API}/contexts?format=json`,
data: {
name: 'used tables application',
iconName: 'star',
menuItems: [
{ label: 'All requests', targetType: 'table', targetId: requests.id },
{ label: 'Docs', targetType: 'url', url: 'https://docs.nextcloud.com' },
],
},
})
const context = (await contextResponse.json()).ocs.data
// A data widget on a grid page adds its table to the application
const billingPageId = (await (await ocsRequest(page.request, user, { method: 'POST', url: `${API}/contexts/${context.id}/pages?format=json`, data: { title: 'Billing' } })).json()).ocs.data.id
await ocsRequest(page.request, user, {
method: 'PATCH',
url: `${API}/contexts/${context.id}/pages/${billingPageId}?format=json`,
data: { widgets: [{ type: 'data', gridX: 0, gridY: 0, gridWidth: 12, gridHeight: 5, source: { nodeType: 0, nodeId: invoices.id } }] },
})

await page.goto(`/index.php/apps/tables/#/application/${context.id}/overview`)

const stats = page.locator('[data-cy="context-stats"]')
await expect(stats).toContainText('2 pages')
await expect(stats).toContainText('2 tables')
await expect(stats).toContainText('1 member')
await expect(page.locator('[data-cy="context-table-row"]').filter({ hasText: 'Requests' })).toContainText('All requests')
await expect(page.locator('[data-cy="context-table-row"]').filter({ hasText: 'Invoices' })).toContainText('Billing')
await expect(page.locator('[data-cy="context-members-list"]')).toContainText('Owner')
})

test('An application with many pages gets a filter for them', async ({ userPage: { page, user } }) => {
const contextId = await createEmptyApplication(page.request, user, 'many pages application')
for (const title of ['Intake', 'Planning', 'Reports', 'Archive', 'Invoices', 'Contacts', 'Settings']) {
await ocsRequest(page.request, user, { method: 'POST', url: `${API}/contexts/${contextId}/pages?format=json`, data: { title } })
}

await page.goto(`/index.php/apps/tables/#/application/${contextId}/overview`)
await expect(page.locator('[data-cy="page-card"]')).toHaveCount(8)
await page.getByRole('textbox', { name: 'Filter pages' }).fill('voic')

await expect(page.locator('[data-cy="page-card"]')).toHaveCount(1)
await expect(page.locator('[data-cy="page-card"]')).toContainText('Invoices')
})

test('The overview lists the pages; a page added there gets a menu entry and opens in edit mode', async ({ userPage: { page, user } }) => {
const contextResponse = await ocsRequest(page.request, user, { method: 'POST', url: `${API}/contexts?format=json`, data: { name: 'overview application', iconName: 'star' } })
const contextId = (await contextResponse.json()).ocs.data.id
Expand Down Expand Up @@ -189,7 +238,7 @@

const saveResponse = page.waitForResponse(response => response.url().includes('/apps/tables/api/2/contexts/') && response.request().method() === 'PUT')
await page.locator('[data-cy="context-menu-save"]').click()
expect((await saveResponse).status()).toBe(200)

Check failure on line 241 in playwright/e2e/application.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/application.spec.ts:219:2 › Applications › A menu entry is reordered with its buttons

1) [chromium] › playwright/e2e/application.spec.ts:219:2 › Applications › A menu entry is reordered with its buttons, sits under another one and keeps its place after a reload Error: expect(received).toBe(expected) // Object.is equality Expected: 200 Received: 500 239 | const saveResponse = page.waitForResponse(response => response.url().includes('/apps/tables/api/2/contexts/') && response.request().method() === 'PUT') 240 | await page.locator('[data-cy="context-menu-save"]').click() > 241 | expect((await saveResponse).status()).toBe(200) | ^ 242 | 243 | await page.reload() 244 | const items = page.locator('[data-cy="context-menu-preview-item"]') at /home/runner/work/tables/tables/playwright/e2e/application.spec.ts:241:41

await page.reload()
const items = page.locator('[data-cy="context-menu-preview-item"]')
Expand Down Expand Up @@ -377,6 +426,6 @@
const importResponse = page.waitForResponse(r => r.url().includes('/scheme/import') && r.request().method() === 'POST')
await dialog.getByRole('button', { name: 'Import' }).click()
const response = await importResponse
await expect(dialog).toContainText('Import completed successfully.')

Check failure on line 429 in playwright/e2e/application.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable34)

[chromium] › playwright/e2e/application.spec.ts:274:2 › Applications › A scheme imported through the dialog brings its menu and its pages

1) [chromium] › playwright/e2e/application.spec.ts:274:2 › Applications › A scheme imported through the dialog brings its menu and its pages Error: expect(locator).toContainText(expected) failed Locator: getByRole('dialog', { name: /application scheme/ }) Expected substring: "Import completed successfully." Received string: "Import application schemeFailedCould not import scheme due to unknown errors.Done" Timeout: 30000ms Call log: - Expect "toContainText" getByRole('dialog', { name: /application scheme/ }) with timeout 30000ms - waiting for getByRole('dialog', { name: /application scheme/ }) 63 × locator resolved to <div role="dialog" tabindex="-1" aria-modal="true" data-v-c6039372="" data-v-adda232f="" data-v-789e3d11="" data-v-owner="130" aria-labelledby="nc-vue-13" class="dialog__modal modal-mask" aria-describedby="modal-description-nc-vue-14">…</div> - unexpected value "Import application schemeFailedCould not import scheme due to unknown errors.Done" 427 | await dialog.getByRole('button', { name: 'Import' }).click() 428 | const response = await importResponse > 429 | await expect(dialog).toContainText('Import completed successfully.') | ^ 430 | return response 431 | } 432 | at importThroughDialog (/home/runner/work/tables/tables/playwright/e2e/application.spec.ts:429:23) at /home/runner/work/tables/tables/playwright/e2e/application.spec.ts:279:20
return response
}
Loading
Loading