Skip to content

test: Create unit tests for react components in packages/ui/components/form/select#10459

Merged
keithwillcode merged 7 commits intomainfrom
test-select
Aug 25, 2023
Merged

test: Create unit tests for react components in packages/ui/components/form/select#10459
keithwillcode merged 7 commits intomainfrom
test-select

Conversation

@gitstart-calcom
Copy link
Copy Markdown
Contributor

@gitstart-calcom gitstart-calcom commented Jul 28, 2023

Run

yarn test select

image

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api ❌ Failed (Inspect) Aug 25, 2023 0:15am
cal-demo ❌ Failed (Inspect) Aug 25, 2023 0:15am
dev ❌ Failed (Inspect) Aug 25, 2023 0:15am
ui ❌ Failed (Inspect) Aug 25, 2023 0:15am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Aug 25, 2023 0:15am
qa ⬜️ Ignored (Inspect) Visit Preview Aug 25, 2023 0:15am

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 28, 2023

Thank you for following the naming conventions! 🙏

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 28, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel bot commented Jul 28, 2023

Current Playwright Test Results Summary

✅ 122 Passing - ⚠️ 5 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 08/25/2023 12:18:06pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 4993e43

Started: 08/25/2023 12:07:57pm UTC

⚠️ Flakes

📄   apps/web/playwright/event-types.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Event Types tests user Different Locations Tests can add Attendee Phone Number location and book with it
Retry 2Retry 1Initial Attempt
0% (0) 0 / 27 runs
failed over last 7 days
7.41% (2) 2 / 27 runs
flaked over last 7 days

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Paid booking should be able to be cancelled
Retry 1Initial Attempt
0% (0) 0 / 178 runs
failed over last 7 days
5.06% (9) 9 / 178 runs
flaked over last 7 days

📄   apps/web/playwright/booking-pages.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
pro user can reschedule a booking
Retry 1Initial Attempt
0.38% (1) 1 / 261 run
failed over last 7 days
9.96% (26) 26 / 261 runs
flaked over last 7 days

📄   apps/web/playwright/webhook.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
FORM_SUBMITTED can submit a form and get a submission event
Retry 1Initial Attempt
1.15% (3) 3 / 261 runs
failed over last 7 days
22.99% (60) 60 / 261 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 1Initial Attempt
0.75% (2) 2 / 265 runs
failed over last 7 days
98.87% (262) 262 / 265 runs
flaked over last 7 days

View Detailed Build Results


@alwaysmeticulous
Copy link
Copy Markdown

alwaysmeticulous bot commented Jul 28, 2023

🤖 Meticulous spotted visual differences in 52 of 123 screens tested: view and approve differences detected.

Last updated for commit 5a30b44. This comment will update as new commits are pushed.

await selectOption("Option 2");
});

expect(onChangeMock).toHaveBeenCalled();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be best to test the callback args as well.


expect(screen.getByRole("form")).toHaveFormValues({ test: "option2" });
});
});
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara Jul 31, 2023

Choose a reason for hiding this comment

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

We don't seem to be testing the code that we have written in Select component.
In the component, we are just configuring the props for react-select, so that's what we should be testing more I think.

Screenshot 2023-07-31 at 12 45 44 PM
  • We need a test for verifying that any classes passed to Select are passed to ReactSelect
  • We might need to test certain classes as well. It isn't recommended to test implementation details so may be we keep a color map for tests and verify the background color of the DOM element is CAL_BG_SUBTLE when isDisabled prop is given.
  • Similarly we should probably test the result of passing all these props - isFocussed, isDisabled, isSelected. It might be overkill as well

});
});

describe("Tests for SelectWithValidation component", () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should atleast have one test that actually tests for validation failure.

Copy link
Copy Markdown
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Thanks @gitstart. Left some comments.

@keithwillcode keithwillcode added Low priority Created by Linear-GitHub Sync automated-tests area: unit tests, e2e tests, playwright labels Jul 31, 2023
@gitstart-calcom
Copy link
Copy Markdown
Contributor Author

Hello @hariombalhara
The changes have been made, and they are ready for review

keithwillcode
keithwillcode previously approved these changes Aug 25, 2023
@keithwillcode keithwillcode dismissed hariombalhara’s stale review August 25, 2023 11:50

Requested changes were implemented

@keithwillcode keithwillcode enabled auto-merge (squash) August 25, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-tests area: unit tests, e2e tests, playwright core area: core, team members only Low priority Created by Linear-GitHub Sync

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants