Skip to content

Commit 93acd4d

Browse files
committed
add tests for solidstart + tanstack
1 parent 5a45742 commit 93acd4d

File tree

2 files changed

+244
-0
lines changed

2 files changed

+244
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
2+
import {screen} from 'sentry-test/reactTestingLibrary';
3+
import {textWithMarkupMatcher} from 'sentry-test/utils';
4+
5+
import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types';
6+
7+
import docs from '.';
8+
9+
describe('javascript-solidstart onboarding docs', () => {
10+
it('renders onboarding docs correctly', () => {
11+
renderWithOnboardingLayout(docs);
12+
13+
expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
14+
expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
15+
expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
16+
17+
expect(
18+
screen.getByText(
19+
textWithMarkupMatcher(/import \* as Sentry from "@sentry\/solidstart"/)
20+
)
21+
).toBeInTheDocument();
22+
23+
expect(
24+
screen.getAllByText(textWithMarkupMatcher(/src\/entry-client\.tsx/))
25+
).toHaveLength(2);
26+
expect(
27+
screen.getByText(textWithMarkupMatcher(/public\/instrument\.server\.mjs/))
28+
).toBeInTheDocument();
29+
});
30+
31+
it('displays sample rates when performance and replay are selected', () => {
32+
renderWithOnboardingLayout(docs, {
33+
selectedProducts: [
34+
ProductSolution.ERROR_MONITORING,
35+
ProductSolution.PERFORMANCE_MONITORING,
36+
ProductSolution.SESSION_REPLAY,
37+
],
38+
});
39+
40+
expect(
41+
screen.getAllByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
42+
).toHaveLength(2);
43+
expect(
44+
screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0\.1/))
45+
).toBeInTheDocument();
46+
expect(
47+
screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 1\.0/))
48+
).toBeInTheDocument();
49+
});
50+
51+
it('includes browserTracingIntegration when performance is selected', () => {
52+
renderWithOnboardingLayout(docs, {
53+
selectedProducts: [
54+
ProductSolution.ERROR_MONITORING,
55+
ProductSolution.PERFORMANCE_MONITORING,
56+
],
57+
});
58+
59+
expect(
60+
screen.getByText(textWithMarkupMatcher(/Sentry\.browserTracingIntegration/))
61+
).toBeInTheDocument();
62+
});
63+
64+
it('includes replayIntegration when replay is selected', () => {
65+
renderWithOnboardingLayout(docs, {
66+
selectedProducts: [
67+
ProductSolution.ERROR_MONITORING,
68+
ProductSolution.SESSION_REPLAY,
69+
],
70+
});
71+
72+
expect(
73+
screen.getByText(textWithMarkupMatcher(/Sentry\.replayIntegration/))
74+
).toBeInTheDocument();
75+
});
76+
77+
it('excludes performance integration when performance is not selected', () => {
78+
renderWithOnboardingLayout(docs, {
79+
selectedProducts: [
80+
ProductSolution.ERROR_MONITORING,
81+
ProductSolution.SESSION_REPLAY,
82+
],
83+
});
84+
85+
expect(
86+
screen.queryByText(textWithMarkupMatcher(/Sentry\.browserTracingIntegration/))
87+
).not.toBeInTheDocument();
88+
expect(
89+
screen.queryByText(textWithMarkupMatcher(/tracesSampleRate/))
90+
).not.toBeInTheDocument();
91+
});
92+
93+
it('excludes replay integration when replay is not selected', () => {
94+
renderWithOnboardingLayout(docs, {
95+
selectedProducts: [
96+
ProductSolution.ERROR_MONITORING,
97+
ProductSolution.PERFORMANCE_MONITORING,
98+
],
99+
});
100+
101+
expect(
102+
screen.queryByText(textWithMarkupMatcher(/Sentry\.replayIntegration/))
103+
).not.toBeInTheDocument();
104+
expect(
105+
screen.queryByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
106+
).not.toBeInTheDocument();
107+
expect(
108+
screen.queryByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
109+
).not.toBeInTheDocument();
110+
});
111+
112+
it('enables logs by setting enableLogs to true', () => {
113+
renderWithOnboardingLayout(docs, {
114+
selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.LOGS],
115+
});
116+
117+
expect(screen.getAllByText(textWithMarkupMatcher(/enableLogs: true/))).toHaveLength(
118+
2
119+
);
120+
});
121+
122+
it('shows Logging Integrations in next steps when logs is selected', () => {
123+
renderWithOnboardingLayout(docs, {
124+
selectedProducts: [
125+
ProductSolution.ERROR_MONITORING,
126+
ProductSolution.PERFORMANCE_MONITORING,
127+
ProductSolution.LOGS,
128+
],
129+
});
130+
131+
expect(screen.getByText('Logging Integrations')).toBeInTheDocument();
132+
});
133+
134+
it('does not show Logging Integrations in next steps when logs is not selected', () => {
135+
renderWithOnboardingLayout(docs, {
136+
selectedProducts: [
137+
ProductSolution.ERROR_MONITORING,
138+
ProductSolution.PERFORMANCE_MONITORING,
139+
],
140+
});
141+
142+
expect(screen.queryByText('Logging Integrations')).not.toBeInTheDocument();
143+
});
144+
145+
it('displays verify instructions', () => {
146+
renderWithOnboardingLayout(docs);
147+
148+
expect(screen.getByText(textWithMarkupMatcher(/Throw error/))).toBeInTheDocument();
149+
});
150+
151+
it('has metrics onboarding configuration', () => {
152+
expect(docs.metricsOnboarding).toBeDefined();
153+
expect(docs.metricsOnboarding?.install).toBeDefined();
154+
expect(docs.metricsOnboarding?.configure).toBeDefined();
155+
expect(docs.metricsOnboarding?.verify).toBeDefined();
156+
});
157+
});
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
2+
import {screen} from 'sentry-test/reactTestingLibrary';
3+
import {textWithMarkupMatcher} from 'sentry-test/utils';
4+
5+
import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types';
6+
7+
import docs from '.';
8+
9+
describe('javascript-tanstackstart-react onboarding docs', () => {
10+
it('renders onboarding docs correctly', () => {
11+
renderWithOnboardingLayout(docs);
12+
13+
expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
14+
expect(screen.getByRole('heading', {name: 'Set up the SDK'})).toBeInTheDocument();
15+
expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
16+
17+
expect(
18+
screen.getByText(
19+
textWithMarkupMatcher(/import \* as Sentry from "@sentry\/tanstackstart-react"/)
20+
)
21+
).toBeInTheDocument();
22+
});
23+
24+
it('displays sample rates when performance and replay are selected', () => {
25+
renderWithOnboardingLayout(docs, {
26+
selectedProducts: [
27+
ProductSolution.ERROR_MONITORING,
28+
ProductSolution.PERFORMANCE_MONITORING,
29+
ProductSolution.SESSION_REPLAY,
30+
],
31+
});
32+
33+
expect(
34+
screen.getByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
35+
).toBeInTheDocument();
36+
expect(
37+
screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0\.1/))
38+
).toBeInTheDocument();
39+
expect(
40+
screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 1\.0/))
41+
).toBeInTheDocument();
42+
});
43+
44+
it('includes tanstackRouterBrowserTracingIntegration when performance is selected', () => {
45+
renderWithOnboardingLayout(docs, {
46+
selectedProducts: [
47+
ProductSolution.ERROR_MONITORING,
48+
ProductSolution.PERFORMANCE_MONITORING,
49+
],
50+
});
51+
52+
expect(
53+
screen.getByText(
54+
textWithMarkupMatcher(/Sentry\.tanstackRouterBrowserTracingIntegration/)
55+
)
56+
).toBeInTheDocument();
57+
});
58+
59+
it('includes replayIntegration when replay is selected', () => {
60+
renderWithOnboardingLayout(docs, {
61+
selectedProducts: [
62+
ProductSolution.ERROR_MONITORING,
63+
ProductSolution.SESSION_REPLAY,
64+
],
65+
});
66+
67+
expect(
68+
screen.getByText(textWithMarkupMatcher(/Sentry\.replayIntegration/))
69+
).toBeInTheDocument();
70+
});
71+
72+
it('displays verify instructions', () => {
73+
renderWithOnboardingLayout(docs);
74+
75+
expect(screen.getByText(textWithMarkupMatcher(/Throw error/))).toBeInTheDocument();
76+
expect(
77+
screen.getByText(textWithMarkupMatcher(/Break the world/))
78+
).toBeInTheDocument();
79+
});
80+
81+
it('has metrics onboarding configuration', () => {
82+
expect(docs.metricsOnboarding).toBeDefined();
83+
expect(docs.metricsOnboarding?.install).toBeDefined();
84+
expect(docs.metricsOnboarding?.configure).toBeDefined();
85+
expect(docs.metricsOnboarding?.verify).toBeDefined();
86+
});
87+
});

0 commit comments

Comments
 (0)