mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-11-16 14:42:32 -06:00
test(project-sharing): pin keyboard sharing, removal cancel and row details
Before splitting UserTeam, cover what the lifecycle spec left out: Enter on Share keeps focus on the button, cancelling the remove dialog keeps the share, team rows link to the team page and the current user's row is marked "You".
This commit is contained in:
@@ -18,14 +18,25 @@ for (const kind of ['user', 'team'] as const) {
|
||||
await section.getByRole('combobox', {name: `Search for a ${kind} to share this project with`}).pressSequentially(name, {delay: 10})
|
||||
await expect(section.locator('.search-results').getByRole('option').first()).toContainText(name)
|
||||
await section.locator('.search-results').getByRole('option').first().click()
|
||||
await section.getByRole('button', {name: 'Share', exact: true}).click()
|
||||
const share = section.getByRole('button', {name: 'Share', exact: true})
|
||||
await share.focus()
|
||||
await share.press('Enter')
|
||||
const row = section.getByRole('row').filter({hasText: name})
|
||||
await expect(row).toBeVisible()
|
||||
await expect(share).toBeFocused()
|
||||
if (kind === 'team') {
|
||||
await expect(row.getByRole('link', {name})).toHaveAttribute('href', `/teams/${team.id}/edit`)
|
||||
}
|
||||
await row.getByRole('combobox').selectOption('1')
|
||||
await expect(row.locator('td.type')).toHaveText('Read & write')
|
||||
await page.reload()
|
||||
await expect(row.locator('td.type')).toHaveText('Read & write')
|
||||
await row.getByRole('button', {name: `Remove this ${kind}`}).click()
|
||||
const removeDialog = page.getByRole('dialog', {name: `Remove a ${kind} from the List`})
|
||||
await removeDialog.getByRole('button', {name: 'Cancel', exact: true}).click()
|
||||
await expect(removeDialog).toHaveCount(0)
|
||||
await expect(row).toBeVisible()
|
||||
await row.getByRole('button', {name: `Remove this ${kind}`}).click()
|
||||
await page.locator('dialog[open]').getByRole('button', {name: 'Do it!'}).click()
|
||||
await expect(row).toHaveCount(0)
|
||||
await page.reload()
|
||||
@@ -59,7 +70,7 @@ test('read-only members cannot manage shares', async ({page, apiContext}) => {
|
||||
await login(page, apiContext, reader)
|
||||
await page.goto('/projects/1/settings/share')
|
||||
const section = page.getByRole('heading', {name: 'Shared with these users', exact: true}).locator('..')
|
||||
await expect(section.getByRole('row').filter({hasText: reader.username})).toBeVisible()
|
||||
await expect(section.getByRole('row').filter({hasText: reader.username}).getByText('You', {exact: true})).toBeVisible()
|
||||
await expect(section.getByRole('combobox', {name: 'Search for a user to share this project with'})).toHaveCount(0)
|
||||
await expect(section.getByRole('button', {name: 'Share', exact: true})).toHaveCount(0)
|
||||
await expect(section.getByRole('button', {name: 'Remove this user'})).toHaveCount(0)
|
||||
|
||||
Reference in New Issue
Block a user