From e7918d53900ebafa5f4cd653953787257a59b1f7 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 13 Dec 2016 18:15:22 +0100 Subject: [PATCH 1/3] Finishing off base rtss functional tests --- .../lib/component/current-op-component.jsx | 6 +- .../lib/component/time-and-pause-button.jsx | 22 ++++++- test/compass-functional.test.js | 51 +++++++++++++-- test/support/spectron-support.js | 64 +++++++++++++++++++ 4 files changed, 136 insertions(+), 7 deletions(-) diff --git a/src/internal-packages/server-stats/lib/component/current-op-component.jsx b/src/internal-packages/server-stats/lib/component/current-op-component.jsx index 4d08042aaad..e098fdf4d14 100644 --- a/src/internal-packages/server-stats/lib/component/current-op-component.jsx +++ b/src/internal-packages/server-stats/lib/component/current-op-component.jsx @@ -106,7 +106,11 @@ class CurrentOpComponent extends React.Component {

Slowest Operations

-
✔ No Slow Operations
+
+ ✔ No Slow Operations +
); } diff --git a/src/internal-packages/server-stats/lib/component/time-and-pause-button.jsx b/src/internal-packages/server-stats/lib/component/time-and-pause-button.jsx index 347edcfbe7d..1a960a285c8 100644 --- a/src/internal-packages/server-stats/lib/component/time-and-pause-button.jsx +++ b/src/internal-packages/server-stats/lib/component/time-and-pause-button.jsx @@ -20,8 +20,26 @@ class TimeAndPauseButton extends React.Component { render() { return (
- - + +
00:00:00
); diff --git a/test/compass-functional.test.js b/test/compass-functional.test.js index 38fe254fc63..69df8cc4cc3 100644 --- a/test/compass-functional.test.js +++ b/test/compass-functional.test.js @@ -151,12 +151,55 @@ describe('Compass Functional Test Suite #spectron', function() { .should.eventually.equal('0'); }); - it('renders the network graph'); - it('renders the memory graph'); - it('renders the hottest collections'); - it('renders the slow operations'); + it('renders the network bytes in', function() { + return client + .getNetworkBytesIn() + .should.eventually.not.equal(null); + }); + + it('renders the network bytes out', function() { + return client + .getNetworkBytesOut() + .should.eventually.not.equal(null); + }); + + it('renders the network connections', function() { + return client + .getNetworkConnections() + .should.eventually.equal('5'); + }); + + it('renders the memory vsize', function() { + return client + .getMemoryVSize() + .should.eventually.not.equal(null); + }); + + it('renders the memory resident size', function() { + return client + .getMemoryResident() + .should.eventually.not.equal(null); + }); + + it('renders the memory mapped size', function() { + return client + .getMemoryMapped() + .should.eventually.not.equal(null); + }); + + it('renders the slow operations', function() { + return client + .getSlowestOperations() + .should.eventually.include('No Slow Operations'); + }); context('when pausing the performance tab', function() { + it('pauses the performance tab', function() { + return client + .clickPerformancePauseButton() + .getSlowestOperations() + .should.eventually.include('No Slow Operations'); + }); }); }); diff --git a/test/support/spectron-support.js b/test/support/spectron-support.js index 6db86e893c5..a9591ccadd8 100644 --- a/test/support/spectron-support.js +++ b/test/support/spectron-support.js @@ -232,6 +232,14 @@ function addWaitCommands(client) { */ function addClickCommands(client) { + /** + * click the pause button the performance tab. + */ + client.addCommand('clickPerformancePauseButton', function() { + const button = selector('performance-pause'); + return this.waitForVisible(button, TIMEOUT).click(button); + }); + /** * Click the LAST delete database trash icon in the list. * @@ -559,6 +567,62 @@ function addClickCommands(client) { */ function addGetCommands(client) { + /** + * Get the slow operations list. + */ + client.addCommand('getSlowestOperations', function() { + const base = selector('no-slow-operations'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the memory vsize from the memory graph. + */ + client.addCommand('getMemoryVSize', function() { + const base = selector('performance-virtual'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the memory resident out from the memory graph. + */ + client.addCommand('getMemoryResident', function() { + const base = selector('performance-resident'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the memory mapped from the memory graph. + */ + client.addCommand('getMemoryMapped', function() { + const base = selector('performance-mapped'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the network bytes in from the network graph. + */ + client.addCommand('getNetworkBytesIn', function() { + const base = selector('performance-bytesIn'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the network bytes out from the network graph. + */ + client.addCommand('getNetworkBytesOut', function() { + const base = selector('performance-bytesOut'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + + /** + * Get the network connections from the network graph. + */ + client.addCommand('getNetworkConnections', function() { + const base = selector('performance-connections'); + return this.waitForVisible(base, TIMEOUT).getText(base); + }); + /** * Get active reads count from the read & write graph. */ From 57782c9ac23d7825c8ca3d7c2ab17ab276a49013 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 13 Dec 2016 18:34:45 +0100 Subject: [PATCH 2/3] Disable services in the test run --- src/app/network-optin/index.jade | 10 ++++---- test/compass-functional.test.js | 4 ++++ test/support/spectron-support.js | 40 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/app/network-optin/index.jade b/src/app/network-optin/index.jade index c0b48bdd386..8f79903e6f8 100644 --- a/src/app/network-optin/index.jade +++ b/src/app/network-optin/index.jade @@ -9,31 +9,31 @@ ul li label - input(type='checkbox', name='enableFeedbackPanel', data-hook='product-feedback-checkbox') + input(type='checkbox', name='enableFeedbackPanel', data-hook='product-feedback-checkbox', data-test-id='product-feedback-checkbox') span Enable Product Feedback Tool p.option-description Enables a tool for sending feedback or talking to our Product and Development teams directly from Compass. li label - input(type='checkbox', name='enableMaps', data-hook='enable-maps-checkbox') + input(type='checkbox', name='enableMaps', data-hook='enable-maps-checkbox', data-test-id='enable-maps-checkbox') span Enable Geographic Visualizations p.option-description Allow Compass to make requests to a 3rd party mapping service. li label - input(type='checkbox', name='trackErrors', data-hook='track-errors-checkbox') + input(type='checkbox', name='trackErrors', data-hook='track-errors-checkbox' data-test-id='track-errors-checkbox') span Enable Crash Reports p.option-description Allow Compass to send crash reports containing stack traces and unhandled exceptions. li label - input(type='checkbox', name='trackUsageStatistics', data-hook='usage-stats-checkbox') + input(type='checkbox', name='trackUsageStatistics', data-hook='usage-stats-checkbox', data-test-id='usage-stats-checkbox') span Enable Usage Statistics p.option-description Allow Compass to send anonymous usage statistics. li label - input(type='checkbox', name='autoUpdates', data-hook='auto-updates-checkbox') + input(type='checkbox', name='autoUpdates', data-hook='auto-updates-checkbox', data-test-id='auto-updates-checkbox') span Enable Automatic Updates p.option-description Allow Compass to periodically check for new updates. diff --git a/test/compass-functional.test.js b/test/compass-functional.test.js index 69df8cc4cc3..227c66b4670 100644 --- a/test/compass-functional.test.js +++ b/test/compass-functional.test.js @@ -37,6 +37,10 @@ describe('Compass Functional Test Suite #spectron', function() { return client .clickCloseFeatureTourButton() .waitForPrivacySettingsModal() + .clickEnableProductFeedbackCheckbox() + .clickEnableCrashReportsCheckbox() + .clickEnableUsageStatsCheckbox() + .clickEnableAutoUpdatesCheckbox() .getModalTitle() .should.eventually.equal('Privacy Settings'); }); diff --git a/test/support/spectron-support.js b/test/support/spectron-support.js index a9591ccadd8..116aa05e00a 100644 --- a/test/support/spectron-support.js +++ b/test/support/spectron-support.js @@ -232,6 +232,46 @@ function addWaitCommands(client) { */ function addClickCommands(client) { + /** + * Click the enable product feedback checkbox. + */ + client.addCommand('clickEnableProductFeedbackCheckbox', function() { + const checkbox = selector('product-feedback-checkbox'); + return this.waitForVisible(checkbox, TIMEOUT).click(checkbox); + }); + + /** + * Click the enable geo viz checkbox. + */ + client.addCommand('clickEnableGeoCheckbox', function() { + const checkbox = selector('enable-maps-checkbox'); + return this.waitForVisible(checkbox, TIMEOUT).click(checkbox); + }); + + /** + * Click the enable crash reports checkbox. + */ + client.addCommand('clickEnableCrashReportsCheckbox', function() { + const checkbox = selector('track-errors-checkbox'); + return this.waitForVisible(checkbox, TIMEOUT).click(checkbox); + }); + + /** + * Click the enable usage stats checkbox. + */ + client.addCommand('clickEnableUsageStatsCheckbox', function() { + const checkbox = selector('usage-stats-checkbox'); + return this.waitForVisible(checkbox, TIMEOUT).click(checkbox); + }); + + /** + * Click the enable auto updates checkbox. + */ + client.addCommand('clickEnableAutoUpdatesCheckbox', function() { + const checkbox = selector('auto-updates-checkbox'); + return this.waitForVisible(checkbox, TIMEOUT).click(checkbox); + }); + /** * click the pause button the performance tab. */ From 75929b752758672e69f3820497e7ca2b76fab22b Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 13 Dec 2016 18:42:57 +0100 Subject: [PATCH 3/3] Add timeouts on all waitUntil commands --- test/support/spectron-support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/spectron-support.js b/test/support/spectron-support.js index 116aa05e00a..221066959ce 100644 --- a/test/support/spectron-support.js +++ b/test/support/spectron-support.js @@ -330,7 +330,7 @@ function addClickCommands(client) { return this.getText('div[data-hook=optin-container]').then(function(text) { return text.length === 0; }); - }); + }, TIMEOUT); }); /**