Merge pull request #16432 from gabriellpr/cc-type-test

test: closed captions typing
This commit is contained in:
Anton Georgiev 2023-01-13 14:43:51 -05:00 committed by GitHub
commit 93175cc4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 1 deletions

View File

@ -33,6 +33,7 @@ const CaptionsButton = ({ intl, isActive, handleOnClick }) => (
size="lg"
onClick={handleOnClick}
id={isActive ? 'stop-captions-button' : 'start-captions-button'}
data-test="startViewingClosedCaptionsBtn"
/>
);

View File

@ -71,7 +71,7 @@ class LiveCaptions extends PureComponent {
return (
<div>
<div style={captionStyles}>
<div data-test="liveCaptions" style={captionStyles}>
{clear ? '' : data}
</div>
<div style={visuallyHidden}>

View File

@ -395,6 +395,7 @@ class ReaderMenu extends PureComponent {
label={intl.formatMessage(intlMessages.start)}
onClick={() => this.handleStart()}
disabled={locale == null}
data-test="startViewingClosedCaptions"
/>
</Styled.Actions>
</Styled.Footer>

View File

@ -140,6 +140,7 @@ class WriterMenu extends PureComponent {
aria-describedby="descriptionStart"
onClick={this.handleStart}
disabled={locale == null}
data-test="startWritingClosedCaptions"
/>
<div id="descriptionStart" hidden>{intl.formatMessage(intlMessages.ariaStartDesc)}</div>
</Styled.Content>

View File

@ -308,6 +308,7 @@ class UserOptions extends PureComponent {
description: intl.formatMessage(intlMessages.captionsDesc),
key: this.captionsId,
onClick: this.handleCaptionsClick,
dataTest: 'writeClosedCaptions',
});
}
if (amIModerator) {

View File

@ -345,6 +345,13 @@ exports.lockPrivateChat = 'input[data-test="lockPrivateChat"]';
exports.lockEditSharedNotes = 'input[data-test="lockEditSharedNotes"]';
exports.lockUserList = 'input[data-test="lockUserList"]';
// Closed Captions
exports.writeClosedCaptions = 'li[data-test="writeClosedCaptions"]';
exports.startWritingClosedCaptions = 'button[data-test="startWritingClosedCaptions"]';
exports.startViewingClosedCaptionsBtn = 'button[data-test="startViewingClosedCaptionsBtn"]';
exports.startViewingClosedCaptions = 'button[data-test="startViewingClosedCaptions"]';
exports.liveCaptions = 'div[data-test="liveCaptions"]';
// Locales
exports.locales = ['af', 'ar', 'az', 'bg-BG', 'bn', 'ca', 'cs-CZ', 'da', 'de',
'dv', 'el-GR', 'en', 'eo', 'es', 'es-419', 'es-ES', 'es-MX', 'et', 'eu',

View File

@ -5,6 +5,7 @@ const e = require('../core/elements');
const { waitAndClearDefaultPresentationNotification } = require('../notifications/util');
const { sleep } = require('../core/helpers');
const { checkAvatarIcon, checkIsPresenter, checkMutedUsers } = require('./util');
const { getNotesLocator } = require('../sharednotes/util');
const { checkTextContent } = require('../core/util');
const { getSettings } = require('../core/settings');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
@ -265,6 +266,27 @@ class MultiUsers {
await this.modPage.hasElement(e.multiUsersWhiteboardOn);
}
async writeClosedCaptions() {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage2.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.writeClosedCaptions);
await this.modPage.waitAndClick(e.startWritingClosedCaptions);
await this.modPage.waitAndClick(e.startViewingClosedCaptionsBtn);
await this.modPage2.waitAndClick(e.startViewingClosedCaptionsBtn);
await this.modPage.waitAndClick(e.startViewingClosedCaptions);
await this.modPage2.waitAndClick(e.startViewingClosedCaptions);
const notesLocator = getNotesLocator(this.modPage);
await notesLocator.type(e.message);
await this.modPage.hasText(e.liveCaptions, e.message);
await this.modPage2.hasText(e.liveCaptions, e.message);
}
}
exports.MultiUsers = MultiUsers;

View File

@ -226,6 +226,13 @@ test.describe.parallel('User', () => {
await multiusers.initUserPage(false);
await multiusers.muteAllUsersExceptPresenter();
});
test('Write closed captions', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
await multiusers.initModPage2(true);
await multiusers.writeClosedCaptions();
});
});
test.describe.parallel('Mobile devices', () => {