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
42 changes: 42 additions & 0 deletions playwright/e2e/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,48 @@
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 tableResponse = await ocsRequest(page.request, user, { method: 'POST', url: '/index.php/apps/tables/api/1/tables', data: { title: 'Requests' } })
const table = await tableResponse.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: table.id },
{ label: 'Docs', targetType: 'url', url: 'https://docs.nextcloud.com' },
],
},
})
const context = (await contextResponse.json()).ocs.data

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

const stats = page.locator('[data-cy="context-stats"]')
await expect(stats).toContainText('1 page')
await expect(stats).toContainText('1 table')
await expect(stats).toContainText('1 member')
const row = page.locator('[data-cy="context-table-row"]').filter({ hasText: 'Requests' })
await expect(row).toContainText('All requests')
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}`)
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('A page with widgets added on the overview gets a menu entry and opens in edit mode', async ({ userPage: { page } }) => {
await page.goto('/index.php/apps/tables')
await createContext(page, 'overview application')
Expand Down Expand Up @@ -171,7 +213,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 216 in playwright/e2e/application.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

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

2) [chromium] › playwright/e2e/application.spec.ts:194: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 214 | const saveResponse = page.waitForResponse(response => response.url().includes('/apps/tables/api/2/contexts/') && response.request().method() === 'PUT') 215 | await page.locator('[data-cy="context-menu-save"]').click() > 216 | expect((await saveResponse).status()).toBe(200) | ^ 217 | 218 | await page.reload() 219 | const items = page.locator('[data-cy="context-menu-preview-item"]') at /home/runner/work/tables/tables/playwright/e2e/application.spec.ts:216:41

await page.reload()
const items = page.locator('[data-cy="context-menu-preview-item"]')
Expand Down
Loading
Loading