import { expect, test } from "@playwright/test";
import { getStory } from "../test-utils";
test.describe("Navigation", () => {
    test("Basic", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--basic");
        await expect(page).toHaveScreenshot();
    });
    test("App bar open", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--app-bar-opened");
        await expect(page).toHaveScreenshot();
    });
    test("Org bar open", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--org-side-bar-opened");
        await expect(page).toHaveScreenshot();
    });
    test("Info bar open", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--info-side-bar-opened");
        await expect(page).toHaveScreenshot();
    });
    test("Info bar open - with divider", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--info-side-bar-opened-with-divider");
        await expect(page).toHaveScreenshot();
    });
    test("Info button", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--info-button");
        await expect(page).toHaveScreenshot();
    });
    test("User bar open", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--user-side-bar-opened");
        await expect(page).toHaveScreenshot();
    });
    test("User bar open - with custom section", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--user-side-bar-opened-with-custom-section");
        await expect(page).toHaveScreenshot();
    });
    test("User bar open - with custom section and state", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--user-side-bar-with-custom-section-and-state");
        await expect(page).toHaveScreenshot();
    });
    test("App bar - without elements", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--app-bar-without-elements");
        await expect(page).toHaveScreenshot();
    });
    test("App bar - without elements and nav elements", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--app-bar-without-elements-and-nav-elements");
        await expect(page).toHaveScreenshot();
    });
    test("Notifications bar open", async ({ page }) => {
        // Fake current time for consistent screenshots
        const fakeNow = new Date("January 5 2023 13:37:11").valueOf();
        await page.addInitScript(`{
  Date = class extends Date {
    constructor(...args) {
      if (args.length === 0) {
        super(${fakeNow});
      } else {
        super(...args);
      }
    }
  }
  const __DateNowOffset = ${fakeNow} - Date.now();
  const __DateNow = Date.now;
  Date.now = () => __DateNow() + __DateNowOffset;
	}`);
        await getStory(page, "uishell-c3navigation--notifications-side-bar-opened");
        await expect(page).toHaveScreenshot();
    });
    test("Notifications bar open - no notifications", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--notifications-side-bar-opened-no-notifications");
        await expect(page).toHaveScreenshot();
    });
    test("Action button", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--acion-button-instead-of-info-bar");
        await expect(page).toHaveScreenshot();
    });
    test("Action button with custom element", async ({ page }) => {
        await getStory(page, "uishell-c3navigation--acion-button-with-custom-element");
        await expect(page).toHaveScreenshot();
    });
});
