Skip to content

Commit

Permalink
[MM-54494] Keep backwards compatibility with older MM versions (#526)
Browse files Browse the repository at this point in the history
* Keep backwards compatibility with older MM versions

* Add e2e test
  • Loading branch information
streamer45 authored Oct 3, 2023
1 parent 3a91020 commit 16ccfa1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
41 changes: 40 additions & 1 deletion e2e/tests/join_call.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect, chromium} from '@playwright/test';

import PlaywrightDevPage from '../page';
import {startCall, getUserStoragesForTest, getUsernamesForTest} from '../utils';
import {newUserPage, startCall, getUserStoragesForTest, getUsernamesForTest} from '../utils';

const userStorages = getUserStoragesForTest();
const usernames = getUsernamesForTest();
Expand Down Expand Up @@ -71,4 +71,43 @@ test.describe('join call', () => {

await userPage.leaveCall();
});

test('user profile popover', async ({page}) => {
const userAPage = page;
const userBPage = await newUserPage(userStorages[1]);
await userBPage.goto();

// We have both users send a message so it's much easier to
// consistently find the proper selector to open the profile.
await userAPage.locator('#post_textbox').fill('messageA');
await userAPage.locator('[data-testid=SendMessageButton]').click();
await userBPage.page.locator('#post_textbox').fill('messageB');
await userBPage.page.locator('[data-testid=SendMessageButton]').click();

await userAPage.locator('.post__header').locator('button.user-popover').last().click();
await expect(userAPage.locator('#user-profile-popover')).toBeVisible();
await userAPage.locator('#user-profile-popover').locator('#startCallButton').click();

await expect(userAPage.locator('#calls-widget')).toBeVisible();
await expect(userAPage.locator('#calls-widget-loading-overlay')).toBeHidden();

await userAPage.locator('#calls-widget-leave-button').click();
await expect(userAPage.locator('#calls-widget')).toBeHidden();

// We then verify that join button is disabled if the other user is already in a call.
await userBPage.startCall();

// We have both users send a message so it's much easier to
// consistently find the proper selector to open the profile.
await userAPage.locator('#post_textbox').fill('messageA');
await userAPage.locator('[data-testid=SendMessageButton]').click();
await userBPage.page.locator('#post_textbox').fill('messageB');
await userBPage.page.locator('[data-testid=SendMessageButton]').click();

await userAPage.locator('.post__header').locator('button.user-popover').last().click();
await expect(userAPage.locator('#user-profile-popover')).toBeVisible();
await expect(userAPage.locator('#user-profile-popover').locator('#startCallButton')).toBeDisabled();

await userBPage.leaveCall();
});
});
8 changes: 6 additions & 2 deletions e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ export function getUserStoragesForTest() {
return [`${names[0]}StorageState.json`, `${names[1]}StorageState.json`];
}

export async function startCall(userState: string) {
export async function newUserPage(userState: string) {
const browser = await chromium.launch();
const context = await browser.newContext({storageState: userState});
const userPage = new PlaywrightDevPage(await context.newPage());
return new PlaywrightDevPage(await context.newPage());
}

export async function startCall(userState: string) {
const userPage = await newUserPage(userState);
await userPage.goto();
await userPage.startCall();
return userPage;
Expand Down
5 changes: 5 additions & 0 deletions webapp/src/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,11 @@ export default combineReducers({
users,
channelID,
profiles,

// DEPRECATED - Needed to keep compatibility with older MM server
// version.
voiceConnectedProfiles: profiles,

reactions,
usersStatuses,
calls,
Expand Down

0 comments on commit 16ccfa1

Please sign in to comment.