-
Notifications
You must be signed in to change notification settings - Fork 5.9k
/
Copy pathuploads.test.ts
56 lines (46 loc) · 1.99 KB
/
uploads.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
await codeServerPage.openContextMenu('span:has-text("test-directory")')
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
await codeServerPage.openContextMenu('span:has-text("test-directory")')
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)
})
})