diff --git a/e2e/createGraph.spec.ts b/e2e/createGraph.spec.ts new file mode 100644 index 00000000..d360c665 --- /dev/null +++ b/e2e/createGraph.spec.ts @@ -0,0 +1,13 @@ +import { test } from '@playwright/test'; + +test('create graph', async ({ page }) => { + await page.goto('http://localhost:3000/login'); + await page.getByRole('button', { name: 'Connect' }).click(); + await page.getByText('Select Graph...').click(); + await page.getByRole('button', { name: 'Create new Graph...' }).click(); + await page.getByPlaceholder('Graph name').fill('falkorDB'); + await page.getByRole('button', { name: 'Create' }).click(); + await page.getByPlaceholder('MATCH (n) OPTIONAL MATCH (n').fill('CREATE (:Rider {name:\'Valentino Rossi\'})-[:rides]->(:Team {name:\'Yamaha\'}), (:Rider {name:\'Dani Pedrosa\'})-[:rides]->(:Team {name:\'Honda\'}), (:Rider {name:\'Andrea Dovizioso\'})-[:rides]->(:Team {name:\'Ducati\'})'); + await page.getByRole('button').first().click(); + await page.getByText("falkorDB").first().click() +}); \ No newline at end of file diff --git a/e2e/graph.spec.ts b/e2e/graph.spec.ts new file mode 100644 index 00000000..5d97bf5e --- /dev/null +++ b/e2e/graph.spec.ts @@ -0,0 +1,29 @@ +import { expect, test } from '@playwright/test'; + +test.beforeEach(async ({ page }) => { + await page.goto('http://localhost:3000/login'); + await page.getByRole('button', { name: 'Connect' }).click(); + await page.getByText('Select Graph...').click(); + await page.getByRole('button', { name: 'Create new Graph...' }).click(); + await page.getByPlaceholder('Graph name').fill('falkorDB'); + await page.getByRole('button', { name: 'Create' }).click(); + await page.waitForTimeout(2000) + await page.getByPlaceholder('MATCH (n) OPTIONAL MATCH (n)').fill('CREATE (:Rider {name:\'Valentino Rossi\'})-[:rides]->(:Team {name:\'Yamaha\'}), (:Rider {name:\'Dani Pedrosa\'})-[:rides]->(:Team {name:\'Honda\'}), (:Rider {name:\'Andrea Dovizioso\'})-[:rides]->(:Team {name:\'Ducati\'})'); + await page.getByRole('button').first().click(); + await page.getByPlaceholder('MATCH (n) OPTIONAL MATCH (n)').click({ clickCount: 3 }); + await page.getByPlaceholder('MATCH (n) OPTIONAL MATCH (n)').fill(''); +}); + +test('delete graph', async ({ page }) => { + await page.getByRole('button').nth(1).click(); + await page.getByRole('button', { name: 'Delete graph' }).click(); + await page.getByRole('button', { name: 'Delete' }).click(); + await page.getByText('Select Graph...').click() +}); + +test('tabs navigation', async ({ page }) => { + await page.getByRole('button').first().click(); + await page.getByRole('tab', {name: 'Graph'}).click(); + await page.getByRole('tab', {name: 'Data'}).first().click(); + await page.getByRole('tab', {name: 'Metadata'}).click(); +}); \ No newline at end of file diff --git a/e2e/homePage.spec.ts b/e2e/homePage.spec.ts new file mode 100644 index 00000000..47a65ada --- /dev/null +++ b/e2e/homePage.spec.ts @@ -0,0 +1,18 @@ +import { expect, test } from '@playwright/test'; + +test.beforeEach(async ({ page }) => { + await page.goto('http://localhost:3000/'); +}); + +test('connect', async ({ page }) => { + await page.getByRole('button').click(); + await page.waitForURL('http://localhost:3000/login'); + expect(page.url()).toBe('http://localhost:3000/login'); + +}); + +test('themes', async ({ page }) => { + await page.getByLabel('system mode').click(); + await page.getByLabel('dark mode').click(); + expect(page.getByLabel('light mode')).toBeVisible(); +}); \ No newline at end of file diff --git a/e2e/login.spec.ts b/e2e/login.spec.ts index 97a1fa66..271f2331 100644 --- a/e2e/login.spec.ts +++ b/e2e/login.spec.ts @@ -1,12 +1,11 @@ -import { test } from '@playwright/test'; +import { expect, test } from '@playwright/test'; test.beforeEach(async ({ page }) => { - await page.goto('http://localhost:3000/'); + await page.goto('http://localhost:3000/login'); }); -test('connect', async ({ page }) => { +test('login', async ({ page }) => { await page.getByRole('button', { name: 'Connect' }).click(); - await page.getByRole('button', { name: 'Connect' }).click(); - - await page.getByText('Select Graph...').click(); + await page.waitForURL("http://localhost:3000/graph"); + expect(page.url()).toBe("http://localhost:3000/graph"); }); \ No newline at end of file diff --git a/e2e/simple.spec.ts b/e2e/simple.spec.ts deleted file mode 100644 index 8fe982c0..00000000 --- a/e2e/simple.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test.beforeEach(async ({ page }) => { - await page.goto('http://localhost:3000/'); -}); - -test('has title', async ({ page }) => { - await expect(page).toHaveTitle(/FalkorDB Browser/); -}); - -test('dark-mode', async ({ page }) => { - await page.getByLabel('system mode').click(); - await page.getByLabel('dark mode').click(); - await page.getByLabel('light mode').click(); -}); \ No newline at end of file