Skip to content

Commit 5c09e7a

Browse files
committed
first test, fixtures and POM introduction
1 parent cf2cee6 commit 5c09e7a

File tree

5 files changed

+64
-18
lines changed

5 files changed

+64
-18
lines changed

e2e/example.spec.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

e2e/homepage.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { test, expect } from '../src/test-fixtures';
2+
import { HomePage } from '../src/page/homePage';
3+
4+
test.describe('Homepage', () => {
5+
test('should load successfully', async ({ page }, testInfo) => {
6+
const homePage = new HomePage(page);
7+
await homePage.goto();
8+
try {
9+
expect(await homePage.isLoaded()).toBeTruthy();
10+
} catch (error) {
11+
await page.screenshot({ path: `test-results/homepage-failure-${testInfo.project.name}.png`, fullPage: true });
12+
throw error;
13+
}
14+
});
15+
});

prompt/prompt.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# prompt.md
2+
3+
## Prompt Guidelines for QA Engineers
4+
5+
- **Clarity:** Write prompts that are clear and concise. Avoid ambiguity.
6+
- **Scope:** Limit prompts to a single task or question whenever possible.
7+
- **Length:** Keep prompts short (1-3 sentences). If more detail is needed, use bullet points.
8+
- **Context:** Provide relevant context, such as environment, browser, or test data. You are testing ecommerce platform.
9+
- **Expected Outcome:** State what you expect as a result (e.g., pass/fail, screenshot, log output).
10+
- **Limitations:**
11+
- Avoid asking for unsupported browser features or OS-level automation.
12+
- Do not request actions that require elevated permissions unless necessary.
13+
- Specify timeouts and wait conditions for asynchronous actions.
14+
- Use only supported selectors and locators for UI automation.
15+
- **Examples:**
16+
- "Login with valid credentials and verify dashboard loads."
17+
- "Check that error message appears when submitting empty form."
18+
- "Take a screenshot after clicking the submit button."
19+
20+
---
21+
This file provides basic prompt limitations and best practices for QA engineers working with automation tools.

src/page/homePage.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Page } from '@playwright/test';
2+
3+
export class HomePage {
4+
constructor(private page: Page) {}
5+
6+
async goto() {
7+
await this.page.goto('https://www.rohlik.cz');
8+
}
9+
10+
async isLoaded() {
11+
// Example: check for a visible element unique to homepage
12+
return await this.page.isVisible('header');
13+
}
14+
}

src/test-fixtures.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { test as base, expect } from '@playwright/test';
2+
3+
const test = base.extend({
4+
page: async ({ page }, use, testInfo) => {
5+
try {
6+
await use(page);
7+
} catch (error) {
8+
await page.screenshot({ path: `test-results/failure-${testInfo.title}-${testInfo.project.name}.png`, fullPage: true });
9+
throw error;
10+
}
11+
},
12+
});
13+
14+
export { test, expect };

0 commit comments

Comments
 (0)