Skip to content

Commit

Permalink
test(e2e): improve tests for about page (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
shootermv authored Nov 9, 2023
1 parent 115e682 commit d47de99
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/pages/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import SlackIcon from '../resources/slack-icon.svg'
import { useTranslation } from 'react-i18next'

const About = () => {
const { t } = useTranslation()

return (
<AboutStyle>
<div className="about-center-container">
<h1>{t(TEXT_KEYS.website_name)}</h1>
<WhatIsWebsite />
<DiscoveredMistake />
<Privacy />
Expand Down Expand Up @@ -132,10 +129,8 @@ const Funding = () => {

const AboutStyle = styled.div`
display: flex;
justify-content: center;
align-items: center;
height: 100%;
flex-direction: column;
padding: 1rem;
& .about-center-container {
width: 100%;
max-width: 770px;
Expand Down
25 changes: 18 additions & 7 deletions tests/about.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import { test } from './utils'

test('about page', async ({ page }) => {
await page.goto('/')
await page.getByText('אודות').click()
await page.getByRole('link', { name: 'תרומות קטנות נוספות' }).click()
await page.getByRole('heading', { name: 'הסדנא לידע ציבורי פותחת ומנגישה מידע' }).waitFor()
import { test, expect } from '@playwright/test'
test.describe('About Page Tests', () => {
test('can access about page by clicking `about` menu', async ({ page }) => {
await page.goto('/')
await page.getByText('אודות').click()
await expect(page).toHaveURL('http://localhost:3000/about')
const locator = await page.getByText('אודות')
await expect(locator).toHaveClass('menu-item active')
})
test('page display title `מהו אתר “דאטאבוס”?`', async ({ page }) => {
await page.goto('/about')
await expect(page.getByRole('heading', { name: 'מהו אתר “דאטאבוס”?' })).toBeVisible()
})
test('clicking dontaions link should lead to sadna site', async ({ page }) => {
await page.goto('/about')
await page.getByRole('link', { name: 'תרומות קטנות נוספות' }).click()
await page.getByRole('heading', { name: 'הסדנא לידע ציבורי פותחת ומנגישה מידע' }).waitFor()
})
})

0 comments on commit d47de99

Please sign in to comment.