diff --git a/integration/src/browser/edit-community.spec.ts b/integration/src/browser/edit-community.spec.ts new file mode 100644 index 00000000..3f31e469 --- /dev/null +++ b/integration/src/browser/edit-community.spec.ts @@ -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(); + }, +); diff --git a/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-Desktop-Chrome-linux.png b/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-Desktop-Chrome-linux.png new file mode 100644 index 00000000..fd6e8b1e --- /dev/null +++ b/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-Desktop-Chrome-linux.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:157c9ea88c4d8b3a4ab06cb6305e1b1b7a0ecc1ba298cdd84aef74fc708c3b8c +size 177015 diff --git a/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-iPhone-11-linux.png b/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-iPhone-11-linux.png new file mode 100644 index 00000000..56366c44 --- /dev/null +++ b/integration/src/browser/edit-community.spec.ts-snapshots/edit-button-iPhone-11-linux.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f364acb5fb325915bc5b67320854f335358f1bb11319ffb3b8b21751fdbd91c +size 273796 diff --git a/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-Desktop-Chrome-linux.png b/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-Desktop-Chrome-linux.png new file mode 100644 index 00000000..7a8f03e3 --- /dev/null +++ b/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-Desktop-Chrome-linux.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:654854e56586524d54d6d3a221705c2ff9b63a2511a675a5b915e7e269fbda3f +size 75715 diff --git a/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-iPhone-11-linux.png b/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-iPhone-11-linux.png new file mode 100644 index 00000000..27e521b6 --- /dev/null +++ b/integration/src/browser/edit-community.spec.ts-snapshots/edit-page-iPhone-11-linux.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33f46cd62869e2837cbcfdc9790a3c4235f609bee7ec1c9eb0dc2cda42bb74f5 +size 166366 diff --git a/src/frontend/components/Community.js b/src/frontend/components/Community.js index c85381b6..2736add5 100644 --- a/src/frontend/components/Community.js +++ b/src/frontend/components/Community.js @@ -295,6 +295,7 @@ export default function Community(props) { {isOwner ? (