mirror of
https://github.com/author-more/penpot-desktop.git
synced 2025-12-05 19:07:56 -06:00
test: add tabs tests
This commit is contained in:
53
tests/tabs.spec.ts
Normal file
53
tests/tabs.spec.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { ElectronApplication, expect, test } from "@playwright/test";
|
||||
import { describe } from "node:test";
|
||||
import { launchElectronApp } from "./utils/app.js";
|
||||
|
||||
let electronApp: ElectronApplication;
|
||||
|
||||
test.beforeEach(async () => {
|
||||
electronApp = await launchElectronApp();
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
await electronApp.close();
|
||||
});
|
||||
|
||||
describe("tabs", () => {
|
||||
test("should show no tabs screen", async () => {
|
||||
const window = await electronApp.firstWindow();
|
||||
|
||||
const screen = window.locator(".no-tabs-exist");
|
||||
const tabs = window.locator("tab-group .tabs > .tab");
|
||||
|
||||
await expect(screen).toBeHidden();
|
||||
await expect(tabs).toHaveCount(1);
|
||||
|
||||
const tab = tabs.first();
|
||||
await tab.getByRole("button", { name: "×" }).click();
|
||||
|
||||
await expect(tabs).toHaveCount(0);
|
||||
await expect(screen).toBeVisible();
|
||||
await expect(screen).toContainText("No tabs are opened");
|
||||
await expect(screen).toContainText(
|
||||
"Add a new tab to start making awesome things.",
|
||||
);
|
||||
});
|
||||
|
||||
test("should add a tab from no tabs screen", async () => {
|
||||
const window = await electronApp.firstWindow();
|
||||
|
||||
const tabs = window.locator("tab-group .tabs > .tab");
|
||||
const tab = tabs.first();
|
||||
await tab.getByRole("button", { name: "×" }).click();
|
||||
|
||||
await expect(tabs).toHaveCount(0);
|
||||
|
||||
const addTabButton = window.getByRole("button", {
|
||||
name: "Create a tab",
|
||||
});
|
||||
await addTabButton.waitFor({ state: "visible" });
|
||||
await addTabButton.click();
|
||||
|
||||
await expect(tabs).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user