assert message text

This commit is contained in:
Trevor Fitzgerald
2026-05-16 19:57:21 -04:00
committed by Thibault Duplessis
parent d0bab279d1
commit 14f33232e2
3 changed files with 13 additions and 3 deletions
+4
View File
@@ -7,3 +7,7 @@ export async function loginAs(page: Page, username: string) {
await page.getByTestId('login-submit').click();
await page.waitForLoadState('networkidle');
}
export function messageText() {
return `hi, the time is ${new Date().toISOString()}`;
}
+1
View File
@@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
test.beforeEach(async ({ page }) => {
+8 -3
View File
@@ -1,15 +1,20 @@
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
import { loginAs, messageText } from './helpers';
test.beforeEach(async ({ page }) => {
await loginAs(page, 'teacher');
});
test('can message their student', async ({ page }) => {
await page.goto('/inbox/student1');
const msg = messageText();
await page.getByTestId('msg-textarea').fill('hi');
await page.goto('/inbox/student1');
await page.getByTestId('msg-textarea').fill(msg);
await page.getByTestId('msg-send-button').click();
await expect(page.getByTestId('msg-textarea')).toBeEmpty();
await expect(page.locator('group').getByText(msg)).toBeVisible();
});
test('cannot message a kid who is not their student', async ({ page }) => {