-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for page level redirects (#45)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> **To test:** 1. RUM is fired before redirect 2. Page is successfully redirected in all three cases (experiments, campaigns, audiences) **Finding:** 1. Tried different ways to override the `window.location.replace () ` to let it do nothing when testing RUM is fired before redirect. However, some browsers have strict security restriction that don't allow certain function to be overridden, which leads to test fails. 2. Modify the script before its execution. The line with `window.location.replace () ` is commented out before the script is executed and security policies are applied. ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] I have signed the [Adobe Open Source CLA](https://opensource.adobe.com/cla.html). - [x] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. - [x] I have added tests to cover my changes. - [x] All new and existing tests passed. --------- Co-authored-by: Julien Ramboz <[email protected]>
- Loading branch information
Showing
9 changed files
with
124 additions
and
3 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
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
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,20 @@ | ||
<html> | ||
<head> | ||
<meta name="audience-foo" content="/tests/fixtures/audiences/variant-1"/> | ||
<meta name="audience-bar" content="/tests/fixtures/audiences/variant-2"/> | ||
<meta name="audience-resolution" content="redirect"/> | ||
<meta property="audience:-foo" content="/tests/fixtures/audiences/variant-1"/> | ||
<script> | ||
window.AUDIENCES = { | ||
foo: () => true, | ||
bar: () => true, | ||
} | ||
</script> | ||
<script type="module" src="/tests/fixtures/scripts.js"></script> | ||
</head> | ||
<body> | ||
<main> | ||
<div>Hello World!</div> | ||
</main> | ||
</body> | ||
</html> |
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,19 @@ | ||
<html> | ||
<head> | ||
<meta name="campaign-foo" content="/tests/fixtures/campaigns/variant-1"/> | ||
<meta name="campaign-bar" content="/tests/fixtures/campaigns/variant-2"/> | ||
<meta name="campaign-resolution" content="redirect"/> | ||
<script type="module" src="/tests/fixtures/scripts.js"></script> | ||
<script> | ||
window.AUDIENCES = { | ||
foo: () => true, | ||
bar: () => true, | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<main> | ||
<div>Hello World!</div> | ||
</main> | ||
</body> | ||
</html> |
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,12 @@ | ||
<html> | ||
<head> | ||
<meta name="experiment" content="foo"/> | ||
<meta name="experiment-variants" content="/tests/fixtures/experiments/page-level-v1,/tests/fixtures/experiments/page-level-v2"/> | ||
<meta name="experiment-name" content="V1,V2"/> | ||
<meta name="experiment-resolution" content="redirect"/> | ||
<script type="module" src="/tests/fixtures/scripts.js"></script> | ||
</head> | ||
<body> | ||
<main>Hello World!</main> | ||
</body> | ||
</html> |
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