Move /e2e -> /e2e-tests
Этот коммит содержится в:
367
e2e-tests/cypress/tests/utils/admin_console.js
Обычный файл
367
e2e-tests/cypress/tests/utils/admin_console.js
Обычный файл
@@ -0,0 +1,367 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export const adminConsoleNavigation = [
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Edition and License',
|
||||
sidebar: 'Edition and License',
|
||||
url: 'admin_console/about/license',
|
||||
},
|
||||
{
|
||||
type: ['cloud_enterprise'],
|
||||
header: 'Subscription',
|
||||
sidebar: 'Subscription',
|
||||
url: 'admin_console/billing/subscription',
|
||||
},
|
||||
{
|
||||
type: ['cloud_enterprise', 'e20'],
|
||||
header: 'Billing History',
|
||||
sidebar: 'Billing History',
|
||||
url: 'admin_console/billing/billing_history',
|
||||
},
|
||||
{
|
||||
type: ['cloud_enterprise'],
|
||||
header: 'Company Information',
|
||||
sidebar: 'Company Information',
|
||||
url: 'admin_console/billing/company_info',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'System Statistics',
|
||||
sidebar: 'Site Statistics',
|
||||
url: '/admin_console/reporting/system_analytics',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Team Statistics',
|
||||
sidebar: 'Team Statistics',
|
||||
url: '/admin_console/reporting/team_statistics',
|
||||
headerContains: true,
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Server Logs',
|
||||
sidebar: 'Server Logs',
|
||||
url: '/admin_console/reporting/server_logs',
|
||||
headerContains: true,
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Mattermost Users',
|
||||
sidebar: 'Users',
|
||||
url: 'admin_console/user_management/users',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Groups',
|
||||
sidebar: 'Groups',
|
||||
url: 'admin_console/user_management/groups',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Mattermost Teams',
|
||||
sidebar: 'Teams',
|
||||
url: 'admin_console/user_management/teams',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Mattermost Channels',
|
||||
team_header: 'Channels',
|
||||
sidebar: 'Channels',
|
||||
url: 'admin_console/user_management/channels',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Permission Schemes',
|
||||
sidebar: 'Permissions',
|
||||
url: 'admin_console/user_management/permissions',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'System Roles',
|
||||
sidebar: 'System Roles',
|
||||
url: 'admin_console/user_management/system_roles',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Web Server',
|
||||
sidebar: 'Web Server',
|
||||
url: 'admin_console/environment/web_server',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Database',
|
||||
sidebar: 'Database',
|
||||
url: 'admin_console/environment/database',
|
||||
},
|
||||
{
|
||||
type: ['e20'],
|
||||
section: 'Environment',
|
||||
header: 'Elasticsearch',
|
||||
sidebar: 'Elasticsearch',
|
||||
url: 'admin_console/environment/elasticsearch',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'File Storage',
|
||||
sidebar: 'File Storage',
|
||||
url: 'admin_console/environment/file_storage',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Image Proxy',
|
||||
sidebar: 'Image Proxy',
|
||||
url: 'admin_console/environment/image_proxy',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'SMTP',
|
||||
sidebar: 'SMTP',
|
||||
url: 'admin_console/environment/smtp',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Push Notification Server',
|
||||
sidebar: 'Push Notification Server',
|
||||
url: 'admin_console/environment/push_notification_server',
|
||||
},
|
||||
{
|
||||
type: ['e20'],
|
||||
section: 'Environment',
|
||||
header: 'High Availability',
|
||||
sidebar: 'High Availability',
|
||||
url: 'admin_console/environment/high_availability',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Rate Limiting',
|
||||
sidebar: 'Rate Limiting',
|
||||
url: 'admin_console/environment/rate_limiting',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Logging',
|
||||
sidebar: 'Logging',
|
||||
url: 'admin_console/environment/logging',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Session Lengths',
|
||||
sidebar: 'Session Lengths',
|
||||
url: 'admin_console/environment/session_lengths',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Performance Monitoring',
|
||||
sidebar: 'Performance Monitoring',
|
||||
url: 'admin_console/environment/performance_monitoring',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
section: 'Environment',
|
||||
header: 'Developer Settings',
|
||||
sidebar: 'Developer',
|
||||
url: 'admin_console/environment/developer',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Customization',
|
||||
sidebar: 'Customization',
|
||||
url: 'admin_console/site_config/customization',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Localization',
|
||||
sidebar: 'Localization',
|
||||
url: 'admin_console/site_config/localization',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Users and Teams',
|
||||
sidebar: 'Users and Teams',
|
||||
url: 'admin_console/site_config/users_and_teams',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Notifications',
|
||||
sidebar: 'Notifications',
|
||||
url: 'admin_console/environment/notifications',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Announcement Banner',
|
||||
sidebar: 'Announcement Banner',
|
||||
url: 'admin_console/site_config/announcement_banner',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Emoji',
|
||||
sidebar: 'Emoji',
|
||||
url: 'admin_console/site_config/emoji',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Posts',
|
||||
sidebar: 'Posts',
|
||||
url: 'admin_console/site_config/posts',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'File Sharing and Downloads',
|
||||
sidebar: 'File Sharing and Downloads',
|
||||
url: 'admin_console/site_config/file_sharing_downloads',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Public Links',
|
||||
sidebar: 'Public Links',
|
||||
url: 'admin_console/site_config/public_links',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Notices',
|
||||
sidebar: 'Notices',
|
||||
url: 'admin_console/site_config/notices',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Signup',
|
||||
sidebar: 'Signup',
|
||||
url: 'admin_console/authentication/signup',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Email Authentication',
|
||||
sidebar: 'Email',
|
||||
url: 'admin_console/authentication/email',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Password',
|
||||
sidebar: 'Password',
|
||||
url: 'admin_console/authentication/password',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Multi-factor Authentication',
|
||||
sidebar: 'MFA',
|
||||
url: 'admin_console/authentication/mfa',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'AD/LDAP',
|
||||
sidebar: 'AD/LDAP',
|
||||
url: 'admin_console/authentication/ldap',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'SAML 2.0',
|
||||
sidebar: 'SAML 2.0',
|
||||
url: 'admin_console/authentication/saml',
|
||||
},
|
||||
{
|
||||
type: ['team'],
|
||||
header: 'GitLab',
|
||||
sidebar: 'GitLab',
|
||||
url: 'admin_console/authentication/gitlab',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'OpenID Connect',
|
||||
sidebar: 'OpenID Connect',
|
||||
url: 'admin_console/authentication/openid',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Guest Access',
|
||||
sidebar: 'Guest Access',
|
||||
url: 'admin_console/authentication/guest_access',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Plugin Management',
|
||||
sidebar: 'Plugin Management',
|
||||
url: 'admin_console/plugins/plugin_management',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Integration Management',
|
||||
sidebar: 'Integration Management',
|
||||
url: 'admin_console/integrations/integration_management',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Bot Accounts',
|
||||
sidebar: 'Bot Accounts',
|
||||
url: 'admin_console/integrations/bot_accounts',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'GIF (Beta)',
|
||||
sidebar: 'GIF (Beta)',
|
||||
url: 'admin_console/integrations/gif',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'CORS',
|
||||
sidebar: 'CORS',
|
||||
url: 'admin_console/integrations/cors',
|
||||
},
|
||||
{
|
||||
type: ['e20', 'cloud_enterprise'],
|
||||
header: 'Data Retention Policies',
|
||||
sidebar: 'Data Retention Policies',
|
||||
url: 'admin_console/compliance/data_retention_settings',
|
||||
},
|
||||
{
|
||||
type: ['team'],
|
||||
header: 'Data Retention Policy',
|
||||
sidebar: 'Data Retention Policy',
|
||||
url: 'admin_console/compliance/data_retention',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Compliance Export',
|
||||
sidebar: 'Compliance Export',
|
||||
url: 'admin_console/compliance/export',
|
||||
},
|
||||
{
|
||||
type: ['e20', 'cloud_enterprise'],
|
||||
header: 'Compliance Monitoring',
|
||||
sidebar: 'Compliance Monitoring',
|
||||
url: 'admin_console/compliance/monitoring',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Custom Terms of Service',
|
||||
sidebar: 'Custom Terms of Service',
|
||||
url: 'admin_console/compliance/custom_terms_of_service',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Experimental Features',
|
||||
sidebar: 'Features',
|
||||
url: 'admin_console/experimental/features',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20', 'cloud_enterprise'],
|
||||
header: 'Feature Flags',
|
||||
sidebar: 'Feature Flags',
|
||||
url: 'admin_console/experimental/feature_flags',
|
||||
},
|
||||
{
|
||||
type: ['team', 'e20'],
|
||||
header: 'Bleve',
|
||||
sidebar: 'Bleve',
|
||||
url: 'admin_console/experimental/blevesearch',
|
||||
},
|
||||
];
|
||||
29
e2e-tests/cypress/tests/utils/benchmark.js
Обычный файл
29
e2e-tests/cypress/tests/utils/benchmark.js
Обычный файл
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export function reportBenchmarkResults(cy, win) {
|
||||
const testName = getTestName();
|
||||
const selectors = win.getSortedTrackedSelectors();
|
||||
win.dumpTrackedSelectorsStatistics();
|
||||
cy.log(selectors.length);
|
||||
cy.writeFile(`tests/integration/benchmark/__benchmarks__/${testName}.json`, JSON.stringify(selectors));
|
||||
}
|
||||
|
||||
// From https://github.com/cypress-io/cypress/issues/2972#issuecomment-577072392
|
||||
function getTestName() {
|
||||
const cypressContext = Cypress.mocha.getRunner().suite.ctx.test;
|
||||
const testTitles = [];
|
||||
|
||||
function extractTitles(obj) {
|
||||
if (obj.hasOwnProperty('parent')) {
|
||||
testTitles.push(obj.title);
|
||||
const nextObj = obj.parent;
|
||||
extractTitles(nextObj);
|
||||
}
|
||||
}
|
||||
|
||||
extractTitles(cypressContext);
|
||||
const orderedTitles = testTitles.reverse();
|
||||
const fileName = orderedTitles.join(' -- ');
|
||||
return fileName;
|
||||
}
|
||||
34
e2e-tests/cypress/tests/utils/config.js
Обычный файл
34
e2e-tests/cypress/tests/utils/config.js
Обычный файл
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export function getKeycloakServerSettings() {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
const {keycloakBaseUrl, keycloakAppName} = Cypress.env();
|
||||
const idpDescriptorUrl = `${keycloakBaseUrl}/auth/realms/${keycloakAppName}`;
|
||||
const idpUrl = `${idpDescriptorUrl}/protocol/saml`;
|
||||
|
||||
return {
|
||||
SamlSettings: {
|
||||
Enable: true,
|
||||
Encrypt: false,
|
||||
IdpURL: idpUrl,
|
||||
IdpDescriptorURL: idpDescriptorUrl,
|
||||
ServiceProviderIdentifier: `${baseUrl}/login/sso/saml`,
|
||||
AssertionConsumerServiceURL: `${baseUrl}/login/sso/saml`,
|
||||
SignatureAlgorithm: 'RSAwithSHA256',
|
||||
PublicCertificateFile: '',
|
||||
PrivateKeyFile: '',
|
||||
FirstNameAttribute: 'firstName',
|
||||
LastNameAttribute: 'lastName',
|
||||
EmailAttribute: 'email',
|
||||
UsernameAttribute: 'username',
|
||||
EnableSyncWithLdap: true,
|
||||
EnableSyncWithLdapIncludeAuth: true,
|
||||
IdAttribute: 'username',
|
||||
},
|
||||
LdapSettings: {
|
||||
EnableSync: true,
|
||||
BaseDN: 'ou=e2etest,dc=mm,dc=test,dc=com',
|
||||
},
|
||||
};
|
||||
}
|
||||
57
e2e-tests/cypress/tests/utils/constants.js
Обычный файл
57
e2e-tests/cypress/tests/utils/constants.js
Обычный файл
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export const FEEDBACK_EMAIL = 'test@example.com';
|
||||
export const ABOUT_LINK = 'https://docs.mattermost.com/about/product.html';
|
||||
export const ASK_COMMUNITY_LINK = 'https://mattermost.com/pl/default-ask-mattermost-community/';
|
||||
export const HELP_LINK = 'https://mattermost.com/default-help/';
|
||||
export const PRIVACY_POLICY_LINK = 'https://mattermost.com/privacy-policy/';
|
||||
export const REPORT_A_PROBLEM_LINK = 'https://mattermost.com/default-report-a-problem/';
|
||||
export const TERMS_OF_SERVICE_LINK = 'https://mattermost.com/terms-of-use/';
|
||||
|
||||
export const CLOUD = 'Cloud';
|
||||
export const E20 = 'E20';
|
||||
export const TEAM = 'Team';
|
||||
|
||||
export const FixedPublicLinks = {
|
||||
TermsOfService: 'https://mattermost.com/terms-of-use/',
|
||||
PrivacyPolicy: 'https://mattermost.com/privacy-policy/',
|
||||
};
|
||||
|
||||
export const SupportSettings = {
|
||||
ABOUT_LINK,
|
||||
ASK_COMMUNITY_LINK,
|
||||
HELP_LINK,
|
||||
PRIVACY_POLICY_LINK,
|
||||
REPORT_A_PROBLEM_LINK,
|
||||
TERMS_OF_SERVICE_LINK,
|
||||
};
|
||||
export const FixedCloudConfig = {
|
||||
EmailSettings: {
|
||||
FEEDBACK_EMAIL,
|
||||
},
|
||||
SupportSettings,
|
||||
};
|
||||
|
||||
export const ServerEdition = {
|
||||
CLOUD,
|
||||
E20,
|
||||
TEAM,
|
||||
};
|
||||
|
||||
export const Constants = {
|
||||
FixedCloudConfig,
|
||||
ServerEdition,
|
||||
};
|
||||
|
||||
export const CustomStatusDuration = {
|
||||
DONT_CLEAR: '',
|
||||
THIRTY_MINUTES: 'thirty_minutes',
|
||||
ONE_HOUR: 'one_hour',
|
||||
FOUR_HOURS: 'four_hours',
|
||||
TODAY: 'today',
|
||||
THIS_WEEK: 'this_week',
|
||||
DATE_AND_TIME: 'date_and_time',
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
148
e2e-tests/cypress/tests/utils/email.js
Обычный файл
148
e2e-tests/cypress/tests/utils/email.js
Обычный файл
@@ -0,0 +1,148 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export function getEmailUrl() {
|
||||
const smtpUrl = Cypress.env('smtpUrl') || 'http://localhost:9001';
|
||||
|
||||
return `${smtpUrl}/api/v1/mailbox`;
|
||||
}
|
||||
|
||||
export function splitEmailBodyText(text) {
|
||||
return text.split('\n').map((d) => d.trim());
|
||||
}
|
||||
|
||||
export function getEmailResetEmailTemplate(userEmail) {
|
||||
return [
|
||||
'----------------------',
|
||||
'You updated your email',
|
||||
'----------------------',
|
||||
'',
|
||||
`Your email address for Mattermost has been changed to ${userEmail}.`,
|
||||
'If you did not make this change, please contact the system administrator.',
|
||||
'',
|
||||
'To change your notification preferences, log in to your team site and go to Settings > Notifications.',
|
||||
];
|
||||
}
|
||||
|
||||
export function getJoinEmailTemplate(sender, userEmail, team, isGuest = false) {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
return [
|
||||
`${sender} invited you to join the ${team.display_name} team.`,
|
||||
`${isGuest ? 'You were invited as a guest to collaborate with the team' : 'Start collaborating with your team on Mattermost'}`,
|
||||
'',
|
||||
`<join-link-check> Join now ( ${baseUrl}/signup_user_complete/?d=${encodeURIComponent(JSON.stringify({display_name: team.display_name.replace(' ', '+'), email: userEmail, name: team.name}))}&t=<actual-token> )`,
|
||||
'',
|
||||
'What is Mattermost?',
|
||||
'Mattermost is a flexible, open source messaging platform that enables secure team collaboration.',
|
||||
'Learn more ( mattermost.com )',
|
||||
'',
|
||||
'© 2022 Mattermost, Inc. 530 Lytton Avenue, Second floor, Palo Alto, CA, 94301',
|
||||
];
|
||||
}
|
||||
|
||||
export function getMentionEmailTemplate(sender, message, postId, siteName, teamName, channelDisplayName) {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
return [
|
||||
`@${sender} mentioned you in a message`,
|
||||
`While you were away, @${sender} mentioned you in the ${channelDisplayName} channel.`,
|
||||
'',
|
||||
`Reply in Mattermost ( ${baseUrl}/landing#/${teamName}/pl/${postId} )`,
|
||||
'',
|
||||
`@${sender}`,
|
||||
'<skip-local-time-check>',
|
||||
channelDisplayName,
|
||||
'',
|
||||
message,
|
||||
'',
|
||||
'Want to change your notifications settings?',
|
||||
`Login to ${siteName} ( ${baseUrl} ) and go to Settings > Notifications`,
|
||||
'',
|
||||
'© 2022 Mattermost, Inc. 530 Lytton Avenue, Second floor, Palo Alto, CA, 94301',
|
||||
];
|
||||
}
|
||||
|
||||
export function getPasswordResetEmailTemplate() {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
return [
|
||||
'Reset Your Password',
|
||||
'Click the button below to reset your password. If you didn’t request this, you can safely ignore this email.',
|
||||
'',
|
||||
`<reset-password-link-check> Reset Password ( http://${baseUrl}/reset_password_complete?token=<actual-token> )`,
|
||||
'',
|
||||
'The password reset link expires in 24 hours.',
|
||||
'',
|
||||
'© 2022 Mattermost, Inc. 530 Lytton Avenue, Second floor, Palo Alto, CA, 94301',
|
||||
];
|
||||
}
|
||||
|
||||
export function getEmailVerifyEmailTemplate(userEmail) {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
return [
|
||||
'Verify your email address',
|
||||
`Thanks for joining ${baseUrl.split('/')[2]}. ( ${baseUrl} )`,
|
||||
'Click below to verify your email address.',
|
||||
'',
|
||||
`<email-verify-link-check> Verify Email ( ${baseUrl}/do_verify_email?token=<actual-token>&email=${encodeURIComponent(userEmail)} )`,
|
||||
'',
|
||||
'This email address was used to create an account with Mattermost.',
|
||||
'If it was not you, you can safely ignore this email.',
|
||||
'',
|
||||
'© 2022 Mattermost, Inc. 530 Lytton Avenue, Second floor, Palo Alto, CA, 94301',
|
||||
];
|
||||
}
|
||||
|
||||
export function getWelcomeEmailTemplate(userEmail, siteName, teamName) {
|
||||
const baseUrl = Cypress.config('baseUrl');
|
||||
|
||||
return [
|
||||
'Welcome to the team',
|
||||
`Thanks for joining ${baseUrl.split('/')[2]}. ( ${baseUrl} )`,
|
||||
'Click below to verify your email address.',
|
||||
'',
|
||||
`<email-verify-link-check> Verify Email ( ${baseUrl}/do_verify_email?token=<actual-token>&email=${encodeURIComponent(userEmail)}&redirect_to=/${teamName} )`,
|
||||
'',
|
||||
`This email address was used to create an account with ${siteName}.`,
|
||||
'If it was not you, you can safely ignore this email.',
|
||||
'',
|
||||
'Download the desktop and mobile apps',
|
||||
'For the best experience, download the apps for PC, Mac, iOS and Android.',
|
||||
'',
|
||||
'Download ( https://mattermost.com/download/#mattermostApps )',
|
||||
'',
|
||||
'© 2022 Mattermost, Inc. 530 Lytton Avenue, Second floor, Palo Alto, CA, 94301',
|
||||
];
|
||||
}
|
||||
|
||||
export function verifyEmailBody(expectedBody, actualBody) {
|
||||
expect(expectedBody.length).to.equal(actualBody.length);
|
||||
|
||||
for (let i = 0; i < expectedBody.length; i++) {
|
||||
if (expectedBody[i].includes('skip-local-time-check')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (expectedBody[i].includes('email-verify-link-check')) {
|
||||
expect(actualBody[i]).to.include('Verify Email');
|
||||
expect(actualBody[i]).to.include('do_verify_email?token=');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (expectedBody[i].includes('join-link-check')) {
|
||||
expect(actualBody[i]).to.include('Join now');
|
||||
expect(actualBody[i]).to.include('signup_user_complete/?d=');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (expectedBody[i].includes('reset-password-link-check')) {
|
||||
expect(actualBody[i]).to.include('Reset Password');
|
||||
expect(actualBody[i]).to.include('reset_password_complete?token=');
|
||||
continue;
|
||||
}
|
||||
|
||||
expect(expectedBody[i], `Line ${i} expects "${expectedBody[i]}" but got ${actualBody[i]}`).to.equal(actualBody[i]);
|
||||
}
|
||||
}
|
||||
27
e2e-tests/cypress/tests/utils/file.js
Обычный файл
27
e2e-tests/cypress/tests/utils/file.js
Обычный файл
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// Converts a file size in bytes into a human-readable string of the form '123MB'.
|
||||
export function fileSizeToString(bytes) {
|
||||
// it's unlikely that we'll have files bigger than this
|
||||
if (bytes > 1024 ** 4) {
|
||||
// check if file is smaller than 10 to display fractions
|
||||
if (bytes < (1024 ** 4) * 10) {
|
||||
return (Math.round((bytes / (1024 ** 4)) * 10) / 10) + 'TB';
|
||||
}
|
||||
return Math.round(bytes / (1024 ** 4)) + 'TB';
|
||||
} else if (bytes > 1024 ** 3) {
|
||||
if (bytes < (1024 ** 3) * 10) {
|
||||
return (Math.round((bytes / (1024 ** 3)) * 10) / 10) + 'GB';
|
||||
}
|
||||
return Math.round(bytes / (1024 ** 3)) + 'GB';
|
||||
} else if (bytes > 1024 ** 2) {
|
||||
if (bytes < (1024 ** 2) * 10) {
|
||||
return (Math.round((bytes / (1024 ** 2)) * 10) / 10) + 'MB';
|
||||
}
|
||||
return Math.round(bytes / (1024 ** 2)) + 'MB';
|
||||
} else if (bytes > 1024) {
|
||||
return Math.round(bytes / 1024) + 'KB';
|
||||
}
|
||||
return bytes + 'B';
|
||||
}
|
||||
98
e2e-tests/cypress/tests/utils/index.js
Обычный файл
98
e2e-tests/cypress/tests/utils/index.js
Обычный файл
@@ -0,0 +1,98 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/* eslint-disable no-loop-func, quote-props */
|
||||
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
import messageMenusData from '../fixtures/hooks/message_menus.json';
|
||||
import messageMenusWithDatasourceData from '../fixtures/hooks/message_menus_with_datasource.json';
|
||||
|
||||
export * from './constants';
|
||||
export * from './email';
|
||||
export * from './file';
|
||||
export * from './plugins';
|
||||
|
||||
/**
|
||||
* @param {Number} length - length on random string to return, e.g. 7 (default)
|
||||
* @return {String} random string
|
||||
*/
|
||||
export function getRandomId(length = 7) {
|
||||
const MAX_SUBSTRING_INDEX = 27;
|
||||
|
||||
return uuidv4().replace(/-/g, '').substring(MAX_SUBSTRING_INDEX - length, MAX_SUBSTRING_INDEX);
|
||||
}
|
||||
|
||||
export function getRandomLetter(length) {
|
||||
return Array.from({length}, () => String.fromCharCode(97 + Math.floor(Math.random() * 26))).join('');
|
||||
}
|
||||
|
||||
export function getMessageMenusPayload({dataSource, options, prefix = Date.now()} = {}) {
|
||||
let data;
|
||||
if (dataSource) {
|
||||
data = messageMenusWithDatasourceData;
|
||||
data.attachments[0].actions[0].data_source = dataSource;
|
||||
data.attachments[0].pretext = `${prefix}: This is attachment pretext with ${dataSource} options`;
|
||||
data.attachments[0].text = `${prefix}: This is attachment text with ${dataSource} options`;
|
||||
} else {
|
||||
data = messageMenusData;
|
||||
data.attachments[0].pretext = `${prefix}: This is attachment pretext with basic options`;
|
||||
data.attachments[0].text = `${prefix}: This is attachment text with basic options`;
|
||||
|
||||
if (options) {
|
||||
data.attachments[0].actions[0].options = options;
|
||||
}
|
||||
}
|
||||
|
||||
const callbackUrl = Cypress.env().webhookBaseUrl + '/message_menus';
|
||||
data.attachments[0].actions[0].integration.url = callbackUrl;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
export function hexToRgbArray(hex) {
|
||||
var rgbArr = hex.replace('#', '').match(/.{1,2}/g);
|
||||
return [
|
||||
parseInt(rgbArr[0], 16),
|
||||
parseInt(rgbArr[1], 16),
|
||||
parseInt(rgbArr[2], 16),
|
||||
];
|
||||
}
|
||||
|
||||
export function rgbArrayToString(rgbArr) {
|
||||
return `rgb(${rgbArr[0]}, ${rgbArr[1]}, ${rgbArr[2]})`;
|
||||
}
|
||||
|
||||
export const reUrl = /(https?:\/\/[^ ]*)/;
|
||||
|
||||
const userAgent = () => window.navigator.userAgent;
|
||||
|
||||
export function isWindows() {
|
||||
return userAgent().indexOf('Windows') !== -1;
|
||||
}
|
||||
|
||||
export function isMac() {
|
||||
return userAgent().indexOf('Macintosh') !== -1;
|
||||
}
|
||||
|
||||
// Stubs out the clipboard so that we can intercept copy events. Note that this only stubs out calls to
|
||||
// navigator.clipboard.writeText and not document.execCommand.
|
||||
export function stubClipboard() {
|
||||
const clipboard = {contents: '', wasCalled: false};
|
||||
|
||||
cy.window().then((win) => {
|
||||
if (!win.navigator.clipboard) {
|
||||
win.navigator.clipboard = {
|
||||
writeText: () => {}, //eslint-disable-line no-empty-function
|
||||
};
|
||||
}
|
||||
|
||||
cy.stub(win.navigator.clipboard, 'writeText', (link) => {
|
||||
clipboard.wasCalled = true;
|
||||
clipboard.contents = link;
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
});
|
||||
|
||||
return cy.wrap(clipboard);
|
||||
}
|
||||
79
e2e-tests/cypress/tests/utils/plugins.js
Обычный файл
79
e2e-tests/cypress/tests/utils/plugins.js
Обычный файл
@@ -0,0 +1,79 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
/**
|
||||
* @id - plugin ID
|
||||
* @version - plugin version
|
||||
* @url - A URL where the plugin can be downloaded
|
||||
* @filename - Name of a plugin file which should be available at "e2e/cypress/tests/fixtures/[filename]"
|
||||
* upon manual download from the given URL. File is not to be included in the commit.
|
||||
*
|
||||
* Note:
|
||||
* 1. Only those with "@filename" field is required to have corresponding file at fixtures folder.
|
||||
* Download the plugin file from the given "@url" and save to "e2e/cypress/tests/fixtures/[@filename]".
|
||||
* 2. Plugin should typically install in test via URL, unless it is specifically required to upload
|
||||
* by file.
|
||||
*/
|
||||
|
||||
export const agendaPlugin = {
|
||||
id: 'com.mattermost.agenda',
|
||||
version: '0.2.2',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-agenda/releases/download/v0.2.2/com.mattermost.agenda-0.2.2.tar.gz',
|
||||
};
|
||||
|
||||
export const demoPlugin = {
|
||||
id: 'com.mattermost.demo-plugin',
|
||||
version: '0.9.0',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.9.0/com.mattermost.demo-plugin-0.9.0.tar.gz',
|
||||
filename: 'com.mattermost.demo-plugin-0.9.0.tar.gz',
|
||||
};
|
||||
|
||||
export const demoPluginOld = {
|
||||
id: 'com.mattermost.demo-plugin',
|
||||
version: '0.8.0',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.8.0/com.mattermost.demo-plugin-0.8.0.tar.gz',
|
||||
filename: 'com.mattermost.demo-plugin-0.8.0.tar.gz',
|
||||
};
|
||||
|
||||
export const drawPlugin = {
|
||||
id: 'com.mattermost.draw-plugin',
|
||||
version: '0.0.4',
|
||||
url: 'https://github.com/jespino/mattermost-plugin-draw/releases/download/v0.0.4/com.mattermost.draw-plugin-0.0.4.tar.gz',
|
||||
};
|
||||
|
||||
export const githubPlugin = {
|
||||
id: 'github',
|
||||
version: '2.0.1',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-github/releases/download/v2.0.1/github-2.0.1.tar.gz',
|
||||
};
|
||||
|
||||
export const githubPluginOld = {
|
||||
id: 'github',
|
||||
version: '1.0.0',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-github/releases/download/v1.0.0/github-1.0.0.tar.gz',
|
||||
};
|
||||
|
||||
export const gitlabPlugin = {
|
||||
id: 'com.github.manland.mattermost-plugin-gitlab',
|
||||
version: '1.3.0',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-gitlab/releases/download/v1.3.0/com.github.manland.mattermost-plugin-gitlab-1.3.0.tar.gz',
|
||||
filename: 'com.github.manland.mattermost-plugin-gitlab-1.3.0.tar.gz',
|
||||
};
|
||||
|
||||
export const jiraPlugin = {
|
||||
id: 'jira',
|
||||
version: '3.0.1',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-jira/releases/download/v3.0.1/jira-3.0.1.tar.gz',
|
||||
};
|
||||
|
||||
export const matterpollPlugin = {
|
||||
id: 'com.github.matterpoll.matterpoll',
|
||||
version: '1.5.0',
|
||||
url: 'https://github.com/matterpoll/matterpoll/releases/download/v1.5.0/com.github.matterpoll.matterpoll-1.5.0.tar.gz',
|
||||
};
|
||||
|
||||
export const testPlugin = {
|
||||
id: 'com.mattermost.test-plugin',
|
||||
version: '0.1.0',
|
||||
url: 'https://github.com/mattermost/mattermost-plugin-test/releases/download/v0.1.0/com.mattermost.test-plugin-0.1.0.tar.gz',
|
||||
};
|
||||
15
e2e-tests/cypress/tests/utils/timezone.js
Обычный файл
15
e2e-tests/cypress/tests/utils/timezone.js
Обычный файл
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import timezones from 'timezones.json';
|
||||
|
||||
export function getTimezoneLabel(timezone = '') {
|
||||
for (let i = 0; i < timezones.length; i++) {
|
||||
const zone = timezones[i];
|
||||
if (zone.utc.includes(timezone)) {
|
||||
return zone.text;
|
||||
}
|
||||
}
|
||||
|
||||
return timezone;
|
||||
}
|
||||
Ссылка в новой задаче
Block a user