⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246581 in webkit


Ignore:
Timestamp:
Jun 18, 2019, 10:12:35 PM (7 years ago)
Author:
Dewei Zhu
Message:

Customizable test group form should allow user to supply a revision prefix of a commit and revision starts with 'r'.
https://bugs.webkit.org/show_bug.cgi?id=198940

Reviewed by Ryosuke Niwa.

Customizable test group form should adapt prefix matching when fetching for a commit.

  • browser-tests/customizable-test-group-form-tests.js: Updated and added unit tests.
  • public/v3/components/customizable-test-group-form.js: Removed loggings those a unintentionally committed.
  • public/v3/models/commit-set.js: Adapted prefix matching API when fetching a commit.

(IntermediateCommitSet.prototype._fetchCommitLogAndOwnedCommits):

  • unit-tests/commit-set-tests.js: Updated unit tests accordingly.
Location:
trunk/Websites/perf.webkit.org
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Websites/perf.webkit.org/ChangeLog

    r246522 r246581  
     12019-06-17  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        Customizable test group form should allow user to supply a revision prefix of a commit and revision starts with 'r'.
     4        https://bugs.webkit.org/show_bug.cgi?id=198940
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Customizable test group form should adapt prefix matching when fetching for a commit.
     9
     10        * browser-tests/customizable-test-group-form-tests.js: Updated and added unit tests.
     11        * public/v3/components/customizable-test-group-form.js: Removed loggings those a unintentionally committed.
     12        * public/v3/models/commit-set.js: Adapted prefix matching API when fetching a commit.
     13        (IntermediateCommitSet.prototype._fetchCommitLogAndOwnedCommits):
     14        * unit-tests/commit-set-tests.js: Updated unit tests accordingly.
     15
    1162019-06-13  Dewei Zhu  <dewei_zhu@apple.com>
    217
  • trunk/Websites/perf.webkit.org/browser-tests/customizable-test-group-form-tests.js

    r237950 r246581  
    3636    };
    3737
     38    const commitObjectC = {
     39        "id": "185336",
     40        "revision": "210950",
     41        "repository": 1,
     42        "previousCommit": null,
     43        "ownsCommits": false,
     44        "time": 1541494949682,
     45        "authorName": "Chris Dumez",
     46        "authorEmail": "cdumez@apple.com",
     47        "message": "some message",
     48    };
     49
    3850    function cloneObject(object)
    3951    {
     
    6375        const requests = context.symbols.MockRemoteAPI.requests;
    6476        expect(requests.length).to.be(2);
    65         expect(requests[0].url).to.be('/api/commits/1/210948');
    66         expect(requests[1].url).to.be('/api/commits/1/210949');
     77        expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
     78        expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
    6779        requests[0].resolve({commits: [commitObjectA]});
    6880        requests[1].resolve({commits: [commitObjectB]});
     
    89101        revisionEditor = revisionEditors[0];
    90102        expect(revisionEditor.value).to.be('210948');
     103    });
     104
     105    it('should allow user to only provide prefix of a commit as long as the commit is unique in the repository', async () => {
     106        const context = new BrowsingContext();
     107        const customizableTestGroupForm = await createCustomizableTestGroupFormWithContext(context);
     108        const repository = context.symbols.Repository.ensureSingleton(1, {name: 'WebKit'});
     109
     110        const commitA = cloneObject(commitObjectA);
     111        const commitB = cloneObject(commitObjectB);
     112        const commitC = cloneObject(commitObjectC);
     113        commitA.repository = repository;
     114        commitB.repository = repository;
     115        commitC.repository = repository;
     116        const webkitCommitA = context.symbols.CommitLog.ensureSingleton(185326, commitA);
     117        const webkitCommitB = context.symbols.CommitLog.ensureSingleton(185334, commitB);
     118        const commitSetA = context.symbols.CommitSet.ensureSingleton(1, {revisionItems: [{commit: webkitCommitA}]});
     119        const commitSetB = context.symbols.CommitSet.ensureSingleton(2, {revisionItems: [{commit: webkitCommitB}]});
     120
     121        customizableTestGroupForm.setCommitSetMap({A: commitSetA, B: commitSetB});
     122        customizableTestGroupForm.content('customize-link').click();
     123
     124        const requests = context.symbols.MockRemoteAPI.requests;
     125        expect(requests.length).to.be(2);
     126        expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
     127        expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
     128        requests[0].resolve({commits: [commitObjectA]});
     129        requests[1].resolve({commits: [commitObjectB]});
     130
     131        await waitForComponentsToRender(context);
     132
     133        const radioButton = customizableTestGroupForm.content('custom-table').querySelector('input[type="radio"][name="A-1-radio"]:not(:checked)');
     134        radioButton.click();
     135        expect(radioButton.checked).to.be(true);
     136
     137        let revisionEditors = customizableTestGroupForm.content('custom-table').querySelectorAll('input:not([type="radio"])');
     138        expect(revisionEditors.length).to.be(2);
     139        let revisionEditor = revisionEditors[0];
     140        expect(revisionEditor.value).to.be('210949');
     141        revisionEditor.value = '21095';
     142        revisionEditor.dispatchEvent(new Event('change'));
     143
     144        customizableTestGroupForm.content('name').value = 'a/b test';
     145        customizableTestGroupForm.content('name').dispatchEvent(new Event('input'));
     146        expect(requests.length).to.be(3);
     147        expect(requests[2].url).to.be('/api/commits/1/21095?prefix-match=true');
     148        requests[2].resolve({commits: [commitObjectC]});
     149
     150        await waitForComponentsToRender(context);
     151
     152        revisionEditors = customizableTestGroupForm.content('custom-table').querySelectorAll('input:not([type="radio"])');
     153        revisionEditor = revisionEditors[0];
     154        expect(revisionEditor.value).to.be('210950');
    91155    });
    92156
     
    110174        const requests = context.symbols.MockRemoteAPI.requests;
    111175        expect(requests.length).to.be(2);
    112         expect(requests[0].url).to.be('/api/commits/1/210948');
    113         expect(requests[1].url).to.be('/api/commits/1/210949');
     176        expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
     177        expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
    114178        requests[0].resolve({commits: [commitObjectA]});
    115179        requests[1].resolve({commits: [commitObjectB]});
  • trunk/Websites/perf.webkit.org/public/v3/components/customizable-test-group-form.js

    r240104 r246581  
    146146        const commitSets = Array.from(commitSetMap.values());
    147147        const hasCommitWithTestability = commitSets.some((commitSet) =>  !!commitSet.commitsWithTestability().length);
    148         for (const c of commitSets) {
    149             if (c.commitsWithTestability().length)
    150                 console.log(c);
    151         }
    152         console.log({hasCommitWithTestability});
    153         console.log('aaaa');
    154148        if (!hasCommitWithTestability)
    155149            return [];
  • trunk/Websites/perf.webkit.org/public/v3/models/commit-set.js

    r240104 r246581  
    395395    _fetchCommitLogAndOwnedCommits(repository, revision)
    396396    {
    397         return CommitLog.fetchForSingleRevision(repository, revision).then((commits) => {
     397        return CommitLog.fetchForSingleRevision(repository, revision, true).then((commits) => {
    398398            console.assert(commits.length === 1);
    399399            const commit = commits[0];
  • trunk/Websites/perf.webkit.org/unit-tests/commit-set-tests.js

    r239485 r246581  
    502502            const requests = MockRemoteAPI.requests;
    503503            assert.equal(requests.length, 2);
    504             assert.equal(requests[0].url, '/api/commits/111/owner-commit-0');
     504            assert.equal(requests[0].url, '/api/commits/111/owner-commit-0?prefix-match=true');
    505505            assert.equal(requests[0].method, 'GET');
    506             assert.equal(requests[1].url, '/api/commits/112/owned-commit-0');
     506            assert.equal(requests[1].url, '/api/commits/112/owned-commit-0?prefix-match=true');
    507507            assert.equal(requests[1].method, 'GET');
    508508
     
    557557
    558558            assert(requests.length, 2);
    559             assert.equal(requests[0].url, '/api/commits/11/webkit-commit-0');
     559            assert.equal(requests[0].url, '/api/commits/11/webkit-commit-0?prefix-match=true');
    560560            assert.equal(requests[0].method, 'GET');
    561             assert.equal(requests[1].url, '/api/commits/11/webkit-commit-1');
     561            assert.equal(requests[1].url, '/api/commits/11/webkit-commit-1?prefix-match=true');
    562562            assert.equal(requests[1].method, 'GET');
    563563
     
    654654
    655655            const requests = MockRemoteAPI.requests;
    656             assert.equal(requests[0].url, '/api/commits/11/webkit-commit-1');
     656            assert.equal(requests[0].url, '/api/commits/11/webkit-commit-1?prefix-match=true');
    657657            assert.equal(requests[0].method, 'GET');
    658658
Note: See TracChangeset for help on using the changeset viewer.