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
+37
View File
@@ -0,0 +1,37 @@
import type { Page } from '@playwright/test';
export class UploadPage {
readonly page: Page;
constructor(page: Page) {
this.page = page;
}
taskInputSelector = '[data-testid="task-input"]';
fileInputSelector = 'input[type="file"]';
submissionInputSelector = '[data-testid="submission-input"]';
submitButtonSelector = '[data-testid="submit-button"]';
async navigateTo() {
await this.page.goto('http://localhost:5173/upload');
}
async setTaskDescription(text: string) {
await this.page.fill(this.taskInputSelector, text);
}
async uploadFile(filePath: string) {
await this.page.setInputFiles(this.fileInputSelector, filePath);
}
async setSubmissionText(text: string) {
await this.page.fill(this.submissionInputSelector, text);
}
async submit() {
await this.page.click(this.submitButtonSelector);
}
async isSubmitButtonEnabled() {
return this.page.isEnabled(this.submitButtonSelector);
}
}