Skip to content

test: Smoke Tests for packaged embeds and build improvements#9169

Merged
hariombalhara merged 20 commits into
mainfrom
tests/smoke-tests-embed
Jun 1, 2023
Merged

test: Smoke Tests for packaged embeds and build improvements#9169
hariombalhara merged 20 commits into
mainfrom
tests/smoke-tests-embed

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented May 29, 2023

What does this PR do?

Adds tests for the packaged code and improved package publlishing flow to avoid 2 critical issues reported recently by customers.

  • TypeScript types issue couldn't be caught in e2e because we don't import @calcom/embed-react there
  • Packaged code with http://localhost:3000 couldn't be caught because when I tested locally or in CI that URL is available but in production obviously that won't be available. For now that's avoided by ensuring that during npm publish the packages are rebuilt(with existing dist being cleaned-up) for sure with correct env variables.

Fixes #9168 Fixes CAL-1805
Fixes #9091 Fixes CAL-1757

Type of change

  • Tests

How should this be tested?

  • Run packaged code tests with yarn test -- --packaged-embed-tests-only. It would need you to buildembed-react first using cd packages/embeds/embed-react && yarn build
  • Run yarn publish-embed command after deleting dist from all embed packages(embed-core, embed-react,embed-snippet). It would generate dist folder automatically with correct URL https://app.cal.com

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 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 Jun 1, 2023 8:38pm
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 8:38pm
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2023 8:38pm

Comment thread package.json Outdated
"edit-app": "yarn app-store edit",
"publish-embed": "yarn workspaces foreach --from=\"@calcom/embed*\" npm publish --access=public",
"withHostedCalcomEnv": "NEXT_PUBLIC_EMBED_LIB_URL='https://app.cal.com/embed/embed.js' NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn",
"publish-embed": "yarn withHostedCalcomEnv workspace @calcom/embed-core build && yarn withHostedCalcomEnv workspace @calcom/embed-snippet build && yarn workspaces foreach --from=\"@calcom/embed*\" npm publish --access=public",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

embed-core and embed-snippet are the dependencies for embed-react and any new framework specific package(that might be added). So, build them first.

"__build": "yarn tailwind && vite build && tsc --emitDeclarationOnly --declarationDir dist && cp -r ../../../apps/web/public/embed ./dist/",
"__dev": "yarn tailwind && vite build --mode development",
"build": "NEXT_PUBLIC_EMBED_FINGER_PRINT=$(git rev-parse --short HEAD) yarn __build",
"build": "rm -rf dist && NEXT_PUBLIC_EMBED_FINGER_PRINT=$(git rev-parse --short HEAD) yarn __build",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ensure that build is cleaned before doing a fresh build. it ensures that stale files/changes aren't pushed to npm.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 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! 🙌

@hariombalhara hariombalhara force-pushed the tests/smoke-tests-embed branch from a3ee4f6 to 6d6146c Compare May 29, 2023 09:34
@hariombalhara hariombalhara requested a review from zomars May 29, 2023 09:52
@hariombalhara hariombalhara changed the title Tests: Smoke Tests for packaged embeds Tests: Smoke Tests for packaged embeds and build improvements May 29, 2023
Co-authored-by: Omar López <zomars@me.com>
run: yarn test-e2e:embed-react
run: |
yarn test-e2e:embed-react
yarn workspace @calcom/embed-react packaged:tests
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@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.

LGTM

Just waiting for checks to pass 🙏🏽

Copy link
Copy Markdown
Contributor

@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.

LGTM

Just waiting for checks to pass 🙏🏽

@hariombalhara hariombalhara added this pull request to the merge queue Jun 1, 2023
Merged via the queue into main with commit a0bf5b4 Jun 1, 2023
@hariombalhara hariombalhara deleted the tests/smoke-tests-embed branch June 1, 2023 20:54
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 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 🧹 Improvements Improvements to existing features. Mostly UX/UI

Projects

None yet

4 participants