Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add e2e tests#331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Naseem77 wants to merge18 commits intostaging
base:staging
Choose a base branch
Loading
fromadd-e2e-tests
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
4906b4c
Add e2e Tests
Naseem77Dec 10, 2025
1238be6
Add api calls/responses for logic layer
Naseem77Dec 10, 2025
d96ac6b
adding pom for homePage
Naseem77Dec 10, 2025
7b40625
adding auth setup
Naseem77Dec 10, 2025
783d9f4
add docker compose file for database connections
Naseem77Dec 15, 2025
862a87b
add sidebar tests
Naseem77Dec 15, 2025
692efed
add user profile tests
Naseem77Dec 15, 2025
4d34598
update user profile tests
Naseem77Dec 15, 2025
a966b03
update auth setup - adding another user
Naseem77Dec 15, 2025
1b880a4
add database tests
Naseem77Dec 16, 2025
f9e369c
update playwright CI
Naseem77Dec 16, 2025
c124c2e
update ci
Naseem77Dec 16, 2025
f6c751f
update ci
Naseem77Dec 16, 2025
2ddeb39
Update playwright.yml
Naseem77Dec 16, 2025
2e65792
update ci
Naseem77Dec 16, 2025
d7233b7
update ci
Naseem77Dec 16, 2025
bfa04c1
Update playwright.yml
Naseem77Dec 16, 2025
610c3f5
update CI and tests
Naseem77Dec 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
add sidebar tests
  • Loading branch information
@Naseem77
Naseem77 committedDec 15, 2025
commit862a87b0d2914ff3e492898d3ecbf86c69ff2f56
24 changes: 15 additions & 9 deletionsapp/src/components/layout/Sidebar.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,12 +26,13 @@ interface SidebarProps {
onToggleCollapse?: () => void;
}

const SidebarIcon = ({ icon: Icon, label, active, onClick, href}: {
icon: React.ElementType,
label: string,
const SidebarIcon = ({ icon: Icon, label, active, onClick, href, testId}: {
icon: React.ElementType,
label: string,
active?: boolean,
onClick?: () => void,
href?: string
href?: string,
testId?: string
}) => (
<TooltipProvider delayDuration={300} skipDelayDuration={0}>
<Tooltip delayDuration={0}>
Expand All@@ -44,6 +45,7 @@ const SidebarIcon = ({ icon: Icon, label, active, onClick, href }: {
? 'bg-purple-600 text-white'
: 'text-gray-400 hover:bg-gray-800 hover:text-white'
}`}
data-testid={testId}
>
<Icon className="h-5 w-5" />
<span className="sr-only">{label}</span>
Expand All@@ -58,6 +60,7 @@ const SidebarIcon = ({ icon: Icon, label, active, onClick, href }: {
? 'bg-purple-600 text-white'
: 'text-gray-400 hover:bg-gray-800 hover:text-white'
}`}
data-testid={testId}
>
<Icon className="h-5 w-5" />
<span className="sr-only">{label}</span>
Expand All@@ -70,6 +73,7 @@ const SidebarIcon = ({ icon: Icon, label, active, onClick, href }: {
? 'bg-purple-600 text-white'
: 'text-gray-400 hover:bg-gray-800 hover:text-white'
}`}
data-testid={testId}
>
<Icon className="h-5 w-5" />
<span className="sr-only">{label}</span>
Expand DownExpand Up@@ -98,18 +102,20 @@ const Sidebar = ({ className, onSchemaClick, isSchemaOpen, isCollapsed = false,
onClick={onToggleCollapse}
className="group flex h-10 w-10 shrink-0 items-center justify-center gap-2 rounded-full bg-gray-800 text-lg font-semibold text-white hover:bg-gray-700"
title="Toggle Sidebar (Mobile)"
data-testid="sidebar-toggle"
>
<PanelLeft className="h-5 w-5 transition-all group-hover:scale-110" />
<span className="sr-only">Toggle Sidebar</span>
</button>
)}
<ThemeToggle />
{/* <SidebarIcon icon={BrainCircuit} label="Query" active /> */}
<SidebarIcon
icon={Waypoints}
label="Schema"
<SidebarIcon
icon={Waypoints}
label="Schema"
active={isSchemaOpen}
onClick={onSchemaClick}
testId="schema-button"
/>
</nav>

Expand All@@ -118,8 +124,8 @@ const Sidebar = ({ className, onSchemaClick, isSchemaOpen, isCollapsed = false,
</div>

<nav className="flex flex-col items-center gap-4 px-2 py-4">
<SidebarIcon icon={BookOpen} label="Documentation" href="https://docs.falkordb.com/" />
<SidebarIcon icon={LifeBuoy} label="Support" href="https://discord.com/invite/jyUgBweNQz" />
<SidebarIcon icon={BookOpen} label="Documentation" href="https://docs.falkordb.com/"testId="documentation-link"/>
<SidebarIcon icon={LifeBuoy} label="Support" href="https://discord.com/invite/jyUgBweNQz"testId="support-link"/>
{/* <SidebarIcon icon={Settings} label="Settings" /> */}
</nav>
</aside>
Expand Down
3 changes: 2 additions & 1 deletionapp/src/components/schema/SchemaViewer.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -405,12 +405,13 @@ const SchemaViewer = ({ isOpen, onClose, onWidthChange, sidebarWidth = 64 }: Sch

{/* Schema Viewer */}
<div
data-testid="schema-panel"
className={`fixed top-0 h-full bg-gray-900 border-r border-gray-700 flex flex-col transition-all duration-300
${isOpen ? 'translate-x-0' : '-translate-x-full pointer-events-none'}
md:z-30 z-50
w-[80vw] max-w-[400px] md:max-w-none
`}
style={{
style={{
...(isOpen && window.innerWidth >= 768 ? {
left: `${sidebarWidth}px`,
width: `${width}px`
Expand Down
1 change: 1 addition & 0 deletionsapp/src/components/ui/theme-toggle.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,7 @@ const ThemeToggle = () => {
onClick={toggleTheme}
className="flex h-10 w-10 items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-gray-800 hover:text-white"
aria-label="Toggle theme"
data-testid="theme-toggle"
>
{getIcon()}
<span className="sr-only">{getTooltipText()}</span>
Expand Down
141 changes: 141 additions & 0 deletionse2e/logic/pom/sidebar.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
import { Locator } from "@playwright/test";
import { waitForElementToBeVisible } from "../../infra/utils";
import { HomePage } from "./homePage";

/**
* Sidebar class extends HomePage to have access to all page elements
* while providing sidebar-specific locators and methods.
*
* Additionally, since this extends HomePage, you can access:
* - All database-related methods (clickOnConnectDatabase, etc.)
* - All chat-related methods
* - All other page elements
*/
export class Sidebar extends HomePage {
// ==================== LAYER 1: SIDEBAR LOCATORS ====================

private get sidebarToggleBtn(): Locator {
return this.page.getByTestId("sidebar-toggle");
}

private get themeToggleBtn(): Locator {
return this.page.getByTestId("theme-toggle");
}

private get schemaBtn(): Locator {
return this.page.getByTestId("schema-button");
}

private get docsLink(): Locator {
return this.page.getByTestId("documentation-link");
}

private get supportBtn(): Locator {
return this.page.getByTestId("support-link");
}

private get schemaPanel(): Locator {
return this.page.getByTestId("schema-panel");
}

// ==================== LAYER 2: INTERACT WITH VISIBLE ====================

private async interactWithSidebarToggleBtn(): Promise<Locator> {
const isVisible = await waitForElementToBeVisible(this.sidebarToggleBtn);
if (!isVisible) throw new Error("Sidebar toggle is not visible!");
return this.sidebarToggleBtn;
}

private async interactWithThemeToggleBtn(): Promise<Locator> {
const isVisible = await waitForElementToBeVisible(this.themeToggleBtn);
if (!isVisible) throw new Error("Theme toggle is not visible!");
return this.themeToggleBtn;
}

private async interactWithSchemaBtn(): Promise<Locator> {
const isVisible = await waitForElementToBeVisible(this.schemaBtn);
if (!isVisible) throw new Error("Schema button is not visible!");
return this.schemaBtn;
}

private async interactWithDocsLink(): Promise<Locator> {
const isVisible = await waitForElementToBeVisible(this.docsLink);
if (!isVisible) throw new Error("Documentation link is not visible!");
return this.docsLink;
}

private async interactWithSupportBtn(): Promise<Locator> {
const isVisible = await waitForElementToBeVisible(this.supportBtn);
if (!isVisible) throw new Error("Support link is not visible!");
return this.supportBtn;
}

// ==================== LAYER 3: HIGH-LEVEL ACTIONS ====================

async clickOnSidebarToggle(): Promise<void> {
const element = await this.interactWithSidebarToggleBtn();
await element.click();
}

async clickOnThemeToggle(): Promise<void> {
const element = await this.interactWithThemeToggleBtn();
await element.click();
}

async clickOnSchemaButton(): Promise<void> {
const element = await this.interactWithSchemaBtn();
await element.click();
}

async clickOnDocumentationLink(): Promise<void> {
const element = await this.interactWithDocsLink();
await element.click();
}

async clickOnSupportLink(): Promise<void> {
const element = await this.interactWithSupportBtn();
await element.click();
}

// ==================== VERIFICATION METHODS ====================

async isSidebarToggleVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.sidebarToggleBtn);
}

async isThemeToggleVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.themeToggleBtn);
}

async isSchemaButtonVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.schemaBtn);
}

async isDocumentationLinkVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.docsLink);
}

async isSupportLinkVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.supportBtn);
}

async getDocumentationLinkHref(): Promise<string | null> {
const element = await this.interactWithDocsLink();
return await element.getAttribute('href');
}

async getSupportLinkHref(): Promise<string | null> {
const element = await this.interactWithSupportBtn();
return await element.getAttribute('href');
}

async getCurrentTheme(): Promise<string | null> {
return await this.page.evaluate(() => {
return document.documentElement.getAttribute('data-theme');
});
}

async isSchemaPanelVisible(): Promise<boolean> {
return await waitForElementToBeVisible(this.schemaPanel);
}
}
67 changes: 67 additions & 0 deletionse2e/tests/sidebar.spec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
import { test, expect } from '@playwright/test';
import { getBaseUrl } from '../config/urls';
import { Sidebar } from '../logic/pom/sidebar';
import BrowserWrapper from '../infra/ui/browserWrapper';

// Sidebar tests - uses authenticated storageState from auth.setup
test.describe('Left Sidebar Tests', () => {
let browser: BrowserWrapper;

test.beforeEach(async () => {
browser = new BrowserWrapper();
});

test.afterEach(async () => {
await browser.closeBrowser();
});

test('theme toggle changes theme between light and dark', async () => {
const sidebar = await browser.createNewPage(Sidebar, getBaseUrl());
await browser.setPageToFullScreen();

const initialTheme = await sidebar.getCurrentTheme();
expect(initialTheme).toBe('dark');
await sidebar.clickOnThemeToggle();

const afterToggleTheme = await sidebar.getCurrentTheme();
expect(afterToggleTheme).toBe('light');

await sidebar.clickOnThemeToggle();

const finalTheme = await sidebar.getCurrentTheme();
expect(finalTheme).toBe('dark');
});

test('documentation link points to correct URL', async () => {
const sidebar = await browser.createNewPage(Sidebar, getBaseUrl());
await browser.setPageToFullScreen();

const docHref = await sidebar.getDocumentationLinkHref();
expect(docHref).toBe('https://docs.falkordb.com/');
});

test('support link points to correct URL', async () => {
const sidebar = await browser.createNewPage(Sidebar, getBaseUrl());
await browser.setPageToFullScreen();

const supportHref = await sidebar.getSupportLinkHref();
expect(supportHref).toBe('https://discord.com/invite/jyUgBweNQz');
});

test('schema button opens and closes schema panel', async () => {
const sidebar = await browser.createNewPage(Sidebar, getBaseUrl());
await browser.setPageToFullScreen();

const isInitiallyClosed = await sidebar.isSchemaPanelVisible();
expect(isInitiallyClosed).toBeFalsy();
await sidebar.clickOnSchemaButton();

const isOpen = await sidebar.isSchemaPanelVisible();
expect(isOpen).toBeTruthy();

await sidebar.clickOnSchemaButton();

const isClosedAgain = await sidebar.isSchemaPanelVisible();
expect(isClosedAgain).toBeFalsy();
});
});

[8]ページ先頭

©2009-2025 Movatter.jp