Skip to content

How to execute automatic tests with React-monaco and Playwright? #4195

Closed Answered by Torvaldi
Torvaldi asked this question in Q&A
Discussion options

You must be logged in to vote

After some additional research, I found this comment in an openned issue that inspire me this kind of test code :

import test, { Locator, Page, expect } from "@playwright/test";

let page: Page;

test.beforeAll(async ({ browser }) => {
  page = await browser.newPage();

  await page.goto("/");
});

test.afterAll(async () => {
  await page.close();
});

test.describe("Try the Monaco editor", async () => {
  let editorWrapper: Locator;

  test("Should see the editor", async () => {

    // Get the monaco editor wrapper
    editorWrapper = page.getByTestId("monaco-editor-wrapper");

    expect(editorWrapper).toBeVisible();
  });

  test("Edit the code in the editor", async () => {
    // Get…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Torvaldi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant