Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix amp-pixel integration test on Saucelabs. #9130

Merged
merged 6 commits into from
May 4, 2017

Conversation

lannka
Copy link
Contributor

@lannka lannka commented May 3, 2017

The previous failure was due to the fixture iframe that we created for each test does not have an origin (we use srcdoc). In such case, some browsers will take the top window origin as referrer, but some will use null .

The fix is to fully mimic the real production world. Use an iframe to load a valid AMP page from a server.

Closes #8853

@lannka lannka requested a review from zhouyx May 3, 2017 23:20

return withdrawRequest(win, 'no-referrer').then(request => {
describes.integration('amp-pixel integration test', {
body: `<amp-pixel src="${depositRequestUrl('no-referrer')}"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks awesome!

@@ -333,6 +338,42 @@ class SandboxFixture {
}
}

/** @implements {Fixture} */
class IntegrationFixture {
/** @param {!{body: string}} spec */
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed, can we add a TODO here to support extension and version later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think TODO is needed, especially we recently introduced a new "TODO rule" that we need to create a github issue for each TODO.

this works as is right now. if anyone want to add tests using extension, they will add them wisely.

Copy link
Contributor

Choose a reason for hiding this comment

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

we have such a rule now? OK, I agree they will find it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dvoytenko will tell you about the new rule. :-)

referrerpolicy="no-referrer">`,
}, env => {
it('should remove referrer if referrerpolicy=no-referrer', () => {
return withdrawRequest(env.win, 'no-referrer').then(request => {
Copy link
Contributor

@zhouyx zhouyx May 4, 2017

Choose a reason for hiding this comment

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

Though the new integration test looks good. I really can't tell why it will fix test failure on old Chrome? Can you explain it a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous failure was due to the fixture iframe that we created for each test does not have an origin (we use srcdoc). In such case, some browsers will take the top window origin as referrer, but some will use null .

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense. Let's merge this and see : )

@lannka lannka merged commit 9667282 into ampproject:master May 4, 2017
@lannka lannka deleted the fix_amp_pixel_integration-test branch May 4, 2017 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unskip amp-pixel test
4 participants