Skip to content

Commit

Permalink
🏗 Run unit tests on Firefox (#22420)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored May 22, 2019
1 parent 4296d7d commit 6a11b62
Show file tree
Hide file tree
Showing 18 changed files with 1,912 additions and 1,817 deletions.
44 changes: 24 additions & 20 deletions ads/google/a4a/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,27 +872,31 @@ describe('Google A4A utils', () => {
);
});

it('should not fetch if INSUFFICIENT consent', () => {
sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns(
Promise.resolve({
whenPolicyResolved: () => CONSENT_POLICY_STATE.INSUFFICIENT,
})
);
return expect(
getIdentityToken(env.win, env.ampdoc, 'default')
).to.eventually.jsonEqual({});
});
it.configure()
.skipFirefox()
.run('should not fetch if INSUFFICIENT consent', () => {
sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns(
Promise.resolve({
whenPolicyResolved: () => CONSENT_POLICY_STATE.INSUFFICIENT,
})
);
return expect(
getIdentityToken(env.win, env.ampdoc, 'default')
).to.eventually.jsonEqual({});
});

it('should not fetch if UNKNOWN consent', () => {
sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns(
Promise.resolve({
whenPolicyResolved: () => CONSENT_POLICY_STATE.UNKNOWN,
})
);
return expect(
getIdentityToken(env.win, env.ampdoc, 'default')
).to.eventually.jsonEqual({});
});
it.configure()
.skipFirefox()
.run('should not fetch if UNKNOWN consent', () => {
sandbox.stub(Services, 'consentPolicyServiceForDocOrNull').returns(
Promise.resolve({
whenPolicyResolved: () => CONSENT_POLICY_STATE.UNKNOWN,
})
);
return expect(
getIdentityToken(env.win, env.ampdoc, 'default')
).to.eventually.jsonEqual({});
});
});

describe('variables for amp-analytics', () => {
Expand Down
2 changes: 1 addition & 1 deletion build-system/tasks/runtime-test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ function getConfig() {
: [
// With --saucelabs_lite, a subset of the unit tests are run.
// Only browsers that support chai-as-promised may be included below.
// TODO(rsimha): Add more browsers to this list. #6039.
'SL_Safari_12',
'SL_Firefox',
];

return Object.assign({}, karmaDefault, {
Expand Down
20 changes: 11 additions & 9 deletions test/unit/test-amp-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ describe('3p ampcontext.js', () => {
});
});

it('should throw error if metadata missing', () => {
win.name = generateIncorrectAttributes();
const platform = new Platform(window);
expect(() => new AmpContext(win)).to.throw(
platform.isSafari()
? /undefined is not an object/
: /Cannot read property/
);
});
it.configure()
.skipFirefox()
.run('should throw error if metadata missing', () => {
win.name = generateIncorrectAttributes();
const platform = new Platform(window);
expect(() => new AmpContext(win)).to.throw(
platform.isSafari()
? /undefined is not an object/
: /Cannot read property/
);
});

it('should be able to send an intersection observer request', () => {
win.name = generateSerializedAttributes();
Expand Down
1 change: 1 addition & 0 deletions test/unit/test-ampdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ describe('AmpDocService', () => {
// TODO(dvoytenko, #11827): Make this test work on Safari.
it.configure()
.skipSafari()
.skipFirefox()
.run('should navigate via host', () => {
if (!shadowRoot) {
return;
Expand Down
Loading

0 comments on commit 6a11b62

Please sign in to comment.