Skip to content

test: optimize tests by adding shared utility functions #1063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

YaelChen
Copy link
Collaborator

Description

I added the previous tests (verify an API call for gtfs_agencies, verify the dateFrom parameter is a recent date) as functions under utils, so there won't be unnecessary code duplication.

@YaelChen YaelChen requested a review from NoamGaash as a code owner March 19, 2025 14:11
Copy link
Contributor

github-actions bot commented Mar 19, 2025

Copy link
Member

@NoamGaash NoamGaash left a comment

Choose a reason for hiding this comment

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

some ideas -

  1. You can use expect.extend to create custom assertions like expect(page).toGetRequest('gtfs_agencies/list')
  2. I think it could be preferable to separate navigation commands (goto, click and so on) from the assertion commands - maybe it can be something like:
const callAssertion = expect(page).toCall('gtfs_agencies/list')
await page.goto('/')
await page.getByRole('link', { name: 'נסיעות שלא בוצעו', exact: true }).click()
await page.getByLabel('חברה מפעילה').click()
await callAssertion

what do you think?

@YaelChen YaelChen enabled auto-merge (squash) April 7, 2025 08:40
@YaelChen YaelChen disabled auto-merge April 7, 2025 08:40
Copy link
Member

@NoamGaash NoamGaash left a comment

Choose a reason for hiding this comment

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

It looks great! Thanks, and apologies for taking the time with the review 🙏

@YaelChen YaelChen closed this May 11, 2025
@YaelChen YaelChen reopened this May 11, 2025
@YaelChen YaelChen enabled auto-merge (squash) May 11, 2025 16:17
@YaelChen YaelChen disabled auto-merge May 18, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants