index.spec.tsx 2.0 KB

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