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
23 changes: 17 additions & 6 deletions playwright/e2e/context-navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@
*/

import { test, expect } from '../support/fixtures'
import type { Page } from '@playwright/test'
import { createContext, ensureNavigationOpen } from '../support/commands'

function appMenuEntry(page: import('@playwright/test').Page, contextTitle: string) {
return page
.locator('nav[aria-label="Applications menu"]')
.locator(`[title="${contextTitle}"]`)
// Returns the locator for an app menu entry, opening the NC34 waffle popover first if needed.
async function getAppMenuEntry(page: Page, contextTitle: string) {
const waffleBtn = page.locator('button.app-menu__waffle')
if (await waffleBtn.isVisible().catch(() => false)) {
// NC34+: app entries live inside a popover opened by the waffle button
const isExpanded = await waffleBtn.getAttribute('aria-expanded').catch(() => null)
if (isExpanded !== 'true') {
await waffleBtn.click()
await page.waitForTimeout(300)
}
return page.locator(`.app-menu__grid .app-item[title="${contextTitle}"]`)
}
// NC33: entries are always visible inline in the header nav
return page.locator('nav[aria-label="Applications menu"]').locator(`[title="${contextTitle}"]`)
}

test.describe('Test context navigation', () => {
Expand All @@ -21,7 +32,7 @@ test.describe('Test context navigation', () => {
await createContext(page, contextTitle, false)
await page.reload({ waitUntil: 'domcontentloaded' })
await ensureNavigationOpen(page)
await expect(appMenuEntry(page, contextTitle)).toBeHidden()
await expect(await getAppMenuEntry(page, contextTitle)).toBeHidden()

const contextButton = page
.locator('[data-cy="navigationContextItem"]')
Expand Down Expand Up @@ -49,6 +60,6 @@ test.describe('Test context navigation', () => {
page.locator('[data-cy="navigationContextShowInNavSwitch"] input'),
).toBeChecked()

await expect(appMenuEntry(page, contextTitle)).toBeVisible()
await expect(await getAppMenuEntry(page, contextTitle)).toBeVisible()
})
})
16 changes: 11 additions & 5 deletions playwright/e2e/tables-sharing-link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { test, expect } from '../support/fixtures'
import type { Page } from '@playwright/test'
import type { Page, Response } from '@playwright/test'
import { loadTable } from '../support/commands'

async function setupPublicShareTable(page: Page, title: string) {
Expand Down Expand Up @@ -55,32 +55,38 @@
return shareToken as string
}

const isPermissionsPut = (r: Response) =>
r.url().includes('/share/') && r.url().includes('/permissions') && r.request().method() === 'PUT'

async function setSharePermissions(page: Page, permissions: { read?: boolean, create?: boolean, update?: boolean, delete?: boolean }) {
const isCanEdit = permissions.read && permissions.create && permissions.update && permissions.delete
const isViewOnly = permissions.read && !permissions.create && !permissions.update && !permissions.delete

await page.locator('.share-permission-select .action-item__menutoggle').click()

if (isCanEdit) {
// Register listener before click to avoid missing the response on fast servers
const permResponse = page.waitForResponse(isPermissionsPut)
await page.locator('button[role="menuitemradio"]').filter({ hasText: 'Can edit' }).click()
await permResponse
} else if (isViewOnly) {
const permResponse = page.waitForResponse(isPermissionsPut)
await page.locator('button[role="menuitemradio"]').filter({ hasText: 'View only' }).click()
await permResponse
} else {
await page.locator('button[role="menuitemradio"]').filter({ hasText: 'Custom permissions' }).click()
for (const [key, value] of Object.entries(permissions)) {
if (value === undefined) continue
const checkbox = page.locator(`[data-cy="sharePermission${key.charAt(0).toUpperCase() + key.slice(1)}"] input[type="checkbox"]`)
const isChecked = await checkbox.isChecked()
if (isChecked !== value) {
const permResponse = page.waitForResponse(isPermissionsPut)
await checkbox.click({ force: true })
await page.waitForResponse(r => r.url().includes('/share/') && r.url().includes('/permissions') && r.request().method() === 'PUT')
await permResponse
await page.waitForResponse(r => r.url().includes('/apps/tables/share/') && r.request().method() === 'GET')
}
}
return
}

await page.waitForResponse(r => r.url().includes('/share/') && r.url().includes('/permissions') && r.request().method() === 'PUT')
}

test.describe('Public link sharing', () => {
Expand Down Expand Up @@ -198,7 +204,7 @@
await expect(publicPage.locator('[data-cy="createRowModal"]')).toBeVisible()
await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing')
await publicPage.locator('[data-cy="createRowSaveButton"]').click()
await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible()

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

Check failure on line 207 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create

1) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:186:2 › Public link sharing › Can edit public share allows create, edit and delete rows Error: expect(locator).toBeVisible() failed Locator: locator('[data-cy="ncTable"]').getByText('Test row for editing') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('[data-cy="ncTable"]').getByText('Test row for editing') 205 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Test row for editing') 206 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 207 | await expect(publicPage.locator('[data-cy="ncTable"]').getByText('Test row for editing')).toBeVisible() | ^ 208 | 209 | // Verify edit button exists and edit the row 210 | await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible() at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:207:93

// Verify edit button exists and edit the row
await expect(publicPage.locator('[data-cy="editRowBtn"]').last()).toBeVisible()
Expand Down Expand Up @@ -240,7 +246,7 @@
await expect(publicPage.locator('[data-cy="createRowModal"]')).toBeVisible()
await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission')
await publicPage.locator('[data-cy="createRowSaveButton"]').click()
await expect(publicPage.locator('.toastify.toast-success')).toBeVisible()

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (stable33)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63

Check failure on line 249 in playwright/e2e/tables-sharing-link.spec.ts

View workflow job for this annotation

GitHub Actions / Playwright (master)

[chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting

2) [chromium] › playwright/e2e/tables-sharing-link.spec.ts:229:2 › Public link sharing › Create only public share shows form mode and allows submitting Error: expect(locator).toBeVisible() failed Locator: locator('.toastify.toast-success') Expected: visible Timeout: 5000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 5000ms - waiting for locator('.toastify.toast-success') 247 | await publicPage.locator('[data-cy="createRowModal"]').getByRole('textbox').first().fill('Form submission') 248 | await publicPage.locator('[data-cy="createRowSaveButton"]').click() > 249 | await expect(publicPage.locator('.toastify.toast-success')).toBeVisible() | ^ 250 | await publicContext.close() 251 | 252 | await page.goto('/index.php/apps/tables') at /home/runner/work/tables/tables/playwright/e2e/tables-sharing-link.spec.ts:249:63
await publicContext.close()

await page.goto('/index.php/apps/tables')
Expand Down
Loading