-
Notifications
You must be signed in to change notification settings - Fork 43
/
C2601.js
49 lines (40 loc) · 1.6 KB
/
C2601.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { t } from "testcafe";
import createNetworkLogger from "../../helpers/networkLogger";
import { responseStatus } from "../../helpers/assertions/index";
import createFixture from "../../helpers/createFixture";
import placeContextConfig from "../../helpers/constants/placeContextConfig";
import createAlloyProxy from "../../helpers/createAlloyProxy";
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url";
const networkLogger = createNetworkLogger();
createFixture({
title:
"C2601 - Adds only placeContext context data when only device is specified in configuration.",
requestHooks: [networkLogger.edgeEndpointLogs]
});
test.meta({
ID: "C2601",
SEVERITY: "P0",
TEST_RUN: "Regression"
});
const sendEventOptions = {
xdm: {
web: {
webPageDetails: {
URL: TEST_PAGE_URL
}
}
}
};
test("C2601 - Adds only placeContext context data when only device is specified in configuration.", async () => {
const alloy = createAlloyProxy();
await alloy.configure(placeContextConfig);
await alloy.sendEvent(sendEventOptions);
await responseStatus(networkLogger.edgeEndpointLogs.requests, 200);
await t.expect(networkLogger.edgeEndpointLogs.requests.length).eql(1);
const request = networkLogger.edgeEndpointLogs.requests[0].request.body;
const stringifyRequest = JSON.parse(request);
await t.expect(stringifyRequest.events[0].xdm.placeContext).ok();
await t.expect(stringifyRequest.events[0].xdm.web.webPageDetails).ok();
await t.expect(stringifyRequest.events[0].xdm.environment).notOk();
await t.expect(stringifyRequest.events[0].xdm.device).notOk();
});