Ported more tests to playwright. (#6214)

* Ported more tests to playwright.

* Added language test.

* Fixed failing tests. Moved another test.

* Removed frontend tests.

* Splitted runners.

* Fixed runners.

* Split up into the different browser environments.

* Added github reporter.

* Added change user color test.
This commit is contained in:
SamTV12345 2024-03-12 17:45:47 +01:00 committed by GitHub
parent 19ee8c2afa
commit 078324c0d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 1702 additions and 1229 deletions

View file

@ -1,6 +1,6 @@
import {Frame, Locator, Page} from "@playwright/test";
import {MapArrayType} from "../../../node/types/MapType";
import {randomInt} from "node:crypto";
import {randomUUID} from "node:crypto";
export const getPadOuter = async (page: Page): Promise<Frame> => {
return page.frame('ace_outer')!;
@ -115,7 +115,7 @@ export const appendQueryParams = async (page: Page, queryParameters: MapArrayTyp
export const goToNewPad = async (page: Page) => {
// create a new pad before each test run
const padId = "FRONTEND_TESTS"+randomInt(0, 1000);
const padId = "FRONTEND_TESTS"+randomUUID();
await page.goto('http://localhost:9001/p/'+padId);
await page.waitForSelector('iframe[name="ace_outer"]');
return padId;
@ -128,6 +128,8 @@ export const goToPad = async (page: Page, padId: string) => {
export const clearPadContent = async (page: Page) => {
const body = await getPadBody(page);
await body.click();
await page.keyboard.down('Control');
await page.keyboard.press('A');
await page.keyboard.up('Control');

View file

@ -0,0 +1,20 @@
import {Page} from "@playwright/test";
/**
* Sets the src-attribute of the main iframe to the timeslider
* In case a revision is given, sets the timeslider to this specific revision.
* Defaults to going to the last revision.
* It waits until the timer is filled with date and time, because it's one of the
* last things that happen during timeslider load
*
* @param page
* @param {number} [revision] the optional revision
* @returns {Promise}
* @todo for some reason this does only work the first time, you cannot
* goto rev 0 and then via the same method to rev 5. Use buttons instead
*/
export const gotoTimeslider = async (page: Page, revision: number): Promise<any> => {
let revisionString = Number.isInteger(revision) ? `#${revision}` : '';
await page.goto(`${page.url()}/timeslider${revisionString}`);
await page.waitForSelector('#timer')
};