diff --git a/detox/e2e/support/server_api/default_config.json b/detox/e2e/support/server_api/default_config.json deleted file mode 100644 index 6aedc1dbd..000000000 --- a/detox/e2e/support/server_api/default_config.json +++ /dev/null @@ -1,305 +0,0 @@ -{ - "ServiceSettings": { - "SiteURL": "http://localhost:8065", - "WebsocketURL": "", - "LicenseFileLocation": "", - "ListenAddress": ":8065", - "ConnectionSecurity": "", - "TLSCertFile": "", - "TLSKeyFile": "", - "TLSMinVer": "1.2", - "TLSStrictTransport": false, - "TLSStrictTransportMaxAge": 63072000, - "TLSOverwriteCiphers": [], - "UseLetsEncrypt": false, - "Forward80To443": false, - "TrustedProxyIPHeader": [], - "ReadTimeout": 300, - "WriteTimeout": 300, - "IdleTimeout": 300, - "MaximumLoginAttempts": 10, - "GoroutineHealthThreshold": -1, - "GoogleDeveloperKey": "", - "EnableOAuthServiceProvider": false, - "EnableIncomingWebhooks": true, - "EnableOutgoingWebhooks": true, - "EnableCommands": true, - "EnableOnlyAdminIntegrations": true, - "EnablePostUsernameOverride": false, - "EnablePostIconOverride": false, - "EnableLinkPreviews": false, - "EnableTesting": false, - "EnableDeveloper": false, - "EnableOpenTracing": false, - "EnableSecurityFixAlert": true, - "EnableInsecureOutgoingConnections": false, - "AllowedUntrustedInternalConnections": "localhost", - "EnableMultifactorAuthentication": false, - "EnforceMultifactorAuthentication": false, - "EnableUserAccessTokens": false, - "AllowCorsFrom": "", - "CorsExposedHeaders": "", - "CorsAllowCredentials": false, - "CorsDebug": false, - "AllowCookiesForSubdomains": false, - "ExtendSessionLengthWithActivity": true, - "SessionLengthWebInDays": 30, - "SessionLengthMobileInDays": 30, - "SessionLengthSSOInDays": 30, - "SessionCacheInMinutes": 10, - "SessionIdleTimeoutInMinutes": 43200, - "WebsocketSecurePort": 443, - "WebsocketPort": 80, - "WebserverMode": "gzip", - "EnableCustomEmoji": false, - "EnableEmojiPicker": true, - "EnableGifPicker": false, - "GfycatApiKey": "2_KtH_W5", - "GfycatApiSecret": "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof", - "RestrictCustomEmojiCreation": "all", - "RestrictPostDelete": "all", - "AllowEditPost": "always", - "PostEditTimeLimit": -1, - "TimeBetweenUserTypingUpdatesMilliseconds": 5000, - "EnablePostSearch": true, - "MinimumHashtagLength": 3, - "EnableUserTypingMessages": true, - "EnableChannelViewedMessages": true, - "EnableUserStatuses": true, - "ExperimentalEnableAuthenticationTransfer": true, - "CloseUnusedDirectMessages": false, - "EnablePreviewFeatures": true, - "ExperimentalEnableDefaultChannelLeaveJoinMessages": true, - "ExperimentalGroupUnreadChannels": "disabled", - "ExperimentalChannelOrganization": false, - "ExperimentalChannelSidebarOrganization": "disabled", - "EnableAPIChannelDeletion": true, - "EnableAPITeamDeletion": true, - "ExperimentalEnableHardenedMode": false, - "DisableLegacyMFA": true, - "ExperimentalStrictCSRFEnforcement": false, - "EnableEmailInvitations": true, - "DisableBotsWhenOwnerIsDeactivated": true, - "EnableBotAccountCreation": true, - "EnableSVGs": true, - "EnableLatex": true, - "EnableInlineLatex": true, - "CollapsedThreads": "always_on" - }, - "TeamSettings": { - "SiteName": "Mattermost", - "MaxUsersPerTeam": 2000, - "EnableTeamCreation": true, - "EnableUserCreation": true, - "EnableOpenServer": true, - "EnableUserDeactivation": false, - "EnableCustomUserStatuses": true, - "RestrictCreationToDomains": "", - "EnableCustomBrand": false, - "CustomBrandText": "", - "CustomDescriptionText": "", - "RestrictDirectMessage": "any", - "RestrictTeamInvite": "all", - "RestrictPublicChannelManagement": "all", - "RestrictPrivateChannelManagement": "all", - "RestrictPublicChannelCreation": "all", - "RestrictPrivateChannelCreation": "all", - "RestrictPublicChannelDeletion": "all", - "RestrictPrivateChannelDeletion": "all", - "RestrictPrivateChannelManageMembers": "all", - "EnableXToLeaveChannelsFromLHS": false, - "UserStatusAwayTimeout": 300, - "MaxChannelsPerTeam": 2000, - "MaxNotificationsPerChannel": 1000, - "EnableConfirmNotificationsToChannel": true, - "TeammateNameDisplay": "username", - "ExperimentalViewArchivedChannels": true, - "ExperimentalEnableAutomaticReplies": true, - "ExperimentalHideTownSquareinLHS": false, - "ExperimentalTownSquareIsReadOnly": false, - "LockTeammateNameDisplay": false, - "ExperimentalPrimaryTeam": "", - "ExperimentalDefaultChannels": [] - }, - "ClientRequirements": { - "AndroidLatestVersion": "", - "AndroidMinVersion": "", - "DesktopLatestVersion": "", - "DesktopMinVersion": "", - "IosLatestVersion": "", - "IosMinVersion": "" - }, - "LogSettings": { - "EnableConsole": true - }, - "NotificationLogSettings": { - "EnableConsole": true - }, - "PasswordSettings": { - "MinimumLength": 5, - "Lowercase": false, - "Number": false, - "Uppercase": false, - "Symbol": false, - "Enable": false - }, - "FileSettings": { - "EnableFileAttachments": true, - "EnableMobileUpload": true, - "EnableMobileDownload": true, - "MaxFileSize": 52428800, - "DriverName": "local", - "Directory": "./data/", - "EnablePublicLink": false, - "PublicLinkSalt": "" - }, - "EmailSettings": { - "EnableSignUpWithEmail": true, - "EnableSignInWithEmail": true, - "EnableSignInWithUsername": true, - "SendEmailNotifications": true, - "UseChannelInEmailNotifications": false, - "RequireEmailVerification": false, - "FeedbackName": "", - "FeedbackEmail": "test@example.com", - "ReplyToAddress": "test@example.com", - "FeedbackOrganization": "", - "EnableSMTPAuth": false, - "SMTPUsername": "", - "SMTPPassword": "", - "SMTPServer": "localhost", - "SMTPPort": "10025", - "SMTPServerTimeout": 10, - "ConnectionSecurity": "", - "SendPushNotifications": true, - "PushNotificationServer": "https://push-test.mattermost.com", - "PushNotificationContents": "generic", - "EnableEmailBatching": false, - "EmailBatchingBufferSize": 256, - "EmailBatchingInterval": 30, - "EnablePreviewModeBanner": true, - "SkipServerCertificateVerification": false, - "EmailNotificationContentsType": "full", - "LoginButtonColor": "#0000", - "LoginButtonBorderColor": "#2389D7", - "LoginButtonTextColor": "#2389D7" - }, - "RateLimitSettings": { - "Enable": false - }, - "PrivacySettings": { - "ShowEmailAddress": true, - "ShowFullName": true - }, - "SupportSettings": { - "TermsOfServiceLink": "https://mattermost.com/terms-of-use/", - "PrivacyPolicyLink": "https://mattermost.com/privacy-policy/", - "AboutLink": "https://mattermost.com/default-about/", - "HelpLink": "https://mattermost.com/default-help/", - "ReportAProblemLink": "https://mattermost.com/default-report-a-problem/", - "SupportEmail": "feedback@mattermost.com", - "CustomTermsOfServiceEnabled": false, - "CustomTermsOfServiceReAcceptancePeriod": 365, - "EnableAskCommunityLink": true - }, - "AnnouncementSettings": { - "EnableBanner": false - }, - "ThemeSettings": { - "EnableThemeSelection": true, - "DefaultTheme": "default", - "AllowCustomThemes": true, - "AllowedThemes": [] - }, - "GitLabSettings": { - "Enable": false - }, - "GoogleSettings": { - "Enable": false - }, - "Office365Settings": { - "Enable": false - }, - "LdapSettings": { - "Enable": false - }, - "ComplianceSettings": { - "Enable": false - }, - "LocalizationSettings": { - "DefaultServerLocale": "en", - "DefaultClientLocale": "en", - "AvailableLocales": "" - }, - "SamlSettings": { - "Enable": false - }, - "NativeAppSettings": { - "AppDownloadLink": "https://mattermost.com/download/#mattermostApps", - "AndroidAppDownloadLink": "https://mattermost.com/mattermost-android-app/", - "IosAppDownloadLink": "https://mattermost.com/mattermost-ios-app/" - }, - "ClusterSettings": { - "Enable": false - }, - "MetricsSettings": { - "Enable": false - }, - "ExperimentalSettings": { - "ClientSideCertEnable": false, - "ClientSideCertCheck": "secondary", - "LinkMetadataTimeoutMilliseconds": 5000, - "RestrictSystemAdmin": false, - "UseNewSAMLLibrary": false - }, - "AnalyticsSettings": { - "MaxUsersForStatistics": 2500 - }, - "ElasticsearchSettings": { - "ConnectionUrl": "http://localhost:9200", - "Username": "elastic", - "Password": "changeme", - "EnableIndexing": false, - "EnableSearching": false, - "EnableAutocomplete": false, - "Sniff": true - }, - "DataRetentionSettings": { - "EnableMessageDeletion": false, - "EnableFileDeletion": false, - "MessageRetentionDays": 365, - "FileRetentionDays": 365, - "DeletionJobStartTime": "02:00" - }, - "MessageExportSettings": { - "EnableExport": false - }, - "JobSettings": { - "RunJobs": true, - "RunScheduler": true - }, - "PluginSettings": { - "Enable": false, - "PluginStates": { - "com.mattermost.calls": { - "Enable": true - } - } - }, - "DisplaySettings": { - "CustomUrlSchemes": [], - "ExperimentalTimezone": true - }, - "GuestAccountsSettings": { - "Enable": true, - "AllowEmailAccounts": true, - "EnforceMultifactorAuthentication": false, - "RestrictCreationToDomains": "" - }, - "ImageProxySettings": { - "Enable": true, - "ImageProxyType": "local", - "RemoteImageProxyURL": "", - "RemoteImageProxyOptions": "" - } -} diff --git a/detox/e2e/support/server_api/system.ts b/detox/e2e/support/server_api/system.ts index ef485614b..1bbcec80f 100644 --- a/detox/e2e/support/server_api/system.ts +++ b/detox/e2e/support/server_api/system.ts @@ -3,13 +3,10 @@ import path from 'path'; -import {ldapPort, ldapServer} from '@support/test_config'; -import merge from 'deepmerge'; import jestExpect from 'expect'; import client from './client'; import {apiUploadFile, getResponseFromError} from './common'; -import defaultServerConfig from './default_config.json'; // **************************************************************** // System @@ -152,29 +149,6 @@ export const apiRequireSMTPServer = async (baseUrl: string) => { jestExpect(status).toEqual(200); }; -/** - * Update configuration. - * See https://api.mattermost.com/#operation/UpdateConfig - * @param {string} baseUrl - the base server URL - * @param {Object} newConfig - specific config to update - * @return {Object} returns {config} on success or {error, status} on error - */ -export const apiUpdateConfig = async (baseUrl: string, newConfig: any = {}): Promise => { - try { - const {config: currentConfig} = await apiGetConfig(baseUrl); - const config = merge.all([currentConfig, getDefaultConfig(baseUrl), newConfig]); - - const response = await client.put( - `${baseUrl}/api/v4/config`, - config, - ); - - return {config: response.data}; - } catch (err) { - return getResponseFromError(err); - } -}; - /** * Upload server license with file expected at "/detox/e2e/support/fixtures/mattermost-license.txt" * See https://api.mattermost.com/#operation/UploadLicenseFile @@ -209,18 +183,6 @@ export const getClientLicense = async (baseUrl: string): Promise => { return {license: out.license}; }; -export const getDefaultConfig = (siteUrl: string) => { - const fromEnv = { - LdapSettings: { - LdapServer: ldapServer, - LdapPort: ldapPort, - }, - ServiceSettings: {SiteURL: siteUrl}, - }; - - return merge(defaultServerConfig, fromEnv); -}; - export const System = { apiCheckSystemHealth, apiEmailTest, @@ -230,10 +192,8 @@ export const System = { apiRequireLicense, apiRequireLicenseForFeature, apiRequireSMTPServer, - apiUpdateConfig, apiUploadLicense, getClientLicense, - getDefaultConfig, }; export default System; diff --git a/detox/e2e/support/ui/screen/server.ts b/detox/e2e/support/ui/screen/server.ts index 0708ad860..746fbd22a 100644 --- a/detox/e2e/support/ui/screen/server.ts +++ b/detox/e2e/support/ui/screen/server.ts @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {isAndroid, timeouts, wait} from '@support/utils'; +import {isIos, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; class ServerScreen { @@ -47,7 +47,10 @@ class ServerScreen { await this.serverUrlInput.replaceText(serverUrl); await this.serverUrlInput.tapReturnKey(); await this.serverDisplayNameInput.replaceText(serverDisplayName); - await this.tapConnectButton(); + await this.serverDisplayNameInput.tapReturnKey(); + if (isIos()) { + await this.tapConnectButton(); + } }; close = async () => { @@ -56,10 +59,6 @@ class ServerScreen { }; tapConnectButton = async () => { - if (isAndroid()) { - await device.pressBack(); - await wait(timeouts.ONE_SEC); - } await this.connectButton.tap(); await wait(timeouts.ONE_SEC); }; diff --git a/detox/e2e/test/setup.ts b/detox/e2e/test/setup.ts index 5e961cd61..edd07e3b7 100644 --- a/detox/e2e/test/setup.ts +++ b/detox/e2e/test/setup.ts @@ -8,7 +8,6 @@ beforeAll(async () => { // Login as sysadmin and reset server configuration await System.apiCheckSystemHealth(siteOneUrl); await User.apiAdminLogin(siteOneUrl); - await System.apiUpdateConfig(siteOneUrl); await Plugin.apiDisableNonPrepackagedPlugins(siteOneUrl); await device.launchApp({ diff --git a/detox/e2e/test/teams/invite_people.e2e.ts b/detox/e2e/test/teams/invite_people.e2e.ts index fc0faeaea..c74dfef7c 100644 --- a/detox/e2e/test/teams/invite_people.e2e.ts +++ b/detox/e2e/test/teams/invite_people.e2e.ts @@ -79,7 +79,7 @@ describe('Teams - Invite', () => { await expect(Invite.teamIcon).toBeVisible(); // * Verify default Selection - await expect(Invite.screenSelection).toBeVisible(); + await waitFor(Invite.screenSelection).toBeVisible().withTimeout(timeouts.TWO_SEC); // * Verify Server data await expect(Invite.serverDisplayName).toHaveText(serverOneDisplayName); @@ -93,10 +93,9 @@ describe('Teams - Invite', () => { }); it('MM-T5221 - should be able to share a URL invite to the team', async () => { - // # Tap on Share link - await Invite.shareLinkButton.tap(); - if (isIos()) { + // # Tap on Share link + await Invite.shareLinkButton.tap(); const dialog = systemDialog(`Join the ${testTeam.display_name} team`); // * Verify share dialog is open @@ -104,28 +103,28 @@ describe('Teams - Invite', () => { // # Close share dialog await dialog.swipe('down'); - } + } // no support for Android system dialogs by detox yet. See https://github.com/wix/Detox/issues/3227 }); it('MM-T5361 - should show no results item in search list', async () => { const noUser = 'qwertyuiop'; - // # Search for a non existent user + // # Search for a non-existent user await Invite.searchBarInput.replaceText(noUser); // * Validate no results item in search list - await expect(Invite.getSearchListNoResults(noUser)).toBeVisible(); + await waitFor(Invite.getSearchListNoResults(noUser)).toBeVisible().withTimeout(timeouts.TWO_SEC); await expect(Invite.getSearchListNoResultsText(noUser)).toHaveText(noUser); }); it('MM-T5362 - should be able to send email invite', async () => { const noUserEmailFormat = 'qwerty@ui.op'; - // # Search for a non existent user with email format + // # Search for a non-existent user with email format await Invite.searchBarInput.replaceText(noUserEmailFormat); // * Validate email invite item in search list - await expect(Invite.getSearchListTextItem(noUserEmailFormat)).toBeVisible(); + await waitFor(Invite.getSearchListTextItem(noUserEmailFormat)).toBeVisible().withTimeout(timeouts.TWO_SEC); await expect(Invite.getSearchListTextItemText(noUserEmailFormat)).toHaveText(noUserEmailFormat); // # Select email invite item @@ -139,7 +138,7 @@ describe('Teams - Invite', () => { await Invite.sendButton.tap(); // * Validate summary report sent - await expect(Invite.screenSummary).toBeVisible(); + await waitFor(Invite.screenSummary).toBeVisible().withTimeout(timeouts.TEN_SEC); await expect(Invite.getSummaryReportSent()).toBeVisible(); await expect(Invite.getSummaryReportNotSent()).not.toExist(); await expect(Invite.getSummaryReportTextItem(noUserEmailFormat)).toBeVisible(); @@ -149,11 +148,11 @@ describe('Teams - Invite', () => { it('MM-T5363 - should be able to send user invite', async () => { const username = ` @${testUser1.username}`; - // # Search for a existent user + // # Search for an existent user await Invite.searchBarInput.replaceText(testUser1.username); // * Validate user item in search list - await expect(Invite.getSearchListUserItem(testUser1.id)).toBeVisible(); + await waitFor(Invite.getSearchListUserItem(testUser1.id)).toBeVisible().withTimeout(timeouts.TWO_SEC); await expect(Invite.getSearchListUserItemText(testUser1.id)).toHaveText(username); // # Select user item @@ -167,7 +166,7 @@ describe('Teams - Invite', () => { await Invite.sendButton.tap(); // * Validate summary report sent - await expect(Invite.screenSummary).toBeVisible(); + await waitFor(Invite.screenSummary).toBeVisible().withTimeout(timeouts.TEN_SEC); await expect(Invite.getSummaryReportSent()).toBeVisible(); await expect(Invite.getSummaryReportNotSent()).not.toExist(); await expect(Invite.getSummaryReportUserItem(testUser1.id)).toBeVisible(); @@ -177,11 +176,11 @@ describe('Teams - Invite', () => { it('MM-T5364 - should not be able to send user invite to user already in team', async () => { const username = ` @${testUser1.username}`; - // # Search for a existent user already in team + // # Search for an existent user already in team await Invite.searchBarInput.replaceText(testUser1.username); // * Validate user item in search list - await expect(Invite.getSearchListUserItem(testUser1.id)).toBeVisible(); + await waitFor(Invite.getSearchListUserItem(testUser1.id)).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Select user item await Invite.getSearchListUserItem(testUser1.id).tap(); @@ -206,11 +205,11 @@ describe('Teams - Invite', () => { const username1 = ` @${testUser1.username}`; const username2 = ` @${testUser2.username}`; - // # Search for a existent user + // # Search for an existent user await Invite.searchBarInput.replaceText(testUser2.username); // * Validate user item in search list - await expect(Invite.getSearchListUserItem(testUser2.id)).toBeVisible(); + await waitFor(Invite.getSearchListUserItem(testUser2.id)).toBeVisible().withTimeout(timeouts.TEN_SEC); // # Select user item await Invite.getSearchListUserItem(testUser2.id).tap(); @@ -234,7 +233,7 @@ describe('Teams - Invite', () => { await Invite.sendButton.tap(); // * Validate summary - await expect(Invite.screenSummary).toBeVisible(); + await waitFor(Invite.screenSummary).toBeVisible().withTimeout(timeouts.TEN_SEC); // * Validate summary report not sent await expect(Invite.getSummaryReportNotSent()).toBeVisible(); @@ -242,7 +241,7 @@ describe('Teams - Invite', () => { await expect(Invite.getSummaryReportUserItemText(testUser1.id)).toHaveText(username1); // * Validate summary report sent - await expect(Invite.getSummaryReportSent()).toBeVisible(); + await waitFor(Invite.getSummaryReportSent()).toBeVisible().withTimeout(timeouts.TEN_SEC); await expect(Invite.getSummaryReportUserItem(testUser2.id)).toBeVisible(); await expect(Invite.getSummaryReportUserItemText(testUser2.id)).toHaveText(username2); });