Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/__tests__/e2e/pages/Contribute.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ test.describe('Contribute Page', () => {

test('renders issue data correctly', async ({ page }) => {
await expect(page.getByRole('link', { name: 'Contribution 1' })).toBeVisible()
await expect(page.getByText('3 months ago')).toBeVisible()
await expect(

@arkid15r arkid15r Mar 11, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should cover all different cases: day, week, month, year -- singular and plural.
Maybe instead mock the data to always have the issue last updated date as 3 month ago?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I'll do it for day week month year👍, well as far as I have seen the data it always comes in such manner 1 day ago 15 days ago 1 month ago maybe mocking the data is the play. That's a good suggestion in respective of days if days go over the 7 (day>7 will convert it to week ). I suppose that's fine @arkid15r

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have 2 implementations that solve a problem always prefer the most simple one. I recommend going with the test data adjustment if that works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah well that changing tests sounds ok to me, plus it's a small job, happy me😂

page.locator('text=/\\d+ months? ago|a month ago|a day ago|\\d+ days? ago/')
).toBeVisible()
await expect(page.getByRole('link', { name: 'Owasp Nest' })).toBeVisible()
await expect(page.getByText('This is a summary of Contribution 1')).toBeVisible()
await expect(page.getByRole('button', { name: 'Read More' })).toBeVisible()
Expand Down