Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e-tests/playwright/lib/src/server/default_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ const defaultServerConfig: AdminConfig = {
PrivacySettings: {
ShowEmailAddress: true,
ShowFullName: true,
UseAnonymousURLs: false,
},
SupportSettings: {
TermsOfServiceLink: 'https://mattermost.com/pl/terms-of-use/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class ChannelSettingsModal {
readonly container: Locator;

readonly closeButton;
readonly saveButton;

readonly infoTab;
readonly configurationTab;
Expand All @@ -21,6 +22,7 @@ export default class ChannelSettingsModal {
this.container = container;

this.closeButton = container.getByRole('button', {name: 'Close'});
this.saveButton = container.getByTestId('SaveChangesPanel__save-btn');

this.infoTab = container.getByRole('tab', {name: 'info'});
this.configurationTab = container.getByRole('tab', {name: 'configuration'});
Expand All @@ -45,6 +47,11 @@ export default class ChannelSettingsModal {
await expect(this.container).not.toBeVisible({timeout: 10000});
}

async save() {
await expect(this.saveButton).toBeVisible();
await this.saveButton.click();
}

async openInfoTab(): Promise<InfoSettings> {
await expect(this.infoTab).toBeVisible();
await this.infoTab.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import {Locator, expect} from '@playwright/test';

export default class InfoSettings {
readonly container: Locator;
readonly nameInput: Locator;

constructor(container: Locator) {
this.container = container;
this.nameInput = container.locator('#input_channel-settings-name');
}

async toBeVisible() {
await expect(this.container).toBeVisible();
}

async updateName(name: string) {
await expect(this.nameInput).toBeVisible();
await this.nameInput.clear();
await this.nameInput.fill(name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {Locator, expect} from '@playwright/test';

export default class CreateTeamForm {
readonly container: Locator;

// Display name step
readonly teamNameInput: Locator;
readonly teamNameSubmitButton: Locator;
readonly teamNameNextButton: Locator;
readonly teamNameError: Locator;

// Team URL step
readonly teamURLInput: Locator;
readonly teamURLSubmitButton: Locator;
readonly teamURLFinishButton: Locator;
readonly teamURLError: Locator;
readonly backLink: Locator;

constructor(container: Locator) {
this.container = container;

this.teamNameInput = container.locator('#teamNameInput');
this.teamNameSubmitButton = container.locator('#teamNameNextButton');
this.teamNameNextButton = container.locator('#teamNameNextButton');
this.teamNameError = container.locator('#teamNameInputError');

this.teamURLInput = container.locator('#teamURLInput');
this.teamURLSubmitButton = container.locator('#teamURLFinishButton');
this.teamURLFinishButton = container.locator('#teamURLFinishButton');
this.teamURLError = container.locator('#teamURLInputError');
this.backLink = container.getByText('Back to previous step');
}

async toBeVisible() {
await expect(this.container).toBeVisible();
}

async fillTeamName(name: string) {
await this.teamNameInput.fill(name);
}

async submitDisplayName() {
await this.teamNameSubmitButton.click();
}

async fillTeamURL(url: string) {
await this.teamURLInput.fill(url);
}

async submitTeamURL() {
await this.teamURLSubmitButton.click();
}

async goBack() {
await this.backLink.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ export default class FindChannelsModal {
async toBeVisible() {
await expect(this.container).toBeVisible();
}

getResult(channelName: string) {
return this.container.getByTestId(channelName);
}

async selectChannel(channelName: string) {
await this.getResult(channelName).click();
}
}
13 changes: 13 additions & 0 deletions e2e-tests/playwright/lib/src/ui/components/channels/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,33 @@ import {Locator, expect} from '@playwright/test';
export default class ChannelsHeader {
readonly container: Locator;

readonly title: Locator;
readonly channelMenuDropdown;
readonly callButton: Locator;

constructor(container: Locator) {
this.container = container;

this.title = container.locator('#channelHeaderTitle');
this.channelMenuDropdown = container.locator('[aria-controls="channelHeaderDropdownMenu"]');
this.callButton = container.getByRole('button', {name: /call/i}).first();
}

async toBeVisible() {
await expect(this.container).toBeVisible();
}

async toHaveTitle(title: string) {
await expect(this.title).toContainText(title);
}

async openChannelMenu() {
await this.channelMenuDropdown.isVisible();
await this.channelMenuDropdown.click();
}

async openCalls() {
await expect(this.callButton).toBeVisible();
await this.callButton.click();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {Locator, expect} from '@playwright/test';

export default class NewChannelModal {
readonly container: Locator;

readonly displayNameInput: Locator;
readonly urlSection: Locator;
readonly purposeInput: Locator;
readonly publicTypeButton: Locator;
readonly privateTypeButton: Locator;
readonly createButton: Locator;
readonly cancelButton: Locator;

constructor(container: Locator) {
this.container = container;

this.displayNameInput = container.locator('[name="new-channel-modal-name"]');
this.urlSection = container.locator('.new-channel-modal__url');
this.purposeInput = container.locator('#new-channel-modal-purpose');
this.publicTypeButton = container.locator('#public-private-selector-button-O');
this.privateTypeButton = container.locator('#public-private-selector-button-P');
this.createButton = container.getByRole('button', {name: 'Create channel'});
this.cancelButton = container.getByRole('button', {name: 'Cancel'});
}

async toBeVisible() {
await expect(this.container).toBeVisible();
}

async fillDisplayName(name: string) {
await this.displayNameInput.fill(name);
await this.displayNameInput.press('Tab');
}

async create() {
await this.createButton.click();
}

async cancel() {
await this.cancelButton.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class PostDotMenu {
readonly copyTextMenuItem;
readonly deleteMenuItem;
readonly flagMessageMenuItem;
readonly showTranslationMenuItem;

constructor(container: Locator) {
this.container = container;
Expand All @@ -42,6 +43,7 @@ export default class PostDotMenu {
this.copyTextMenuItem = getMenuItem('Copy Text');
this.deleteMenuItem = getMenuItem('Delete');
this.flagMessageMenuItem = getMenuItem('Quarantine for Review');
this.showTranslationMenuItem = getMenuItem('Show translation');
}

async toBeVisible() {
Expand Down
9 changes: 9 additions & 0 deletions e2e-tests/playwright/lib/src/ui/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UserAccountMenu from './user_account_menu';
// Channels Components
import ChannelsAppBar from './channels/app_bar';
import ChannelsCenterView from './channels/center_view';
import CreateTeamForm from './channels/create_team_form';
import ChannelsHeader from './channels/header';
import ChannelsPost from './channels/post';
import ChannelsPostCreate from './channels/post_create';
Expand All @@ -22,6 +23,7 @@ import DeleteScheduledPostModal from './channels/delete_scheduled_post_modal';
import DraftPost from './channels/draft_post';
import EmojiGifPicker from './channels/emoji_gif_picker';
import FindChannelsModal from './channels/find_channels_modal';
import NewChannelModal from './channels/new_channel_modal';
import FlagPostConfirmationDialog from './channels/flag_post_confirmation_dialog';
import GenericConfirmModal from './channels/generic_confirm_modal';
import InvitePeopleModal from './channels/invite_people_modal';
Expand Down Expand Up @@ -51,6 +53,7 @@ import UserDetail from './system_console/sections/user_management/user_detail';
import EditionAndLicense from './system_console/sections/about/edition_and_license';
import MobileSecurity from './system_console/sections/environment/mobile_security';
import Notifications from './system_console/sections/site_configuration/notifications';
import UsersAndTeams from './system_console/sections/site_configuration/users_and_teams';
import SystemConsoleFeatureDiscovery from './system_console/sections/system_users/feature_discovery';
import SystemConsoleHeader from './system_console/header';
import SystemConsoleNavbar from './system_console/navbar';
Expand All @@ -69,6 +72,7 @@ const components = {
// Channels
ChannelsAppBar,
ChannelsCenterView,
CreateTeamForm,
ChannelsHeader,
ChannelsPost,
ChannelsPostCreate,
Expand All @@ -83,6 +87,7 @@ const components = {
EmojiGifPicker,
FindChannelsModal,
FlagPostConfirmationDialog,
NewChannelModal,
GenericConfirmModal,
InvitePeopleModal,
MembersInvitedModal,
Expand Down Expand Up @@ -113,6 +118,7 @@ const components = {
MobileSecurity,
Notifications,
RadioSetting,
UsersAndTeams,
SystemConsoleFeatureDiscovery,
SystemConsoleHeader,
SystemConsoleNavbar,
Expand All @@ -136,6 +142,7 @@ export {
// Channels Page
ChannelsAppBar,
ChannelsCenterView,
CreateTeamForm,
ChannelsHeader,
ChannelsPost,
ChannelsPostCreate,
Expand All @@ -150,6 +157,7 @@ export {
EmojiGifPicker,
FindChannelsModal,
FlagPostConfirmationDialog,
NewChannelModal,
GenericConfirmModal,
InvitePeopleModal,
MembersInvitedModal,
Expand Down Expand Up @@ -180,6 +188,7 @@ export {
MobileSecurity,
Notifications,
RadioSetting,
UsersAndTeams,
SystemConsoleFeatureDiscovery,
SystemConsoleHeader,
SystemConsoleNavbar,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import {Locator, expect} from '@playwright/test';

import {RadioSetting} from '../../base_components';

/**
* System Console -> Site Configuration -> Users and Teams
*/
export default class UsersAndTeams {
readonly container: Locator;

readonly header: Locator;
readonly useAnonymousURLs: RadioSetting;
readonly saveButton: Locator;

constructor(container: Locator) {
this.container = container;

this.header = container.getByText('Users and Teams', {exact: true});
this.useAnonymousURLs = new RadioSetting(
container.getByRole('group', {name: /Use anonymous channel and team URLs/i}),
);
this.saveButton = container.getByRole('button', {name: 'Save'});
}

async toBeVisible() {
await expect(this.container).toBeVisible();
await expect(this.header).toBeVisible();
}

async save() {
await this.saveButton.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export class ColumnToggleMenu {
}
}

type RoleFilter = 'Any' | 'System Admin' | 'Member' | 'Guest';
type RoleFilter =
| 'Any'
| 'System Admin'
| 'Member'
| 'Guests (all)'
| 'Guests in a single channel'
| 'Guests in multiple channels';
type StatusFilter = 'Any' | 'Activated users' | 'Deactivated users';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class UsersTable {
readonly lastPostHeader: Locator;
readonly daysActiveHeader: Locator;
readonly messagesPostedHeader: Locator;
readonly channelCountHeader: Locator;
readonly actionsHeader: Locator;

constructor(container: Locator) {
Expand All @@ -38,6 +39,7 @@ export class UsersTable {
this.lastPostHeader = container.locator('#systemUsersTable-header-lastPostDateColumn');
this.daysActiveHeader = container.locator('#systemUsersTable-header-daysActiveColumn');
this.messagesPostedHeader = container.locator('#systemUsersTable-header-totalPostsColumn');
this.channelCountHeader = container.locator('#systemUsersTable-header-channelCountColumn');
this.actionsHeader = container.locator('#systemUsersTable-header-actionsColumn');
}

Expand Down Expand Up @@ -65,6 +67,7 @@ export class UsersTable {
'Last post': this.lastPostHeader,
'Days active': this.daysActiveHeader,
'Messages posted': this.messagesPostedHeader,
'Channel count': this.channelCountHeader,
Actions: this.actionsHeader,
};
const header = headerMap[columnName];
Expand Down Expand Up @@ -143,6 +146,7 @@ export class UserRow {
readonly lastPostCell: Locator;
readonly daysActiveCell: Locator;
readonly messagesPostedCell: Locator;
readonly channelCountCell: Locator;
readonly actionsCell: Locator;

// User details components
Expand All @@ -168,6 +172,7 @@ export class UserRow {
this.lastPostCell = container.locator('.lastPostDateColumn');
this.daysActiveCell = container.locator('.daysActiveColumn');
this.messagesPostedCell = container.locator('.totalPostsColumn');
this.channelCountCell = container.locator('.channelCountColumn');
this.actionsCell = container.locator('.actionsColumn');

this.profilePicture = this.userDetailsCell.locator('.profilePicture');
Expand Down
Loading
Loading