'custom-configuration-test-group-form' should update test name when selected test...
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 03:34:28 +0000 (03:34 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 03:34:28 +0000 (03:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196114

Reviewed by Ryosuke Niwa.

r240104 fixes commit sets unnecessarily get updated even there is no change.
However, this made changing test or platform no longer triggers 'commitSetChange' action.
Test name should change not only when 'commitSet' gets change, but also platform or test changes.
Renaming the action name from 'commitSetChange' to a more accurate description 'testConfigChange'.
Dispatch 'testConfigChange' when platform or test changes.

* browser-tests/custom-analysis-task-configurator-tests.js: Changed action name to 'commitSetChange'.
* public/v3/components/custom-analysis-task-configurator.js:
(CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should dispatch 'commitSetChange' action.
(CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Changed action name to 'commitSetChange'.
* public/v3/components/custom-configuration-test-group-form.js: Added a unit test for this change.
(CustomConfigurationTestGroupForm.prototype.didConstructShadowTree):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243358 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/browser-tests/custom-analysis-task-configurator-tests.js
Websites/perf.webkit.org/public/v3/components/custom-analysis-task-configurator.js
Websites/perf.webkit.org/public/v3/components/custom-configuration-test-group-form.js

index b2e9109..401cd78 100644 (file)
@@ -1,3 +1,23 @@
+2019-03-21  Dewei Zhu  <dewei_zhu@apple.com>
+
+        'custom-configuration-test-group-form' should update test name when selected test or platform changes.
+        https://bugs.webkit.org/show_bug.cgi?id=196114
+
+        Reviewed by Ryosuke Niwa.
+
+        r240104 fixes commit sets unnecessarily get updated even there is no change.
+        However, this made changing test or platform no longer triggers 'commitSetChange' action.
+        Test name should change not only when 'commitSet' gets change, but also platform or test changes.
+        Renaming the action name from 'commitSetChange' to a more accurate description 'testConfigChange'.
+        Dispatch 'testConfigChange' when platform or test changes.
+
+        * browser-tests/custom-analysis-task-configurator-tests.js: Changed action name to 'commitSetChange'.
+        * public/v3/components/custom-analysis-task-configurator.js:
+        (CustomAnalysisTaskConfigurator.prototype._didUpdateSelectedPlatforms): Should dispatch 'commitSetChange' action.
+        (CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Changed action name to 'commitSetChange'.
+        * public/v3/components/custom-configuration-test-group-form.js: Added a unit test for this change.
+        (CustomConfigurationTestGroupForm.prototype.didConstructShadowTree):
+
 2019-03-18  Dewei Zhu  <dewei_zhu@apple.com>
 
         Fix a bug from r226303 that latest build time is not correctly calculated.
index bf23e23..cd73942 100644 (file)
@@ -231,4 +231,69 @@ describe('CustomAnalysisTaskConfigurator', () => {
         await waitForComponentsToRender(context);
         expect(customAnalysisTaskConfigurator.content('baseline-revision-table').querySelector('input').value).to.be('');
     });
+
+    it('Should dispatch "testConfigChange" action when selected platform changed', async () => {
+        const context = new BrowsingContext();
+        const customAnalysisTaskConfigurator = await createCustomAnalysisTaskConfiguratorWithContext(context);
+        let testConfigChangeActionCount = 0;
+        context.symbols.CustomAnalysisTaskConfigurator.commitFetchInterval = 1;
+
+        customAnalysisTaskConfigurator.listenToAction("testConfigChange", () => testConfigChangeActionCount += 1);
+
+        const test = new context.symbols.Test(1, {name: 'Speedometer'});
+        const mojave = new context.symbols.Platform(1, {
+            name: 'Mojave',
+            metrics: [
+                new context.symbols.Metric(1, {
+                    name: 'Allocation',
+                    aggregator: 'Arithmetic',
+                    test
+                })
+            ],
+            lastModifiedByMetric: Date.now(),
+        });
+        const highSierra = new context.symbols.Platform(2, {
+            name: 'High Sierra',
+            metrics: [
+                new context.symbols.Metric(1, {
+                    name: 'Allocation',
+                    aggregator: 'Arithmetic',
+                    test
+                })
+            ],
+            lastModifiedByMetric: Date.now(),
+        });
+        const repository = context.symbols.Repository.ensureSingleton(1, {name: 'WebKit'});
+        const triggerableRepositoryGroup = new context.symbols.TriggerableRepositoryGroup(1, {repositories: [{repository}]});
+        new context.symbols.Triggerable(1, {
+            name: 'test-triggerable',
+            isDisabled: false,
+            repositoryGroups: [triggerableRepositoryGroup],
+            configurations: [{test, platform: mojave}, {test, platform: highSierra}],
+        });
+        customAnalysisTaskConfigurator.selectTests([test]);
+        customAnalysisTaskConfigurator.selectPlatform(mojave);
+
+        await waitForComponentsToRender(context);
+        expect(testConfigChangeActionCount).to.be(2);
+
+        const requests = context.symbols.MockRemoteAPI.requests;
+        expect(requests.length).to.be(1);
+        expect(requests[0].url).to.be('/api/commits/1/latest?platform=1');
+        requests[0].reject();
+
+        customAnalysisTaskConfigurator.content('baseline-revision-table').querySelector('input').value = '123';
+        customAnalysisTaskConfigurator.content('baseline-revision-table').querySelector('input').dispatchEvent(new Event('input'));
+        await sleep(context.symbols.CustomAnalysisTaskConfigurator.commitFetchInterval);
+        expect(requests.length).to.be(2);
+        expect(requests[1].url).to.be('/api/commits/1/123');
+
+        customAnalysisTaskConfigurator._configureComparison();
+        await waitForComponentsToRender(context);
+        expect(testConfigChangeActionCount).to.be(3);
+
+        customAnalysisTaskConfigurator.selectPlatform(highSierra);
+        await waitForComponentsToRender(context);
+        expect(testConfigChangeActionCount).to.be(4);
+    });
 });
\ No newline at end of file
index f2d5107..3e09464 100644 (file)
@@ -60,6 +60,7 @@ class CustomAnalysisTaskConfigurator extends ComponentBase {
             this._updateMapFromSpecifiedRevisionsForConfiguration(this._invalidRevisionsByConfiguration, configuration);
         }
         this._updateCommitSetMap();
+        this.dispatchAction('testConfigChange');
         this.enqueueToRender();
     }
 
@@ -336,7 +337,7 @@ class CustomAnalysisTaskConfigurator extends ComponentBase {
 
         this._commitSetMap = {'Baseline': newBaseline, 'Comparison': newComparison};
 
-        this.dispatchAction('commitSetChange');
+        this.dispatchAction('testConfigChange');
         this.enqueueToRender();
     }
 
index bd94984..87b17c1 100644 (file)
@@ -49,7 +49,7 @@ class CustomConfigurationTestGroupForm extends TestGroupForm {
     {
         super.didConstructShadowTree();
 
-        this.part('configurator').listenToAction('commitSetChange', () => this.enqueueToRender());
+        this.part('configurator').listenToAction('testConfigChange', () => this.enqueueToRender());
 
         this.content('task-name').oninput = () => this.enqueueToRender();
         this.content('group-name').oninput = () => this.enqueueToRender();