From 5b5ee1160eb6fd8e4be0701d7d86f5c23d700d67 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Tue, 11 Apr 2023 18:59:10 +0800 Subject: [PATCH] expect boards product by default in e2e (#22911) --- .../channel/new_channel_with_board_spec.js | 2 -- e2e-tests/playwright/global_setup.ts | 14 +------------- e2e-tests/playwright/support/constant.ts | 1 + e2e-tests/playwright/support/flag.ts | 14 +------------- e2e-tests/playwright/support/server/client.ts | 5 +++-- .../playwright/support/server/default_config.ts | 11 ----------- e2e-tests/playwright/support/test_fixture.ts | 10 +--------- e2e-tests/playwright/test.config.ts | 10 ++++++++-- .../create_empty_board.spec.ts | 2 -- .../tests/visual/boards/board_template.spec.ts | 2 -- .../visual/boards/view_untitled_board.spec.ts | 2 -- 11 files changed, 15 insertions(+), 58 deletions(-) diff --git a/e2e-tests/cypress/tests/integration/channels/channel/new_channel_with_board_spec.js b/e2e-tests/cypress/tests/integration/channels/channel/new_channel_with_board_spec.js index 32c3591dd3..e924b17f82 100644 --- a/e2e-tests/cypress/tests/integration/channels/channel/new_channel_with_board_spec.js +++ b/e2e-tests/cypress/tests/integration/channels/channel/new_channel_with_board_spec.js @@ -22,8 +22,6 @@ describe('New Channel modal with Boards enabled', () => { cy.apiLogin(sysadmin); cy.visit(`/${testTeam.name}/channels/town-square`); }); - - cy.shouldHaveFeatureFlag('BoardsProduct', true); }); it('MM-T5141 New Channel is created with an associated Board', () => { diff --git a/e2e-tests/playwright/global_setup.ts b/e2e-tests/playwright/global_setup.ts index d54d6ded88..53386e351f 100644 --- a/e2e-tests/playwright/global_setup.ts +++ b/e2e-tests/playwright/global_setup.ts @@ -5,7 +5,6 @@ import {expect} from '@playwright/test'; import {UserProfile} from '@mattermost/types/users'; import {Client, createRandomTeam, getAdminClient, getDefaultAdminUser, makeClient} from './support/server'; -import {boardsPluginId, callsPluginId} from './support/constant'; import {defaultTeam} from './support/util'; import testConfig from './test.config'; @@ -97,26 +96,15 @@ async function printClientInfo(client: Client) { - BuildHashEnterprise = ${config.BuildHashEnterprise} - BuildEnterpriseReady = ${config.BuildEnterpriseReady} - FeatureFlagAppsEnabled = ${config.FeatureFlagAppsEnabled} - - FeatureFlagBoardsProduct = ${config.FeatureFlagBoardsProduct} - FeatureFlagCallsEnabled = ${config.FeatureFlagCallsEnabled} - TelemetryId = ${config.TelemetryId}`); } -function getProductsAsPlugin() { - const productsAsPlugin = [callsPluginId]; - - if (!testConfig.boardsProductEnabled) { - productsAsPlugin.push(boardsPluginId); - } - - return productsAsPlugin; -} - async function ensurePluginsLoaded(client: Client) { const pluginStatus = await client.getPluginStatuses(); const plugins = await client.getPlugins(); - getProductsAsPlugin().forEach(async (pluginId) => { + testConfig.ensurePluginsInstalled.forEach(async (pluginId) => { const isInstalled = pluginStatus.some((plugin) => plugin.plugin_id === pluginId); if (!isInstalled) { // eslint-disable-next-line no-console diff --git a/e2e-tests/playwright/support/constant.ts b/e2e-tests/playwright/support/constant.ts index e5fd709f4e..35aa9bb5f4 100644 --- a/e2e-tests/playwright/support/constant.ts +++ b/e2e-tests/playwright/support/constant.ts @@ -1,6 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. +export const appsPluginId = 'com.mattermost.apps'; export const boardsPluginId = 'focalboard'; export const boardsProductId = 'boards'; export const callsPluginId = 'com.mattermost.calls'; diff --git a/e2e-tests/playwright/support/flag.ts b/e2e-tests/playwright/support/flag.ts index dfa82775bc..8e9a451c73 100644 --- a/e2e-tests/playwright/support/flag.ts +++ b/e2e-tests/playwright/support/flag.ts @@ -5,22 +5,10 @@ import os from 'node:os'; import {expect, test} from '@playwright/test'; -import {boardsPluginId, callsPluginId} from './constant'; +import {callsPluginId} from './constant'; import {getAdminClient} from './server/init'; import {isSmallScreen} from './util'; -export async function shouldHaveBoardsEnabled(enabled = true) { - const {adminClient} = await getAdminClient(); - const config = await adminClient.getConfig(); - - const boardsEnabled = - (typeof config.FeatureFlags.BoardsProduct === 'boolean' && config.FeatureFlags.BoardsProduct) || - config.PluginSettings.PluginStates[boardsPluginId].Enable; - - const matched = boardsEnabled === enabled; - expect(matched, matched ? '' : `Boards expect "${enabled}" but actual "${boardsEnabled}"`).toBeTruthy(); -} - export async function shouldHaveCallsEnabled(enabled = true) { const {adminClient} = await getAdminClient(); const config = await adminClient.getConfig(); diff --git a/e2e-tests/playwright/support/server/client.ts b/e2e-tests/playwright/support/server/client.ts index 32eb55f448..703275e0d7 100644 --- a/e2e-tests/playwright/support/server/client.ts +++ b/e2e-tests/playwright/support/server/client.ts @@ -167,8 +167,9 @@ async function makeClient(userRequest?: UserRequest, useCache = true): Promise; ExperimentalSettings: Partial; - FeatureFlags: Partial; PasswordSettings: Partial; PluginSettings: Partial; ServiceSettings: Partial; @@ -40,9 +38,6 @@ const onPremServerConfig = (): Partial => { ExperimentalSettings: { EnableAppBar: true, }, - FeatureFlags: { - BoardsProduct: testConfig.boardsProductEnabled, - }, PasswordSettings: { MinimumLength: 5, Lowercase: false, @@ -57,11 +52,6 @@ const onPremServerConfig = (): Partial => { defaultenabled: true, }, }, - PluginStates: { - focalboard: { - Enable: !testConfig.boardsProductEnabled, - }, - }, }, ServiceSettings: { SiteURL: testConfig.baseURL, @@ -686,7 +676,6 @@ const defaultServerConfig: AdminConfig = { GraphQL: false, InsightsEnabled: true, CommandPalette: false, - BoardsProduct: false, SendWelcomePost: true, WorkTemplate: false, PostPriority: true, diff --git a/e2e-tests/playwright/support/test_fixture.ts b/e2e-tests/playwright/support/test_fixture.ts index 8b7949634b..d35435dd7c 100644 --- a/e2e-tests/playwright/support/test_fixture.ts +++ b/e2e-tests/playwright/support/test_fixture.ts @@ -1,13 +1,7 @@ import {test as base, Browser} from '@playwright/test'; import {TestBrowser} from './browser_context'; -import { - shouldHaveBoardsEnabled, - shouldHaveCallsEnabled, - shouldHaveFeatureFlag, - shouldSkipInSmallScreen, - shouldRunInLinux, -} from './flag'; +import {shouldHaveCallsEnabled, shouldHaveFeatureFlag, shouldSkipInSmallScreen, shouldRunInLinux} from './flag'; import {initSetup, getAdminClient} from './server'; import {hideDynamicChannelsContent, waitForAnimationEnd, waitUntil} from './test_action'; import {pages} from './ui/pages'; @@ -36,7 +30,6 @@ class PlaywrightExtended { readonly testBrowser: TestBrowser; // ./flag - readonly shouldHaveBoardsEnabled; readonly shouldHaveCallsEnabled; readonly shouldHaveFeatureFlag; readonly shouldSkipInSmallScreen; @@ -62,7 +55,6 @@ class PlaywrightExtended { this.testBrowser = new TestBrowser(browser); // ./flag - this.shouldHaveBoardsEnabled = shouldHaveBoardsEnabled; this.shouldHaveCallsEnabled = shouldHaveCallsEnabled; this.shouldHaveFeatureFlag = shouldHaveFeatureFlag; this.shouldSkipInSmallScreen = shouldSkipInSmallScreen; diff --git a/e2e-tests/playwright/test.config.ts b/e2e-tests/playwright/test.config.ts index 2d29d2a100..5a370a541e 100644 --- a/e2e-tests/playwright/test.config.ts +++ b/e2e-tests/playwright/test.config.ts @@ -3,6 +3,9 @@ import {Page, ViewportSize} from '@playwright/test'; import * as dotenv from 'dotenv'; + +import {appsPluginId, callsPluginId} from '@e2e-support/constant'; + dotenv.config(); export type TestArgs = { @@ -17,7 +20,7 @@ export type TestConfig = { adminUsername: string; adminPassword: string; adminEmail: string; - boardsProductEnabled: boolean; + ensurePluginsInstalled: string[]; resetBeforeTest: boolean; haClusterEnabled: boolean; haClusterNodeCount: number; @@ -41,7 +44,10 @@ const config: TestConfig = { adminUsername: process.env.PW_ADMIN_USERNAME || 'sysadmin', adminPassword: process.env.PW_ADMIN_PASSWORD || 'Sys@dmin-sample1', adminEmail: process.env.PW_ADMIN_EMAIL || 'sysadmin@sample.mattermost.com', - boardsProductEnabled: parseBool(process.env.PW_BOARDS_PRODUCT_ENABLED, true), + ensurePluginsInstalled: + typeof process.env?.PW_ENSURE_PLUGINS_INSTALLED === 'string' + ? process.env.PW_ENSURE_PLUGINS_INSTALLED.split(',') + : [appsPluginId, callsPluginId], haClusterEnabled: parseBool(process.env.PW_HA_CLUSTER_ENABLED, false), haClusterNodeCount: parseNumber(process.env.PW_HA_CLUSTER_NODE_COUNT, 2), haClusterName: process.env.PW_HA_CLUSTER_NAME || 'mm_dev_cluster', diff --git a/e2e-tests/playwright/tests/functional/boards/board-creation-and-set-up/create_empty_board.spec.ts b/e2e-tests/playwright/tests/functional/boards/board-creation-and-set-up/create_empty_board.spec.ts index d4e4c30681..0967d8577c 100644 --- a/e2e-tests/playwright/tests/functional/boards/board-creation-and-set-up/create_empty_board.spec.ts +++ b/e2e-tests/playwright/tests/functional/boards/board-creation-and-set-up/create_empty_board.spec.ts @@ -7,8 +7,6 @@ import {shouldSkipInSmallScreen} from '@e2e-support/flag'; shouldSkipInSmallScreen(); test('MM-T4274 Create an Empty Board', async ({pw, pages}) => { - await pw.shouldHaveBoardsEnabled(); - // Create and sign in a new user const {user} = await pw.initSetup(); diff --git a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts index ca130486db..1866840349 100644 --- a/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts +++ b/e2e-tests/playwright/tests/visual/boards/board_template.spec.ts @@ -7,8 +7,6 @@ import {shouldSkipInSmallScreen} from '@e2e-support/flag'; shouldSkipInSmallScreen(); test('Board template', async ({pw, pages, browserName, viewport}, testInfo) => { - await pw.shouldHaveBoardsEnabled(); - // Create and sign in a new user const {user} = await pw.initSetup(); diff --git a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts index 00645a851b..f5a03b4ba9 100644 --- a/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts +++ b/e2e-tests/playwright/tests/visual/boards/view_untitled_board.spec.ts @@ -7,8 +7,6 @@ import {shouldSkipInSmallScreen} from '@e2e-support/flag'; shouldSkipInSmallScreen(); test('View untitled board', async ({pw, pages, browserName, viewport}, testInfo) => { - await pw.shouldHaveBoardsEnabled(); - // Create and sign in a new user const {user} = await pw.initSetup();