Download benchmarks/reference/ui-todo.spec.js from SevdanurGenc/LLM-Automated-Test-Generation-Agent: direct link, hf CLI and curl.
- Browser
- Download file 2.59 kB
-
https://huggingface.co/SevdanurGenc/LLM-Automated-Test-Generation-Agent/resolve/main/benchmarks/reference/ui-todo.spec.js
- Command line
-
hf download hf://SevdanurGenc/LLM-Automated-Test-Generation-Agent/benchmarks/reference/ui-todo.spec.js
-
curl -L -o ui-todo.spec.js https://huggingface.co/SevdanurGenc/LLM-Automated-Test-Generation-Agent/resolve/main/benchmarks/reference/ui-todo.spec.js
2.59 kB
| const { test, expect } = require('@playwright/test'); | |
| const URL = 'file://' + require('path').join(__dirname, 'index.html'); | |
| test.beforeEach(async ({ page }) => { await page.goto(URL); }); | |
| async function add(page, text) { | |
| await page.getByLabel('Yeni görev').fill(text); | |
| await page.getByRole('button', { name: 'Ekle' }).click(); | |
| } | |
| test('starts empty', async ({ page }) => { | |
| await expect(page.locator('#todo-list li')).toHaveCount(0); | |
| await expect(page.locator('#counter')).toHaveText('0 görev kaldı'); | |
| }); | |
| test('adds trimmed task and clears input', async ({ page }) => { | |
| await add(page, ' Süt al '); | |
| await expect(page.locator('#todo-list li span')).toHaveText(['Süt al']); | |
| await expect(page.getByLabel('Yeni görev')).toHaveValue(''); | |
| await expect(page.locator('#counter')).toHaveText('1 görev kaldı'); | |
| }); | |
| test('rejects empty task', async ({ page }) => { | |
| await add(page, ' '); | |
| await expect(page.getByRole('alert')).toHaveText('Görev boş olamaz'); | |
| await expect(page.locator('#todo-list li')).toHaveCount(0); | |
| }); | |
| test('rejects duplicate ignoring case and clears error after valid add', async ({ page }) => { | |
| await add(page, 'Ödev'); | |
| await add(page, 'ödev'); | |
| await expect(page.getByRole('alert')).toHaveText('Bu görev zaten var'); | |
| await add(page, 'Spor'); | |
| await expect(page.getByRole('alert')).toHaveText(''); | |
| await expect(page.locator('#todo-list li')).toHaveCount(2); | |
| }); | |
| test('completing a task updates counter and style', async ({ page }) => { | |
| await add(page, 'A'); | |
| await add(page, 'B'); | |
| await page.getByLabel('Tamamlandı: A').check(); | |
| await expect(page.locator('#counter')).toHaveText('1 görev kaldı'); | |
| await expect(page.locator('#todo-list li').first()).toHaveClass(/done/); | |
| await page.getByLabel('Tamamlandı: A').uncheck(); | |
| await expect(page.locator('#counter')).toHaveText('2 görev kaldı'); | |
| }); | |
| test('delete removes the task', async ({ page }) => { | |
| await add(page, 'A'); | |
| await add(page, 'B'); | |
| await page.getByRole('button', { name: 'Sil: A' }).click(); | |
| await expect(page.locator('#todo-list li span')).toHaveText(['B']); | |
| }); | |
| test('clear done removes only completed tasks', async ({ page }) => { | |
| await add(page, 'A'); | |
| await add(page, 'B'); | |
| await add(page, 'C'); | |
| await page.getByLabel('Tamamlandı: A').check(); | |
| await page.getByLabel('Tamamlandı: C').check(); | |
| await page.getByRole('button', { name: 'Tamamlananları temizle' }).click(); | |
| await expect(page.locator('#todo-list li span')).toHaveText(['B']); | |
| await expect(page.locator('#counter')).toHaveText('1 görev kaldı'); | |
| }); | |