chore: อัพไฟล์เทส

This commit is contained in:
oat 2023-12-15 09:50:44 +07:00
parent 73f62e4d56
commit 1ff48d94aa
3 changed files with 188 additions and 15 deletions

View file

@ -1,5 +1,5 @@
import { test, expect, Page } from '@playwright/test'
import { nanoid } from 'nanoid'
test.describe.configure({ mode: 'serial' })
let page: Page
@ -21,23 +21,26 @@ test('Login', async ({}) => {
})
test('listViewMode', async () => {
await page.click("(//i[@role='img'])[2]")
await page.click("//i[text()='view_list']")
})
test('Create Cabinet', async () => {
await page.click("//span[text()='สร้างตู้เก็บเอกสาร']")
await page.fill("(//input[@placeholder='กรอกชื่อ'])[2]", 'oat-test')
await page.click("(//span[text()='บันทึก'])[3]")
await page.fill("//input[@placeholder='กรอกชื่อ']", 'oat-test')
await page.click("//button[@type='submit']")
})
test('Go into Cabinet', async () => {
await page.click('//td[contains(text(),"oat-test")]')
})
var drawername = nanoid(7)
test('Create Drawer', async () => {
await page.click("//span[text()='สร้างลิ้นชัก']")
await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]", 'oat-drawer2')
await page.click("(//button[@type='submit'])[3]")
await page.fill("(//input[@class='q-field__native q-placeholder'])[2]", drawername)
await page.click("(//button[@type='submit'])")
})
test('Go into Drawer', async () => {
@ -46,18 +49,18 @@ test('Go into Drawer', async () => {
test('Create Folder', async () => {
await page.click("//span[text()='สร้างแฟ้ม']")
await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]", 'oat-folder2')
await page.click("(//span[text()='บันทึก'])[2]")
await page.fill("(//input[@class='q-field__native q-placeholder'])[2]", 'oat-folder')
await page.click("(//button[@type='submit'])")
})
test('Go into Folder', async () => {
await page.click("//table[@class='q-table']")
await page.click("//table[@class='q-table']/tbody[1]/tr[1]/td[1]")
})
test('Create subFolder', async () => {
await page.click("//span[text()='สร้างแฟ้มย่อย']")
await page.fill("(//input[@placeholder='กรอกชื่อ'])[1]","oat-subfolder2")
await page.click("(//span[text()='บันทึก'])[2]")
await page.fill("(//input[@class='q-field__native q-placeholder'])[2]","oat-subfolder")
await page.click("//span[text()='บันทึก']")
})
test('Go into SubFolder', async () => {
@ -67,15 +70,15 @@ test('Go into SubFolder', async () => {
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.fill("//input[@placeholder='กรอกชื่อเรื่อง']",'oattestfile')
await page.click("(//button[@type='submit'])[1]")
await page.waitForTimeout(3000)
await page.click("//i[text()='refresh']")
await page.click("button#getFolder")
await page.waitForTimeout(1000)
})
test('Go into File', async () => {
await page.click("//table[@class='q-table']/tbody[1]/tr[1]/td[1]")
await page.click('//td[contains(text(),"test.docx")]')
})
test('Download File', async () => {