提交 05a3e199 编写于 作者: WOSHIMAHAIFENG's avatar WOSHIMAHAIFENG

Merge branch 'dev_file' into 'dev'

添加file 测试用例

See merge request !10
...@@ -1143,7 +1143,6 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1143,7 +1143,6 @@ describe('ExtApi-FileManagerTest', () => {
}) })
await createFile() await createFile()
await page.setData({ await page.setData({
basePath: basePath, basePath: basePath,
temFile: 'save/1.txt', temFile: 'save/1.txt',
...@@ -1156,9 +1155,18 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1156,9 +1155,18 @@ describe('ExtApi-FileManagerTest', () => {
await page.setData({ await page.setData({
saveFileRet: '' saveFileRet: ''
}) })
await clearDir('')
});
it('saveFileSyncTest',
async () => {
let globalTempPath = await getData('globalTempPath')
let basePath = await getData('basePath')
await page.setData({
basePath: basePath
})
await clearDir('')
await page.setData({ await page.setData({
basePath: globalTempPath, basePath: globalTempPath,
temFile: 'save/2.txt', temFile: 'save/2.txt',
...@@ -1189,15 +1197,81 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1189,15 +1197,81 @@ describe('ExtApi-FileManagerTest', () => {
await btnSavedFileList.tap() await btnSavedFileList.tap()
await isDone() await isDone()
let fileListSuccess = await getData("fileListSuccess") let fileListSuccess = await getData("fileListSuccess")
expect(fileListSuccess.length).toEqual(3) expect(fileListSuccess.length > 0).toEqual(true)
await clearDir('')
});
it('getSavedFileListTest',
async () => {
let globalTempPath = await getData('globalTempPath')
let basePath = await getData('basePath')
await page.setData({
basePath: basePath
})
await clearDir('')
await page.setData({
basePath: globalTempPath,
temFile: 'save/2.txt',
mkdirFile: 'save',
writeFile: 'save/2.txt',
accessFile: '2.txt'
})
await createFile()
await page.setData({
basePath: basePath,
writeFile: 'save/2.txt',
})
btnSaveFile = await page.$('#btn-save-file-sync')
await btnSaveFile.tap()
await isDone()
let btnSavedFileList = await page.$('#btn-getsaved-filelist')
await btnSavedFileList.tap()
await isDone()
let fileListSuccess = await getData("fileListSuccess")
expect(fileListSuccess.length > 0).toEqual(true)
await clearDir('')
});
it('removeSavedFileTest',
async () => {
let globalTempPath = await getData('globalTempPath')
let basePath = await getData('basePath')
await page.setData({
basePath: basePath
})
await clearDir('')
await page.setData({
basePath: globalTempPath,
temFile: 'save/2.txt',
mkdirFile: 'save',
writeFile: 'save/2.txt',
accessFile: '2.txt'
})
await createFile()
await page.setData({
basePath: basePath,
writeFile: 'save/2.txt',
})
btnSaveFile = await page.$('#btn-save-file-sync')
await btnSaveFile.tap()
await isDone()
let btnRemoveSavedFileRet = await page.$('#btn-remove-saved-file')
await btnRemoveSavedFileRet.tap()
let removeSavedFileRet = await getData("removeSavedFileRet")
expect(removeSavedFileRet).toEqual('removeSavedFile:ok')
await clearDir('') await clearDir('')
}); });
//openFiletest openFileSynctest closeTest closeTestSync writeTest writeSyncTest //openFiletest openFileSynctest closeTest closeTestSync writeTest writeSyncTest
it('fd test', async () => { it('openFiletest', async () => {
await clearDir('') await clearDir('')
await page.setData({ await page.setData({
mkdirFile: 'fd', mkdirFile: 'fd',
...@@ -1221,8 +1295,16 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1221,8 +1295,16 @@ describe('ExtApi-FileManagerTest', () => {
await isDone() await isDone()
fd = await getData("fd") fd = await getData("fd")
expect(fd).not.toBe(''); expect(fd).not.toBe('');
});
// closeTest closeTestSync
it('closeTest', async () => {
await clearDir('')
await page.setData({
mkdirFile: 'fd',
writeFile: 'fd/1.txt',
readFile: 'fd/1.txt'
})
await createFile()
//closeTest //closeTest
let btnCloseFile = await page.$('#btn-close-file') let btnCloseFile = await page.$('#btn-close-file')
await btnCloseFile.tap() await btnCloseFile.tap()
...@@ -1239,12 +1321,17 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1239,12 +1321,17 @@ describe('ExtApi-FileManagerTest', () => {
closeFileRet = await getData("closeFileRet") closeFileRet = await getData("closeFileRet")
expect(closeFileRet).toEqual('close:ok') expect(closeFileRet).toEqual('close:ok')
//writeTest });
//writeTest writeSyncTest
it('writeTest', async () => {
await clearDir('')
await page.setData({ await page.setData({
mkdirFile: 'fd',
writeFile: 'fd/1.txt', writeFile: 'fd/1.txt',
readFile: 'fd/1.txt', readFile: 'fd/1.txt',
writeData: '我是一只小小鸟' writeData: '我是一只小小鸟'
}) })
await createFile()
let btnWrite = await page.$('#btn-write') let btnWrite = await page.$('#btn-write')
await btnWrite.tap() await btnWrite.tap()
...@@ -1259,10 +1346,10 @@ describe('ExtApi-FileManagerTest', () => { ...@@ -1259,10 +1346,10 @@ describe('ExtApi-FileManagerTest', () => {
writeData: '我是' writeData: '我是'
}) })
btnWrite = await page.$('#btn-write') btnWrite = await page.$('#btn-write')
await btnWrite.tap() await btnWrite.tap()
await isDone() await isDone()
bytesWritten = await getData("bytesWritten") bytesWritten = await getData("bytesWritten")
expect(bytesWritten).toEqual(2) expect(bytesWritten).toEqual(2)
//fstatTest //fstatTest
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册