-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
394 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Participant } from '../helpers/Participant'; | ||
|
||
const CLOSE_BUTTON = 'modal-header-close-button'; | ||
|
||
/** | ||
* Base class for all dialogs. | ||
*/ | ||
export default class BaseDialog { | ||
participant: Participant; | ||
|
||
/** | ||
* Initializes for a participant. | ||
* | ||
* @param {Participant} participant - The participant. | ||
*/ | ||
constructor(participant: Participant) { | ||
this.participant = participant; | ||
} | ||
|
||
/** | ||
* Clicks on the X (close) button. | ||
*/ | ||
async clickCloseButton(): Promise<void> { | ||
await this.participant.driver.$(`#${CLOSE_BUTTON}`).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Participant } from '../helpers/Participant'; | ||
|
||
/** | ||
* Classname of the closed/hidden participants pane | ||
*/ | ||
const PARTICIPANTS_PANE = 'participants_pane'; | ||
|
||
/** | ||
* Represents the participants pane from the UI. | ||
*/ | ||
export default class ParticipantsPane { | ||
private participant: Participant; | ||
|
||
/** | ||
* Initializes for a participant. | ||
* | ||
* @param {Participant} participant - The participant. | ||
*/ | ||
constructor(participant: Participant) { | ||
this.participant = participant; | ||
} | ||
|
||
/** | ||
* Checks if the pane is open. | ||
*/ | ||
async isOpen() { | ||
return this.participant.driver.$(`.${PARTICIPANTS_PANE}`).isExisting(); | ||
} | ||
|
||
/** | ||
* Clicks the "participants" toolbar button to open the participants pane. | ||
*/ | ||
async open() { | ||
await this.participant.getToolbar().clickParticipantsPaneButton(); | ||
|
||
await this.participant.driver.$(`.${PARTICIPANTS_PANE}`).waitForDisplayed(); | ||
} | ||
|
||
/** | ||
* Clicks the "participants" toolbar button to close the participants pane. | ||
*/ | ||
async close() { | ||
await this.participant.getToolbar().clickCloseParticipantsPaneButton(); | ||
|
||
await this.participant.driver.$(`.${PARTICIPANTS_PANE}`).waitForDisplayed({ reverse: true }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Key } from 'webdriverio'; | ||
|
||
import BaseDialog from './BaseDialog'; | ||
|
||
const VIDEO_QUALITY_SLIDER_CLASS = 'custom-slider'; | ||
|
||
/** | ||
* The video quality dialog. | ||
*/ | ||
export default class VideoQualityDialog extends BaseDialog { | ||
/** | ||
* Opens the video quality dialog and sets the video quality to the minimum or maximum definition. | ||
* @param audioOnly - Whether to set the video quality to audio only (minimum). | ||
* @private | ||
*/ | ||
async setVideoQuality(audioOnly: boolean) { | ||
await this.participant.getToolbar().clickVideoQualityButton(); | ||
|
||
const videoQualitySlider = this.participant.driver.$(`.${VIDEO_QUALITY_SLIDER_CLASS}`); | ||
|
||
const audioOnlySliderValue = parseInt(await videoQualitySlider.getAttribute('min'), 10); | ||
|
||
const maxDefinitionSliderValue = parseInt(await videoQualitySlider.getAttribute('max'), 10); | ||
const activeValue = parseInt(await videoQualitySlider.getAttribute('value'), 10); | ||
|
||
const targetValue = audioOnly ? audioOnlySliderValue : maxDefinitionSliderValue; | ||
const distanceToTargetValue = targetValue - activeValue; | ||
const keyDirection = distanceToTargetValue > 0 ? Key.ArrowRight : Key.ArrowLeft; | ||
|
||
// we need to click the element to activate it so it will receive the keys | ||
await videoQualitySlider.click(); | ||
|
||
// Move the slider to the target value. | ||
for (let i = 0; i < Math.abs(distanceToTargetValue); i++) { | ||
|
||
await this.participant.driver.keys(keyDirection); | ||
} | ||
|
||
// Close the video quality dialog. | ||
await this.clickCloseButton(); | ||
} | ||
} |
Oops, something went wrong.