E2E Tests: unify compose files, support Opensearch (#28716)
* Unify docker-compose files, support opensearch and redis * Support cypress/playwright bools, MM_SERVICE_OVERRIDES input * Remove unused directives from E2E tests * [skip ci] Fix ES tests, PR messages * [skip ci] Fix service pruning on server restart * [skip ci] Make services overrides a CSV, better param descriptions --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6af8c2f83e
Коммит
0a14eb3d45
@@ -103,8 +103,13 @@ case "${TEST:-$TEST_DEFAULT}" in
|
||||
esac
|
||||
# OS specific defaults overrides
|
||||
case $MME2E_OSTYPE in
|
||||
linux )
|
||||
export IS_LINUX="-linux"
|
||||
;;
|
||||
darwin )
|
||||
BROWSER_DEFAULT="electron" ;;
|
||||
export BROWSER_DEFAULT="electron"
|
||||
export IS_LINUX=""
|
||||
;;
|
||||
* )
|
||||
esac
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ enable_docker_service() {
|
||||
|
||||
assert_docker_services_validity() {
|
||||
local SERVICES_TO_CHECK="$*"
|
||||
local SERVICES_VALID="postgres minio inbucket openldap elasticsearch keycloak cypress webhook-interactions playwright"
|
||||
local SERVICES_VALID="postgres minio inbucket openldap elasticsearch opensearch redis keycloak cypress webhook-interactions playwright"
|
||||
local SERVICES_REQUIRED="postgres inbucket"
|
||||
for SERVICE_NAME in $SERVICES_TO_CHECK; do
|
||||
if ! mme2e_is_token_in_list "$SERVICE_NAME" "$SERVICES_VALID"; then
|
||||
@@ -78,82 +78,140 @@ $(if mme2e_is_token_in_list "postgres" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
postgres:
|
||||
image: mattermostdevelopment/mirrored-postgres:12
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: mmuser
|
||||
POSTGRES_PASSWORD: mostest
|
||||
POSTGRES_DB: mattermost_test
|
||||
command: postgres -c "config_file=/etc/postgresql/postgresql.conf"
|
||||
volumes:
|
||||
- ../../server/build/docker/postgres.conf:/etc/postgresql/postgresql.conf
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-h", "localhost"]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
networks: !reset []
|
||||
extends:
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: postgres'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "inbucket" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
inbucket:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
restart: "no"
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: inbucket'
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: inbucket
|
||||
healthcheck:
|
||||
test: [ "CMD", "nc", "-z", "-w1", "127.0.0.1", "10025" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "minio" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
minio:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
restart: "no"
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: minio'
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: minio
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-f", "127.0.0.1:9000/minio/health/live" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "openldap" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
openldap:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
restart: "no"
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: openldap'
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: openldap
|
||||
healthcheck:
|
||||
test: [ "CMD", "bash", "-o", "pipefail", "-c", "ss -ltn \"sport = :636\" | grep -qE \"^LISTEN\"" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "elasticsearch" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
elasticsearch:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
environment:
|
||||
xpack.security.enabled: "false"
|
||||
action.destructive_requires_name: "false"
|
||||
extends:
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: elasticsearch
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-fsS", "localhost:9200/_cluster/health?wait_for_status=green&timeout=5s" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
if [ "$MME2E_ARCHTYPE" = "arm64" ]; then
|
||||
echo '
|
||||
elasticsearch:
|
||||
image: mattermostdevelopment/mattermost-elasticsearch:8.9.0
|
||||
platform: linux/arm64/v8
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: elasticsearch'
|
||||
else
|
||||
echo '
|
||||
elasticsearch:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: elasticsearch'
|
||||
platform: linux/arm64/v8'
|
||||
fi
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "opensearch" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
opensearch:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
environment:
|
||||
http.port: 9200
|
||||
extends:
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: opensearch
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-fsS", "localhost:9200/_cluster/health?wait_for_status=green&timeout=5s" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "redis" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
redis:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
extends:
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: redis
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "keycloak" "$ENABLED_DOCKER_SERVICES"; then
|
||||
echo '
|
||||
keycloak:
|
||||
restart: "no"
|
||||
network_mode: host
|
||||
networks: !reset []
|
||||
environment:
|
||||
JAVA_OPTS: "-Xms64m -Xmx2G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true"
|
||||
volumes:
|
||||
- "../../server/build/docker/keycloak/realm-export.json:/opt/keycloak/data/import/realm-export.json"
|
||||
- "../../server/build/docker/keycloak/kc-healthcheck.sh:/usr/local/bin/kc-healthcheck.sh"
|
||||
extends:
|
||||
file: ../../server/build/gitlab-dc.common.yml
|
||||
service: keycloak'
|
||||
file: ../../server/build/docker-compose.common.yml
|
||||
service: keycloak
|
||||
healthcheck:
|
||||
# We cannot use a simple curl --silent localhost:9990/health | grep -q \"status\":\"UP\" because theres no curl in the image: https://www.keycloak.org/server/health#_using_the_health_checks
|
||||
test: [ "CMD", "/usr/local/bin/kc-healthcheck.sh" ]
|
||||
interval: 10s
|
||||
timeout: 15s
|
||||
retries: 12'
|
||||
fi)
|
||||
|
||||
$(if mme2e_is_token_in_list "cypress" "$ENABLED_DOCKER_SERVICES"; then
|
||||
@@ -274,6 +332,15 @@ generate_env_files() {
|
||||
echo "$env" >>.env.server
|
||||
done
|
||||
|
||||
# Generating service-specific env vars
|
||||
for SERVICE in $ENABLED_DOCKER_SERVICES; do
|
||||
case $SERVICE in
|
||||
opensearch)
|
||||
echo "MM_ELASTICSEARCHSETTINGS_BACKEND=opensearch" >>.env.server
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Generating TEST-specific env files
|
||||
# Some are defaulted in .e2erc due to being needed to other scripts as well
|
||||
export REPO=mattermost # Static, but declared here for making generate_test_cycle.js easier to run
|
||||
@@ -305,7 +372,7 @@ generate_env_files() {
|
||||
keycloak)
|
||||
echo "CYPRESS_keycloakBaseUrl=http://localhost:8484" >>.env.cypress
|
||||
;;
|
||||
elasticsearch)
|
||||
elasticsearch|opensearch)
|
||||
echo "CYPRESS_elasticsearchConnectionURL=http://localhost:9200" >>.env.cypress
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -10,7 +10,7 @@ mme2e_wait_image "$SERVER_IMAGE" 4 30
|
||||
# Launch mattermost-server, and wait for it to be healthy
|
||||
mme2e_log "Starting E2E containers"
|
||||
${MME2E_DC_SERVER} create
|
||||
${MME2E_DC_SERVER} up -d
|
||||
${MME2E_DC_SERVER} up -d --remove-orphans
|
||||
if ! mme2e_wait_service_healthy server 60 10; then
|
||||
mme2e_log "Mattermost container not healthy, retry attempts exhausted. Giving up." >&2
|
||||
exit 1
|
||||
|
||||
@@ -78,13 +78,13 @@ describe('MM-T2574 Session Lengths', () => {
|
||||
},
|
||||
};
|
||||
|
||||
cy.get('#extendSessionLengthWithActivityfalse').check();
|
||||
cy.get('#extendSessionLengthWithActivityfalse').should('exist').check();
|
||||
Object.entries(helpText).forEach(([key, value]) => {
|
||||
cy.findByTestId(key).should('exist');
|
||||
cy.findByTestId(`${key}help-text`).should('have.text', value.false);
|
||||
});
|
||||
|
||||
cy.get('#extendSessionLengthWithActivitytrue').check();
|
||||
cy.get('#extendSessionLengthWithActivitytrue').should('exist').check();
|
||||
Object.entries(helpText).forEach(([key, value]) => {
|
||||
if (value.true) {
|
||||
cy.findByTestId(key).should('exist');
|
||||
|
||||
@@ -101,11 +101,11 @@ describe('Integrations page', () => {
|
||||
const cId = clientID as unknown as string;
|
||||
cy.contains('.item-details', cId).within(() => {
|
||||
// * Copy button should exist for Client ID
|
||||
cy.contains('.item-details__token', 'Client ID').within(() => {
|
||||
cy.contains('.item-details__token', 'Client ID').should('exist').within(() => {
|
||||
cy.get('.fa-copy').should('exist');
|
||||
});
|
||||
|
||||
cy.contains('.item-details__token', 'Client Secret').within(() => {
|
||||
cy.contains('.item-details__token', 'Client Secret').should('exist').within(() => {
|
||||
// * Client secret should not show
|
||||
cy.contains('*******************').should('exist');
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('Integrations page', () => {
|
||||
cy.findByText('Hide Secret').should('exist');
|
||||
cy.findByText('Show Secret').should('not.exist');
|
||||
|
||||
cy.contains('.item-details__token', 'Client Secret').within(() => {
|
||||
cy.contains('.item-details__token', 'Client Secret').should('exist').within(() => {
|
||||
// * Token should not be obscured
|
||||
cy.contains('*******************').should('not.exist');
|
||||
|
||||
|
||||
@@ -394,6 +394,9 @@ describe('Integrations page', () => {
|
||||
// # Enter a request url for custom slash command
|
||||
cy.findByLabelText('Request URL').should('exist').scrollIntoView().type('https://example.com');
|
||||
|
||||
// # Enter the desired request method
|
||||
cy.findByLabelText('Request Method').should('exist').scrollIntoView().select('GET');
|
||||
|
||||
// # Check the option of autocomplete
|
||||
cy.findByLabelText('Autocomplete').should('exist').scrollIntoView().click();
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ describe('System Console > User Management > Users', () => {
|
||||
it('MM-T933 Users - System admin changes own password - Cancel out of changes', () => {
|
||||
// # Search for the admin.
|
||||
cy.findByPlaceholderText('Search users').type(otherAdmin.username).wait(TIMEOUTS.HALF_SEC);
|
||||
cy.get('#systemUsersTable-cell-0_emailColumn').should('contain', otherAdmin.email);
|
||||
|
||||
// # Open the actions menu.
|
||||
cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC);
|
||||
@@ -123,6 +124,7 @@ describe('System Console > User Management > Users', () => {
|
||||
it('MM-T934 Users - System admin changes own password - Incorrect old password', () => {
|
||||
// # Search for the admin.
|
||||
cy.findByPlaceholderText('Search users').type(otherAdmin.username).wait(TIMEOUTS.HALF_SEC);
|
||||
cy.get('#systemUsersTable-cell-0_emailColumn').should('contain', otherAdmin.email);
|
||||
|
||||
// # Open the actions menu.
|
||||
cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC);
|
||||
@@ -145,6 +147,7 @@ describe('System Console > User Management > Users', () => {
|
||||
it('MM-T935 Users - System admin changes own password - Invalid new password', () => {
|
||||
// # Search for the admin.
|
||||
cy.findByPlaceholderText('Search users').type(otherAdmin.username).wait(TIMEOUTS.HALF_SEC);
|
||||
cy.get('#systemUsersTable-cell-0_emailColumn').should('contain', otherAdmin.email);
|
||||
|
||||
// # Open the actions menu.
|
||||
cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC);
|
||||
@@ -167,6 +170,7 @@ describe('System Console > User Management > Users', () => {
|
||||
it('MM-T936 Users - System admin changes own password - Blank fields', () => {
|
||||
// # Search for the admin.
|
||||
cy.findByPlaceholderText('Search users').type(otherAdmin.username).wait(TIMEOUTS.HALF_SEC);
|
||||
cy.get('#systemUsersTable-cell-0_emailColumn').should('contain', otherAdmin.email);
|
||||
|
||||
// # Open the actions menu.
|
||||
cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC);
|
||||
@@ -195,6 +199,7 @@ describe('System Console > User Management > Users', () => {
|
||||
it('MM-T937 Users - System admin changes own password - Successfully changed', () => {
|
||||
// # Search for the admin.
|
||||
cy.findByPlaceholderText('Search users').type(otherAdmin.username).wait(TIMEOUTS.HALF_SEC);
|
||||
cy.get('#systemUsersTable-cell-0_emailColumn').should('contain', otherAdmin.email);
|
||||
|
||||
// # Open the actions menu.
|
||||
cy.get('#systemUsersTable-cell-0_actionsColumn').click().wait(TIMEOUTS.HALF_SEC);
|
||||
|
||||
2
e2e-tests/playwright/package-lock.json
сгенерированный
2
e2e-tests/playwright/package-lock.json
сгенерированный
@@ -14,7 +14,7 @@
|
||||
"async-wait-until": "2.0.12",
|
||||
"axe-core": "4.10.0",
|
||||
"chalk": "4.1.2",
|
||||
"dayjs": "^1.11.13",
|
||||
"dayjs": "1.11.13",
|
||||
"deepmerge": "4.3.1",
|
||||
"dotenv": "16.4.5",
|
||||
"form-data-encoder": "4.0.2",
|
||||
|
||||
Ссылка в новой задаче
Block a user