-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
153 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
# testing | ||
/coverage | ||
/e2e/results/ | ||
test-results/ | ||
|
||
# next.js | ||
/.next/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
import { search } from './utils' | ||
|
||
test.describe('色味で絞り込める', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/') | ||
}) | ||
|
||
test('正しく絞り込めている', async ({ page }) => { | ||
await page.selectOption('[data-testid="search-select"]', 'Dearly Stars') | ||
await page.click('[data-testid="search-color-button-1"]') | ||
await expect(page.getByTestId('card-area')).toContainText('日高愛') | ||
}) | ||
|
||
test('キーワードでさらに絞り込める', async ({ page }) => { | ||
await page.selectOption( | ||
'[data-testid="search-select"]', | ||
'シャイニーカラーズ' | ||
) | ||
await page.click('[data-testid="search-color-button-2"]') | ||
|
||
const cardArea = page.getByTestId('card-area') | ||
|
||
await search(page, '西城樹里') | ||
await expect(cardArea, 'ヒットする').toContainText('西城樹里') | ||
|
||
await search(page, '風野灯織') | ||
await expect(cardArea, '色味が異なるアイドルはヒットしない').toContainText( | ||
'見つかりませんでした' | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('検索して画面を記録', async ({ contextOptions, browser }, { project }) => { | ||
const saveDir = `e2e/results/${project.name}` | ||
const context = await browser.newContext({ | ||
...contextOptions, | ||
recordVideo: { dir: saveDir } | ||
}) | ||
|
||
const page = await context.newPage() | ||
await page.goto('http://localhost:3000') | ||
|
||
// ブランドを指定 | ||
await page.selectOption('[data-testid="search-select"]', '765AS') | ||
|
||
// アイドル名を入力 | ||
await page.click('[data-testid="search-textbox"]') | ||
await page.locator('[data-testid="search-textbox"]').fill('あまみはるか') | ||
|
||
// 検索実行 | ||
await page.click('[data-testid="search-button"]') | ||
|
||
// 色味で絞り込み | ||
await page.click('[data-testid="search-color-button-1"]') | ||
|
||
await expect(page.locator('[data-testid="name-label"] > p')).toHaveText([ | ||
'天海春香', | ||
'Haruka Amami' | ||
]) | ||
|
||
// ページ全体のスクリーンショット | ||
await page.screenshot({ path: `${saveDir}/full-page.png`, fullPage: true }) | ||
|
||
await context.close() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
import { search } from './utils' | ||
|
||
test('Keep', async ({ page }) => { | ||
await page.goto('/') | ||
|
||
await search(page, '白菊ほたる') | ||
await page.getByTestId('keep-button').click() | ||
|
||
await page.selectOption('[data-testid="search-select"]', 'Keepしたカラー') | ||
await expect(page.getByTestId('card-area'), '追加できる').toContainText( | ||
'白菊ほたる' | ||
) | ||
|
||
await page.getByTestId('remove-button').click() | ||
await page.selectOption('[data-testid="search-select"]', 'Keepしたカラー') | ||
await expect(page.getByTestId('card-area'), '削除できる').toContainText( | ||
'見つかりませんでした' | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.describe('ブランドで検索できる', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/') | ||
}) | ||
|
||
const tests = [ | ||
['765AS', '天海春香'], | ||
['Dearly Stars', '日高愛'], | ||
['ミリオンライブ!', '春日未来'], | ||
['シンデレラガールズ', '相葉夕美'], | ||
['SideM', '蒼井享介'], | ||
['シャイニーカラーズ', '緋田美琴'], | ||
['未分類', '亜夜'] | ||
] | ||
|
||
for (const [value, want] of tests) { | ||
test(value, async ({ page }) => { | ||
await page.selectOption('[data-testid="search-select"]', value) | ||
await expect(page.getByTestId('card-area')).toContainText(want) | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
import { search } from './utils' | ||
|
||
test.describe('アイドル名で検索できる', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/') | ||
}) | ||
|
||
test('漢字から', async ({ page }) => { | ||
await search(page, '天海春香') | ||
await expect(page.getByTestId('card-area')).toContainText('天海春香') | ||
}) | ||
|
||
test('ひらがなから', async ({ page }) => { | ||
await search(page, 'あまみはるか') | ||
await expect(page.getByTestId('card-area')).toContainText('天海春香') | ||
}) | ||
|
||
test('ブランド絞り込み', async ({ page }) => { | ||
await page.selectOption( | ||
'[data-testid="search-select"]', | ||
'シンデレラガールズ' | ||
) | ||
|
||
const cardArea = page.getByTestId('card-area') | ||
|
||
await search(page, '白菊ほたる') | ||
await expect( | ||
cardArea, | ||
'シンデレラガールズのアイドルがヒットする' | ||
).toContainText('白菊ほたる') | ||
|
||
await search(page, '天海春香') | ||
await expect(cardArea, '765ASのアイドルがヒットしない').toContainText( | ||
'見つかりませんでした' | ||
) | ||
}) | ||
}) | ||
|
||
test('ユニット名で検索できる', async ({ page }) => { | ||
await page.goto('/') | ||
await search(page, '放課後クライマックスガールズ') | ||
await expect(page.getByTestId('card-area')).toContainText( | ||
'放課後クライマックスガールズ' | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Page } from '@playwright/test' | ||
|
||
/** | ||
* 検索 | ||
* @param page Page | ||
* @param keyword 検索キーワード | ||
*/ | ||
export const search = async (page: Page, keyword: string) => { | ||
// キーワードを入力 | ||
await page.click('[data-testid="search-textbox"]') | ||
await page.locator('[data-testid="search-textbox"]').fill(keyword) | ||
|
||
// 検索実行 | ||
await page.click('[data-testid="search-button"]') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters