-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DCXY-20504: Don't pre-render dropzone when l2 limit is hit and upsell is shown #489
Merged
Merged
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
80ce70d
DCXY-19397: don't prerender dropzone when l2 limit is hit and upsell …
kbenelli-adobe cc9a138
DCXY-19397: match org cookie
kbenelli-adobe 7955712
destructure cookies from doc
kbenelli-adobe 688369c
DCXY-19397-New: Update per comments. Don't need verbinclude l2 list a…
kbenelli-adobe 5ff289a
DCXY-19397-New: include create pdf
kbenelli-adobe ee4dc94
faster string check
kbenelli-adobe 379b69e
DCXY-19397-New: pdf convert is create pdf group
kbenelli-adobe 51627c5
DCXY-19397-New: unit test coverage for skip prerender cases
kbenelli-adobe 3d7517b
DCXY-19397-New: fixed eslint error
kbenelli-adobe 8eeabad
DCXY-19397-New: don't need to work with this eslint fix
kbenelli-adobe 7e8974e
DCXY-19397-New: don't need to work with this eslint fix
kbenelli-adobe 841c61c
DCXY-19397-New: remove duplicate window location
kbenelli-adobe 65541fc
DCXY-19397-New: Updated cookie names to avoid chrome viewer extension…
kbenelli-adobe 24f5a30
DCXY-19397-New: Supports cname convention for 1 pass cookie search.
kbenelli-adobe f2a4761
DCXY-19397-New: Updated tests to match cnames
kbenelli-adobe 33ffe16
DCXY-19397-New: simplify look up to to-pdf, pdf-to, or verb name
kbenelli-adobe 6aae123
DCXY-19397-New: check and map env prefix respectively
kbenelli-adobe cb96217
edge worker inlined snippet, remove the snipped from dom if exhausted
kbenelli-adobe c9893e7
Merge branch 'stage' into DCXY-19397-New
kbenelli-adobe 1ee08cd
don't allow for undefined cookie name
kbenelli-adobe 36fbd72
Merge branch 'stage' into DCXY-19397-New
seanchoi-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
76 changes: 76 additions & 0 deletions
76
test/blocks/dc-converter-widget/dc-converter-widget-skip-prerender-200.jest.js
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,76 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable compat/compat */ | ||
|
||
import path from 'path'; | ||
import fs from 'fs'; | ||
import init from '../../../acrobat/blocks/dc-converter-widget/dc-converter-widget.js'; | ||
|
||
const skippedPreRenderCases = [ | ||
{ | ||
mockFilePath: './mocks/body-variants/body-compress-pdf.html', | ||
url: 'https://www.adobe.com/acrobat/online/compress-pdf.html', | ||
cookieValue: 'p_ac_cm_p_ops=true', | ||
}, | ||
{ | ||
mockFilePath: './mocks/body-variants/body-convert-pdf.html', | ||
url: 'https://www.adobe.com/acrobat/online/convert-pdf.html', | ||
cookieValue: 'p_ac_cr_p_c=true', | ||
}, | ||
{ | ||
mockFilePath: './mocks/body-variants/body-word-to-pdf.html', | ||
url: 'https://www.adobe.com/acrobat/online/word-to-pdf.html', | ||
cookieValue: 'p_ac_cr_p_c=true', | ||
}, | ||
{ | ||
mockFilePath: './mocks/body-variants/body-pdf-to-word.html', | ||
url: 'https://www.adobe.com/acrobat/online/pdf-to-word.html', | ||
cookieValue: 'p_ac_ex_p_c=true', | ||
}, | ||
{ | ||
mockFilePath: './mocks/body-variants/body-pdf-to-word.html', | ||
url: 'https://www.adobe.com/acrobat/online/pdf-to-word.html', | ||
cookieValue: 'p_ac_ex_p_c_st=true', | ||
}, | ||
]; | ||
|
||
describe('DC Converter Widget Skip Prerender Verbs', () => { | ||
window.fetch = jest.fn(() => Promise.resolve({ | ||
status: 200, | ||
text: () => Promise.resolve( | ||
fs.readFileSync(path.resolve(__dirname, './mocks/widget.html')), | ||
), | ||
})); | ||
window.browser = { isMobile: true }; | ||
window.performance.mark = jest.fn(); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
document.cookie = ''; | ||
}); | ||
|
||
it.each(skippedPreRenderCases)( | ||
'render widget when pre-render is skipped from limit exhausted cookie condition', | ||
async ({ url, mockFilePath, cookieValue }) => { | ||
document.cookie = cookieValue; | ||
document.body.innerHTML = fs.readFileSync( | ||
path.resolve(__dirname, mockFilePath), | ||
'utf8', | ||
); | ||
|
||
delete window.location; | ||
window.location = new URL(url); | ||
|
||
const block = document.querySelector('.dc-converter-widget'); | ||
await init(block); | ||
jest.runAllTimers(); | ||
}, | ||
); | ||
|
||
afterAll(() => { | ||
jest.clearAllMocks(); | ||
document.cookie = ''; | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/blocks/dc-converter-widget/mocks/body-variants/body-compress-pdf.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,10 @@ | ||
<main> | ||
<div class="dc-converter-widget"> | ||
<div> | ||
<div>compress-pdf</div> | ||
</div> | ||
<div> | ||
<div>https://www.adobe.com/go/testredirect</div> | ||
</div> | ||
</div> | ||
</main> |
10 changes: 10 additions & 0 deletions
10
test/blocks/dc-converter-widget/mocks/body-variants/body-convert-pdf.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,10 @@ | ||
<main> | ||
<div class="dc-converter-widget"> | ||
<div> | ||
<div>createpdf</div> | ||
</div> | ||
<div> | ||
<div>https://www.adobe.com/go/testredirect</div> | ||
</div> | ||
</div> | ||
</main> |
10 changes: 10 additions & 0 deletions
10
test/blocks/dc-converter-widget/mocks/body-variants/body-pdf-to-word.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,10 @@ | ||
<main> | ||
<div class="dc-converter-widget"> | ||
<div> | ||
<div>pdf-to-word</div> | ||
</div> | ||
<div> | ||
<div>https://www.adobe.com/go/testredirect</div> | ||
</div> | ||
</div> | ||
</main> |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
test/blocks/dc-converter-widget/mocks/body-variants/body-word-to-pdf.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,10 @@ | ||
<main> | ||
<div class="dc-converter-widget"> | ||
<div> | ||
<div>word-to-pdf</div> | ||
</div> | ||
<div> | ||
<div>https://www.adobe.com/go/testredirect</div> | ||
</div> | ||
</div> | ||
</main> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hate to add more logic but we should use p_ s_ and d_ for prod, stage and dev, respectively. Perhaps remove the p_ from this map and prepend the right prefix to
limitCookie
at L220There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, makes sense. Updated