Skip to content

Commit 5a463c2

Browse files
committed
Fix flaky extendNames tests by adding leap year tolerance
1 parent 66194c7 commit 5a463c2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

e2e/specs/stateless/extendNames.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ test('should be able to extend multiple names (including names in grace preiod)
113113
await addresPage.search(label)
114114
await expect(addresPage.getNameRow(name)).toBeVisible({ timeout: 5000 })
115115
await expect(await addresPage.getTimestamp(name)).not.toBe(timestampDict[name])
116-
await expect(await addresPage.getTimestamp(name)).toBe(timestampDict[name] + 31536000000 * 3)
116+
// Allow up to 3 days tolerance for leap year differences across 3 years
117+
const ts = await addresPage.getTimestamp(name)
118+
expect(Math.abs(ts - timestampDict[name] - 31536000000 * 3)).toBeLessThanOrEqual(86400000 * 3)
117119
}
118120
})
119121

@@ -179,7 +181,8 @@ test('should be able to extend a single unwrapped name from profile', async ({
179181
await extendNamesModal.getExtendButton.click()
180182
await transactionModal.autoComplete()
181183
const newTimestamp = await profilePage.getExpiryTimestamp()
182-
expect(newTimestamp).toEqual(timestamp + 31536000000)
184+
// Allow 1 day tolerance for leap year differences
185+
expect(Math.abs(newTimestamp - timestamp - 31536000000)).toBeLessThanOrEqual(86400000)
183186
})
184187
})
185188

@@ -241,7 +244,8 @@ test('should be able to extend a single unwrapped name in grace period from prof
241244
await transactionModal.autoComplete()
242245

243246
const newTimestamp = await profilePage.getExpiryTimestamp()
244-
expect(newTimestamp).toEqual(timestamp + 31536000000)
247+
// Allow 1 day tolerance for leap year differences
248+
expect(Math.abs(newTimestamp - timestamp - 31536000000)).toBeLessThanOrEqual(86400000)
245249
})
246250
})
247251

@@ -304,7 +308,8 @@ test('should be able to extend a single unwrapped name in grace period from prof
304308
const transactionModal = makePageObject('TransactionModal')
305309
await transactionModal.autoComplete()
306310
const newTimestamp = await profilePage.getExpiryTimestamp()
307-
await expect(newTimestamp).toEqual(timestamp + 31536000000)
311+
// Allow 1 day tolerance for leap year differences
312+
expect(Math.abs(newTimestamp - timestamp - 31536000000)).toBeLessThanOrEqual(86400000)
308313
})
309314
})
310315

0 commit comments

Comments
 (0)