Skip to content
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

fix: team and org invite e2e tests #12566

Merged
merged 3 commits into from
Nov 28, 2023
Merged

Conversation

zomars
Copy link
Member

@zomars zomars commented Nov 28, 2023

What does this PR do?

  • Fixes e2e tests for organizations and team invites
  • Removes the need for the clipboard fixture (introduced in test: Add more orgs tests #12241 ) as it resulted to be very flaky on CI
  • Removes clipboard fixture altogether to prevent future flaky tests due to it's usage

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)

How should this be tested?

Run tests for:

  • apps/web/playwright/team/team-invitation.e2e.ts
  • apps/web/playwright/organization/organization-invitation.e2e.ts

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Copy link

vercel bot commented Nov 28, 2023

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

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2023 6:22am
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2023 6:22am
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2023 6:22am
cal ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2023 6:22am
cal-demo ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2023 6:22am
qa ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2023 6:22am
ui ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2023 6:22am

@zomars
Copy link
Member Author

zomars commented Nov 28, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

github-actions bot commented Nov 28, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes!

Copy link
Member Author

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Self review done

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed as it is very flaky by nature. Also relying in hacks like setTimeOut which makes it inconsistent across different machine speeds.

Comment on lines 206 to 211
export async function getInviteLink(page: Page) {
const response = await page.waitForResponse("**/api/trpc/teams/createInvite?batch=1");
const json = await response.json();
// @ts-expect-error trust me bro
const date = json[0].result.data.json.inviteLink as string;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of relying on the clipboard. I've refactored the endpoint so it returns the fully formed inviteLink from the server according to the team context.


const inviteLink =
isOrgInvite || (props?.orgMembers && props.orgMembers?.length > 0) ? orgInviteLink : teamInviteLink;
const copyInviteLinkToClipboard = async (inviteLink: string) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

We send the fully formed invite link from the server

accepted: true,
OR: [{ role: "ADMIN" }, { role: "OWNER" }],
},
include: { team: true },
Copy link
Member Author

Choose a reason for hiding this comment

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

So we don't double query and can reuse the response

Comment on lines 36 to 48
async function getInviteLink() {
const teamInviteLink = `${WEBAPP_URL}/teams?token=${token}`;
const orgInviteLink = `${WEBAPP_URL}/signup?token=${token}&callbackUrl=/getting-started`;
if (!isOrg) return teamInviteLink;
// Only fetch if is not an org
const orgMembers = await getMembersHandler({
ctx,
input: { teamIdToExclude: teamId, distinctUser: true },
});
if (!orgMembers) return teamInviteLink;
if (orgMembers.length < 1) return teamInviteLink;
return orgInviteLink;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

In here we have all the context to form the invite link instead of relying on the client to do so.

Copy link
Contributor

github-actions bot commented Nov 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! 🙌

Copy link

deploysentinel bot commented Nov 28, 2023

Current Playwright Test Results Summary

✅ 341 Passing - ⚠️ 8 Flaky

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

(Last updated on 11/28/2023 06:40:32am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: fd7caf6

Started: 11/28/2023 06:32:56am UTC

⚠️ Flakes

📄   apps/web/playwright/change-username.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Change username on settings User can change username to include periods(or dots)
Retry 1Initial Attempt
0.80% (2) 2 / 251 runs
failed over last 7 days
2.79% (7) 7 / 251 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 on submitting team form, triggers team webhook
Retry 2Retry 1Initial Attempt
3.41% (9) 9 / 264 runs
failed over last 7 days
16.67% (44) 44 / 264 runs
flaked over last 7 days

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

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Phone Question and Each Other Question Booking With Phone Question and Address Question Booking With Phone Question and Multi email Question Phone required and Multi email not required
Retry 1Initial Attempt
0.40% (1) 1 / 253 run
failed over last 7 days
0.79% (2) 2 / 253 runs
flaked over last 7 days

📄   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 -- future Different Locations Tests Can add Organzer Phone Number location and book with it
Retry 1Initial Attempt
-0.61% (-1) -1 / 163 runs
failed over last 7 days
6.75% (11) 11 / 163 runs
flaked over last 7 days

📄   apps/web/playwright/organization/organization-creation.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Organization should be able to create an organization and complete onboarding
Retry 1Initial Attempt
2.65% (6) 6 / 226 runs
failed over last 7 days
94.69% (214) 214 / 226 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
0.37% (1) 1 / 273 run
failed over last 7 days
53.48% (146) 146 / 273 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
8.42% (23) 23 / 273 runs
failed over last 7 days
88.28% (241) 241 / 273 runs
flaked over last 7 days

📄   packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Routing Forms Seeded Routing Form Routing Link should validate fields
Retry 1Initial Attempt
0.77% (2) 2 / 261 runs
failed over last 7 days
8.43% (22) 22 / 261 runs
flaked over last 7 days

View Detailed Build Results


@zomars
Copy link
Member Author

zomars commented Nov 28, 2023

As of now, all checks are passing
image

@zomars zomars enabled auto-merge (squash) November 28, 2023 06:43
Copy link
Member

@sean-brydon sean-brydon left a comment

Choose a reason for hiding this comment

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

LGTM - good fix. Clipboard was very flaky even in local so this is great

@zomars zomars merged commit c765ea9 into main Nov 28, 2023
44 checks passed
@zomars zomars deleted the fix_team_and_org_invite_e2e_tests branch November 28, 2023 10:49
jakazzy pushed a commit to jakazzy/cal.com that referenced this pull request Dec 5, 2023
hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only devops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants