DEV: Fix failing click-track tests.
This commit is contained in:
parent
4bbb34f7cb
commit
71fb8a4195
|
@ -93,7 +93,7 @@ export default {
|
||||||
|
|
||||||
let trackPromise = Ember.RSVP.resolve();
|
let trackPromise = Ember.RSVP.resolve();
|
||||||
if (tracking) {
|
if (tracking) {
|
||||||
if (navigator.sendBeacon) {
|
if (!Ember.testing && navigator.sendBeacon) {
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
data.append("url", href);
|
data.append("url", href);
|
||||||
data.append("post_id", postId);
|
data.append("post_id", postId);
|
||||||
|
|
|
@ -4,7 +4,7 @@ acceptance("Click Track", {});
|
||||||
|
|
||||||
QUnit.test("Do not track mentions", async assert => {
|
QUnit.test("Do not track mentions", async assert => {
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", () => assert.ok(false));
|
server.post("/clicks/track", () => assert.ok(false));
|
||||||
|
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
assert.ok(invisible("#user-card"), "card should not appear");
|
assert.ok(invisible("#user-card"), "card should not appear");
|
||||||
|
|
|
@ -138,7 +138,7 @@ export default function() {
|
||||||
return response({ topic_list: { topics: [] } });
|
return response({ topic_list: { topics: [] } });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get("/clicks/track", success);
|
this.post("/clicks/track", success);
|
||||||
|
|
||||||
this.get("/search", request => {
|
this.get("/search", request => {
|
||||||
if (request.queryParams.q === "posts") {
|
if (request.queryParams.q === "posts") {
|
||||||
|
|
|
@ -62,11 +62,10 @@ QUnit.test("tracks internal URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -79,11 +78,10 @@ QUnit.test("tracks external URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -99,11 +97,10 @@ QUnit.test(
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,10 +56,8 @@ QUnit.test("tracks internal URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com");
|
||||||
request.url.indexOf("url=http%3A%2F%2Fdiscuss.domain.com") !== -1
|
|
||||||
);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,11 +69,10 @@ QUnit.test("tracks external URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -88,11 +85,10 @@ QUnit.test("tracks external URLs in other posts", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.equal(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331"
|
"url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,11 +54,10 @@ QUnit.test("tracks internal URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -75,7 +74,7 @@ QUnit.test("does not track attachments", async assert => {
|
||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", () => assert.ok(false));
|
server.post("/clicks/track", () => assert.ok(false));
|
||||||
|
|
||||||
assert.ok(track(generateClickEventOn(".attachment")));
|
assert.ok(track(generateClickEventOn(".attachment")));
|
||||||
});
|
});
|
||||||
|
@ -85,11 +84,10 @@ QUnit.test("tracks external URLs", async assert => {
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -105,11 +103,10 @@ QUnit.test(
|
||||||
|
|
||||||
const done = assert.async();
|
const done = assert.async();
|
||||||
/* global server */
|
/* global server */
|
||||||
server.get("/clicks/track", request => {
|
server.post("/clicks/track", request => {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
request.url.indexOf(
|
request.requestBody,
|
||||||
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
"url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue