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

🏗 Surface console errors during tests as mocha failures #14336

Merged
merged 3 commits into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ads/google/a4a/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ describe('Google A4A utils', () => {
},
};

it('should extract correct config from header', () => {
// TODO(zhouyx, #14336): Fails due to console errors.
it.skip('should extract correct config from header', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
let url;
Expand Down
3 changes: 2 additions & 1 deletion ads/google/test/test-doubleclick.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ describes.sandboxed('writeAdScript', {}, env => {
verifyScript(win, 'gpt.js');
});

it('should use GPT when multiSize is not null', () => {
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should use GPT when multiSize is not null', () => {
const data = {multiSize: 'hey!'};
writeAdScript(win, data);
verifyScript(win, 'gpt.js');
Expand Down
41 changes: 29 additions & 12 deletions extensions/amp-a4a/0.1/test/test-amp-a4a.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ describe('amp-a4a', () => {
a4a.onLayoutMeasure();
});

it('should render via cached iframe', () => {
// TODO(lannka, #14336): Fails due to console errors.
it.skip('should render via cached iframe', () => {
return a4a.layoutCallback().then(() => {
verifyCachedContentIframeRender(a4aElement, TEST_URL);
// Should have reported an error.
Expand All @@ -635,7 +636,9 @@ describe('amp-a4a', () => {
});
});

it('should fire amp-analytics triggers for illegal render modes', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should fire amp-analytics triggers for illegal ' +
'render modes', () => {
const triggerAnalyticsEventSpy =
sandbox.spy(analytics, 'triggerAnalyticsEvent');
return a4a.layoutCallback().then(() => {
Expand Down Expand Up @@ -692,7 +695,8 @@ describe('amp-a4a', () => {

['', 'client_cache', 'safeframe', 'some_random_thing'].forEach(
headerVal => {
it(`should not attach a NameFrame when header is ${headerVal}`,
// TODO(lannka, #14336): Fails due to console errors.
it.skip(`should not attach a NameFrame when header is ${headerVal}`,
() => {
// Make sure there's no signature, so that we go down the 3p iframe path.
delete adResponse.headers['AMP-Fast-Fetch-Signature'];
Expand Down Expand Up @@ -783,7 +787,8 @@ describe('amp-a4a', () => {

['', 'client_cache', 'nameframe', 'some_random_thing'].forEach(
headerVal => {
it(`should not attach a SafeFrame when header is ${headerVal}`,
// TODO(lannka, #14336): Fails due to console errors.
it.skip(`should not attach a SafeFrame when header is ${headerVal}`,
() => {
// If rendering type is anything but safeframe, we SHOULD NOT attach a
// SafeFrame.
Expand Down Expand Up @@ -1220,10 +1225,12 @@ describe('amp-a4a', () => {
it('#layoutCallback not valid AMP', () => {
return executeLayoutCallbackTest(false);
});
it('#layoutCallback AMP render fail, recover non-AMP', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('#layoutCallback AMP render fail, recover non-AMP', () => {
return executeLayoutCallbackTest(true, true);
});
it('should run end-to-end in the presence of an XHR error', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should run end-to-end in the presence of an XHR error', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
fetchMock.getOnce(
Expand Down Expand Up @@ -1253,7 +1260,8 @@ describe('amp-a4a', () => {
});
});
});
it('should use adUrl from onNetworkFailure', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should use adUrl from onNetworkFailure', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
fetchMock.getOnce(
Expand Down Expand Up @@ -1286,7 +1294,9 @@ describe('amp-a4a', () => {
});
});
});
it('should not execute frame GET if disabled via onNetworkFailure', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should not execute frame GET if disabled via ' +
'onNetworkFailure', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
fetchMock.getOnce(
Expand All @@ -1310,7 +1320,9 @@ describe('amp-a4a', () => {
});
});
});
it('should handle XHR error when resolves before layoutCallback', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should handle XHR error when resolves before ' +
'layoutCallback', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
fetchMock.getOnce(
Expand All @@ -1331,7 +1343,9 @@ describe('amp-a4a', () => {
}));
});
});
it('should handle XHR error when resolves after layoutCallback', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should handle XHR error when resolves after ' +
'layoutCallback', () => {
return createIframePromise().then(fixture => {
setupForAdTesting(fixture);
let rejectXhr;
Expand Down Expand Up @@ -2186,7 +2200,9 @@ describes.realWin('AmpA4a-RTC', {amp: true}, env => {
expect(AMP.maybeExecuteRealTimeConfig).to.be.undefined;
expect(a4a.tryExecuteRealTimeConfig_()).to.be.undefined;
});
it('should log user error if RTC Config set but RTC not supported', () => {
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should log user error if RTC Config set but RTC not ' +
'supported', () => {
element.setAttribute('rtc-config',
JSON.stringify({'urls': ['https://a.com']}));
expect(a4a.tryExecuteRealTimeConfig_()).to.be.undefined;
Expand All @@ -2203,7 +2219,8 @@ describes.realWin('AmpA4a-RTC', {amp: true}, env => {
expect(AMP.maybeExecuteRealTimeConfig.called).to.be.true;
expect(AMP.maybeExecuteRealTimeConfig.calledWith(a4a, macros)).to.be.true;
});
it('should catch error in maybeExecuteRealTimeConfig', () => {
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should catch error in maybeExecuteRealTimeConfig', () => {
const err = new Error('Test');
AMP.maybeExecuteRealTimeConfig = sandbox.stub().throws(err);
a4a.tryExecuteRealTimeConfig_();
Expand Down
3 changes: 2 additions & 1 deletion extensions/amp-access/0.1/test/test-amp-access-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ describes.realWin('AccessIframeAdapter', {
});
});

it('should tolerate storage failures', () => {
// TODO(dvoytenko, #14336): Fails due to console errors.
it.skip('should tolerate storage failures', () => {
storageMock.expects('getItem')
.withExactArgs('amp-access-iframe')
.throws(new Error('intentional'))
Expand Down
3 changes: 2 additions & 1 deletion extensions/amp-access/0.1/test/test-amp-access-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ describes.fakeWin('AccessSource', {
});
});

it('should parse type', () => {
// TODO(dvoytenko, #14336): Fails due to console errors.
it.skip('should parse type', () => {
let config = {
'authorization': 'https://acme.com/a',
'pingback': 'https://acme.com/p',
Expand Down
3 changes: 2 additions & 1 deletion extensions/amp-access/0.1/test/test-amp-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ describes.fakeWin('AccessService authorization', {
});
});

it('should use fallback on authorization failure when available', () => {
// TODO(dvoytenko, #14336): Fails due to console errors.
it.skip('should use fallback on authorization failure when available', () => {
expectGetReaderId('reader1');
adapterMock.expects('authorize')
.withExactArgs()
Expand Down
3 changes: 2 additions & 1 deletion extensions/amp-access/0.1/test/test-login-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ describes.sandboxed('WebLoginDialog', {}, () => {
expect(windowApi.open.firstCall.args[0]).to.equal('');
});

it('should yield error if window.open fails', () => {
// TODO(dvoytenko, #14336): Fails due to console errors.
it.skip('should yield error if window.open fails', () => {
// Open is called twice due to retry on _top.
windowMock.expects('open').twice().throws('OPEN ERROR');
return openLoginDialog(ampdoc, 'http://acme.com/login')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,25 @@ describes.realWin('amp-ad-network-adsense-impl', {
element.setAttribute('width', '100vw');
expect(impl.isValidElement()).to.be.true;
});
it('should NOT be valid (responsive with wrong height)', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should NOT be valid (responsive with wrong height)', () => {
isResponsiveStub.callsFake(() => true);
element.setAttribute('data-full-width', 'true');
element.setAttribute('height', '666');
element.setAttribute('width', '100vw');
expect(impl.isValidElement()).to.be.false;
});
it('should NOT be valid (responsive with wrong width)', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should NOT be valid (responsive with wrong width)', () => {
isResponsiveStub.callsFake(() => true);
element.setAttribute('data-full-width', 'true');
element.setAttribute('height', '320');
element.setAttribute('width', '666');
expect(impl.isValidElement()).to.be.false;
});
it('should NOT be valid (responsive with missing data-full-width)', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should NOT be valid (responsive with missing ' +
'data-full-width)', () => {
isResponsiveStub.callsFake(() => true);
element.setAttribute('height', '320');
element.setAttribute('width', '100vw');
Expand Down Expand Up @@ -851,8 +855,8 @@ describes.realWin('amp-ad-network-adsense-impl', {
}
doc.body.style.direction = '';
});

it('should change left margin for responsive', () => {
// TODO(charliereams, #14336): Fails due to console errors.
it.skip('should change left margin for responsive', () => {
containerContainer = doc.createElement('div');
container = doc.createElement('div');
return buildImpl({
Expand All @@ -867,7 +871,8 @@ describes.realWin('amp-ad-network-adsense-impl', {
});
});

it('should change right margin for responsive in RTL', () => {
// TODO(charliereams, #14336): Fails due to console errors.
it.skip('should change right margin for responsive in RTL', () => {
containerContainer = doc.createElement('div');
container = doc.createElement('div');
doc.body.style.direction = 'rtl'; // todo: revert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,8 @@ describes.realWin('amp-ad-network-doubleclick-impl', realWinConfig, env => {
});
});

it('should force iframe to match size of creative', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('should force iframe to match size of creative', () => {
sandbox.stub(impl, 'sendXhrRequest').returns(
mockSendXhrRequest('150x50'));
impl.buildCallback();
Expand All @@ -926,7 +927,8 @@ describes.realWin('amp-ad-network-doubleclick-impl', realWinConfig, env => {
});
});

it('amp creative - should force iframe to match size of slot', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('amp creative - should force iframe to match size of slot', () => {
stubForAmpCreative();
sandbox.stub(impl, 'sendXhrRequest').callsFake(mockSendXhrRequest);
sandbox.stub(impl, 'renderViaCachedContentIframe_').callsFake(
Expand All @@ -946,7 +948,8 @@ describes.realWin('amp-ad-network-doubleclick-impl', realWinConfig, env => {
});
});

it('should force iframe to match size of slot', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('should force iframe to match size of slot', () => {
sandbox.stub(impl, 'sendXhrRequest').callsFake(mockSendXhrRequest);
sandbox.stub(impl, 'renderViaCachedContentIframe_').callsFake(
() => impl.iframeRenderHelper_({src: impl.adUrl_, name: 'name'}));
Expand All @@ -962,7 +965,9 @@ describes.realWin('amp-ad-network-doubleclick-impl', realWinConfig, env => {
});
});

it('should issue an ad request even with bad multi-size data attr', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('should issue an ad request even with bad multi-size ' +
'data attr', () => {
stubForAmpCreative();
sandbox.stub(impl, 'sendXhrRequest').callsFake(mockSendXhrRequest);
impl.element.setAttribute('data-multi-size', '201x50');
Expand Down Expand Up @@ -1288,7 +1293,8 @@ describes.realWin('additional amp-ad-network-doubleclick-impl',
});
});

describe('centering', () => {
// TODO(bradfrizzell, #14336): Fails due to console errors.
describe.skip('centering', () => {
const size = {width: '300px', height: '150px'};

function verifyCss(iframe, expectedSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ describes.realWin('DoubleClick Fast Fetch Fluid', realWinConfig, env => {
expect(fireDelayedImpressionsSpy).to.not.be.calledOnce;
});

it('should contain sz=320x50 in ad request by default', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('should contain sz=320x50 in ad request by default', () => {
impl.initiateAdRequest();
return impl.adPromise_.then(() => {
expect(impl.adUrl_).to.be.ok;
expect(impl.adUrl_).to.match(/[&?]sz=320x50/);
});
});

it('should contain mulitple sizes in ad request', () => {
// TODO(glevitzky, #14336): Fails due to console errors.
it.skip('should contain mulitple sizes in ad request', () => {
multiSizeImpl.initiateAdRequest();
return multiSizeImpl.adPromise_.then(() => {
expect(multiSizeImpl.adUrl_).to.be.ok;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ describes.realWin('DoubleClick Fast Fetch - Safeframe', realWinConfig, env => {
* If the safeframed creative asks to expand with invalid expand
* values, should fail gracefully.
*/
it('expand_request fails if invalid values sent', () => {
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('expand_request fails if invalid values sent', () => {
const expandMessage = {};
expandMessage[MESSAGE_FIELDS.CHANNEL] = safeframeHost.channel;
expandMessage[MESSAGE_FIELDS.ENDPOINT_IDENTITY] = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,21 @@ describes.realWin('amp-ad-network-doubleclick-impl', config , env => {
it('should not send SRA request if only 1 slot is valid', () =>
executeTest([{networkId: 1234, instances: 1, invalidInstances: 2}]));

it('should handle xhr failure by not sending subsequent request',
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should handle xhr failure by not sending subsequent request',
() => executeTest([{networkId: 1234, instances: 2, xhrFail: true}]));

it('should handle mixture of xhr and non xhr failures', () => executeTest(
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should handle mixture of xhr and ' +
'non xhr failures', () => executeTest(
[{networkId: 1234, instances: 2, xhrFail: true}, 4567, 4567]));

it('should correctly use SRA for multiple slots. multiple networks',
() => executeTest([1234, 4567, 1234, 4567]));

it('should handle mixture of all possible scenarios', () => executeTest(
// TODO(bradfrizzell, #14336): Fails due to console errors.
it.skip('should handle mixture of all ' +
'possible scenarios', () => executeTest(
[1234, 1234, 101, {networkId: 4567, instances: 2, xhrFail: true}, 202,
{networkId: 8901, instances: 3, invalidInstances: 1}]));
});
Expand Down
7 changes: 4 additions & 3 deletions extensions/amp-ad/0.1/test/test-amp-ad-3p-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ describes.realWin('amp-ad-3p-impl', {
`${remoteUrl}?$internalRuntimeVersion$"]`)).to.be.ok;
});
});

it('should use default path if custom disabled', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should use default path if custom disabled', () => {
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://example.com/boot/remote.html');
Expand Down Expand Up @@ -261,7 +261,8 @@ describes.realWin('amp-ad-3p-impl', {
});
});

it('should not use remote html path for preload if disabled', () => {
// TODO(keithwrightbos, #14336): Fails due to console errors.
it.skip('should not use remote html path for preload if disabled', () => {
const meta = win.document.createElement('meta');
meta.setAttribute('name', 'amp-3p-iframe-src');
meta.setAttribute('content', 'https://example.com/boot/remote.html');
Expand Down
4 changes: 3 additions & 1 deletion extensions/amp-ad/0.1/test/test-amp-ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ describes.realWin('Ad loader', {amp: true}, env => {
});
});

it('fails upgrade on A4A upgrade with loadElementClass error', () => {
// TODO(jridgewell, #14336): Fails due to console errors.
it.skip('fails upgrade on A4A upgrade with loadElementClass ' +
'error', () => {
a4aRegistry['zort'] = function() {
return true;
};
Expand Down
Loading