index.spec.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import {DataScrubbingRelayPiiConfigFixture} from 'sentry-fixture/dataScrubbingRelayPiiConfig';
  2. import {EventFixture} from 'sentry-fixture/event';
  3. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  4. import {textWithMarkupMatcher} from 'sentry-test/utils';
  5. import {GPUEventContext} from 'sentry/components/events/contexts/gpu';
  6. import type {GPUData} from 'sentry/components/events/contexts/gpu/types';
  7. export const gpuMockData: GPUData = {
  8. name: '',
  9. id: 0,
  10. vendor_id: 0,
  11. vendor_name: 'Apple',
  12. memory_size: 4096,
  13. api_type: '',
  14. multi_threaded_rendering: true,
  15. version: 'Metal',
  16. npot_support: 'Full',
  17. };
  18. export const gpuMetaMockData = {
  19. api_type: {
  20. '': {
  21. rem: [['organization:0', 's', 0, 0]],
  22. len: 5,
  23. },
  24. },
  25. name: {
  26. '': {
  27. rem: [['organization:0', 's', 0, 0]],
  28. len: 18,
  29. },
  30. },
  31. };
  32. const event = EventFixture({
  33. _meta: {
  34. contexts: {
  35. gpu: gpuMetaMockData,
  36. },
  37. },
  38. });
  39. // Flaky test https://github.com/getsentry/sentry/actions/runs/4465585304/jobs/7842795315?pr=45984
  40. // eslint-disable-next-line
  41. describe.skip('gpu event context', function () {
  42. it('display redacted data', async function () {
  43. render(<GPUEventContext event={event} data={gpuMockData} />, {
  44. organization: {
  45. relayPiiConfig: JSON.stringify(DataScrubbingRelayPiiConfigFixture()),
  46. },
  47. });
  48. expect(screen.getByText('API Type')).toBeInTheDocument(); // subject
  49. await userEvent.hover(screen.getAllByText(/redacted/)[0]);
  50. expect(
  51. await screen.findByText(
  52. textWithMarkupMatcher(
  53. "Replaced because of the data scrubbing rule [Replace] [Password fields] with [Scrubbed] from [password] in your organization's settings"
  54. )
  55. )
  56. ).toBeInTheDocument(); // tooltip description
  57. expect(screen.getByText('Name')).toBeInTheDocument(); // subject
  58. await userEvent.hover(screen.getAllByText(/redacted/)[1]);
  59. expect(
  60. await screen.findByText(
  61. textWithMarkupMatcher(
  62. "Replaced because of the data scrubbing rule [Replace] [Password fields] with [Scrubbed] from [password] in your organization's settings"
  63. )
  64. )
  65. ).toBeInTheDocument(); // tooltip description
  66. });
  67. });