Skip to content

Commit

Permalink
tests: cypress drag and drop
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Apr 3, 2024
1 parent d676c2e commit ee14ee1
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
59 changes: 59 additions & 0 deletions cypress/e2e/files/FileSystemAPIUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { basename } from 'node:path'

class FileSystemEntry {

private _isFile: boolean
private _fullPath: string

constructor(isFile: boolean, fullPath: string) {
this._isFile = isFile
this._fullPath = fullPath
}

get isFile() {
return !!this._isFile
}

get isDirectory() {
return !this.isFile
}

get name() {
return basename(this._fullPath)
}

}

export class FileSystemFileEntry extends FileSystemEntry {

private _contents: string

constructor(fullPath: string, contents: string) {
super(true, fullPath)
this._contents = contents
}

file(success: (file: File) => void) {
success(new File([this._contents], this.name))
}

}

export class FileSystemDirectoryEntry extends FileSystemEntry {

private _entries: FileSystemEntry[]

constructor(fullPath: string, entries: FileSystemEntry[]) {
super(false, fullPath)
this._entries = entries || []
}

createReader() {
return {
readEntries: (success: (entries: FileSystemEntry[]) => void) => {
success(this._entries)
},
}
}

}
2 changes: 1 addition & 1 deletion cypress/e2e/files/drag-n-drop.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getRowForFile } from './FilesUtils.ts'

describe('files: Drag and Drop', { testIsolation: true }, () => {
describe('files: Drag and Drop legacy', { testIsolation: true }, () => {
beforeEach(() => {
cy.createRandomUser().then((user) => {
cy.login(user)
Expand Down

0 comments on commit ee14ee1

Please sign in to comment.