test(*): Add POM to BDD tests

This commit is contained in:
Josh Creek
2025-04-24 10:02:33 +01:00
parent a7c1d60db8
commit b8130f4b0b
9 changed files with 201 additions and 50 deletions
+3 -6
View File
@@ -1,9 +1,6 @@
import { Given, When, Then } from '@cucumber/cucumber';
import { expect } from '@playwright/test';
Given('I am on the homepage', async function () {
await this.page.goto('http://localhost:5173/');
});
import { ResultsPage } from '../pages/ResultsPage.ts';
When('I fill in the assessment form and submit', async function () {
await this.page.fill('textarea[name="assessment"]', 'Sample student submission');
@@ -11,7 +8,7 @@ When('I fill in the assessment form and submit', async function () {
});
Then('I should see my feedback displayed', async function () {
await this.page.waitForSelector('.feedback');
const feedback = await this.page.textContent('.feedback');
await this.resultsPage.waitForFeedbackVisible();
const feedback = await this.resultsPage.getGrade();
expect(feedback).toBeTruthy();
});