mirror of
https://github.com/coder/code-server.git
synced 2026-04-20 09:51:06 -05:00
Disable "Show Local" button, add --disable-file-uploads option and add file operation trace level logs (#6557)
This commit is contained in:
61
test/e2e/uploads.test.ts
Normal file
61
test/e2e/uploads.test.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { promises as fs } from "fs"
|
||||
import * as path from "path"
|
||||
import { clean } from "../utils/helpers"
|
||||
import { describe, test, expect } from "./baseFixture"
|
||||
|
||||
describe("Uploads (enabled)", ["--disable-workspace-trust"], {}, () => {
|
||||
const testName = "uploads-enabled"
|
||||
test.beforeAll(async () => {
|
||||
await clean(testName)
|
||||
})
|
||||
|
||||
test("should see the 'Upload...' option", async ({ codeServerPage }) => {
|
||||
// Setup
|
||||
const workspaceDir = await codeServerPage.workspaceDir
|
||||
const tmpDirPath = path.join(workspaceDir, "test-directory")
|
||||
await fs.mkdir(tmpDirPath)
|
||||
|
||||
// Action
|
||||
const fileInExplorer = await codeServerPage.page.waitForSelector('span:has-text("test-directory")')
|
||||
await fileInExplorer.click({
|
||||
button: "right",
|
||||
})
|
||||
expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(true)
|
||||
})
|
||||
|
||||
test("should see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
||||
// Action
|
||||
await codeServerPage.navigateMenus(["File", "Open File..."])
|
||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("Uploads (disabled)", ["--disable-workspace-trust", "--disable-file-uploads"], {}, () => {
|
||||
const testName = "uploads-disabled"
|
||||
test.beforeAll(async () => {
|
||||
await clean(testName)
|
||||
})
|
||||
|
||||
test("should not see the 'Upload...' option", async ({ codeServerPage }) => {
|
||||
// Setup
|
||||
const workspaceDir = await codeServerPage.workspaceDir
|
||||
const tmpDirPath = path.join(workspaceDir, "test-directory")
|
||||
await fs.mkdir(tmpDirPath)
|
||||
|
||||
// Action
|
||||
const fileInExplorer = await codeServerPage.page.waitForSelector('span:has-text("test-directory")')
|
||||
await fileInExplorer.click({
|
||||
button: "right",
|
||||
})
|
||||
|
||||
expect(await codeServerPage.page.isVisible("text=Upload...")).toBe(false)
|
||||
})
|
||||
|
||||
test("should not see the 'Show Local' button on Open File", async ({ codeServerPage }) => {
|
||||
// Action
|
||||
await codeServerPage.navigateMenus(["File", "Open File..."])
|
||||
await codeServerPage.page.waitForSelector(".quick-input-widget")
|
||||
expect(await codeServerPage.page.isVisible("text=Show Local")).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user