Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
[MM-27188] E2E Tests Automated - Cypress/E2E: Automate backlogs - Sys…
Browse files Browse the repository at this point in the history
…tem Console (11 test cases) (#6610)

* writing test in progress

* add more tests

* ONE MORE TEST TO GO!!! EYYYYY

* FINISHED!

* fix linting and update snapshot

* fix type check

* data test ADD

* Address PR comments

* fix linting

* update test

* move to respective files

* update STUFFZ

* fix linting

* Reset language to english after test

* Fix state of app not updating

* fix test file

* Update e2e/cypress/integration/system_console/about/edition_and_license_spec.js

Co-authored-by: Joseph Baylon <[email protected]>

* Address PR comments

Co-authored-by: Mattermod <[email protected]>
Co-authored-by: Joseph Baylon <[email protected]>
  • Loading branch information
3 people committed Oct 14, 2020
1 parent e933ba7 commit fabd696
Show file tree
Hide file tree
Showing 14 changed files with 514 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ Your subscription details are as follows:
</a>
and
<a
data-testid="privacyPolicyLink"
href="https://about.mattermost.com/default-privacy-policy/"
rel="noopener noreferrer"
target="_blank"
Expand Down Expand Up @@ -510,6 +511,7 @@ exports[`components/admin_console/license_settings/LicenseSettings should match
</a>
and
<a
data-testid="privacyPolicyLink"
href="https://about.mattermost.com/default-privacy-policy/"
rel="noopener noreferrer"
target="_blank"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ export default class LicenseSettings extends React.PureComponent {
href='https://about.mattermost.com/enterprise-edition-terms/'
>{'Enterprise Edition Terms of Service'}</a>{' and '}
<a
data-testid='privacyPolicyLink'
rel='noopener noreferrer'
target='_blank'
href='https://about.mattermost.com/default-privacy-policy/'
Expand Down
8 changes: 8 additions & 0 deletions components/analytics/__snapshots__/line_chart.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ exports[`components/analytics/line_chart.tsx should match snapshot, loaded with
className="content"
>
<canvas
data-labels={
Array [
"test1",
"test2",
"test3",
]
}
data-testid="test"
height={400}
width={600}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports[`components/analytics/statistic_count.tsx should match snapshot, loaded
>
<div
className="title"
data-testid="undefinedTitle"
>
Test
<i
Expand All @@ -33,6 +34,7 @@ exports[`components/analytics/statistic_count.tsx should match snapshot, loaded
>
<div
className="title"
data-testid="undefinedTitle"
>
Test Zero
<i
Expand All @@ -57,6 +59,7 @@ exports[`components/analytics/statistic_count.tsx should match snapshot, on load
>
<div
className="title"
data-testid="undefinedTitle"
>
Test
<i
Expand Down
3 changes: 3 additions & 0 deletions components/analytics/line_chart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('components/analytics/line_chart.tsx', () => {
test('should match snapshot, on loading', () => {
const wrapper = shallow(
<LineChart
id='test'
title='Test'
height={400}
width={600}
Expand All @@ -26,6 +27,7 @@ describe('components/analytics/line_chart.tsx', () => {

const wrapper = shallow(
<LineChart
id='test'
title='Test'
height={400}
width={600}
Expand All @@ -46,6 +48,7 @@ describe('components/analytics/line_chart.tsx', () => {

const wrapper = shallow(
<LineChart
id='test'
title='Test'
height={400}
width={600}
Expand Down
3 changes: 3 additions & 0 deletions components/analytics/line_chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Props = {
width: number;
height: number;
data?: any;
id: string;
}

export default class LineChart extends React.PureComponent<Props> {
Expand Down Expand Up @@ -116,9 +117,11 @@ export default class LineChart extends React.PureComponent<Props> {
} else {
content = (
<canvas
data-testid={this.props.id}
ref='canvas'
width={this.props.width}
height={this.props.height}
data-labels={this.props.data.labels}
/>
);
}
Expand Down
13 changes: 11 additions & 2 deletions components/analytics/statistic_count.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Props = {
title: ReactNode;
icon: string;
count?: number;
id?: string;
}

export default class StatisticCount extends React.PureComponent<Props> {
Expand All @@ -22,11 +23,19 @@ export default class StatisticCount extends React.PureComponent<Props> {
return (
<div className='col-lg-3 col-md-4 col-sm-6'>
<div className='total-count'>
<div className='title'>
<div
data-testid={`${this.props.id}Title`}
className='title'
>
{this.props.title}
<i className={'fa ' + this.props.icon}/>
</div>
<div className='content'>{typeof this.props.count === 'undefined' || isNaN(this.props.count) ? loading : this.props.count}</div>
<div
data-testid={this.props.id}
className='content'
>
{typeof this.props.count === 'undefined' || isNaN(this.props.count) ? loading : this.props.count}
</div>
</div>
</div>
);
Expand Down
16 changes: 16 additions & 0 deletions components/analytics/system_analytics/system_analytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class SystemAnalytics extends React.PureComponent {
} else {
postCount = (
<StatisticCount
id='totalPosts'
title={
<FormattedMessage
id='analytics.system.totalPosts'
Expand All @@ -93,6 +94,7 @@ export default class SystemAnalytics extends React.PureComponent {
/>
}
data={botPostCountsDay}
id='totalPostsFromBotsLineChart'
width={740}
height={225}
/>
Expand All @@ -108,6 +110,7 @@ export default class SystemAnalytics extends React.PureComponent {
defaultMessage='Total Posts'
/>
}
id='totalPostsLineChart'
data={postCountsDay}
width={740}
height={225}
Expand All @@ -124,6 +127,7 @@ export default class SystemAnalytics extends React.PureComponent {
defaultMessage='Active Users With Posts'
/>
}
id='activeUsersWithPostsLineChart'
data={userCountsWithPostsDay}
width={740}
height={225}
Expand All @@ -141,6 +145,7 @@ export default class SystemAnalytics extends React.PureComponent {
if (this.props.isLicensed) {
sessionCount = (
<StatisticCount
id='totalSessions'
title={
<FormattedMessage
id='analytics.system.totalSessions'
Expand All @@ -154,6 +159,7 @@ export default class SystemAnalytics extends React.PureComponent {

commandCount = (
<StatisticCount
id='totalCommands'
title={
<FormattedMessage
id='analytics.system.totalCommands'
Expand All @@ -167,6 +173,7 @@ export default class SystemAnalytics extends React.PureComponent {

incomingCount = (
<StatisticCount
id='incomingWebhooks'
title={
<FormattedMessage
id='analytics.system.totalIncomingWebhooks'
Expand All @@ -180,6 +187,7 @@ export default class SystemAnalytics extends React.PureComponent {

outgoingCount = (
<StatisticCount
id='outgoingWebhooks'
title={
<FormattedMessage
id='analytics.system.totalOutgoingWebhooks'
Expand All @@ -194,6 +202,7 @@ export default class SystemAnalytics extends React.PureComponent {
advancedStats = (
<div>
<StatisticCount
id='websocketConns'
title={
<FormattedMessage
id='analytics.system.totalWebsockets'
Expand All @@ -204,6 +213,7 @@ export default class SystemAnalytics extends React.PureComponent {
count={stats[StatTypes.TOTAL_WEBSOCKET_CONNECTIONS]}
/>
<StatisticCount
id='masterDbConns'
title={
<FormattedMessage
id='analytics.system.totalMasterDbConnections'
Expand All @@ -214,6 +224,7 @@ export default class SystemAnalytics extends React.PureComponent {
count={stats[StatTypes.TOTAL_MASTER_DB_CONNECTIONS]}
/>
<StatisticCount
id='replicaDbConns'
title={
<FormattedMessage
id='analytics.system.totalReadDbConnections'
Expand Down Expand Up @@ -266,6 +277,7 @@ export default class SystemAnalytics extends React.PureComponent {

const userCount = (
<StatisticCount
id='totalActiveUsers'
title={
<FormattedMessage
id='analytics.system.totalUsers'
Expand All @@ -279,6 +291,7 @@ export default class SystemAnalytics extends React.PureComponent {

const teamCount = (
<StatisticCount
id='totalTeams'
title={
<FormattedMessage
id='analytics.system.totalTeams'
Expand All @@ -292,6 +305,7 @@ export default class SystemAnalytics extends React.PureComponent {

const channelCount = (
<StatisticCount
id='totalChannels'
title={
<FormattedMessage
id='analytics.system.totalChannels'
Expand All @@ -305,6 +319,7 @@ export default class SystemAnalytics extends React.PureComponent {

const dailyActiveUsers = (
<StatisticCount
id='dailyActiveUsers'
title={
<FormattedMessage
id='analytics.system.dailyActiveUsers'
Expand All @@ -318,6 +333,7 @@ export default class SystemAnalytics extends React.PureComponent {

const monthlyActiveUsers = (
<StatisticCount
id='monthlyActiveUsers'
title={
<FormattedMessage
id='analytics.system.monthlyActiveUsers'
Expand Down
3 changes: 3 additions & 0 deletions components/analytics/team_analytics/team_analytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export default class TeamAnalytics extends React.PureComponent {
defaultMessage='Total Posts'
/>
}
id='totalPosts'
data={postCountsDay}
width={740}
height={225}
Expand All @@ -200,6 +201,7 @@ export default class TeamAnalytics extends React.PureComponent {
defaultMessage='Active Users With Posts'
/>
}
id='activeUsersWithPosts'
data={userCountsWithPostsDay}
width={740}
height={225}
Expand Down Expand Up @@ -246,6 +248,7 @@ export default class TeamAnalytics extends React.PureComponent {
</div>
<div className='team-statistics__team-filter'>
<select
data-testid='teamFilter'
className='form-control team-statistics__team-filter__dropdown'
onChange={this.handleTeamChange}
value={this.state.team.id}
Expand Down
Loading

0 comments on commit fabd696

Please sign in to comment.