From 83bcfffadc1f58e4c661837f2d3fb3b84547ebf7 Mon Sep 17 00:00:00 2001 From: Fityan <63894003+fityannugroho@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:39:35 +0700 Subject: [PATCH] test: remove redundant API request in dashboard tests --- app/__tests__/dashboard/area-selector.spec.ts | 3 --- app/__tests__/dashboard/boundary-settings.spec.ts | 3 --- app/__tests__/home.spec.ts | 6 ++++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/__tests__/dashboard/area-selector.spec.ts b/app/__tests__/dashboard/area-selector.spec.ts index 9ad2e7d..97e0be6 100644 --- a/app/__tests__/dashboard/area-selector.spec.ts +++ b/app/__tests__/dashboard/area-selector.spec.ts @@ -2,9 +2,6 @@ import { config } from '@/lib/config' import { expect, test } from '@playwright/test' test.beforeEach(async ({ page }) => { - const res = await page.request.get(config.dataSource.area.url) - await expect(res).toBeOK() - await page.goto('/') }) diff --git a/app/__tests__/dashboard/boundary-settings.spec.ts b/app/__tests__/dashboard/boundary-settings.spec.ts index 2e74a52..1f593f3 100644 --- a/app/__tests__/dashboard/boundary-settings.spec.ts +++ b/app/__tests__/dashboard/boundary-settings.spec.ts @@ -2,9 +2,6 @@ import { config } from '@/lib/config' import test, { expect } from '@playwright/test' test.beforeEach(async ({ page }) => { - const res = await page.request.get(config.dataSource.area.url) - await expect(res).toBeOK() - await page.goto('/') }) diff --git a/app/__tests__/home.spec.ts b/app/__tests__/home.spec.ts index 726d028..8b32823 100644 --- a/app/__tests__/home.spec.ts +++ b/app/__tests__/home.spec.ts @@ -1,14 +1,16 @@ import { config } from '@/lib/config' import { expect, test } from '@playwright/test' +test.beforeEach(async ({ page }) => { + await page.goto('/') +}) + test.describe('meta tags', () => { test('has title', async ({ page }) => { - await page.goto('/') await expect(page).toHaveTitle(config.appName) }) test('has description', async ({ page }) => { - await page.goto('/') await expect( page.locator('head').locator('meta[name="description"]'), ).toHaveAttribute('content', config.appDescription)