Files
jitsi-meet/tests/pageobjects/ChatPanel.ts
bgrozev 70c3c8db13 test: Refactor, update and fix JaaS tests (#16463)
* ref: Move the jaas util out of specs/.
* ref: Extract a more generic joinMuc utility.
* ref: Rename joinMuc to joinJaasMuc.
* ref: Move tileView.spec.ts out of 2way, use joinMuc.
* ref: Enforce that "name" is p1, p2, p3, p4 using types.
* fix: Fix mute test filename.
* ref: Split the chat test into jaas and iframe tests.
* test: Add webhook verification to jaas visitor tests.
* ref: Remove the iframe/visitors test (ported to jaas).
* ref: Move the transcriptions test to jaas.
* ref: Make getEndpointId work from outside the iframe.
* ref: Remove TestProperties.useIFrameApi. Use the flag in IParticipantOptions instead.
* ref: Do not set a special tenant when the iFrame API is used, leave it to tests to determine.
* ref: Remove the jaas-specific tests from iframe/participantsPresnce (will be re-added under jaas/ later).
* ref: Move the dial in/out tests to jaas/.
* Add tests for jaas join/leave webhooks (port back from iframe/participantsPresence).
* config: Fallback to IFRAME_TENANT and JWT_* for jaas configuration.
* ref: Simplify boolean expression.
* ref: Remove the skipFirstModerator option (unused).
* ref: Do not override token if specified.
* fix: Do not generate token for alone/invite test.
* ref: Extract more dial-in utilities.
* test: Verify Invite UI in jaas.
* Do not generate token for dial in (case covered in jaas/).
* ref: Remove preferGenerateToken (unused).
* ref: Move mute utils in their own helper.
* fix: Fix setting the jaas enabled flag.
* Do not run alone/invite for jaas (temp fix).
* fix: Switch back to meeting window.
* Do not run alone/dialInAudio on jaas.
* Disable the SIP jibri test (broken).
2025-10-01 11:40:02 -05:00

208 lines
5.3 KiB
TypeScript

import BasePageObject from './BasePageObject';
/**
* Chat panel elements.
*/
export default class ChatPanel extends BasePageObject {
/**
* Is chat panel open.
*/
isOpen() {
return this.participant.driver.$('#sideToolbarContainer').isExisting();
}
/**
* Presses the "chat" keyboard shortcut which opens or closes the chat
* panel.
*/
async pressShortcut() {
await this.participant.driver.$('body').click();
await this.participant.driver.keys([ 'c' ]);
}
async sendMessage(message: string) {
if (!await this.isOpen()) {
await this.pressShortcut();
}
if (!await this.isOpen()) {
throw new Error('Chat panel failed to open');
}
const inputField = this.participant.driver.$('#chat-input');
await inputField.click();
await this.participant.driver.keys(`${message}\n`);
}
/**
* Opens the polls tab in the chat panel.
*/
async openPollsTab() {
await this.participant.driver.$('#polls-tab').click();
}
/**
* Checks whether the polls tab is visible.
*/
async isPollsTabVisible() {
return this.participant.driver.$('#polls-tab-panel').isDisplayed();
}
async clickCreatePollButton() {
await this.participant.driver.$('aria/Create a poll').click();
}
/**
* Waits for the new poll input to be visible.
*/
async waitForNewPollInput() {
await this.participant.driver.$(
'#polls-create-input')
.waitForExist({
timeout: 2000,
timeoutMsg: 'New poll not created'
});
}
/**
* Waits for the option input to be visible.
* @param index
*/
async waitForOptionInput(index: number) {
await this.participant.driver.$(
`#polls-answer-input-${index}`)
.waitForExist({
timeout: 1000,
timeoutMsg: `Answer input ${index} not created`
});
}
/**
* Waits for the option input to be non-existing.
* @param index
*/
async waitForOptionInputNonExisting(index: number) {
await this.participant.driver.$(
`#polls-answer-input-${index}`)
.waitForExist({
reverse: true,
timeout: 2000,
timeoutMsg: `Answer input ${index} still exists`
});
}
/**
* Clicks the "Add option" button.
*/
async clickAddOptionButton() {
await this.participant.driver.$('aria/Add option').click();
}
/**
* Clicks the "Remove option" button.
* @param index
*/
async clickRemoveOptionButton(index: number) {
await this.participant.driver.$(`[data-testid="remove-polls-answer-input-${index}"]`).click();
}
/**
* Fills in the poll question.
* @param question
*/
async fillPollQuestion(question: string) {
const input = await this.participant.driver.$('#polls-create-input');
await input.click();
await this.participant.driver.keys(question);
}
/**
* Fills in the poll option.
* @param index
* @param option
*/
async fillPollOption(index: number, option: string) {
const input = await this.participant.driver.$(`#polls-answer-input-${index}`);
await input.click();
await this.participant.driver.keys(option);
}
/**
* Gets the poll option.
* @param index
*/
async getOption(index: number) {
return this.participant.driver.$(`#polls-answer-input-${index}`).getValue();
}
/**
* Clicks the "Save" button.
*/
async clickSavePollButton() {
await this.participant.driver.$('aria/Save').click();
}
/**
* Clicks the "Edit" button.
*/
async clickEditPollButton() {
await this.participant.driver.$('aria/Edit').click();
}
/**
* Clicks the "Skip" button.
*/
async clickSkipPollButton() {
await this.participant.driver.$('aria/Skip').click();
}
/**
* Clicks the "Send" button.
*/
async clickSendPollButton() {
await this.participant.driver.$('aria/Send poll').click();
}
/**
* Waits for the "Send" button to be visible.
*/
async waitForSendButton() {
await this.participant.driver.$('aria/Send poll').waitForExist({
timeout: 1000,
timeoutMsg: 'Send button not visible'
});
}
/**
* Votes for the given option in the given poll.
* @param pollId
* @param index
*/
async voteForOption(pollId: string, index: number) {
await this.participant.driver.execute(
(id, ix) => document.getElementById(`poll-answer-checkbox-${id}-${ix}`)?.click(),
pollId, index);
await this.participant.driver.$('aria/Submit').click();
}
/**
* Checks whether the given poll is visible.
* @param pollId
*/
async isPollVisible(pollId: string) {
return this.participant.driver.$(`#poll-${pollId}`).isDisplayed();
}
/**
* Gets the result text for the given option in the given poll.
* @param pollId
* @param optionIndex
*/
async getResult(pollId: string, optionIndex: number) {
return await this.participant.driver.$(`#poll-result-${pollId}-${optionIndex}`).getText();
}
}