|
| 1 | +import type { Page } from '@playwright/test' |
| 2 | + |
| 3 | +import { expect, test } from '@playwright/test' |
| 4 | + |
| 5 | +async function login(page: Page, { login, password, location }: { |
| 6 | + login: string |
| 7 | + password: string |
| 8 | + location: string |
| 9 | +}) { |
| 10 | + await page.goto('apps/spreed/') |
| 11 | + await page.getByRole('textbox', { name: 'Account name or email' }).fill('admin') |
| 12 | + await page.getByRole('textbox', { name: 'Password' }).fill('admin') |
| 13 | + await page.getByRole('button', { name: 'Log in', exact: true }).click() |
| 14 | + await page.waitForURL('apps/spreed/') |
| 15 | +} |
| 16 | + |
| 17 | +test('can open app', async ({ page }) => { |
| 18 | + await login(page, { login: 'admin', password: 'admin', location: 'apps/spreed/' }) |
| 19 | + // Expect a title "to contain" a substring. |
| 20 | + await expect(page).toHaveTitle(/Talk - Nextcloud/) |
| 21 | +}) |
| 22 | + |
| 23 | +test('can open a conversation', async ({ page }) => { |
| 24 | + await login(page, { login: 'admin', password: 'admin', location: 'apps/spreed/' }) |
| 25 | + await page.getByRole('textbox', { name: 'Search …' }).fill('test') |
| 26 | + await page.locator('a[href="/index.php/call/biiwputz"]').click() |
| 27 | + await page.waitForURL('call/biiwputz') |
| 28 | + |
| 29 | + const selector = '.rich-contenteditable__input' |
| 30 | + await expect(page.locator(selector)).toBeVisible() |
| 31 | + await page.waitForFunction((selector) => document.querySelector(selector)!.getAttribute('contenteditable') === 'true', selector) |
| 32 | + // Expects page to have a heading with the name of Installation. |
| 33 | + // await expect(page.getByRole('textbox', { name: 'Write a message' })).toBeVisible() |
| 34 | + await page.locator(selector).fill('wololo') |
| 35 | + |
| 36 | + await page.locator('button[aria-label="Send message"]').click() |
| 37 | +}) |
0 commit comments