mirror of
https://github.com/lichess-org/lila.git
synced 2026-05-26 13:51:00 +00:00
assert message text
This commit is contained in:
committed by
Thibault Duplessis
parent
d0bab279d1
commit
14f33232e2
@@ -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,4 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
import { loginAs } from './helpers';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user