Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 1s
162 lines
5.8 KiB
TypeScript
162 lines
5.8 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {expect, test} from '@mattermost/playwright-lib';
|
|
|
|
/**
|
|
* @objective Verify archived channel icons display correctly for public and private channels in various UI contexts
|
|
*/
|
|
test(
|
|
'displays archive icons for public and private channels in sidebar',
|
|
{tag: ['@visual', '@archived_channels', '@snapshots']},
|
|
async ({pw, browserName, viewport}, testInfo) => {
|
|
// # Initialize setup and create test channels
|
|
const {team, user, adminClient} = await pw.initSetup();
|
|
|
|
// # Create public and private channels
|
|
const publicChannel = await adminClient.createChannel(
|
|
pw.random.channel({
|
|
teamId: team.id,
|
|
name: 'public-to-archive',
|
|
displayName: 'Public Archive Test',
|
|
type: 'O',
|
|
}),
|
|
);
|
|
|
|
const privateChannel = await adminClient.createChannel(
|
|
pw.random.channel({
|
|
teamId: team.id,
|
|
name: 'private-to-archive',
|
|
displayName: 'Private Archive Test',
|
|
type: 'P',
|
|
}),
|
|
);
|
|
|
|
// # Archive both channels
|
|
await adminClient.deleteChannel(publicChannel.id);
|
|
await adminClient.deleteChannel(privateChannel.id);
|
|
|
|
// # Log in user
|
|
const {page, channelsPage} = await pw.testBrowser.login(user);
|
|
|
|
// # Visit town square to ensure we're in a stable state
|
|
await channelsPage.goto(team.name, 'town-square');
|
|
await channelsPage.toBeVisible();
|
|
|
|
// # Open browse channels modal to show archived channels
|
|
await page.keyboard.press('Control+K');
|
|
await page.waitForTimeout(500);
|
|
|
|
// # Type to search for archived channels
|
|
await page.keyboard.type('archive');
|
|
await page.waitForTimeout(500);
|
|
|
|
// # Hide dynamic content
|
|
await pw.hideDynamicChannelsContent(page);
|
|
|
|
// * Verify channel switcher shows both archived channels with correct icons
|
|
const testArgs = {page, browserName, viewport};
|
|
await pw.matchSnapshot(testInfo, testArgs);
|
|
},
|
|
);
|
|
|
|
/**
|
|
* @objective Verify archived channel icons display correctly in admin console channel list
|
|
*/
|
|
test(
|
|
'displays archive icons in admin console channel list',
|
|
{tag: ['@visual', '@archived_channels', '@admin_console', '@snapshots']},
|
|
async ({pw, browserName, viewport}, testInfo) => {
|
|
// # Initialize setup with admin user
|
|
const {team, adminUser, adminClient} = await pw.initSetup();
|
|
|
|
// # Create public and private channels
|
|
const publicChannel = await adminClient.createChannel(
|
|
pw.random.channel({
|
|
teamId: team.id,
|
|
name: 'admin-public-archive',
|
|
displayName: 'Admin Public Archive',
|
|
type: 'O',
|
|
}),
|
|
);
|
|
|
|
const privateChannel = await adminClient.createChannel(
|
|
pw.random.channel({
|
|
teamId: team.id,
|
|
name: 'admin-private-archive',
|
|
displayName: 'Admin Private Archive',
|
|
type: 'P',
|
|
}),
|
|
);
|
|
|
|
// # Archive both channels
|
|
await adminClient.deleteChannel(publicChannel.id);
|
|
await adminClient.deleteChannel(privateChannel.id);
|
|
|
|
// # Log in as admin
|
|
const {page} = await pw.testBrowser.login(adminUser);
|
|
|
|
// # Navigate to admin console channels list
|
|
await page.goto('/admin_console/user_management/channels');
|
|
await page.waitForTimeout(1000);
|
|
|
|
// # Wait for channel list to load
|
|
await expect(page.locator('.DataGrid')).toBeVisible({timeout: 10000});
|
|
|
|
// # Search for our test channels to bring them into view
|
|
await page.fill('[data-testid="searchInput"]', 'Admin');
|
|
await page.waitForTimeout(500);
|
|
|
|
// * Verify both archived channels are visible with correct icons
|
|
const testArgs = {page, browserName, viewport};
|
|
await pw.matchSnapshot(testInfo, testArgs);
|
|
},
|
|
);
|
|
|
|
/**
|
|
* @objective Verify archived private channel icon displays in channel header when viewing archived channel
|
|
*/
|
|
test(
|
|
'displays archive icon in channel header for archived private channel',
|
|
{tag: ['@visual', '@archived_channels', '@channel_header', '@snapshots']},
|
|
async ({pw, browserName, viewport}, testInfo) => {
|
|
// # Initialize setup
|
|
const {team, adminUser, adminClient} = await pw.initSetup();
|
|
|
|
// # Create a private channel
|
|
const privateChannel = await adminClient.createChannel(
|
|
pw.random.channel({
|
|
teamId: team.id,
|
|
name: 'private-header-test',
|
|
displayName: 'Private Header Test',
|
|
type: 'P',
|
|
}),
|
|
);
|
|
|
|
// # Archive the channel
|
|
await adminClient.deleteChannel(privateChannel.id);
|
|
|
|
const {page, channelsPage} = await pw.testBrowser.login(adminUser);
|
|
|
|
// # Visit the archived channel directly
|
|
await channelsPage.goto(team.name, privateChannel.name);
|
|
|
|
// # Wait for channel header to load (archived channels don't have post-create)
|
|
await expect(page.locator('.channel-header')).toBeVisible();
|
|
|
|
// # Verify archived channel message is visible
|
|
await expect(page.locator('#channelArchivedMessage')).toBeVisible();
|
|
|
|
// # Hide dynamic content
|
|
await pw.hideDynamicChannelsContent(page);
|
|
|
|
// # Focus on channel header area for snapshot
|
|
const headerElement = page.locator('.channel-header');
|
|
await expect(headerElement).toBeVisible();
|
|
|
|
// * Verify channel header shows archive-lock icon for private archived channel
|
|
const testArgs = {page, browserName, viewport};
|
|
await pw.matchSnapshot(testInfo, testArgs);
|
|
},
|
|
);
|