Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion static/gsApp/components/features/planFeature.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {OrganizationFixture} from 'sentry-fixture/organization';

import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
import {AM3_CHECKOUT_PLANS} from 'getsentry-test/fixtures/billingConfig';
import {PlanDetailsLookupFixture} from 'getsentry-test/fixtures/planDetailsLookup';
import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
import {PlanTier} from 'getsentry-test/planTier';
Expand Down Expand Up @@ -117,7 +118,9 @@ describe('PlanFeature', () => {

await waitFor(() => {
expect(mockFn).toHaveBeenCalledWith({
plan: PlanDetailsLookupFixture('am3_business'),
// The billing config offers reserved tiers starting at the plan
// default, so its plans differ from the full planDetails fixture.
plan: AM3_CHECKOUT_PLANS.find(plan => plan.id === 'am3_business'),
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/overrides/useScmFeatureMeta.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('useScmFeatureMeta', () => {
'10M spans / mo'
);
expect(result.current.meta[ProductSolution.SESSION_REPLAY].volume).toBe(
'50 replays / mo'
'5,000 replays / mo'
);
expect(result.current.meta[ProductSolution.LOGS].volume).toBe('5 GB logs / mo');
// PROFILING is intentionally absent from DYNAMIC_FORMATS, so the static
Expand Down
19 changes: 12 additions & 7 deletions static/gsApp/views/amCheckout/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,12 @@ describe('Default Tier Checkout', () => {
)
).toBeInTheDocument();

// 500 replays from sponsored plan becomes 50 on am3
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('50');
// The sponsored plan's 500 replays snap up to the 5,000 default, which is
// included at $0, so the volume sliders no longer auto-show
await userEvent.click(
await screen.findByRole('button', {name: 'Show reserved volume sliders'})
);
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('5K');
});

it('renders for self-serve partners', async () => {
Expand Down Expand Up @@ -485,7 +489,7 @@ describe('Default Tier Checkout', () => {
expect(screen.getByTestId('spans-volume-item')).toHaveTextContent('20M');

// other categories use defaults
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('50');
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('5K');

expect(screen.getByTestId('product-option-seer')).toBeChecked();
});
Expand Down Expand Up @@ -538,7 +542,7 @@ describe('Default Tier Checkout', () => {
expect(screen.getByTestId('spans-volume-item')).toHaveTextContent('20M');

// other categories use defaults
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('50');
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('5K');

expect(screen.getByTestId('product-option-seer')).not.toBeChecked();
});
Expand Down Expand Up @@ -605,8 +609,9 @@ describe('Default Tier Checkout', () => {
);
// Check that missing 'Errors' category defaults to 50,000 errors
expect(screen.getByTestId('errors-volume-item')).toHaveTextContent('50K');
// For 'Replays', should be set to 50 as per the subscription
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('50');
// The subscription's grandfathered 50 replays snap up to the 5,000
// default, the lowest tier checkout offers
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('5K');
// Check that missing 'Attachments' category defaults to 1 GB
expect(screen.getByTestId('attachments-volume-item')).toHaveTextContent('1 GB');
});
Expand Down Expand Up @@ -751,6 +756,6 @@ describe('Default Tier Checkout', () => {
expect(screen.getByTestId('errors-volume-item')).toHaveTextContent('50K');
expect(screen.getByTestId('attachments-volume-item')).toHaveTextContent('1 GB');
expect(screen.getByTestId('spans-volume-item')).toHaveTextContent('10M');
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('50');
expect(screen.getByTestId('replays-volume-item')).toHaveTextContent('5K');
});
});
32 changes: 22 additions & 10 deletions tests/js/getsentry-test/fixtures/am3Plans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ const AM3_CATEGORY_DISPLAY_NAMES = {
plural: 'continuous profile hours',
singular: 'continuous profile hour',
},
profileDurationUI: {plural: 'UI profile hours', singular: 'UI profile hour'},
profileDurationUI: {
plural: 'UI profile hours',
singular: 'UI profile hour',
},
uptime: {singular: 'uptime monitor', plural: 'uptime monitors'},
logBytes: {singular: 'log', plural: 'logs'},
seerAutofix: {singular: 'issue fix', plural: 'issue fixes'},
seerScanner: {singular: 'issue scan', plural: 'issue scans'},
seerUsers: {singular: 'active contributor', plural: 'active contributors'},
sizeAnalyses: {singular: 'size analysis build', plural: 'size analysis builds'},
sizeAnalyses: {
singular: 'size analysis build',
plural: 'size analysis builds',
},
installableBuilds: {
singular: 'build distribution install',
plural: 'build distribution installs',
Expand Down Expand Up @@ -578,14 +584,14 @@ export const AM3_PLANS = {
{
events: 5000,
unitPrice: 0.3,
price: 1500,
price: 0,
onDemandPrice: 0.375,
},
{
events: 10000,
unitPrice: 0.285,
price: 2900,
onDemandPrice: 0.3563,
onDemandPrice: 0.45,
},
{
events: 25000,
Expand Down Expand Up @@ -1087,14 +1093,14 @@ export const AM3_PLANS = {
{
events: 5000,
unitPrice: 0.3,
price: 16200,
price: 0,
onDemandPrice: 0.375,
},
{
events: 10000,
unitPrice: 0.285,
price: 31300,
onDemandPrice: 0.3563,
onDemandPrice: 0.45,
},
{
events: 25000,
Expand Down Expand Up @@ -1723,6 +1729,12 @@ export const AM3_PLANS = {
price: 0,
onDemandPrice: 0,
},
{
events: 5000,
unitPrice: 0,
price: 0,
onDemandPrice: 0,
},
],
attachments: [
{
Expand Down Expand Up @@ -2036,14 +2048,14 @@ export const AM3_PLANS = {
{
events: 5000,
unitPrice: 0.3,
price: 1500,
price: 0,
onDemandPrice: 0.375,
},
{
events: 10000,
unitPrice: 0.285,
price: 2900,
onDemandPrice: 0.3563,
onDemandPrice: 0.45,
},
{
events: 25000,
Expand Down Expand Up @@ -2547,14 +2559,14 @@ export const AM3_PLANS = {
{
events: 5000,
unitPrice: 0.3,
price: 16200,
price: 0,
onDemandPrice: 0.375,
},
{
events: 10000,
unitPrice: 0.285,
price: 31300,
onDemandPrice: 0.3563,
onDemandPrice: 0.45,
},
{
events: 25000,
Expand Down
26 changes: 21 additions & 5 deletions tests/js/getsentry-test/fixtures/billingConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@ import {MM1_PLANS} from 'getsentry-test/fixtures/mm1Plans';
import {MM2_PLANS} from 'getsentry-test/fixtures/mm2Plans';
import {PlanTier} from 'getsentry-test/planTier';

import type {BillingConfig} from 'getsentry/types';
import type {BillingConfig, Plan} from 'getsentry/types';

// Mirrors the backend's start_at_default checkout serialization: AM3 replays
// default to 5,000 and the 50 tier stays valid only for existing
// subscriptions, so billing-config payloads do not offer it. Other surfaces
// (e.g. subscription planDetails) keep the full tier list.
export const AM3_CHECKOUT_PLANS: Plan[] = Object.values(AM3_PLANS).map(plan => ({
...plan,
planCategories: {
...plan.planCategories,
...(plan.planCategories.replays
? {
replays: plan.planCategories.replays.filter(bucket => bucket.events >= 5_000),
}
: {}),
},
}));

export function BillingConfigFixture(tier: PlanTier): BillingConfig {
if (tier === PlanTier.TEST) {
Expand Down Expand Up @@ -47,13 +63,13 @@ export function BillingConfigFixture(tier: PlanTier): BillingConfig {
defaultReserved: {
errors: 50_000,
attachments: 1,
replays: 50,
replays: 5_000,
monitorSeats: 1,
spans: 10_000_000,
uptime: 1,
},
annualDiscount: 0.1,
planList: Object.values(AM3_PLANS),
planList: AM3_CHECKOUT_PLANS,
featureList: FeatureListFixture(),
};
}
Expand All @@ -66,7 +82,7 @@ export function BillingConfigFixture(tier: PlanTier): BillingConfig {
defaultReserved: {
errors: 50_000,
attachments: 1,
replays: 50,
replays: 5_000,
monitorSeats: 1,
spans: 10_000_000,
uptime: 1,
Expand All @@ -77,7 +93,7 @@ export function BillingConfigFixture(tier: PlanTier): BillingConfig {
...Object.values(MM2_PLANS),
...Object.values(AM1_PLANS),
...Object.values(AM2_PLANS),
...Object.values(AM3_PLANS),
...AM3_CHECKOUT_PLANS,
],
featureList: FeatureListFixture(),
};
Expand Down
Loading