From 8dc5ea76981ae65f1fccfbd05b387dcbe5345929 Mon Sep 17 00:00:00 2001 From: Amir Ziaei Date: Sun, 31 Mar 2024 00:48:27 +0200 Subject: [PATCH] f --- apps/app/src/entry.ts | 2 +- apps/app/tests/e2e/instagram-auth.setup.ts | 22 +++++++--------------- apps/app/tsconfig.json | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/apps/app/src/entry.ts b/apps/app/src/entry.ts index c3e3336..0a4a309 100644 --- a/apps/app/src/entry.ts +++ b/apps/app/src/entry.ts @@ -2,7 +2,7 @@ import './env' import { router } from './routes' const { port } = Bun.serve({ - port: process.env.PORT || 3000, + port: process.env.PORT, development: process.env.NODE_ENV !== 'production', fetch(req) { return router.match(req) diff --git a/apps/app/tests/e2e/instagram-auth.setup.ts b/apps/app/tests/e2e/instagram-auth.setup.ts index 7b60aab..c3121fe 100644 --- a/apps/app/tests/e2e/instagram-auth.setup.ts +++ b/apps/app/tests/e2e/instagram-auth.setup.ts @@ -4,30 +4,22 @@ const authFile = 'mnt/auth.json' setup('authenticate instagram', async ({ page }) => { await page.goto('https://www.instagram.com/') - try { - await expect(page.getByText('Allow the use of cookies from')).toBeVisible() - await page.getByRole('button', { name: 'Decline optional cookies' }).click() - } catch { - /** no need to handle */ + const declineCookies = page.getByRole('button', { + name: 'Decline optional cookies', + }) + if (await declineCookies.isVisible()) { + await declineCookies.click() } await page .getByLabel('Phone number, username, or') .fill(process.env.IG_USERNAME) await page.getByLabel('Password').fill(process.env.IG_PASSWORD) await page.getByRole('button', { name: 'Log in', exact: true }).click() - try { - await expect(page.getByText('Save your login info?')).toBeVisible() + if (await page.getByText('Save your login info?').isVisible()) { await page.getByRole('button', { name: 'Save info' }).click() - } catch { - /** no need to handle */ } - try { - await expect(page.getByText('Turn on Notifications')).toBeVisible({ - timeout: 10_000, - }) + if (await page.getByText('Turn on Notifications').isVisible()) { await page.getByRole('button', { name: 'Not Now' }).click() - } catch { - /** no need to handle */ } await expect(page.getByRole('link', { name: 'Home Home' })).toBeVisible() await page.context().storageState({ path: authFile }) diff --git a/apps/app/tsconfig.json b/apps/app/tsconfig.json index 8ae2e0b..73f2ce2 100644 --- a/apps/app/tsconfig.json +++ b/apps/app/tsconfig.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/tsconfig", "extends": "../../tsconfig.base.json", - "include": ["src/**/*.ts"], + "include": ["**/*.ts"], "exclude": ["node_modules"] }