Fix E2E test cases and setup for GHA (#26944)

* Fix E2E test cases and setup for GHA
* Fix more test cases, apply recommendations
Этот коммит содержится в:
Mario Vitale
2024-05-06 08:37:20 +02:00
коммит произвёл GitHub
родитель 8da64a5c34
Коммит c9cb3d5bb0
13 изменённых файлов: 45 добавлений и 22 удалений

Просмотреть файл

@@ -52,7 +52,7 @@ mme2e_wait_service_healthy () {
SERVICE_NAME=${1?}
RETRIES_LEFT=${2:-1}
RETRIES_INTERVAL=${3:-10}
mme2e_wait_command_success "${DC_COMMAND} ps ${SERVICE_NAME} | grep -q '\(healthy\)'" "Waiting for ${SERVICE_NAME} container to be healthy" "$RETRIES_LEFT" "$RETRIES_INTERVAL"
mme2e_wait_command_success "${DC_COMMAND} ps ${SERVICE_NAME} | grep -qE '\(healthy\)'" "Waiting for ${SERVICE_NAME} container to be healthy" "$RETRIES_LEFT" "$RETRIES_INTERVAL"
}
mme2e_wait_image () {
IMAGE_NAME=${1?}

Просмотреть файл

@@ -1,6 +1,4 @@
---
version: "3.1"
services:
dashboard:
image: mattermostdevelopment/mirrored-node:18.17

Просмотреть файл

@@ -45,7 +45,6 @@ generate_docker_compose_file() {
# Image hashes in this file are for amd64 systems
# NB: May include paths relative to the "server/build" directory, which contains the original compose file that this yaml is overriding
version: "2.4"
services:
server:
image: \${SERVER_IMAGE}
@@ -56,16 +55,10 @@ services:
MM_SERVICESETTINGS_ALLOWCORSFROM: "*"
MM_SERVICESETTINGS_ENABLELOCALMODE: "true"
MM_SERVICESETTINGS_ENABLESECURITYFIXALERT: "false"
MM_PLUGINSETTINGS_ENABLED: "true"
MM_PLUGINSETTINGS_ENABLEUPLOADS: "true"
MM_PLUGINSETTINGS_AUTOMATICPREPACKAGEDPLUGINS: "true"
MM_TEAMSETTINGS_ENABLEOPENSERVER: "true"
MM_SQLSETTINGS_DATASOURCE: "postgres://mmuser:mostest@localhost:5432/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes"
MM_SQLSETTINGS_DRIVERNAME: "postgres"
MM_EMAILSETTINGS_SMTPSERVER: "localhost"
MM_CLUSTERSETTINGS_READONLYCONFIG: "false"
MM_SERVICESETTINGS_ENABLEONBOARDINGFLOW: "false"
MM_FEATUREFLAGS_ONBOARDINGTOURTIPS: "false"
MM_SERVICEENVIRONMENT: "test"
MM_FEATUREFLAGS_MOVETHREADSENABLED: "true"
MM_LOGSETTINGS_ENABLEDIAGNOSTICS: "false"

Просмотреть файл

@@ -3,6 +3,16 @@ set -e -u -o pipefail
cd "$(dirname "$0")"
. .e2erc
mme2e_log "Configuring starting server parameters that may be changed at runtime"
for SETTING in \
TeamSettings.EnableOpenServer=true \
PluginSettings.Enable=true \
PluginSettings.EnableUploads=true \
PluginSettings.AutomaticPrepackagedPlugins=true
do
mme2e_log "Configuring parameter: $SETTING"
${MME2E_DC_SERVER} exec -T -- server mmctl --local config set $(tr = ' ' <<<$SETTING)
done
if [ -n "${MM_LICENSE:-}" ]; then
# We prefer uploading the license here, instead of setting the env var for the server
# This is to retain the flexibility of being able to remove it programmatically, if the tests require it

Просмотреть файл

@@ -19,4 +19,13 @@ if ! mme2e_wait_service_healthy server 60 10; then
mme2e_log "Mattermost container not healthy, retry attempts exhausted. Giving up." >&2
exit 1
fi
for MIGRATION in migration_advanced_permissions_phase_2; do
# Query explanation: if it doesn't find the migration in the table, there are 0 results and the command fails with a divide-by-zero error. Otherwise the command succeeds
MIGRATION_CHECK_COMMAND="${MME2E_DC_SERVER} exec -T -- postgres psql -U mmuser mattermost_test -c \"select 1 / (select count(*) from Systems where name = '${MIGRATION}' and value = 'true');\""
if ! mme2e_wait_command_success "$MIGRATION_CHECK_COMMAND >/dev/null 2>&1" "Waiting for migration to be completed: ${MIGRATION}" "30" "10"; then
mme2e_log "Migration ${MIGRATION} not completed, retry attempts exhausted. Giving up." >&2
exit 2
fi
mme2e_log "${MIGRATION}: completed."
done
mme2e_log "Mattermost container is running and healthy"

Просмотреть файл

@@ -73,12 +73,14 @@ function hoverOnChannelDescriptionAndVerifyBehavior() {
const channelDescriptionText = `test description ${getRandomId()}`;
// # Wait a little for channel to load
cy.wait(TIMEOUTS.FIVE_SEC);
cy.wait(TIMEOUTS.ONE_SEC);
// # Scan within channel header description area
cy.get('#channelHeaderDescription').should('be.visible').within(() => {
// * Verify that empty header text is visible and click it
cy.findByText('Add a channel header').should('be.visible').click();
// * Verify that empty header text is exists and click it.
// Note that it is invisible until the mouse hovers it, which is unfeasible in Cypress
// https://docs.cypress.io/api/commands/hover
cy.findByText('Add a channel header').click({force: true});
});
// # Scan inside the channel header modal

Просмотреть файл

@@ -15,7 +15,7 @@ import {checkMetrics, toggleMetricsOn} from './helper';
describe('Metrics > No license', () => {
before(() => {
cy.shouldNotRunOnCloudEdition();
cy.apiAdminLogin();
cy.apiAdminLogin().wait(50);
cy.apiDeleteLicense();
toggleMetricsOn();
});

Просмотреть файл

@@ -51,7 +51,7 @@ function verifyCanNavigate(testCase) {
// * Verify that it redirects to the URL and matches with the header
cy.url().should('include', testCase.url);
cy.get('.admin-console__header', {timeout: TIMEOUTS.ONE_MIN}).
cy.get(`${testCase.headerSelector || '.admin-console__header'}`, {timeout: TIMEOUTS.ONE_MIN}).
should('be.visible').
and(testCase.headerContains ? 'contain' : 'have.text', testCase.header);
}

Просмотреть файл

@@ -35,7 +35,7 @@ describe('Settings > Display > Theme > Custom Theme Colors', () => {
cy.get('#customThemes').check().should('be.checked');
// # Open Center Channel Styles section
cy.get('#centerChannelStyles').click({force: true});
cy.get('#centerChannelStyles').click({force: true}).wait(TIMEOUTS.ONE_HUNDRED_MILLIS);
// # Select custom code theme
cy.get('#codeThemeSelect').scrollIntoView().should('be.visible').select(theme.name);

Просмотреть файл

@@ -11,13 +11,19 @@
// Group: @channels @signin_authentication
describe('Login page with close server', () => {
const oldSettings = {};
before(() => {
// Disable other auth options
// Back up config, and disable other auth options
const newSettings = {
Office365Settings: {Enable: false},
LdapSettings: {Enable: false},
TeamSettings: {EnableOpenServer: false},
};
cy.apiGetConfig((config) => {
Object.entries(newSettings).forEach(([key]) => {
oldSettings[key] = config[key];
});
});
cy.apiUpdateConfig(newSettings);
// # Create new team and users
@@ -26,6 +32,10 @@ describe('Login page with close server', () => {
cy.visit('/login');
});
});
after(() => {
// Restore backed up settings
cy.apiAdminLogin().apiUpdateConfig(oldSettings);
});
it('MM-47222 Should verify access problem page can be reached', () => {
cy.findByText('Don\'t have an account?').should('be.visible').click();
cy.findByText('Contact your workspace admin').should('be.visible');

Просмотреть файл

@@ -114,7 +114,7 @@ describe('Team Settings', () => {
// # Set 'sample.mattermost.com' as the only allowed email domain and save
cy.get('#allowedDomains').click().type(emailDomain).type(' ');
cy.findByText('Save').should('be.visible').click();
cy.findByText('Save').should('be.visible');
// # Save and verify it took effect
cy.uiSave();

Просмотреть файл

@@ -43,7 +43,7 @@ describe('unread_with_bottom_start_toast', () => {
// # Add enough messages
for (let index = 0; index < 30; index++) {
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id});
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id}).wait(50);
}
cy.postMessage('hello');
@@ -78,7 +78,7 @@ describe('unread_with_bottom_start_toast', () => {
// # Add enough messages
for (let index = 0; index < 30; index++) {
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id});
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id}).wait(50);
}
cy.postMessage('hello');
@@ -111,7 +111,7 @@ describe('unread_with_bottom_start_toast', () => {
// # Add enough messages
for (let index = 0; index < 30; index++) {
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id});
cy.postMessageAs({sender: otherUser, message: `test message ${index}`, channelId: channel.id}).wait(50);
}
cy.wait(TIMEOUTS.ONE_SEC);

Просмотреть файл

@@ -15,7 +15,7 @@ export const adminConsoleNavigation = [
url: 'admin_console/billing/subscription',
},
{
type: ['cloud_enterprise', 'e20'],
type: ['cloud_enterprise'],
header: 'Billing History',
sidebar: 'Billing History',
url: 'admin_console/billing/billing_history',
@@ -49,6 +49,7 @@ export const adminConsoleNavigation = [
{
type: ['team', 'e20', 'cloud_enterprise'],
header: 'Mattermost Users',
headerSelector: '.admin-console__header #systemUsersTable-headerId',
sidebar: 'Users',
url: 'admin_console/user_management/users',
},