Closed dreamofabear closed 6 years ago
Re: the first checkbox, here's where we apply the prod
and canary
configs before testing. I'll let @danielrozenberg confirm that the configs are indeed triggering the prod
or canary
specific behavior from the runtime.
Edit: I reread the OP and realized that the tests aren't being triggered for config-only changes. That logic lives in pr-check.js
. You'll need to add FLAG_CONFIG
to the list of cases in which the visual tests are run.
Re: (1) above, I've tried to get visual tests running with locally changed canary/prod configs and have been unsuccessful so far. Two things I've noticed:
visual-diff.rb#apply_amp_config()
to pass --local_branch
to avoid clobbering your local canary/prod configs with the version from origin/master
, which may be wildly out of date (as mine was, since I never push to origin/master). We should fix this.cdn.ampproject.org
rather than local folder. This is confusing because, with --debug
, Selenium appears to output correct-looking HTML in the console. But when I added a sleep(30)
after snapshot generation and inspected the page in Chrome, the HTML did point to CDN.Re: (3) above, the regression test is being added in #15649.
I just realized actually we hit this issue awhile ago: https://github.com/ampproject/amphtml/issues/13351#issuecomment-363946198
Visual tests today may still not be running with locally built binaries!
Yeah, IIRC, we hit the issue before, and saw that the local gulp
server was serving amp.js
. Not sure why the test page is still fetching from the cdn. Maybe there's another runtime setting somewhere that isn't in the correct state?
Re: (1) above, I created a branch to test this, by creating a new component* <amp-test-config>
that changes its textContent
to 'canary'
or 'prod'
depending on the value of AMP_CONFIG['canary']
, and ran a visual diff on a test case (removing all other test cases) — looks good! I'm gonna tick this box
(* note, this branch should not be merged, because it's practically hacked together. lmk if you want to make this code merge-worthy. I don't see a lot of value in it, as long as we keep that branch around for future sanity checks)
Oops, looks like there is indeed an issue! If I run gulp visual-diff
, the internal web server doesn't modify the example files to use the local build (https://cdn.ampproject.org/v0/
→ /dist/v0
), but if I run gulp visual-diff --webserver_debug
, it does! I'll follow up on this
Here's where --webserver-debug
gets plumbed to:
Seems like adding morgan('dev')
to middleware
is what triggers the URL replacement. Good catch!
@rsimha yep, @choumx and I just figured it out. Gonna send out a PR to fix this soon (I want to run a few local checks first)
And here is why morgan('dev')
and app
were gated on quiet
: https://github.com/ampproject/amphtml/pull/11594#discussion_r143317962
TL;DR: It's my fault. I mistakenly believed that doing so would merely silence the Powered by AMP ⚡
messages, but it had the side effect of pulling the runtime from the wrong place. And all my testing of the visual tests didn't catch this because I used --webserver_debug
>_<
It's only visual diff testing that uses the --quiet
flag for gulp serve
, so normal testing was never affected by this bug.
I'm glad this is getting fixed!
/cc @timhaines
After merging #15717, running gulp visual-diff
works as expected. Marking checkbox (1) as complete once again :)
Verified using the example that @choumx gave me, using #15744
I believe we currently run visual tests with AMP runtime built on both prod and canary experiment configs (canary-config.json and prod-config.json), but PRs that change these configs don't trigger visual tests.
We should change this to ensure that our visual testing system can catch bugs like #15596.
From @rsimha:
/to @danielrozenberg /cc @rsimha