Browse Source

test(ui): Fix flaky group "last seen" in snapshots (#27461)

Scott Cooper 3 years ago
parent
commit
01de460af9
1 changed files with 26 additions and 17 deletions
  1. 26 17
      static/app/components/group/inboxBadges/timesTag.tsx

+ 26 - 17
static/app/components/group/inboxBadges/timesTag.tsx

@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
 import TimeSince from 'app/components/timeSince';
 import {IconClock} from 'app/icons';
 import {t} from 'app/locale';
+import getDynamicText from 'app/utils/getDynamicText';
 
 /**
  * Used in new inbox
@@ -19,26 +20,34 @@ const TimesTag = ({lastSeen, firstSeen}: Props) => {
   return (
     <Wrapper>
       <StyledIconClock size="xs" color="gray300" />
-      {lastSeen && (
-        <TimeSince
-          tooltipTitle={t('Last Seen')}
-          date={lastSeen}
-          suffix={t('ago')}
-          shorten
-        />
-      )}
+      {lastSeen &&
+        getDynamicText({
+          value: (
+            <TimeSince
+              tooltipTitle={t('Last Seen')}
+              date={lastSeen}
+              suffix={t('ago')}
+              shorten
+            />
+          ),
+          fixed: '10s ago',
+        })}
       {firstSeen && lastSeen && (
         <Separator className="hidden-xs hidden-sm">&nbsp;|&nbsp;</Separator>
       )}
-      {firstSeen && (
-        <TimeSince
-          tooltipTitle={t('First Seen')}
-          date={firstSeen}
-          suffix={t('old')}
-          className="hidden-xs hidden-sm"
-          shorten
-        />
-      )}
+      {firstSeen &&
+        getDynamicText({
+          value: (
+            <TimeSince
+              tooltipTitle={t('First Seen')}
+              date={firstSeen}
+              suffix={t('old')}
+              className="hidden-xs hidden-sm"
+              shorten
+            />
+          ),
+          fixed: '10s old',
+        })}
     </Wrapper>
   );
 };