Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Prototype for viewing a diff on wpt.fyi #310

Merged
merged 6 commits into from
Dec 14, 2017

Conversation

lukebjerring
Copy link
Collaborator

@lukebjerring
Copy link
Collaborator Author

Considerations:

  • Browser summary should probably be extracted, display something more useful than Diff@diff
  • Diff is omitting entries for test-counts with unchanged results, which makes the numbers look strange.
  • Existing UI uses redness shade inversely proportional to number of differences, which makes no sense
  • Super slow to load

@foolip foolip requested review from rwaldron and mattl and removed request for foolip November 29, 2017 23:27
@rwaldron
Copy link
Contributor

rwaldron commented Dec 4, 2017

@lukebjerring ping for rebase—thanks!

@lukebjerring
Copy link
Collaborator Author

@rwaldron sync'd.

@rwaldron
Copy link
Contributor

rwaldron commented Dec 4, 2017

@lukebjerring Github is still reporting that there are conflicts, which I can confirm by pulling this locally. Can you run this in your local branch:

# assuming "upstream" is https://github.com/w3c/wptdashboard.git
git pull --rebase upstream master

Resolve the conflicts, commit, then...

git push HEAD -f

@lukebjerring
Copy link
Collaborator Author

Not sure what you're seeing, but I see:

This branch has no conflicts with the base branch
Merging can be performed automatically.

@rwaldron
Copy link
Contributor

rwaldron commented Dec 4, 2017

I just nuked everything local and started fresh and now I cannot reproduce this conflict that Github claims, so we're back on track.

Copy link
Contributor

@rwaldron rwaldron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing the following warning in the console:

property-accessors.html:341 Polymer::Attributes: couldn't decode Array as JSON:
_deserializeValue @ property-accessors.html:341

And the following Uncaught exception:

Uncaught (in promise) TypeError: Cannot read property 'map' of null
test-file-results.html:107

Is this display intentional?

@@ -41,7 +41,7 @@
async connectedCallback () {
super.connectedCallback()

if (!this.testRuns) {
if (this.testRunResources) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand this change—I don't see any other changes that involve this.testRunResources. Any details would be appreciated 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestRun is an array of the JSON objects, which can be passed in directly. TestRunResources are URLs to fetch the JSON objects. This PR uses both (the TestRun for the diff is passed as a JSON object).

This will probably change anyway, since the single-result view 'diff' isn't needed, so will probably keep 'diff' as a separate property on the Polymer element.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the details!

@@ -57,7 +57,7 @@
.reduce((sum, item) => {
return Array.isArray(item) ? sum.concat(item) : [...sum, item]
}, [])
this.testRuns = flattened
this.testRuns = this.testRuns ? [...flattened, ...this.testRuns] : flattened
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.testRuns = flattened.concat(this.testRuns || [])

wdyt?

@@ -364,6 +364,14 @@
: '&'
path += 'sha=' + this.sha
}
var diffRuns = this.testRuns.filter(r => r['revision'] == 'diff')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use MemberExpression.IdentifierName: r.revision == 'diff'

? '?'
: '&'
path += 'before=' + this.testRuns[0]['browser_name'] + '@' + this.testRuns[0]['revision']
path += '&after=' + this.testRuns[1]['browser_name'] + '@' + this.testRuns[1]['revision']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • use destructuring to unpack this.testRuns[0] and this.testRuns[1]:
    let [before, after] = this.testRuns;
  • use MemberExpression.IdentifierName (for all cases here and throughout): before.browser_name, before.revision, after.browser_name & after.revision
  • use template string:
    path += `before=${before.browser_name}@${before.revision}`

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about unpack.

@rwaldron
Copy link
Contributor

rwaldron commented Dec 4, 2017

Have you seen this?

@lukebjerring
Copy link
Collaborator Author

lukebjerring commented Dec 4, 2017

Looks like the doubling-up of runs is a bug on single test-files, will fix along with other issues.

@rwaldron
Copy link
Contributor

rwaldron commented Dec 4, 2017

doubling-up of runs is already a bug

I'm not seeing this on master—where are you seeing it?

@lukebjerring
Copy link
Collaborator Author

lukebjerring commented Dec 4, 2017 via email

Copy link
Contributor

@rwaldron rwaldron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last minor change needed and this can be merged (feel free to merge once you make the change)

@@ -41,7 +41,7 @@
async connectedCallback () {
super.connectedCallback()

if (!this.testRuns) {
if (this.testRunResources) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the details!

@@ -144,6 +145,9 @@
}

resultsURL (testRun, testFile) {
if (testRun.revision == 'diff') {
return testRun.results_url + '&path=' + encodeURI(testFile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a template string update here.

path += '&after=' + this.testRuns[1]['browser_name'] + '@' + this.testRuns[1]['revision']
let [before, after] = this.testRuns
path += `before=${before.browser_name}@${before.revision}`
path += `&after=${after.browser_name}@${after.revision}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@mattl mattl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable.

@rwaldron rwaldron merged commit a187c33 into web-platform-tests:master Dec 14, 2017
@lukebjerring lukebjerring deleted the run-diff-html branch December 21, 2017 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants