-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(integration): add cases for editing a community
This change adds test cases for seeing or not the edit community button. I've had to add a label to the button to select it, which also helps make it a little more accessible. Refs #388, #431
- Loading branch information
1 parent
572d696
commit fa31ef1
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { expect, test } from './test'; | ||
import { screenshot } from './utils'; | ||
|
||
test.asACommunityModerator( | ||
'can edit a community', | ||
async ({ community, page }) => { | ||
await page.goto(`/communities/${community.slug}`); | ||
|
||
const editButton = page.locator('[aria-label="Edit this community"]'); | ||
|
||
await expect(editButton).toBeVisible(); | ||
expect(await screenshot(page, editButton)).toMatchSnapshot( | ||
'edit-button.png', | ||
); | ||
|
||
await editButton.click(); | ||
|
||
const editForm = page.locator('form'); | ||
|
||
await expect(editForm).toContainText('Enter a description'); | ||
expect(await screenshot(page, editForm)).toMatchSnapshot('edit-page.png'); | ||
}, | ||
); | ||
|
||
test.asACommunityMember( | ||
'cannot edit a community', | ||
async ({ community, page }) => { | ||
await page.goto(`/communities/${community.slug}`); | ||
|
||
const editButton = page.locator('[aria-label="Edit this community"]'); | ||
|
||
await expect(page.locator('body')).toContainText(community.name); | ||
await expect(editButton).not.toBeVisible(); | ||
}, | ||
); |
3 changes: 3 additions & 0 deletions
3
...c/browser/edit-community.spec.ts-snapshots/edit-button-Desktop-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...on/src/browser/edit-community.spec.ts-snapshots/edit-button-iPhone-11-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...src/browser/edit-community.spec.ts-snapshots/edit-page-Desktop-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...tion/src/browser/edit-community.spec.ts-snapshots/edit-page-iPhone-11-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters