Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tests by AZYEPES #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const config: PlaywrightTestConfig = {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'https://playwright.deev/docs/intro',
baseURL: 'https://playwright.dev/',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down
16 changes: 8 additions & 8 deletions tests/search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
import { test, expect } from '@playwright/test';

test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.goto('/docs/intro');
});

test('Realizar una busqueda que no tenga resultados', async ({ page }) => {
await page.getByRole('button').click();
await page.getByRole('button', {name: /Search/ }).click();

await page.getByPlaceholder('Search docs').click();

await page.getByPlaceholder('Search docs').fill('hascontent');

expect(page.locator('.DocSearch-NoResults p')).toBeVisible();
await expect(page.locator("//p[@class='DocSearch-Title']")).toBeVisible();

expect(page.locator('.DocSearch-NoResults p')).toHaveText('No results for hascontent');
await expect(page.locator("//p[@class='DocSearch-Title']")).toHaveText('No results for "hascontent"');

})

test('Limpiar el input de busqueda', async ({ page }) => {
await page.getByRole('button', { name: 'Search' }).click();
await page.getByRole('button', { name: /Search/ }).click();

const searchBox = page.getByPlaceholder('Search docs');

await searchBox.click();

await searchBox.fill('somerandomtext');

await expect(searchBox).toHaveText('somerandomtext');
await expect(searchBox).toHaveValue('somerandomtext');

await page.getByRole('button', { name: 'Clear the query' }).click();

await expect(searchBox).toHaveAttribute('value', '');
});

test('Realizar una busqueda que genere al menos tenga un resultado', async ({ page }) => {
await page.getByRole('button', { name: 'Search ' }).click();
await page.getByRole('button', { name: 'Search' }).click();

const searchBox = page.getByPlaceholder('Search docs');

await searchBox.click();

await page.getByPlaceholder('Search docs').fill('havetext');

expect(searchBox).toHaveText('havetext');
await expect(searchBox).toHaveValue('havetext');

// Verity there are sections in the results
await page.locator('.DocSearch-Dropdown-Container section').nth(1).waitFor();
Expand Down