mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #35478 from overleaf/oa-paywall-ctas
[web] Paywall CTAs GitOrigin-RevId: 26703fe008926db67473a43ef64addca0e23accd
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react'
|
||||
import sinon from 'sinon'
|
||||
import { SplitTestProvider } from '@/shared/context/split-test-context'
|
||||
import { OwnerPaywallPrompt } from '@/features/history/components/change-list/owner-paywall-prompt'
|
||||
|
||||
function renderPrompt() {
|
||||
return render(
|
||||
<SplitTestProvider>
|
||||
<OwnerPaywallPrompt />
|
||||
</SplitTestProvider>
|
||||
)
|
||||
}
|
||||
|
||||
describe('<OwnerPaywallPrompt/>', function () {
|
||||
let openStub: sinon.SinonStub
|
||||
|
||||
beforeEach(function () {
|
||||
// StartFreeTrialButton opens the plans page in a new tab on click
|
||||
openStub = sinon.stub(window, 'open')
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
openStub.restore()
|
||||
window.metaAttributesCache.delete('ol-splitTestVariants')
|
||||
})
|
||||
|
||||
it('shows the "Start free trial" CTA and free-trial refresh message', function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {})
|
||||
renderPrompt()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Start free trial' }))
|
||||
screen.getByText('Please refresh this page after starting your free trial.')
|
||||
})
|
||||
|
||||
it('shows the "Subscribe now" CTA and subscribe refresh message when paywall-cta-trial-ineligible is enabled', function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {
|
||||
'paywall-cta-trial-ineligible': 'enabled',
|
||||
})
|
||||
renderPrompt()
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Subscribe now' }))
|
||||
screen.getByText('Please refresh this page after subscribing.')
|
||||
})
|
||||
})
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { SplitTestProvider } from '@/shared/context/split-test-context'
|
||||
import { CompileTimeWarningUpgradePromptInner } from '@/features/pdf-preview/components/compile-time-warning-upgrade-prompt-inner'
|
||||
|
||||
function renderPrompt() {
|
||||
return render(
|
||||
<SplitTestProvider>
|
||||
<CompileTimeWarningUpgradePromptInner
|
||||
handleDismissWarning={() => {}}
|
||||
segmentation={{}}
|
||||
/>
|
||||
</SplitTestProvider>
|
||||
)
|
||||
}
|
||||
|
||||
describe('<CompileTimeWarningUpgradePromptInner/>', function () {
|
||||
afterEach(function () {
|
||||
window.metaAttributesCache.delete('ol-splitTestVariants')
|
||||
})
|
||||
|
||||
it('shows the "Start free trial" CTA by default', function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {})
|
||||
renderPrompt()
|
||||
screen.getByRole('button', { name: 'Start free trial' })
|
||||
})
|
||||
|
||||
it('shows the "Subscribe now" CTA when paywall-cta-trial-ineligible is enabled', function () {
|
||||
window.metaAttributesCache.set('ol-splitTestVariants', {
|
||||
'paywall-cta-trial-ineligible': 'enabled',
|
||||
})
|
||||
renderPrompt()
|
||||
screen.getByRole('button', { name: 'Subscribe now' })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user