feat: playwright is configured

This commit is contained in:
Palash gupta 2022-05-18 00:08:36 +05:30
parent dd0047da07
commit b2fc4776b7
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6
3 changed files with 22 additions and 17 deletions

View File

@ -15,7 +15,7 @@
"postinstall": "yarn husky:configure", "postinstall": "yarn husky:configure",
"husky:configure": "cd .. && husky install frontend/.husky", "husky:configure": "cd .. && husky install frontend/.husky",
"playwright": "playwright test --config=./playwright.config.ts", "playwright": "playwright test --config=./playwright.config.ts",
"playwright:local:debug": "PWDEBUG=1 yarn playwright" "playwright:local:debug": "PWDEBUG=console yarn playwright"
}, },
"engines": { "engines": {
"node": ">=12.13.0" "node": ">=12.13.0"

View File

@ -1,4 +1,4 @@
import { devices, PlaywrightTestConfig } from '@playwright/test'; import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = { const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
@ -7,24 +7,12 @@ const config: PlaywrightTestConfig = {
name: 'Signoz', name: 'Signoz',
testDir: './tests', testDir: './tests',
use: { use: {
trace: 'on-first-retry', trace: 'retain-on-failure',
baseURL: process.env.FRONTEND_API_ENDPOINT,
}, },
updateSnapshots: 'all', updateSnapshots: 'all',
fullyParallel: false, fullyParallel: false,
quiet: true, quiet: true,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
}; };
export default config; export default config;

View File

@ -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();
});