Diff
Modified: trunk/Websites/perf.webkit.org/ChangeLog (246580 => 246581)
--- trunk/Websites/perf.webkit.org/ChangeLog 2019-06-19 04:44:11 UTC (rev 246580)
+++ trunk/Websites/perf.webkit.org/ChangeLog 2019-06-19 05:12:35 UTC (rev 246581)
@@ -1,3 +1,18 @@
+2019-06-17 Dewei Zhu <dewei_...@apple.com>
+
+ 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.
+
2019-06-13 Dewei Zhu <dewei_...@apple.com>
Custom analysis task configurator should allow supplying commit prefix and revision starts 'r'.
Modified: trunk/Websites/perf.webkit.org/browser-tests/customizable-test-group-form-tests.js (246580 => 246581)
--- trunk/Websites/perf.webkit.org/browser-tests/customizable-test-group-form-tests.js 2019-06-19 04:44:11 UTC (rev 246580)
+++ trunk/Websites/perf.webkit.org/browser-tests/customizable-test-group-form-tests.js 2019-06-19 05:12:35 UTC (rev 246581)
@@ -35,6 +35,18 @@
"message": "some message",
};
+ const commitObjectC = {
+ "id": "185336",
+ "revision": "210950",
+ "repository": 1,
+ "previousCommit": null,
+ "ownsCommits": false,
+ "time": 1541494949682,
+ "authorName": "Chris Dumez",
+ "authorEmail": "cdu...@apple.com",
+ "message": "some message",
+ };
+
function cloneObject(object)
{
const clone = {};
@@ -62,8 +74,8 @@
const requests = context.symbols.MockRemoteAPI.requests;
expect(requests.length).to.be(2);
- expect(requests[0].url).to.be('/api/commits/1/210948');
- expect(requests[1].url).to.be('/api/commits/1/210949');
+ expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
+ expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
requests[0].resolve({commits: [commitObjectA]});
requests[1].resolve({commits: [commitObjectB]});
@@ -90,6 +102,58 @@
expect(revisionEditor.value).to.be('210948');
});
+ it('should allow user to only provide prefix of a commit as long as the commit is unique in the repository', async () => {
+ const context = new BrowsingContext();
+ const customizableTestGroupForm = await createCustomizableTestGroupFormWithContext(context);
+ const repository = context.symbols.Repository.ensureSingleton(1, {name: 'WebKit'});
+
+ const commitA = cloneObject(commitObjectA);
+ const commitB = cloneObject(commitObjectB);
+ const commitC = cloneObject(commitObjectC);
+ commitA.repository = repository;
+ commitB.repository = repository;
+ commitC.repository = repository;
+ const webkitCommitA = context.symbols.CommitLog.ensureSingleton(185326, commitA);
+ const webkitCommitB = context.symbols.CommitLog.ensureSingleton(185334, commitB);
+ const commitSetA = context.symbols.CommitSet.ensureSingleton(1, {revisionItems: [{commit: webkitCommitA}]});
+ const commitSetB = context.symbols.CommitSet.ensureSingleton(2, {revisionItems: [{commit: webkitCommitB}]});
+
+ customizableTestGroupForm.setCommitSetMap({A: commitSetA, B: commitSetB});
+ customizableTestGroupForm.content('customize-link').click();
+
+ const requests = context.symbols.MockRemoteAPI.requests;
+ expect(requests.length).to.be(2);
+ expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
+ expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
+ requests[0].resolve({commits: [commitObjectA]});
+ requests[1].resolve({commits: [commitObjectB]});
+
+ await waitForComponentsToRender(context);
+
+ const radioButton = customizableTestGroupForm.content('custom-table').querySelector('input[type="radio"][name="A-1-radio"]:not(:checked)');
+ radioButton.click();
+ expect(radioButton.checked).to.be(true);
+
+ let revisionEditors = customizableTestGroupForm.content('custom-table').querySelectorAll('input:not([type="radio"])');
+ expect(revisionEditors.length).to.be(2);
+ let revisionEditor = revisionEditors[0];
+ expect(revisionEditor.value).to.be('210949');
+ revisionEditor.value = '21095';
+ revisionEditor.dispatchEvent(new Event('change'));
+
+ customizableTestGroupForm.content('name').value = 'a/b test';
+ customizableTestGroupForm.content('name').dispatchEvent(new Event('input'));
+ expect(requests.length).to.be(3);
+ expect(requests[2].url).to.be('/api/commits/1/21095?prefix-match=true');
+ requests[2].resolve({commits: [commitObjectC]});
+
+ await waitForComponentsToRender(context);
+
+ revisionEditors = customizableTestGroupForm.content('custom-table').querySelectorAll('input:not([type="radio"])');
+ revisionEditor = revisionEditors[0];
+ expect(revisionEditor.value).to.be('210950');
+ });
+
it('should use the commit set map when customize button is clicked as the behavior of radio buttons', async () => {
const context = new BrowsingContext();
const customizableTestGroupForm = await createCustomizableTestGroupFormWithContext(context);
@@ -109,8 +173,8 @@
const requests = context.symbols.MockRemoteAPI.requests;
expect(requests.length).to.be(2);
- expect(requests[0].url).to.be('/api/commits/1/210948');
- expect(requests[1].url).to.be('/api/commits/1/210949');
+ expect(requests[0].url).to.be('/api/commits/1/210948?prefix-match=true');
+ expect(requests[1].url).to.be('/api/commits/1/210949?prefix-match=true');
requests[0].resolve({commits: [commitObjectA]});
requests[1].resolve({commits: [commitObjectB]});
Modified: trunk/Websites/perf.webkit.org/public/v3/components/customizable-test-group-form.js (246580 => 246581)
--- trunk/Websites/perf.webkit.org/public/v3/components/customizable-test-group-form.js 2019-06-19 04:44:11 UTC (rev 246580)
+++ trunk/Websites/perf.webkit.org/public/v3/components/customizable-test-group-form.js 2019-06-19 05:12:35 UTC (rev 246581)
@@ -145,12 +145,6 @@
const commitSets = Array.from(commitSetMap.values());
const hasCommitWithTestability = commitSets.some((commitSet) => !!commitSet.commitsWithTestability().length);
- for (const c of commitSets) {
- if (c.commitsWithTestability().length)
- console.log(c);
- }
- console.log({hasCommitWithTestability});
- console.log('aaaa');
if (!hasCommitWithTestability)
return [];
Modified: trunk/Websites/perf.webkit.org/public/v3/models/commit-set.js (246580 => 246581)
--- trunk/Websites/perf.webkit.org/public/v3/models/commit-set.js 2019-06-19 04:44:11 UTC (rev 246580)
+++ trunk/Websites/perf.webkit.org/public/v3/models/commit-set.js 2019-06-19 05:12:35 UTC (rev 246581)
@@ -394,7 +394,7 @@
_fetchCommitLogAndOwnedCommits(repository, revision)
{
- return CommitLog.fetchForSingleRevision(repository, revision).then((commits) => {
+ return CommitLog.fetchForSingleRevision(repository, revision, true).then((commits) => {
console.assert(commits.length === 1);
const commit = commits[0];
if (!commit.ownsCommits())
Modified: trunk/Websites/perf.webkit.org/unit-tests/commit-set-tests.js (246580 => 246581)
--- trunk/Websites/perf.webkit.org/unit-tests/commit-set-tests.js 2019-06-19 04:44:11 UTC (rev 246580)
+++ trunk/Websites/perf.webkit.org/unit-tests/commit-set-tests.js 2019-06-19 05:12:35 UTC (rev 246581)
@@ -501,9 +501,9 @@
const requests = MockRemoteAPI.requests;
assert.equal(requests.length, 2);
- assert.equal(requests[0].url, '/api/commits/111/owner-commit-0');
+ assert.equal(requests[0].url, '/api/commits/111/owner-commit-0?prefix-match=true');
assert.equal(requests[0].method, 'GET');
- assert.equal(requests[1].url, '/api/commits/112/owned-commit-0');
+ assert.equal(requests[1].url, '/api/commits/112/owned-commit-0?prefix-match=true');
assert.equal(requests[1].method, 'GET');
requests[0].resolve({commits: [{
@@ -556,9 +556,9 @@
const requests = MockRemoteAPI.requests;
assert(requests.length, 2);
- assert.equal(requests[0].url, '/api/commits/11/webkit-commit-0');
+ assert.equal(requests[0].url, '/api/commits/11/webkit-commit-0?prefix-match=true');
assert.equal(requests[0].method, 'GET');
- assert.equal(requests[1].url, '/api/commits/11/webkit-commit-1');
+ assert.equal(requests[1].url, '/api/commits/11/webkit-commit-1?prefix-match=true');
assert.equal(requests[1].method, 'GET');
requests[1].resolve({commits: [{
@@ -653,7 +653,7 @@
commitSet.removeCommitForRepository(MockModels.webkit);
const requests = MockRemoteAPI.requests;
- assert.equal(requests[0].url, '/api/commits/11/webkit-commit-1');
+ assert.equal(requests[0].url, '/api/commits/11/webkit-commit-1?prefix-match=true');
assert.equal(requests[0].method, 'GET');
requests[0].resolve({commits: [{