-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functional test for viewName in click notification. Fix logic to …
…include viewName.
- Loading branch information
Showing
3 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
Copyright 2023 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { t } from "testcafe"; | ||
import createNetworkLogger from "../../helpers/networkLogger"; | ||
import { responseStatus } from "../../helpers/assertions/index"; | ||
import createFixture from "../../helpers/createFixture"; | ||
import { | ||
compose, | ||
orgMainConfigMain, | ||
debugEnabled | ||
} from "../../helpers/constants/configParts"; | ||
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; | ||
import createAlloyProxy from "../../helpers/createAlloyProxy"; | ||
import addHtmlToBody from "../../helpers/dom/addHtmlToBody"; | ||
|
||
const networkLogger = createNetworkLogger(); | ||
const config = compose(orgMainConfigMain, debugEnabled); | ||
|
||
createFixture({ | ||
title: "C14286730: Target SPA click interaction includes viewName", | ||
requestHooks: [networkLogger.edgeEndpointLogs], | ||
url: `${TEST_PAGE_URL}?test=C14286730` | ||
}); | ||
|
||
test.meta({ | ||
ID: "C28755", | ||
SEVERITY: "P0", | ||
TEST_RUN: "Regression" | ||
}); | ||
|
||
test("Test C14286730: Target SPA click interaction includes viewName", async () => { | ||
const alloy = createAlloyProxy(); | ||
await alloy.configure(config); | ||
|
||
await addHtmlToBody( | ||
`<div id="personalization-products-container">Products</div>` | ||
); | ||
await alloy.sendEvent({ | ||
renderDecisions: true, | ||
xdm: { | ||
web: { | ||
webPageDetails: { | ||
viewName: "products" | ||
} | ||
} | ||
} | ||
}); | ||
|
||
await responseStatus(networkLogger.edgeEndpointLogs.requests, 200); | ||
|
||
await t.expect(networkLogger.edgeEndpointLogs.count(() => true)).eql(2); | ||
|
||
await t.click(".clickme"); | ||
|
||
await t.expect(networkLogger.edgeEndpointLogs.count(() => true)).eql(3); | ||
|
||
const displayNotification = JSON.parse( | ||
networkLogger.edgeEndpointLogs.requests[1].request.body | ||
); | ||
const interactNotification = JSON.parse( | ||
networkLogger.edgeEndpointLogs.requests[2].request.body | ||
); | ||
|
||
await t | ||
.expect(displayNotification.events[0].xdm.web.webPageDetails.viewName) | ||
.eql("products"); | ||
await t | ||
.expect(interactNotification.events[0].xdm.web.webPageDetails.viewName) | ||
.eql("products"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters