signal-desktop/ts/test-mock/calling/callLinkAdmin_test.ts

88 lines
2.2 KiB
TypeScript
Raw Normal View History

2024-06-10 15:23:43 +00:00
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { expect } from 'playwright/test';
import * as durations from '../../util/durations';
import type { App } from '../playwright';
import { Bootstrap } from '../bootstrap';
2024-10-25 20:31:30 +00:00
import { createCallLink } from '../helpers';
2024-06-10 15:23:43 +00:00
describe('calling/callLinkAdmin', function (this: Mocha.Suite) {
this.timeout(durations.MINUTE);
let bootstrap: Bootstrap;
let app: App;
beforeEach(async () => {
bootstrap = new Bootstrap();
await bootstrap.init();
app = await bootstrap.link();
});
afterEach(async function (this: Mocha.Context) {
if (!bootstrap) {
return;
}
await bootstrap.maybeSaveLogs(this.currentTest, app);
await app.close();
await bootstrap.teardown();
});
it('can create and edit a call link', async () => {
const window = await app.getWindow();
2024-10-25 20:31:30 +00:00
{
const name = 'New Name';
await createCallLink(window, { name });
2024-06-10 15:23:43 +00:00
2024-10-25 20:31:30 +00:00
const title = await window
.locator('.CallsList__ItemTile')
.getByText(name);
2024-06-10 15:23:43 +00:00
2024-10-25 20:31:30 +00:00
await expect(title).toContainText(name);
}
2024-06-25 18:56:28 +00:00
2024-10-25 20:31:30 +00:00
{
const name = 'Public call link';
await createCallLink(window, {
name,
isAdminApprovalRequired: false,
});
const callLinkItem = await window.getByText(name);
await callLinkItem.click();
const callLinkDetails = window.locator(
'.CallsTab__ConversationCallDetails'
);
await callLinkDetails.waitFor();
const restrictionsSelect = await window.locator(
'.CallLinkRestrictionsSelect select'
);
await expect(restrictionsSelect).toHaveJSProperty('value', '0');
}
2024-06-25 18:56:28 +00:00
2024-10-25 20:31:30 +00:00
{
const name = 'Restricted call link';
await createCallLink(window, {
name,
isAdminApprovalRequired: true,
});
const callLinkItem = await window.getByText(name);
await callLinkItem.click();
const callLinkDetails = window.locator(
'.CallsTab__ConversationCallDetails'
);
await callLinkDetails.waitFor();
const restrictionsSelect = await window.locator(
'.CallLinkRestrictionsSelect select'
);
await expect(restrictionsSelect).toHaveJSProperty('value', '1');
}
2024-06-10 15:23:43 +00:00
});
});