Skip to content
Merged
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
18 changes: 13 additions & 5 deletions apps/meteor/tests/e2e/rooms-join.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ test.describe.serial('Join rooms', () => {
let targetChannel: string;
let poHomeChannel: HomeChannel;

test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
// Set the precondition explicitly instead of relying on the previous block's `afterAll`
// to have restored the permission. That cross-block coupling is racy: if the restore
// hasn't propagated, the user lands on the "not subscribed" screen and the composer's
// Join button never renders.
test.beforeAll(async ({ api }) => {
await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] });
});

test.beforeEach(async ({ api }) => {
Expand All @@ -66,7 +70,9 @@ test.describe.serial('Join rooms', () => {

test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
await page.goto(`/channel/${targetChannel}`);
// `gotoChannel` waits for the room to finish loading, so the Join-button assertion
// below doesn't race the preview render.
await poHomeChannel.gotoChannel(targetChannel);
});

test.afterEach(async ({ api }) => {
Expand All @@ -93,15 +99,17 @@ test.describe.serial('Join rooms', () => {
let discussion: Record<string, string>;

test.beforeAll(async ({ api }) => {
// Don't depend on an earlier block's `afterAll` to restore preview-c-room (racy).
await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] });
discussion = await createTargetDiscussion(api);
});

test.afterAll(async ({ api }) => {
await deleteRoom(api, discussion._id);
});

test('should let a non-member join a discussion', async ({ page }) => {
await page.goto(`/channel/${discussion.name}`);
test('should let a non-member join a discussion', async () => {
await poHomeChannel.gotoChannel(discussion.name);

await expect(poHomeChannel.composer.btnJoinRoom).toBeVisible();

Expand Down
Loading