diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d63277eae8..445d9d909e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -27,29 +27,35 @@ jobs: - uses: actions/checkout@v3 - uses: ./.github/actions/dangerous-git-checkout - - name: Build & Cache Web Binaries - uses: ./.github/actions/cache-build-web + - name: Setup Node.js 20.x + uses: actions/setup-node@v3 with: - e2e_testing_mode: "1" - - - name: Check if pnpm is installed - id: pnpm-check - run: | - if pnpm --version; then - echo "pnpm is installed." - echo "PNPM_INSTALLED=true" >> $GITHUB_ENV - else - echo "pnpm is not installed." - echo "PNPM_INSTALLED=false" >> $GITHUB_ENV - fi + node-version: 20.x - name: Install pnpm - if: env.PNPM_INSTALLED == 'false' uses: pnpm/action-setup@v4 - name: Install dependencies - if: env.PNPM_INSTALLED == 'false' - run: pnpm install + run: pnpm install --config.platform=linux --config.architecture=x64 + shell: bash + + - name: create .env + run: cp .env.example .env + shell: bash + + - name: Fill ENCRYPTION_KEY, ENTERPRISE_LICENSE_KEY and E2E_TESTING in .env + run: | + RANDOM_KEY=$(openssl rand -hex 32) + sed -i "s/ENCRYPTION_KEY=.*/ENCRYPTION_KEY=${RANDOM_KEY}/" .env + sed -i "s/CRON_SECRET=.*/CRON_SECRET=${RANDOM_KEY}/" .env + sed -i "s/NEXTAUTH_SECRET=.*/NEXTAUTH_SECRET=${RANDOM_KEY}/" .env + sed -i "s/ENTERPRISE_LICENSE_KEY=.*/ENTERPRISE_LICENSE_KEY=${RANDOM_KEY}/" .env + echo "E2E_TESTING=1" >> .env + shell: bash + + - name: Build App + run: | + pnpm build --filter=@formbricks/web... - name: Apply Prisma Migrations run: | @@ -72,15 +78,7 @@ jobs: sleep 10 done - - name: Cache Playwright - uses: actions/cache@v3 - id: playwright-cache - with: - path: ~/.cache/ms-playwright - key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }} - - name: Install Playwright - if: steps.playwright-cache.outputs.cache-hit != 'true' run: pnpm exec playwright install --with-deps - name: Run E2E Tests diff --git a/apps/web/playwright/js.spec.ts b/apps/web/playwright/js.spec.ts index f0680c303f..925d2d4c2d 100644 --- a/apps/web/playwright/js.spec.ts +++ b/apps/web/playwright/js.spec.ts @@ -47,13 +47,6 @@ test.describe("JS Package Test", async () => { })(); await page.waitForURL(/\/environments\/[^/]+\/surveys\/[^/]+\/summary/); - - // await expect(page.getByRole("link", { name: "Surveys" })).toBeVisible(); - // await page.getByRole("link", { name: "Surveys" }).click(); - - // await page.waitForURL(/\/environments\/[^/]+\/surveys/); - - // await expect(page.getByRole("heading", { name: "Surveys" })).toBeVisible(); }); await test.step("JS display survey on page and submit response", async () => { @@ -64,20 +57,20 @@ test.describe("JS Package Test", async () => { await page.goto(htmlFile); // Formbricks In App Sync has happened - const syncApi = await page.waitForResponse((response) => response.url().includes("/app/sync"), { - timeout: 20000, - }); + const syncApi = await page.waitForResponse( + (response) => { + return response.url().includes("/app/sync"); + }, + { + timeout: 120000, + } + ); + expect(syncApi.status()).toBe(200); // Formbricks Modal exists in the DOM await expect(page.locator("#formbricks-modal-container")).toHaveCount(1); - // const displayApi = await page.waitForResponse((response) => response.url().includes("/display")); - // expect(displayApi.status()).toBe(200); - - // Formbricks Modal exists in the DOM - // await expect(page.locator("#formbricks-modal-container")).toHaveCount(1); - // Formbricks Modal is visible await expect( page.locator("#questionCard-0").getByRole("link", { name: "Powered by Formbricks" }) diff --git a/packages/js/index.html b/packages/js/index.html index 24e57a5f15..5a540f5d97 100644 --- a/packages/js/index.html +++ b/packages/js/index.html @@ -7,7 +7,7 @@ e.parentNode.insertBefore(t, e), setTimeout(function () { formbricks.init({ - environmentId: "clyfn6ncr00052s58w7bgcl3a", + environmentId: "clzmroqa40005bbl9zmlzepy4", userId: "RANDOM_USER_ID", apiHost: "http://localhost:3000", });