Skip to content

Commit

Permalink
test and list update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gallayl committed Jun 2, 2024
1 parent 545e2f2 commit e81f4b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions e2e/file-browser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test'
import { assertAndDismissNoty, login, uploadFile } from './helpers'
import { join } from 'path'
import { readFileSync } from 'fs'
import { readFile } from 'fs/promises'

test.describe('File Browser', () => {
test('Should be able to create a drive in the temp directory', async ({ page, browserName }) => {
Expand Down Expand Up @@ -32,13 +32,17 @@ test.describe('File Browser', () => {
await page.getByText('- No Data -')
})

test.only('Should able to upload a file', async ({ page }) => {
test('Should able to upload a file', async ({ page }) => {
await page.goto('/')
await login(page)
await page.locator('icon-url-widget', { hasText: 'File Browser' }).click()
await uploadFile(page, './e2e/test-files/upload.md', 'text/markdown')
await assertAndDismissNoty(page, 'File uploaded successfully')
await page.getByText('upload.md').nth(1).dblclick()

await page.getByText('upload.md').doubleClick()
const fileContent = await readFile('./e2e/test-files/upload.md', { encoding: 'utf-8' })
const editor = await page.locator('monaco-editor').getByRole('textbox')
await expect(fileContent.replace(/[^a-zA-Z ]/g, '')).toContain(
(await editor.inputValue()).replace(/[^a-zA-Z ]/g, ''),
)
})
})
4 changes: 4 additions & 0 deletions frontend/src/pages/file-browser/folder-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export const FolderPanel = Shade<{
})
onFileListChange(fileList)

useDisposable('onFilesystemChanged', () =>
drivesService.subscribe('onFilesystemChanged', () => drivesService.getFileList(letter, path)),
)

service.hasFocus.setValue(!!props.focused)

element.style.height = '100%'
Expand Down
1 change: 0 additions & 1 deletion frontend/src/services/drives-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export class DrivesService extends EventHub<{ onFilesystemChanged: DrivesFilesys
action: '/files/:letter/:path',
url: { letter, path },
})
this.fileListCache.flushAll()
return removeResult
}

Expand Down

0 comments on commit e81f4b2

Please sign in to comment.