Skip to content

Commit

Permalink
Add more tests to check for the presence of basic beacon parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
wildlyinaccurate committed May 2, 2021
1 parent 13914f7 commit 4c4e8eb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/integration/lux-auto.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,41 @@ const testPages = [

describe.each(testPages)("%s", (_, testPage) => {
const luxRequests = requestInterceptor.createRequestMatcher("/beacon/");
let beacon;

beforeAll(async () => {
luxRequests.reset();
await navigateTo(`http://localhost:3000/${testPage}`);
beacon = luxRequests.getUrl(0);
});

test("LUX beacon is automatically sent", () => {
expect(luxRequests.count()).toEqual(1);
});

test("customer ID is detected correctly", () => {
const beacon = luxRequests.getUrl(0);
test("LUX version is included in the beacon", () => {
expect(parseInt(beacon.searchParams.get("v"), 10)).toBeGreaterThan(200);
});

test("customer ID is detected correctly", () => {
expect(beacon.searchParams.get("id")).toEqual("10001");
});

test("document title is used as the default page label", () => {
const beacon = luxRequests.getUrl(0);
test("page ID and session ID are sent", () => {
expect(beacon.searchParams.get("sid").length).toBeGreaterThan(0);
expect(beacon.searchParams.get("uid").length).toBeGreaterThan(0);
});

test("document title is used as the default page label", () => {
expect(beacon.searchParams.get("l")).toEqual("LUX Auto Test");
});

test("basic page metrics are sent", () => {
const beacon = luxRequests.getUrl(0);

expect(beacon.searchParams.get("NT").length).toBeGreaterThan(0);
expect(beacon.searchParams.get("PS").length).toBeGreaterThan(0);
expect(beacon.searchParams.get("HN").length).toBeGreaterThan(0);
expect(beacon.searchParams.get("CPU").length).toBeGreaterThan(0);
expect(beacon.searchParams.get("CLS").length).toBeGreaterThan(0);

const navTiming = beacon.searchParams.get("NT");

Expand Down

0 comments on commit 4c4e8eb

Please sign in to comment.