test: Make embed tests stable. (#9718)

* Wait for /embed/embed.js to be servable

* Change something in embeds/ to make embed tests run
This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-06-22 17:38:51 +02:00
1 parent 02f1c50bb2
commit 4f0e843ac6
3 files changed
+16 -1

No files matched your search

+3
View File
@@ -34,12 +34,15 @@ jobs:
app-store:
- 'apps/web/**'
- 'packages/app-store/**'
- 'playwright.config.ts'
embed:
- 'apps/web/**'
- 'packages/embeds/**'
- 'playwright.config.ts'
embed-react:
- 'apps/web/**'
- 'packages/embeds/**'
- 'playwright.config.ts'
env:
name: Create env file
+1 -1
View File
@@ -7,7 +7,7 @@ This folder contains all the various flavours of embeds.
Please see the respective folder READMEs for details on them.
## Publishing to NPM - Soon to be automated using changesets github action
## Publishing to NPM. It will soon be automated using changesets github action
To publish the packages. Following steps should be followed. All commands are to be run at the root.
1. `yarn changeset` -> Creates changelog files and adds summary to changelog. Select embed packages only here.
+12
View File
@@ -34,6 +34,8 @@ const webServer: PlaywrightTestConfig["webServer"] = [
];
if (IS_EMBED_TEST) {
ensureAppServerIsReadyToServeEmbed(webServer[0]);
webServer.push({
command: "yarn workspace @calcom/embed-core dev",
port: 3100,
@@ -43,6 +45,8 @@ if (IS_EMBED_TEST) {
}
if (IS_EMBED_REACT_TEST) {
ensureAppServerIsReadyToServeEmbed(webServer[0]);
webServer.push({
command: "yarn workspace @calcom/embed-react dev",
port: 3101,
@@ -261,3 +265,11 @@ expect.extend({
});
export default config;
function ensureAppServerIsReadyToServeEmbed(webServer: { port?: number; url?: string }) {
// We should't depend on an embed dependency for App's tests. So, conditionally modify App webServer.
// Only one of port or url can be specified, so remove port.
delete webServer.port;
webServer.url = `${process.env.NEXT_PUBLIC_WEBAPP_URL}/embed/embed.js`;
console.log("Ensuring that /embed/embed.js is 200 before starting tests");
}