-
Notifications
You must be signed in to change notification settings - Fork 43
/
C2600.js
49 lines (40 loc) · 1.62 KB
/
C2600.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 environmentContextConfig from "../../helpers/constants/environmentContextConfig";
import createAlloyProxy from "../../helpers/createAlloyProxy";
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url";
const networkLogger = createNetworkLogger();
createFixture({
title:
"C2600 - Adds only environment context data when only device is specified in configuration.",
requestHooks: [networkLogger.edgeEndpointLogs]
});
test.meta({
ID: "C2600",
SEVERITY: "P0",
TEST_RUN: "Regression"
});
const sendEventOptions = {
xdm: {
web: {
webPageDetails: {
URL: TEST_PAGE_URL
}
}
}
};
test("C2600 - Adds only environment context data when only device is specified in configuration.", async () => {
const alloy = createAlloyProxy();
await alloy.configure(environmentContextConfig);
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.environment).ok();
await t.expect(stringifyRequest.events[0].xdm.web.webPageDetails).ok();
await t.expect(stringifyRequest.events[0].xdm.device).notOk();
await t.expect(stringifyRequest.events[0].xdm.placeContext).notOk();
});