|
| 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 | +}); |
0 commit comments