From b2fc4776b76ce2d5321ce3feaa52d3cf89def9e9 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Wed, 18 May 2022 00:08:36 +0530 Subject: [PATCH] feat: playwright is configured --- frontend/package.json | 2 +- frontend/playwright.config.ts | 20 ++++---------------- frontend/tests/signup/index.spec.ts | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 frontend/tests/signup/index.spec.ts diff --git a/frontend/package.json b/frontend/package.json index 3dc652985e..49fa763d5d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,7 +15,7 @@ "postinstall": "yarn husky:configure", "husky:configure": "cd .. && husky install frontend/.husky", "playwright": "playwright test --config=./playwright.config.ts", - "playwright:local:debug": "PWDEBUG=1 yarn playwright" + "playwright:local:debug": "PWDEBUG=console yarn playwright" }, "engines": { "node": ">=12.13.0" diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 604c67a03f..9747285a66 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -1,4 +1,4 @@ -import { devices, PlaywrightTestConfig } from '@playwright/test'; +import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { forbidOnly: !!process.env.CI, @@ -7,24 +7,12 @@ const config: PlaywrightTestConfig = { name: 'Signoz', testDir: './tests', use: { - trace: 'on-first-retry', + trace: 'retain-on-failure', + baseURL: process.env.FRONTEND_API_ENDPOINT, }, updateSnapshots: 'all', fullyParallel: false, quiet: true, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - { - name: 'webkit', - use: { ...devices['Desktop Safari'] }, - }, - ], }; + export default config; diff --git a/frontend/tests/signup/index.spec.ts b/frontend/tests/signup/index.spec.ts new file mode 100644 index 0000000000..a7e06f4fa6 --- /dev/null +++ b/frontend/tests/signup/index.spec.ts @@ -0,0 +1,17 @@ +import { expect, test } from '@playwright/test'; +import ROUTES from 'constants/routes'; + +test('Login Page', async ({ page, baseURL }) => { + const loginPage = `${baseURL}${ROUTES.LOGIN}`; + + await page.goto(loginPage, { + waitUntil: 'networkidle', + }); + + const signup = 'Monitor your applications. Find what is causing issues.'; + + // Click text=Monitor your applications. Find what is causing issues. + const el = page.locator(`text=${signup}`); + + expect(el).toBeVisible(); +});