From a2f19e6de23f49c49934c9f36097a94e38ff2b51 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Thu, 12 Sep 2019 09:00:17 +0000 Subject: [PATCH] mgr/dashboard: Increase the global value of jasmine timeout Some tests are taking longer than the default jasmine timeout to finish and are causing a failure. This commit will increase the timeout to 5 minutes, removing the need to increase it for each failing test. Signed-off-by: Tiago Melo --- .../frontend/e2e/cluster/logs.e2e-spec.ts | 11 --- .../frontend/e2e/rgw/users.e2e-spec.ts | 9 -- .../frontend/e2e/ui/dashboard.e2e-spec.ts | 87 ++++++++----------- .../mgr/dashboard/frontend/protractor.conf.js | 2 +- 4 files changed, 38 insertions(+), 71 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/e2e/cluster/logs.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/cluster/logs.e2e-spec.ts index dca739c3c54..47c95a39bdc 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/cluster/logs.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/cluster/logs.e2e-spec.ts @@ -69,13 +69,6 @@ describe('Logs page', () => { }); describe('audit logs respond to editing configuration setting test', () => { - let originalTimeout; - - beforeEach(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 200000; - }); - it('should change config settings and check audit logs reacted', async () => { await configuration.navigateTo(); await configuration.edit(configname, ['global', '5']); @@ -86,9 +79,5 @@ describe('Logs page', () => { await configuration.navigateTo(); await configuration.configClear(configname); }); - - afterEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; - }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/e2e/rgw/users.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/rgw/users.e2e-spec.ts index 29f1c7e78ac..4caaa4df175 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/rgw/users.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/rgw/users.e2e-spec.ts @@ -43,12 +43,7 @@ describe('RGW users page', () => { }); describe('Invalid input test', () => { - let originalTimeout; - beforeAll(async () => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 200000; - await users.navigateTo(); }); @@ -59,9 +54,5 @@ describe('RGW users page', () => { it('should put invalid input into user edit form and check fields are marked invalid', async () => { await users.invalidEdit(); }); - - afterAll(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; - }); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts index 3ec8719bc5e..d15c358d525 100644 --- a/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/e2e/ui/dashboard.e2e-spec.ts @@ -94,60 +94,47 @@ describe('Dashboard Main Page', () => { }); }); - describe('Correct information', () => { - let originalTimeout; + it('Should check that dashboard cards have correct information', async () => { + interface TestSpec { + cardName: string; + regexMatcher?: RegExp; + pageObject: PageHelper; + } - beforeEach(async () => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 200000; - }); - - it('Should check that dashboard cards have correct information', async () => { - interface TestSpec { - cardName: string; - regexMatcher?: RegExp; - pageObject: PageHelper; - } - - const testSpecs: TestSpec[] = [ - { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons }, - { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors }, - { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts }, - { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds }, - { cardName: 'Pools', pageObject: pools }, - { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi } - ]; + const testSpecs: TestSpec[] = [ + { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons }, + { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors }, + { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts }, + { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds }, + { cardName: 'Pools', pageObject: pools }, + { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi } + ]; - for (let i = 0; i < testSpecs.length; i++) { - const spec = testSpecs[i]; - await dashboard.navigateTo(); - const infoCardBodyText = await dashboard.infoCardBodyText(spec.cardName); - let dashCount = 0; - if (spec.regexMatcher) { - const match = infoCardBodyText.match(new RegExp(spec.regexMatcher)); - if (match && match.length > 1) { - dashCount = Number(match[1]); - } else { - return Promise.reject( - `Regex ${spec.regexMatcher} did not find a match for card with name ` + - `${spec.cardName}` - ); - } + for (let i = 0; i < testSpecs.length; i++) { + const spec = testSpecs[i]; + await dashboard.navigateTo(); + const infoCardBodyText = await dashboard.infoCardBodyText(spec.cardName); + let dashCount = 0; + if (spec.regexMatcher) { + const match = infoCardBodyText.match(new RegExp(spec.regexMatcher)); + if (match && match.length > 1) { + dashCount = Number(match[1]); } else { - dashCount = Number(infoCardBodyText); + return Promise.reject( + `Regex ${spec.regexMatcher} did not find a match for card with name ` + + `${spec.cardName}` + ); } - await spec.pageObject.navigateTo(); - const tableCount = await spec.pageObject.getTableTotalCount(); - await expect(dashCount).toBe( - tableCount, - `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` + - `but did not match table count ${tableCount}` - ); + } else { + dashCount = Number(infoCardBodyText); } - }); - - afterEach(function() { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; - }); + await spec.pageObject.navigateTo(); + const tableCount = await spec.pageObject.getTableTotalCount(); + await expect(dashCount).toBe( + tableCount, + `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` + + `but did not match table count ${tableCount}` + ); + } }); }); diff --git a/src/pybind/mgr/dashboard/frontend/protractor.conf.js b/src/pybind/mgr/dashboard/frontend/protractor.conf.js index 143437a81f7..1445893f1e2 100644 --- a/src/pybind/mgr/dashboard/frontend/protractor.conf.js +++ b/src/pybind/mgr/dashboard/frontend/protractor.conf.js @@ -28,7 +28,7 @@ const config = { framework: 'jasmine', jasmineNodeOpts: { showColors: true, - defaultTimeoutInterval: 30000, + defaultTimeoutInterval: 300000, print: function() {} }, params: { -- 2.47.3