-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import { login } from "./login"; | ||
import { test, expect } from '@playwright/test'; | ||
import { login } from './login'; | ||
|
||
test.beforeEach(login("/folders")); | ||
test.beforeEach(login('/folders')); | ||
|
||
test.describe("Open", () => { | ||
test.describe('Open', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.waitForSelector(".big-icon"); | ||
await page.waitForSelector('.big-icon'); | ||
await page.waitForTimeout(500); | ||
}); | ||
|
||
test("Look for Folders", async ({ page }) => { | ||
const ct = await page.locator(".big-icon").count(); | ||
expect(ct, "Number of folders").toBe(2); | ||
test('Look for Folders', async ({ page }) => { | ||
const ct = await page.locator('.big-icon').count(); | ||
expect(ct, 'Number of folders').toBe(2); | ||
}); | ||
|
||
test("Open folder", async ({ page }) => { | ||
await page.locator("text=Local").click(); | ||
test('Open folder', async ({ page }) => { | ||
await page.locator('text=Local').click(); | ||
await page.waitForTimeout(2000); | ||
const elems = await page.locator(".img-outer").all(); | ||
const elems = await page.locator('.img-outer').all(); | ||
expect(elems.length).toBeGreaterThanOrEqual(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { expect, PlaywrightTestArgs } from "@playwright/test"; | ||
import { expect, PlaywrightTestArgs } from '@playwright/test'; | ||
|
||
export function login(route: string) { | ||
return async ({ page }: PlaywrightTestArgs) => { | ||
await page.setViewportSize({ width: 800, height: 600 }); | ||
await page.goto("http://localhost:8080/index.php/apps/memories" + route); | ||
await page.goto('http://localhost:8080/index.php/apps/memories' + route); | ||
|
||
await page.locator("#user").click(); | ||
await page.locator("#user").fill("admin"); | ||
await page.locator("#user").press("Tab"); | ||
await page.locator("#password").fill("password"); | ||
await page.locator('#user').click(); | ||
await page.locator('#user').fill('admin'); | ||
await page.locator('#user').press('Tab'); | ||
await page.locator('#password').fill('password'); | ||
await page.locator('button[type="submit"]').click(); | ||
await expect(page).toHaveURL( | ||
"http://localhost:8080/index.php/apps/memories" + route | ||
); | ||
await expect(page).toHaveURL('http://localhost:8080/index.php/apps/memories' + route); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters