From 8405c4bd52d3476ffeb1af0103ab23e2430b6f38 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 19 Jul 2019 16:30:50 +0800 Subject: [PATCH 01/48] code view loading benchmark test added --- .../cypress/tests/codeView_load_benchmark.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 frontend/cypress/tests/codeView_load_benchmark.js diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js new file mode 100644 index 0000000000..fc8f253bcb --- /dev/null +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -0,0 +1,33 @@ +describe('load code view benchmark', function() { + const MAXIMUM_LOADING_TIME = 8000; + const MAXIMUM_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; + let loadingTimeSeconds; + + it(`time taken to load code view is within ${MAXIMUM_LOADING_TIME_SECONDS}s`, + function() { + // ensure that icons are loaded + Cypress.wait(); + + let startTime; + + cy.get('.summary-chart__title').contains('Eugene') + .parent() + .within(($title) => { + cy.get('a .summary-chart__title--button.fa-code').click(); + startTime = performance.now(); + console.log("starting now"); + }) + + cy.get('#tab-authorship .files') + .then(() => { + const endTime = performance.now(); + const loadingTime = endTime - startTime; + + loadingTimeSeconds = (loadingTime / 1000).toFixed(3); + + assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, + "loading time is within limit"); + cy.log(`time taken to load code view: ${loadingTimeSeconds}s`) + }); + }); +}); From 5e47ef7755b7c4f9767645085c6db05032dc864b Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 19 Jul 2019 16:48:39 +0800 Subject: [PATCH 02/48] code view benchmark: use more specific identifier --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index fc8f253bcb..4866e83b96 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -10,7 +10,7 @@ describe('load code view benchmark', function() { let startTime; - cy.get('.summary-chart__title').contains('Eugene') + cy.get('.summary-chart__title--name').contains('Eugene') .parent() .within(($title) => { cy.get('a .summary-chart__title--button.fa-code').click(); From 071f36b70dad937c86a0e60ae657404f7b00fda2 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 19 Jul 2019 17:08:51 +0800 Subject: [PATCH 03/48] benchmark test: remove console.log message --- frontend/cypress/tests/codeView_load_benchmark.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 4866e83b96..194e64b273 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -10,12 +10,11 @@ describe('load code view benchmark', function() { let startTime; - cy.get('.summary-chart__title--name').contains('Eugene') + cy.get('.summary-chart__title').contains('eugenepeh') .parent() .within(($title) => { cy.get('a .summary-chart__title--button.fa-code').click(); startTime = performance.now(); - console.log("starting now"); }) cy.get('#tab-authorship .files') From 12d64743bfbbbcd9418f5c76bd340e768db066a4 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 19 Jul 2019 17:16:29 +0800 Subject: [PATCH 04/48] benchmark test: assert that button is visible before clicking it --- frontend/cypress/tests/codeView_load_benchmark.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 194e64b273..dbe6bbc62c 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -13,7 +13,9 @@ describe('load code view benchmark', function() { cy.get('.summary-chart__title').contains('eugenepeh') .parent() .within(($title) => { - cy.get('a .summary-chart__title--button.fa-code').click(); + cy.get('a .summary-chart__title--button.fa-code') + .should('be.visible') + .click(); startTime = performance.now(); }) From a438814b48e025828be72d3ebb5a8ef4de8a5817 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 19 Jul 2019 17:22:14 +0800 Subject: [PATCH 05/48] benchmark test: more specific selector --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index dbe6bbc62c..4b86d92df5 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -10,7 +10,7 @@ describe('load code view benchmark', function() { let startTime; - cy.get('.summary-chart__title').contains('eugenepeh') + cy.get('.summary-chart__title--name').contains('eugenepeh') .parent() .within(($title) => { cy.get('a .summary-chart__title--button.fa-code') From b4cdfa6ec71d85c99ee99637ee79ce40f30b44e8 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 13:08:30 +0800 Subject: [PATCH 06/48] codeview benchmark: use new approach independent of username, repeat test 3 times and take average --- .../cypress/tests/codeView_load_benchmark.js | 79 +++++++++++++------ 1 file changed, 56 insertions(+), 23 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 4b86d92df5..c2ccdf7a69 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -1,34 +1,67 @@ describe('load code view benchmark', function() { - const MAXIMUM_LOADING_TIME = 8000; + const NUM_TRIALS = 3; + const THRESHOLD_LOADING_TIME = 8000; + const THRESHOLD_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; + + const BUFFER_PERCENTAGE = 0.1; + const BUFFER_SUGGESTED_TIME = 3000; + const ALLOWED_BUFFER_TIME = BUFFER_PERCENTAGE * MAXIMUM_LOADING_TIME >= BUFFER_SUGGESTED_TIME + ? BUFFER_PERCENTAGE * MAXIMUM_LOADING_TIME : BUFFER_SUGGESTED_TIME; + + const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; const MAXIMUM_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; - let loadingTimeSeconds; - it(`time taken to load code view is within ${MAXIMUM_LOADING_TIME_SECONDS}s`, - function() { - // ensure that icons are loaded - Cypress.wait(); + let totalLoadingTime = 0; + + for (let i = 0; i < NUM_TRIALS; i++) { + it(`time taken to load code view (trial ${i+1})`, function() { + let startTime; + // ensure that icons are loaded + Cypress.wait(); + + cy.get('#summary-wrapper .sort-within-group select') + .select('totalCommits dsc'); + + // ---- need the following 2 cy.get(.) while awaiting PR #828 + cy.get('#summary-wrapper .sort-within-group select') + .select('totalCommits'); - let startTime; + cy.get('#summary-wrapper .sort-within-group select') + .select('totalCommits dsc'); + // ----- end of to delete - cy.get('.summary-chart__title--name').contains('eugenepeh') - .parent() - .within(($title) => { - cy.get('a .summary-chart__title--button.fa-code') - .should('be.visible') - .click(); + cy.get('.summary-chart__title--button.fa-code') + .should('be.visible') + .first() + .click() + .then(() => { startTime = performance.now(); - }) + }) + + cy.get('#tab-authorship .files') + .then(() => { + const endTime = performance.now(); + const loadingTime = endTime - startTime; + const loadingTimeSeconds = loadingTime / 1000; + + totalLoadingTime += loadingTime; + + assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, + `loading time for trial ${i+1}: ${loadingTimeSeconds.toFixed(3)}s`); + }); + }); + } + - cy.get('#tab-authorship .files') - .then(() => { - const endTime = performance.now(); - const loadingTime = endTime - startTime; + it(`average time taken to load is within ${MAXIMUM_LOADING_TIME_SECONDS}s`, function() { + const averageLoadingTime = totalLoadingTime / NUM_TRIALS; + const averageLoadingTimeSeconds = averageLoadingTime / 1000; - loadingTimeSeconds = (loadingTime / 1000).toFixed(3); + // wait so that the average loading time will + // show up as the test time in travis + cy.wait(averageLoadingTime); - assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, - "loading time is within limit"); - cy.log(`time taken to load code view: ${loadingTimeSeconds}s`) - }); + assert.isTrue(averageLoadingTime < MAXIMUM_LOADING_TIME, + `average loading time: ${averageLoadingTimeSeconds}s`); }); }); From 30d5941c841e865527ab8b38ea0a945be6191d3d Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 14:26:55 +0800 Subject: [PATCH 07/48] benchmark test: remove newline --- frontend/cypress/tests/codeView_load_benchmark.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index c2ccdf7a69..d2a92b0b62 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -52,7 +52,6 @@ describe('load code view benchmark', function() { }); } - it(`average time taken to load is within ${MAXIMUM_LOADING_TIME_SECONDS}s`, function() { const averageLoadingTime = totalLoadingTime / NUM_TRIALS; const averageLoadingTimeSeconds = averageLoadingTime / 1000; From 7574c3ef6d8c202566f5761fe170b97edba34f18 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 14:45:32 +0800 Subject: [PATCH 08/48] codeview benchmark: extract test as a function, then call that function in a for loop --- .../cypress/tests/codeView_load_benchmark.js | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index d2a92b0b62..04ae3ef639 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -1,20 +1,18 @@ describe('load code view benchmark', function() { const NUM_TRIALS = 3; const THRESHOLD_LOADING_TIME = 8000; - const THRESHOLD_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; const BUFFER_PERCENTAGE = 0.1; const BUFFER_SUGGESTED_TIME = 3000; - const ALLOWED_BUFFER_TIME = BUFFER_PERCENTAGE * MAXIMUM_LOADING_TIME >= BUFFER_SUGGESTED_TIME - ? BUFFER_PERCENTAGE * MAXIMUM_LOADING_TIME : BUFFER_SUGGESTED_TIME; + const ALLOWED_BUFFER_TIME = BUFFER_PERCENTAGE * THRESHOLD_LOADING_TIME >= BUFFER_SUGGESTED_TIME + ? BUFFER_PERCENTAGE * THRESHOLD_LOADING_TIME : BUFFER_SUGGESTED_TIME; const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; const MAXIMUM_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; let totalLoadingTime = 0; - for (let i = 0; i < NUM_TRIALS; i++) { - it(`time taken to load code view (trial ${i+1})`, function() { + const timeTrial = function() { let startTime; // ensure that icons are loaded Cypress.wait(); @@ -36,7 +34,7 @@ describe('load code view benchmark', function() { .click() .then(() => { startTime = performance.now(); - }) + }); cy.get('#tab-authorship .files') .then(() => { @@ -49,6 +47,13 @@ describe('load code view benchmark', function() { assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, `loading time for trial ${i+1}: ${loadingTimeSeconds.toFixed(3)}s`); }); + } + + + let i; + for (i = 0; i < NUM_TRIALS; i++) { + it(`time taken to load code view (trial ${i+1})`, function() { + timeTrial(); }); } @@ -56,10 +61,6 @@ describe('load code view benchmark', function() { const averageLoadingTime = totalLoadingTime / NUM_TRIALS; const averageLoadingTimeSeconds = averageLoadingTime / 1000; - // wait so that the average loading time will - // show up as the test time in travis - cy.wait(averageLoadingTime); - assert.isTrue(averageLoadingTime < MAXIMUM_LOADING_TIME, `average loading time: ${averageLoadingTimeSeconds}s`); }); From 82ebc46c3212bdafb677cd0af19b3e4e0d29e5db Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 15:01:33 +0800 Subject: [PATCH 09/48] benchmark: fix codacy issues --- frontend/cypress/tests/codeView_load_benchmark.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 04ae3ef639..8424e2c8c1 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -12,7 +12,7 @@ describe('load code view benchmark', function() { let totalLoadingTime = 0; - const timeTrial = function() { + const timeTrial = function(i) { let startTime; // ensure that icons are loaded Cypress.wait(); @@ -47,7 +47,7 @@ describe('load code view benchmark', function() { assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, `loading time for trial ${i+1}: ${loadingTimeSeconds.toFixed(3)}s`); }); - } + }; let i; From 7ee3c6714af3465ac5ed78c838133daf74206370 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 15:26:11 +0800 Subject: [PATCH 10/48] benchmark: move let to the for loop --- frontend/cypress/tests/codeView_load_benchmark.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 8424e2c8c1..a7216e2adc 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -50,10 +50,9 @@ describe('load code view benchmark', function() { }; - let i; - for (i = 0; i < NUM_TRIALS; i++) { + for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - timeTrial(); + timeTrial(i); }); } From 842d4249e0598012b849a7ca69172228f442623f Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 15:38:46 +0800 Subject: [PATCH 11/48] benchmark: specify the threshold + buffer time --- frontend/cypress/tests/codeView_load_benchmark.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index a7216e2adc..74e59d9436 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -1,14 +1,15 @@ describe('load code view benchmark', function() { const NUM_TRIALS = 3; const THRESHOLD_LOADING_TIME = 8000; + const THRESHOLD_LOADING_TIME_SECONDS = THRESHOLD_LOADING_TIME / 1000; const BUFFER_PERCENTAGE = 0.1; const BUFFER_SUGGESTED_TIME = 3000; const ALLOWED_BUFFER_TIME = BUFFER_PERCENTAGE * THRESHOLD_LOADING_TIME >= BUFFER_SUGGESTED_TIME ? BUFFER_PERCENTAGE * THRESHOLD_LOADING_TIME : BUFFER_SUGGESTED_TIME; + const ALLOWED_BUFFER_TIME_SECONDS = ALLOWED_BUFFER_TIME / 1000; const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; - const MAXIMUM_LOADING_TIME_SECONDS = MAXIMUM_LOADING_TIME / 1000; let totalLoadingTime = 0; @@ -56,7 +57,7 @@ describe('load code view benchmark', function() { }); } - it(`average time taken to load is within ${MAXIMUM_LOADING_TIME_SECONDS}s`, function() { + it(`average time taken to load is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { const averageLoadingTime = totalLoadingTime / NUM_TRIALS; const averageLoadingTimeSeconds = averageLoadingTime / 1000; From c87494ac18ba8f0cf3f824e146d83651b686483c Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 16:16:15 +0800 Subject: [PATCH 12/48] benchmark: check whether ALL tests exceed the max time, assert if true --- .../cypress/tests/codeView_load_benchmark.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 74e59d9436..0096ee1397 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -11,7 +11,7 @@ describe('load code view benchmark', function() { const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; - let totalLoadingTime = 0; + let loadingTimes = []; const timeTrial = function(i) { let startTime; @@ -41,12 +41,8 @@ describe('load code view benchmark', function() { .then(() => { const endTime = performance.now(); const loadingTime = endTime - startTime; - const loadingTimeSeconds = loadingTime / 1000; - totalLoadingTime += loadingTime; - - assert.isTrue(loadingTime < MAXIMUM_LOADING_TIME, - `loading time for trial ${i+1}: ${loadingTimeSeconds.toFixed(3)}s`); + loadingTimes.push(loadingTime); }); }; @@ -57,11 +53,15 @@ describe('load code view benchmark', function() { }); } - it(`average time taken to load is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { + it(`at least one trial is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { + const totalLoadingTime = loadingTimes.reduce((acc, curr) => acc + curr, 0); const averageLoadingTime = totalLoadingTime / NUM_TRIALS; const averageLoadingTimeSeconds = averageLoadingTime / 1000; - assert.isTrue(averageLoadingTime < MAXIMUM_LOADING_TIME, + const isATrialWithinMaxTime = loadingTimes.map(time => time <= MAXIMUM_LOADING_TIME) + .reduce((acc, curr) => acc || curr, false); + + assert.isTrue(isATrialWithinMaxTime, `average loading time: ${averageLoadingTimeSeconds}s`); }); }); From 187345a01eb178f7ac008bf56f8ad89dd6a13d3e Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 16:38:58 +0800 Subject: [PATCH 13/48] benchmark: align reduce with map --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 0096ee1397..423e8ebc38 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -59,7 +59,7 @@ describe('load code view benchmark', function() { const averageLoadingTimeSeconds = averageLoadingTime / 1000; const isATrialWithinMaxTime = loadingTimes.map(time => time <= MAXIMUM_LOADING_TIME) - .reduce((acc, curr) => acc || curr, false); + .reduce((acc, curr) => acc || curr, false); assert.isTrue(isATrialWithinMaxTime, `average loading time: ${averageLoadingTimeSeconds}s`); From e0666909130fb6e674fb418873d7e6596b4dd379 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 17:22:55 +0800 Subject: [PATCH 14/48] benchmark: increase timeout for getting tab-authorship to 45s --- frontend/cypress/tests/codeView_load_benchmark.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 423e8ebc38..a7ba779590 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -37,7 +37,8 @@ describe('load code view benchmark', function() { startTime = performance.now(); }); - cy.get('#tab-authorship .files') + cy.get('#tab-authorship .files', { timeout: 45000 }) + .should('be.visible') .then(() => { const endTime = performance.now(); const loadingTime = endTime - startTime; From dd367ac552cd0d22f0d35d8bcb719435af8fade1 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 17:31:09 +0800 Subject: [PATCH 15/48] benchmark: increase timeout to 1min --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index a7ba779590..9fce0caf4e 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -37,7 +37,7 @@ describe('load code view benchmark', function() { startTime = performance.now(); }); - cy.get('#tab-authorship .files', { timeout: 45000 }) + cy.get('#tab-authorship .files', { timeout: 60000 }) .should('be.visible') .then(() => { const endTime = performance.now(); From b6038307180394c90ba13087f775793fe990660d Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 17:37:04 +0800 Subject: [PATCH 16/48] benchmark: increase number of trials to 5 --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 9fce0caf4e..6aeedd44eb 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -1,5 +1,5 @@ describe('load code view benchmark', function() { - const NUM_TRIALS = 3; + const NUM_TRIALS = 5; const THRESHOLD_LOADING_TIME = 8000; const THRESHOLD_LOADING_TIME_SECONDS = THRESHOLD_LOADING_TIME / 1000; From bfbfa6d2c90d75928309754e11e2a7b4c3393831 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 17:37:04 +0800 Subject: [PATCH 17/48] benchmark: increase number of trials to 5 --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 9fce0caf4e..6aeedd44eb 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -1,5 +1,5 @@ describe('load code view benchmark', function() { - const NUM_TRIALS = 3; + const NUM_TRIALS = 5; const THRESHOLD_LOADING_TIME = 8000; const THRESHOLD_LOADING_TIME_SECONDS = THRESHOLD_LOADING_TIME / 1000; From b55fee1db94531e079aa141dc38c7a9be6cd2edf Mon Sep 17 00:00:00 2001 From: bluein-green Date: Wed, 24 Jul 2019 17:46:41 +0800 Subject: [PATCH 18/48] benchmark: increase timeout to 1.5min --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 6aeedd44eb..e524d4ce2c 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -37,7 +37,7 @@ describe('load code view benchmark', function() { startTime = performance.now(); }); - cy.get('#tab-authorship .files', { timeout: 60000 }) + cy.get('#tab-authorship .files', { timeout: 90000 }) .should('be.visible') .then(() => { const endTime = performance.now(); From 1f22e8f85d1a4e83539bdabc33fcd43bfdbceb38 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 25 Jul 2019 11:08:49 +0800 Subject: [PATCH 19/48] benchmark: remove extra cy.get() since PR #832 was merged --- frontend/cypress/tests/codeView_load_benchmark.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index e524d4ce2c..017b3c917f 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -15,20 +15,13 @@ describe('load code view benchmark', function() { const timeTrial = function(i) { let startTime; + // ensure that icons are loaded Cypress.wait(); cy.get('#summary-wrapper .sort-within-group select') .select('totalCommits dsc'); - // ---- need the following 2 cy.get(.) while awaiting PR #828 - cy.get('#summary-wrapper .sort-within-group select') - .select('totalCommits'); - - cy.get('#summary-wrapper .sort-within-group select') - .select('totalCommits dsc'); - // ----- end of to delete - cy.get('.summary-chart__title--button.fa-code') .should('be.visible') .first() @@ -42,6 +35,9 @@ describe('load code view benchmark', function() { .then(() => { const endTime = performance.now(); const loadingTime = endTime - startTime; + const loadingTimeSeconds = loadingTime / 1000; + + cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); loadingTimes.push(loadingTime); }); @@ -63,6 +59,6 @@ describe('load code view benchmark', function() { .reduce((acc, curr) => acc || curr, false); assert.isTrue(isATrialWithinMaxTime, - `average loading time: ${averageLoadingTimeSeconds}s`); + `[average loading time: ${averageLoadingTimeSeconds.toFixed(3)}s]`); }); }); From 78ddd5e27f70e8a4d90dd59332be659f18705341 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 25 Jul 2019 11:21:19 +0800 Subject: [PATCH 20/48] benchmark: add parentheses for time parameter --- frontend/cypress/tests/codeView_load_benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 017b3c917f..61a72ad134 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -55,7 +55,7 @@ describe('load code view benchmark', function() { const averageLoadingTime = totalLoadingTime / NUM_TRIALS; const averageLoadingTimeSeconds = averageLoadingTime / 1000; - const isATrialWithinMaxTime = loadingTimes.map(time => time <= MAXIMUM_LOADING_TIME) + const isATrialWithinMaxTime = loadingTimes.map((time) => time <= MAXIMUM_LOADING_TIME) .reduce((acc, curr) => acc || curr, false); assert.isTrue(isATrialWithinMaxTime, From 0b623cc5ff806542bbb92589b025aa5a41afa8dd Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 13:19:50 +0800 Subject: [PATCH 21/48] benchmark: short-circuit when 1 trial has passed an is within time limit --- .../cypress/tests/codeView_load_benchmark.js | 76 +++++++++---------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 61a72ad134..8ff8385ba6 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -11,36 +11,42 @@ describe('load code view benchmark', function() { const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; - let loadingTimes = []; - - const timeTrial = function(i) { - let startTime; - - // ensure that icons are loaded - Cypress.wait(); - - cy.get('#summary-wrapper .sort-within-group select') - .select('totalCommits dsc'); - - cy.get('.summary-chart__title--button.fa-code') - .should('be.visible') - .first() - .click() - .then(() => { - startTime = performance.now(); - }); - - cy.get('#tab-authorship .files', { timeout: 90000 }) - .should('be.visible') - .then(() => { - const endTime = performance.now(); - const loadingTime = endTime - startTime; - const loadingTimeSeconds = loadingTime / 1000; - - cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); - - loadingTimes.push(loadingTime); - }); + let isATrialWithinMaxTime = false; + + function timeTrial(i) { + if (isATrialWithinMaxTime) { + return; + } + + let startTime; + + // ensure that icons are loaded + Cypress.wait(); + + cy.get('#summary-wrapper .sort-within-group select') + .select('totalCommits dsc'); + + cy.get('.summary-chart__title--button.fa-code') + .should('be.visible') + .first() + .click() + .then(() => { + startTime = performance.now(); + }); + + cy.get('#tab-authorship .files', { timeout: 90000 }) + .should('be.visible') + .then(() => { + const endTime = performance.now(); + const loadingTime = endTime - startTime; + const loadingTimeSeconds = loadingTime / 1000; + + cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); + + if (loadingTime <= MAXIMUM_LOADING_TIME) { + isATrialWithinMaxTime = true; + } + }); }; @@ -51,14 +57,6 @@ describe('load code view benchmark', function() { } it(`at least one trial is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { - const totalLoadingTime = loadingTimes.reduce((acc, curr) => acc + curr, 0); - const averageLoadingTime = totalLoadingTime / NUM_TRIALS; - const averageLoadingTimeSeconds = averageLoadingTime / 1000; - - const isATrialWithinMaxTime = loadingTimes.map((time) => time <= MAXIMUM_LOADING_TIME) - .reduce((acc, curr) => acc || curr, false); - - assert.isTrue(isATrialWithinMaxTime, - `[average loading time: ${averageLoadingTimeSeconds.toFixed(3)}s]`); + assert.isTrue(isATrialWithinMaxTime); }); }); From a3d41b0003f2d54e34c49382f6d4d598989d5657 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 13:31:00 +0800 Subject: [PATCH 22/48] benchmark: remove excess newline --- frontend/cypress/tests/codeView_load_benchmark.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 8ff8385ba6..6f269c64f0 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -49,7 +49,6 @@ describe('load code view benchmark', function() { }); }; - for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { timeTrial(i); From 7198a1ebff5b36ebae6efd4575a823d936f8161d Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 14:40:48 +0800 Subject: [PATCH 23/48] retrigger travis --- frontend/cypress/tests/codeView_load_benchmark.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 6f269c64f0..8ff8385ba6 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -49,6 +49,7 @@ describe('load code view benchmark', function() { }); }; + for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { timeTrial(i); From 76ce89fbb7fb07bd149569134bc39efd6568dfe2 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 14:58:54 +0800 Subject: [PATCH 24/48] benchmark: add a wait statement after selecting descending LoC --- frontend/cypress/tests/codeView_load_benchmark.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 8ff8385ba6..ebfcbf77c1 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -26,6 +26,8 @@ describe('load code view benchmark', function() { cy.get('#summary-wrapper .sort-within-group select') .select('totalCommits dsc'); + Cypress.wait(); + cy.get('.summary-chart__title--button.fa-code') .should('be.visible') .first() From a40acdb738f4bef493ed2f7f28332f614746da48 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:03:35 +0800 Subject: [PATCH 25/48] benchmark: try not short-circuiting --- frontend/cypress/tests/codeView_load_benchmark.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index ebfcbf77c1..b771af51c4 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -14,9 +14,9 @@ describe('load code view benchmark', function() { let isATrialWithinMaxTime = false; function timeTrial(i) { - if (isATrialWithinMaxTime) { - return; - } + // if (isATrialWithinMaxTime) { + // return; + // } let startTime; From 4b75f3ec148659b11d6109ce0afa222145f1b34b Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:14:06 +0800 Subject: [PATCH 26/48] benchmark: use this.skip to SKIP tests rather than short-circuit within test --- frontend/cypress/tests/codeView_load_benchmark.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index b771af51c4..3671e2b8d0 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -14,10 +14,6 @@ describe('load code view benchmark', function() { let isATrialWithinMaxTime = false; function timeTrial(i) { - // if (isATrialWithinMaxTime) { - // return; - // } - let startTime; // ensure that icons are loaded @@ -26,9 +22,7 @@ describe('load code view benchmark', function() { cy.get('#summary-wrapper .sort-within-group select') .select('totalCommits dsc'); - Cypress.wait(); - - cy.get('.summary-chart__title--button.fa-code') + cy.get('.summary-chart__title--button.fa-code', { timeout: 90000 }) .should('be.visible') .first() .click() @@ -54,6 +48,9 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { + if (isATrialWithinMaxTime) { + this.skip(); + } timeTrial(i); }); } From 32bfc3fb648afb726b9f04ce57fc507ca703aca1 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:26:25 +0800 Subject: [PATCH 27/48] benchmark: try old code on travis --- .../cypress/tests/codeView_load_benchmark.js | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 3671e2b8d0..61a72ad134 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -11,51 +11,54 @@ describe('load code view benchmark', function() { const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; - let isATrialWithinMaxTime = false; - - function timeTrial(i) { - let startTime; - - // ensure that icons are loaded - Cypress.wait(); - - cy.get('#summary-wrapper .sort-within-group select') - .select('totalCommits dsc'); - - cy.get('.summary-chart__title--button.fa-code', { timeout: 90000 }) - .should('be.visible') - .first() - .click() - .then(() => { - startTime = performance.now(); - }); - - cy.get('#tab-authorship .files', { timeout: 90000 }) - .should('be.visible') - .then(() => { - const endTime = performance.now(); - const loadingTime = endTime - startTime; - const loadingTimeSeconds = loadingTime / 1000; - - cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); - - if (loadingTime <= MAXIMUM_LOADING_TIME) { - isATrialWithinMaxTime = true; - } - }); + let loadingTimes = []; + + const timeTrial = function(i) { + let startTime; + + // ensure that icons are loaded + Cypress.wait(); + + cy.get('#summary-wrapper .sort-within-group select') + .select('totalCommits dsc'); + + cy.get('.summary-chart__title--button.fa-code') + .should('be.visible') + .first() + .click() + .then(() => { + startTime = performance.now(); + }); + + cy.get('#tab-authorship .files', { timeout: 90000 }) + .should('be.visible') + .then(() => { + const endTime = performance.now(); + const loadingTime = endTime - startTime; + const loadingTimeSeconds = loadingTime / 1000; + + cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); + + loadingTimes.push(loadingTime); + }); }; for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - if (isATrialWithinMaxTime) { - this.skip(); - } timeTrial(i); }); } it(`at least one trial is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { - assert.isTrue(isATrialWithinMaxTime); + const totalLoadingTime = loadingTimes.reduce((acc, curr) => acc + curr, 0); + const averageLoadingTime = totalLoadingTime / NUM_TRIALS; + const averageLoadingTimeSeconds = averageLoadingTime / 1000; + + const isATrialWithinMaxTime = loadingTimes.map((time) => time <= MAXIMUM_LOADING_TIME) + .reduce((acc, curr) => acc || curr, false); + + assert.isTrue(isATrialWithinMaxTime, + `[average loading time: ${averageLoadingTimeSeconds.toFixed(3)}s]`); }); }); From 8656136850735434e8c34bf571f654effeb88884 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:37:23 +0800 Subject: [PATCH 28/48] benchmark: bring in new changes --- .../cypress/tests/codeView_load_benchmark.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 61a72ad134..651560bffd 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -11,7 +11,7 @@ describe('load code view benchmark', function() { const MAXIMUM_LOADING_TIME = THRESHOLD_LOADING_TIME + ALLOWED_BUFFER_TIME; - let loadingTimes = []; + let isATrialWithinMaxTime = false; const timeTrial = function(i) { let startTime; @@ -39,26 +39,23 @@ describe('load code view benchmark', function() { cy.log(`trial ${i+1} loading time: ${loadingTimeSeconds.toFixed(3)}s`); - loadingTimes.push(loadingTime); + if (loadingTime <= MAXIMUM_LOADING_TIME) { + isATrialWithinMaxTime = true; + } }); }; for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { + if (isATrialWithinMaxTime) { + this.skip(); + } timeTrial(i); }); } it(`at least one trial is within ${THRESHOLD_LOADING_TIME_SECONDS}(+${ALLOWED_BUFFER_TIME_SECONDS})s`, function() { - const totalLoadingTime = loadingTimes.reduce((acc, curr) => acc + curr, 0); - const averageLoadingTime = totalLoadingTime / NUM_TRIALS; - const averageLoadingTimeSeconds = averageLoadingTime / 1000; - - const isATrialWithinMaxTime = loadingTimes.map((time) => time <= MAXIMUM_LOADING_TIME) - .reduce((acc, curr) => acc || curr, false); - - assert.isTrue(isATrialWithinMaxTime, - `[average loading time: ${averageLoadingTimeSeconds.toFixed(3)}s]`); + assert.isTrue(isATrialWithinMaxTime); }); }); From 47cf5aa40344cec6b5d832abf851d76935a5ed96 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:49:29 +0800 Subject: [PATCH 29/48] benchmark: use else for timeTrial --- frontend/cypress/tests/codeView_load_benchmark.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 651560bffd..c50ebbb2bb 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -50,8 +50,9 @@ describe('load code view benchmark', function() { it(`time taken to load code view (trial ${i+1})`, function() { if (isATrialWithinMaxTime) { this.skip(); + } else { + timeTrial(i); } - timeTrial(i); }); } From f54bed5df4a6ceb6fc9aee6b34a25468603e00fe Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 15:55:54 +0800 Subject: [PATCH 30/48] cypress support.js: add a cypress.wait() in beforeeach --- frontend/cypress/support.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 98b8f8f718..2a61407481 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -7,6 +7,7 @@ Cypress.Screenshot.defaults({ beforeEach(() => { cy.visit('/'); + Cypress.wait(); }); // Slows down test execution on non-CI environment. From 212e7d2b691cb2c38a879affea44ff8b78d27334 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:07:13 +0800 Subject: [PATCH 31/48] revert adding wait to beforeeach --- frontend/cypress/support.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 2a61407481..98b8f8f718 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -7,7 +7,6 @@ Cypress.Screenshot.defaults({ beforeEach(() => { cy.visit('/'); - Cypress.wait(); }); // Slows down test execution on non-CI environment. From f363934dfab188f091165c7c1365c6493e7dde65 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:12:06 +0800 Subject: [PATCH 32/48] benchmark: reorder this.skip() to align with best practice --- frontend/cypress/tests/codeView_load_benchmark.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index c50ebbb2bb..c9717ba02b 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -48,10 +48,10 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - if (isATrialWithinMaxTime) { - this.skip(); - } else { + if (!isATrialWithinMaxTime) { timeTrial(i); + } else { + this.skip(); } }); } From 24d0668aae302196f7d715d00fb12d5af1c98e04 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:21:01 +0800 Subject: [PATCH 33/48] benchmark: don't use this.skip() --- frontend/cypress/tests/codeView_load_benchmark.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index c9717ba02b..f99ba18528 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -50,8 +50,6 @@ describe('load code view benchmark', function() { it(`time taken to load code view (trial ${i+1})`, function() { if (!isATrialWithinMaxTime) { timeTrial(i); - } else { - this.skip(); } }); } From 2e6245c27053a726e78d6709549d7d7bcb525d42 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:27:02 +0800 Subject: [PATCH 34/48] benchmark: remove condition --- frontend/cypress/tests/codeView_load_benchmark.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index f99ba18528..7661836eac 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -48,9 +48,7 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - if (!isATrialWithinMaxTime) { timeTrial(i); - } }); } From b25e3829da25dd6f8a58058b9e719c49927fe749 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:37:48 +0800 Subject: [PATCH 35/48] benchmark: skip all tests, check on travis --- frontend/cypress/tests/codeView_load_benchmark.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index 7661836eac..ada6ceb28c 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -48,7 +48,8 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - timeTrial(i); + this.skip(); + // timeTrial(i); }); } From 8e684c583945c03107afebac78918fe65ec8a267 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:43:52 +0800 Subject: [PATCH 36/48] benchmark: wrap if else in cy.then() --- frontend/cypress/tests/codeView_load_benchmark.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index ada6ceb28c..abbe762559 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -48,8 +48,12 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - this.skip(); - // timeTrial(i); + cy.then(() => { + if (isATrialWithinMaxTime) { + this.skip(); + } + timeTrial(i); + }); }); } From e242b4fd195a08c47fa8e7e19a23d6fbb4ded429 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 16:49:06 +0800 Subject: [PATCH 37/48] cypress support.js: visit, allow timeout to be 30s --- frontend/cypress/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 98b8f8f718..5de16b09c1 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/'); + cy.visit('/', { timeout: 30000 }); }); // Slows down test execution on non-CI environment. From 21fd0e2ec69a5651e6a114dd544ec4527ca69949 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 17:24:53 +0800 Subject: [PATCH 38/48] cypress support.js: increase beforeEach cy.visit() timeout to 90s --- frontend/cypress/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 5de16b09c1..fdccf76c7a 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/', { timeout: 30000 }); + cy.visit('/', { timeout: 90000 }); }); // Slows down test execution on non-CI environment. From cc97c0aadb8fdf4b4b602661ccb609384353c5b8 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 17:49:36 +0800 Subject: [PATCH 39/48] cypress support.js: increase beforeEach cy.visit() timeout to 2min --- frontend/cypress/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index fdccf76c7a..d89153607f 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/', { timeout: 90000 }); + cy.visit('/', { timeout: 120000 }); }); // Slows down test execution on non-CI environment. From 2aa18cc6e6a9990fdc6c716f9f3f14a4f37290cc Mon Sep 17 00:00:00 2001 From: bluein-green Date: Thu, 1 Aug 2019 17:57:49 +0800 Subject: [PATCH 40/48] benchmark: remove cy.then() wrapping --- frontend/cypress/tests/codeView_load_benchmark.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/cypress/tests/codeView_load_benchmark.js b/frontend/cypress/tests/codeView_load_benchmark.js index abbe762559..651560bffd 100644 --- a/frontend/cypress/tests/codeView_load_benchmark.js +++ b/frontend/cypress/tests/codeView_load_benchmark.js @@ -48,12 +48,10 @@ describe('load code view benchmark', function() { for (let i = 0; i < NUM_TRIALS; i++) { it(`time taken to load code view (trial ${i+1})`, function() { - cy.then(() => { - if (isATrialWithinMaxTime) { - this.skip(); - } - timeTrial(i); - }); + if (isATrialWithinMaxTime) { + this.skip(); + } + timeTrial(i); }); } From fd8c3b8c5186c27b7510a6d0d138baf67883d274 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 2 Aug 2019 11:05:22 +0800 Subject: [PATCH 41/48] cypress support.js: add onfailure in .then() that is chained off the cy.visit() --- frontend/cypress/support.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index d89153607f..68f78bb90e 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,10 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/', { timeout: 120000 }); + cy.visit('/') + .then(() => {}, () => { + cy.reload(true); + }) }); // Slows down test execution on non-CI environment. From 3099b9196b718caee48171b1229c7cd02ab11c17 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 2 Aug 2019 13:38:01 +0800 Subject: [PATCH 42/48] cypress support.js / cypress.json: move pageLoadTimeout as default --- frontend/cypress/cypress.json | 3 ++- frontend/cypress/support.js | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/cypress/cypress.json b/frontend/cypress/cypress.json index 3a46d0e701..428b25ccdf 100644 --- a/frontend/cypress/cypress.json +++ b/frontend/cypress/cypress.json @@ -5,5 +5,6 @@ "fixturesFolder": false, "pluginsFile": false, "video": false, - "defaultCommandTimeout": 30000 + "defaultCommandTimeout": 30000, + "pageLoadTimeout": 120000 } diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 68f78bb90e..98b8f8f718 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,10 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/') - .then(() => {}, () => { - cy.reload(true); - }) + cy.visit('/'); }); // Slows down test execution on non-CI environment. From 7a3514331e65b1d792a378024b385e17c99c63ef Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 2 Aug 2019 13:47:16 +0800 Subject: [PATCH 43/48] move timeout back to cy.visit() --- frontend/cypress/cypress.json | 3 +-- frontend/cypress/support.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/cypress/cypress.json b/frontend/cypress/cypress.json index 428b25ccdf..3a46d0e701 100644 --- a/frontend/cypress/cypress.json +++ b/frontend/cypress/cypress.json @@ -5,6 +5,5 @@ "fixturesFolder": false, "pluginsFile": false, "video": false, - "defaultCommandTimeout": 30000, - "pageLoadTimeout": 120000 + "defaultCommandTimeout": 30000 } diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 98b8f8f718..d89153607f 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/'); + cy.visit('/', { timeout: 120000 }); }); // Slows down test execution on non-CI environment. From df09eefc28ac36eb798f1f4dafde975c9e0eeeb7 Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 2 Aug 2019 16:43:15 +0800 Subject: [PATCH 44/48] cypress support.js: increase cy.visit() timeout to 3min --- frontend/cypress/support.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index d89153607f..09286d501d 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/', { timeout: 120000 }); + cy.visit('/', { timeout: 180000 }); }); // Slows down test execution on non-CI environment. From 6d1fd956ba1f1731b0f5f138d5c372db33fc66ab Mon Sep 17 00:00:00 2001 From: bluein-green Date: Fri, 2 Aug 2019 17:45:26 +0800 Subject: [PATCH 45/48] cypress support / json: move timeout for cy.visit() to configs --- frontend/cypress/cypress.json | 3 ++- frontend/cypress/support.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/cypress/cypress.json b/frontend/cypress/cypress.json index 3a46d0e701..12eee0ef56 100644 --- a/frontend/cypress/cypress.json +++ b/frontend/cypress/cypress.json @@ -5,5 +5,6 @@ "fixturesFolder": false, "pluginsFile": false, "video": false, - "defaultCommandTimeout": 30000 + "defaultCommandTimeout": 30000, + "pageLoadTimeout": 180000 } diff --git a/frontend/cypress/support.js b/frontend/cypress/support.js index 09286d501d..98b8f8f718 100644 --- a/frontend/cypress/support.js +++ b/frontend/cypress/support.js @@ -6,7 +6,7 @@ Cypress.Screenshot.defaults({ }); beforeEach(() => { - cy.visit('/', { timeout: 180000 }); + cy.visit('/'); }); // Slows down test execution on non-CI environment. From c29b0f303303d2cc5c2c54c457a31fd7ae1a2c42 Mon Sep 17 00:00:00 2001 From: Yong Hao TENG Date: Fri, 16 Aug 2019 19:05:33 +0800 Subject: [PATCH 46/48] Use bionic for cypress --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1484cf824e..cc0d4be999 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: - name: "Cypress frontend tests" os: linux - dist: xenial + dist: bionic addons: chrome: stable services: From 4070e0aa305afc0f82245740d0f442e633c5a20d Mon Sep 17 00:00:00 2001 From: Yong Hao TENG Date: Fri, 16 Aug 2019 19:07:37 +0800 Subject: [PATCH 47/48] Remove pageLoadTimeout --- frontend/cypress/cypress.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/cypress/cypress.json b/frontend/cypress/cypress.json index 12eee0ef56..3a46d0e701 100644 --- a/frontend/cypress/cypress.json +++ b/frontend/cypress/cypress.json @@ -5,6 +5,5 @@ "fixturesFolder": false, "pluginsFile": false, "video": false, - "defaultCommandTimeout": 30000, - "pageLoadTimeout": 180000 + "defaultCommandTimeout": 30000 } From 1f98b678bebe3553e21a992de3ca792aae103924 Mon Sep 17 00:00:00 2001 From: Yong Hao TENG Date: Fri, 16 Aug 2019 19:17:32 +0800 Subject: [PATCH 48/48] Use cypress 3.4.1 --- frontend/cypress/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/cypress/package.json b/frontend/cypress/package.json index 3b33b604e7..a98edc8e4a 100644 --- a/frontend/cypress/package.json +++ b/frontend/cypress/package.json @@ -5,6 +5,6 @@ "debug": "cypress open" }, "devDependencies": { - "cypress": "^3.1.5" + "cypress": "^3.4.1" } }