From 3583bd724a67aef846f8e24adce91f9cb807d9ec Mon Sep 17 00:00:00 2001 From: oat Date: Wed, 6 Dec 2023 11:12:38 +0700 Subject: [PATCH] playwright: testlistview --- Services/client/tests/listview.spec.ts | 85 ++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Services/client/tests/listview.spec.ts diff --git a/Services/client/tests/listview.spec.ts b/Services/client/tests/listview.spec.ts new file mode 100644 index 0000000..b76da61 --- /dev/null +++ b/Services/client/tests/listview.spec.ts @@ -0,0 +1,85 @@ +import { test, expect, Page } from '@playwright/test' + +test.describe.configure({ mode: 'serial' }) + +let page: Page + +test.beforeAll(async ({ browser }) => { + page = await browser.newPage() +}) + +test.afterAll(async () => { + await page.close() +}) + +test('Login', async ({}) => { + await page.goto('http://localhost:3010/admin') + await expect(page).toHaveTitle('Sign in to EDM') + await page.fill("input[name='username']", 'admin') + await page.fill("input[name='password']", 'P@ssw0rd') + await page.click("input[name='login']") +}) + +test('listViewMode', async () => { + await page.click("(//i[@role='img'])[2]") +}) + +test('Create Cabinet', async () => { + await page.click("//span[text()='สร้างตู้เก็บเอกสาร']") + await page.fill("(//input[@placeholder='กรอกชื่อ'])[2]", 'oat-test') + await page.click("(//span[text()='บันทึก'])[3]") +}) + +test('Go into Cabinet', async () => { + await page.click('//td[contains(text(),"oat-test")]') +}) + +test('Create Drawer', async () => { + await page.click("//span[text()='สร้างลิ้นชัก']") + await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]", 'oat-drawer2') + await page.click("(//button[@type='submit'])[3]") +}) + +test('Go into Drawer', async () => { + await page.click("(//td[@class='q-td'])[2]") +}) + +test('Create Folder', async () => { + await page.click("//span[text()='สร้างแฟ้ม']") + await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]", 'oat-folder2') + await page.click("(//span[text()='บันทึก'])[2]") +}) + +test('Go into Folder', async () => { + await page.click("//table[@class='q-table']") +}) + +test('Create subFolder', async () => { + await page.click("//span[text()='สร้างแฟ้มย่อย']") + await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]","oat-subfolder2") + await page.click("(//span[text()='บันทึก'])[2]") +}) + +test('Go into SubFolder', async () => { + await page.click("//table[@class='q-table']") +}) + +test('Upload File', async () => { + await page.click("//span[text()='สร้างเอกสาร']") + await page.locator("//input[@type='file']").setInputFiles('tests/test.docx') + await page.fill("//input[@placeholder='กรอกชื่อเรื่อง']",'oattest2') + await page.click("(//button[@type='submit'])[2]") + await page.click("//span[text()='ดำเนินการต่อ']") + await page.waitForTimeout(2000) + await page.click("//i[text()='refresh']") + await page.waitForTimeout(2000) +}) + +test('Go into File', async () => { + await page.click("//table[@class='q-table']/tbody[1]/tr[1]/td[1]") +}) + +test('Download File', async () => { + await page.click("//span[text()='ดาวน์โหลด']") + await page.waitForTimeout(3000) +})