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