mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 22:57:11 -04:00
Ported more tests to playwright.
This commit is contained in:
parent
d8e0975f97
commit
0d7bca27c1
11 changed files with 282 additions and 231 deletions
55
src/tests/frontend-new/specs/undo.spec.ts
Normal file
55
src/tests/frontend-new/specs/undo.spec.ts
Normal file
|
@ -0,0 +1,55 @@
|
|||
'use strict';
|
||||
|
||||
import {expect, test} from "@playwright/test";
|
||||
import {clearPadContent, getPadBody, goToNewPad, writeToPad} from "../helper/padHelper";
|
||||
|
||||
test.beforeEach(async ({ page })=>{
|
||||
await goToNewPad(page);
|
||||
})
|
||||
|
||||
|
||||
test.describe('undo button', function () {
|
||||
|
||||
test('undo some typing by clicking undo button', async function ({page}) {
|
||||
const padBody = await getPadBody(page);
|
||||
await padBody.click()
|
||||
await clearPadContent(page)
|
||||
|
||||
|
||||
// get the first text element inside the editable space
|
||||
const firstTextElement = padBody.locator('div').first()
|
||||
const originalValue = await firstTextElement.textContent(); // get the original value
|
||||
await firstTextElement.focus()
|
||||
|
||||
await writeToPad(page, 'foo'); // send line 1 to the pad
|
||||
|
||||
const modifiedValue = await firstTextElement.textContent(); // get the modified value
|
||||
expect(modifiedValue).not.toBe(originalValue); // expect the value to change
|
||||
|
||||
// get clear authorship button as a variable
|
||||
const undoButton = page.locator('.buttonicon-undo')
|
||||
await undoButton.click() // click the button
|
||||
|
||||
await expect(firstTextElement).toHaveText(originalValue!);
|
||||
});
|
||||
|
||||
test('undo some typing using a keypress', async function ({page}) {
|
||||
const padBody = await getPadBody(page);
|
||||
await padBody.click()
|
||||
await clearPadContent(page)
|
||||
|
||||
// get the first text element inside the editable space
|
||||
const firstTextElement = padBody.locator('div').first()
|
||||
const originalValue = await firstTextElement.textContent(); // get the original value
|
||||
|
||||
await firstTextElement.focus()
|
||||
await writeToPad(page, 'foo'); // send line 1 to the pad
|
||||
const modifiedValue = await firstTextElement.textContent(); // get the modified value
|
||||
expect(modifiedValue).not.toBe(originalValue); // expect the value to change
|
||||
|
||||
// undo the change
|
||||
await page.keyboard.press('Control+Z');
|
||||
|
||||
await expect(firstTextElement).toHaveText(originalValue!);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue