spring.spec.tsx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
  2. import {screen} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import docs, {PackageManager, SpringVersion} from './spring';
  5. describe('GettingStartedWithSpring', function () {
  6. it('renders gradle docs correctly', async function () {
  7. renderWithOnboardingLayout(docs, {
  8. releaseRegistry: {
  9. 'sentry.java.android.gradle-plugin': {
  10. version: '1.99.9',
  11. },
  12. },
  13. });
  14. // Renders main headings
  15. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  16. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  17. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  18. // Renders SDK version from registry
  19. expect(
  20. await screen.findByText(
  21. textWithMarkupMatcher(/id "io\.sentry\.jvm\.gradle" version "1\.99\.9"/)
  22. )
  23. ).toBeInTheDocument();
  24. });
  25. it('renders maven docs correctly', async function () {
  26. renderWithOnboardingLayout(docs, {
  27. releaseRegistry: {
  28. 'sentry.java.maven-plugin': {
  29. version: '3.99.9',
  30. },
  31. },
  32. selectedOptions: {
  33. packageManager: PackageManager.MAVEN,
  34. },
  35. });
  36. // Renders main headings
  37. expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
  38. expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
  39. expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();
  40. // Renders Plugin version from registry
  41. expect(
  42. await screen.findByText(
  43. textWithMarkupMatcher(
  44. /<artifactId>sentry-maven-plugin<\/artifactId>\s*<version>3\.99\.9<\/version>/m
  45. )
  46. )
  47. ).toBeInTheDocument();
  48. });
  49. it('renders spring 5 doc correctly', async function () {
  50. renderWithOnboardingLayout(docs, {
  51. releaseRegistry: {
  52. 'sentry.java.android.gradle-plugin': {
  53. version: '1.99.9',
  54. },
  55. },
  56. selectedOptions: {
  57. springVersion: SpringVersion.V5,
  58. },
  59. });
  60. // Uses Sentry Spring import
  61. expect(
  62. await screen.findByText(
  63. textWithMarkupMatcher(/import io.sentry.spring.EnableSentry/)
  64. )
  65. ).toBeInTheDocument();
  66. });
  67. it('renders spring 6 doc correctly', async function () {
  68. renderWithOnboardingLayout(docs, {
  69. releaseRegistry: {
  70. 'sentry.java.android.gradle-plugin': {
  71. version: '1.99.9',
  72. },
  73. },
  74. selectedOptions: {
  75. springVersion: SpringVersion.V6,
  76. },
  77. });
  78. // Uses Sentry Spring import
  79. expect(
  80. await screen.findByText(
  81. textWithMarkupMatcher(/import io.sentry.spring.jakarta.EnableSentry/)
  82. )
  83. ).toBeInTheDocument();
  84. });
  85. });