Browse Source

test(vitals): Make vital details tests faster (#34195)

Dameli Ushbayeva 2 years ago
parent
commit
ddd39a4234
1 changed files with 10 additions and 13 deletions
  1. 10 13
      tests/js/spec/views/performance/vitalDetail/index.spec.tsx

+ 10 - 13
tests/js/spec/views/performance/vitalDetail/index.spec.tsx

@@ -291,7 +291,6 @@ describe('Performance > VitalDetail', function () {
       await screen.findByLabelText('Search events'),
       'user.email:uhoh*{enter}'
     );
-
     // Check the navigation.
     expect(browserHistory.push).toHaveBeenCalledTimes(1);
     expect(browserHistory.push).toHaveBeenCalledWith({
@@ -304,7 +303,7 @@ describe('Performance > VitalDetail', function () {
     });
   });
 
-  it('Applies conditions when linking to transaction summary', async function () {
+  it('applies conditions when linking to transaction summary', async function () {
     const newRouter = {
       ...router,
       location: {
@@ -356,7 +355,7 @@ describe('Performance > VitalDetail', function () {
     });
   });
 
-  it('Check CLS', async function () {
+  it('check CLS', async function () {
     const newRouter = {
       ...router,
       location: {
@@ -410,9 +409,7 @@ describe('Performance > VitalDetail', function () {
     expect(screen.getByText('0.215').closest('td')).toBeInTheDocument();
   });
 
-  // Disabling for CI, but should run locally when making changes
-  // eslint-disable-next-line jest/no-disabled-tests
-  it.skip('can switch vitals with dropdown menu', async function () {
+  it('can switch vitals with dropdown menu', function () {
     const newRouter = {
       ...router,
       location: {
@@ -438,13 +435,13 @@ describe('Performance > VitalDetail', function () {
       organization: org,
     });
 
-    expect(
-      await screen.findByRole('button', {name: 'Web Vitals: LCP'})
-    ).toBeInTheDocument();
-    userEvent.click(screen.getByRole('button', {name: 'Web Vitals: LCP'}));
+    const button = screen.getByRole('button', {name: /web vitals: lcp/i});
+    expect(button).toBeInTheDocument();
+    userEvent.click(button);
 
-    expect(await screen.findByRole('menuitemradio', {name: 'FCP'})).toBeInTheDocument();
-    userEvent.click(screen.getByRole('menuitemradio', {name: 'FCP'}));
+    const menuItem = screen.getByRole('menuitemradio', {name: /fcp/i});
+    expect(menuItem).toBeInTheDocument();
+    userEvent.click(menuItem);
 
     expect(browserHistory.push).toHaveBeenCalledTimes(1);
     expect(browserHistory.push).toHaveBeenCalledWith({
@@ -457,7 +454,7 @@ describe('Performance > VitalDetail', function () {
     });
   });
 
-  it('Check LCP vital renders correctly', async function () {
+  it('renders LCP vital correctly', async function () {
     render(<TestComponent />, {
       context: routerContext,
       organization: org,