From 898ec7fbbf3e51be1094e612fd30664d307c1e18 Mon Sep 17 00:00:00 2001 From: Naoto Ono Date: Sun, 10 Dec 2023 20:06:20 +0900 Subject: [PATCH] Stop running UI tests --- .github/workflows/ui-test.yaml | 24 -- package.json | 3 +- src/ui-test/config.ts | 7 - src/ui-test/suite/debug-test.ts | 372 ------------------ .../testdata/bindingBreak/.vscode/launch.json | 16 - src/ui-test/testdata/bindingBreak/test.rb | 9 - .../importAnotherFile/.vscode/launch.json | 16 - src/ui-test/testdata/importAnotherFile/bar.rb | 2 - src/ui-test/testdata/importAnotherFile/foo.rb | 10 - .../simpleProgram/.vscode/launch.json | 16 - src/ui-test/testdata/simpleProgram/test.rb | 5 - 11 files changed, 1 insertion(+), 479 deletions(-) delete mode 100644 .github/workflows/ui-test.yaml delete mode 100644 src/ui-test/config.ts delete mode 100644 src/ui-test/suite/debug-test.ts delete mode 100644 src/ui-test/testdata/bindingBreak/.vscode/launch.json delete mode 100644 src/ui-test/testdata/bindingBreak/test.rb delete mode 100644 src/ui-test/testdata/importAnotherFile/.vscode/launch.json delete mode 100644 src/ui-test/testdata/importAnotherFile/bar.rb delete mode 100644 src/ui-test/testdata/importAnotherFile/foo.rb delete mode 100644 src/ui-test/testdata/simpleProgram/.vscode/launch.json delete mode 100644 src/ui-test/testdata/simpleProgram/test.rb diff --git a/.github/workflows/ui-test.yaml b/.github/workflows/ui-test.yaml deleted file mode 100644 index 23ec6dbb..00000000 --- a/.github/workflows/ui-test.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: UI Test - -on: - schedule: - # This job runs at 00:00 UTC every day. - - cron: '0 0 * * *' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: head - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 16.x - - run: gem install debug - - run: npm install @types/vscode@1.65.0 - - run: xvfb-run -a npm run ui-test diff --git a/package.json b/package.json index 9bae5582..036f695e 100644 --- a/package.json +++ b/package.json @@ -400,7 +400,6 @@ "glob": "^8.1.0", "mocha": "^10.2.0", "prettier": "^3.1.0", - "typescript": "^5.3.2", - "vscode-extension-tester": "^5.10.0" + "typescript": "^5.3.2" } } diff --git a/src/ui-test/config.ts b/src/ui-test/config.ts deleted file mode 100644 index c5f9bd65..00000000 --- a/src/ui-test/config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { MochaOptions } from "vscode-extension-tester"; - -const options: MochaOptions = { - timeout: 180000, -}; - -module.exports = options; diff --git a/src/ui-test/suite/debug-test.ts b/src/ui-test/suite/debug-test.ts deleted file mode 100644 index ed14a5f2..00000000 --- a/src/ui-test/suite/debug-test.ts +++ /dev/null @@ -1,372 +0,0 @@ -import * as assert from "assert"; - -import { ActivityBar, DebugToolbar, DebugView, DefaultTreeSection, EditorView, TextEditor, TitleBar, VSBrowser, Workbench, BottomBarPanel, DebugConsoleView, SideBarView } from "vscode-extension-tester"; - -import * as path from "path"; - -const timeoutSec = 60000; -const projectRoot = path.join(__dirname, "..", "..", ".."); -const simpleProgramPath = path.join(projectRoot, "src", "ui-test", "testdata", "simpleProgram"); -const importAnotherFilePath = path.join(projectRoot, "src", "ui-test", "testdata", "importAnotherFile"); -const bindingBreakPath = path.join(projectRoot, "src", "ui-test", "testdata", "bindingBreak"); - -describe("breakpoint", () => { - describe("simpleProgram", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(simpleProgramPath, "simpleProgram", "test.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - describe("set breakpoint", () => { - it("editor", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const expected = 2; - const result = await editor.toggleBreakpoint(expected); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(expected, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - - it("debug console", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("(rdbg:command) b 3", ",b 3", debugView); - await assertEvaluate("(rdbg:command) c", ",c", debugView); - await bar.waitForBreakPoint(); - await assertLocation(3, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); - - describe("remove breakpoint", () => { - it("editor", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const expected = 2; - const result1 = await editor.toggleBreakpoint(expected); - assert.ok(result1); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(expected, view); - const result2 = await editor.toggleBreakpoint(3); - assert.ok(result2); - const result3 = await editor.toggleBreakpoint(4); - assert.ok(result3); - // remove breakpoint - const result4 = await editor.toggleBreakpoint(3); - assert.ok(!result4); - await bar.continue(); - await bar.waitForBreakPoint(); - await assertLocation(4, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - - it("debug console", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const expected = 2; - const result = await editor.toggleBreakpoint(expected); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(expected, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("(rdbg:command) b 3", ",b 3", debugView); - await assertEvaluate("(rdbg:command) b 4", ",b 4", debugView); - await assertEvaluate("deleted: #1", ",del 1", debugView); - await assertEvaluate("(rdbg:command) c", ",c", debugView); - await bar.waitForBreakPoint(); - await assertLocation(4, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); - }); - - describe("importAnotherFile", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(importAnotherFilePath, "importAnotherFile", "bar.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - it("debug tool bar", async () => { - const barFileTab = (await new EditorView().openEditor("bar.rb")) as TextEditor; - const result = await barFileTab.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - await openFile("importAnotherFile", "foo.rb"); - // Since the following error ocuurs when using openEditor('foo.rb'), getTabByTitle is used here: - // ``` - // ElementClickInterceptedError: element click intercepted: Element
resolve()); - }); - - it("debug console", async () => { - const barFileTab = (await new EditorView().openEditor("bar.rb")) as TextEditor; - const result = await barFileTab.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("BP - Line", ",b foo.rb:8", debugView); - await assertEvaluate("(rdbg:command) c", ",c", debugView); - await bar.waitForBreakPoint(); - await assertLocation(8, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); -}); - -describe("step", () => { - describe("simpleProgram", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(simpleProgramPath, "simpleProgram", "test.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - it("debug tool bar", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - await bar.stepInto(); - await assertLocation(3, view); - await bar.stepInto(); - await assertLocation(4, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - - it("debug console", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("(rdbg:command) s", ",s", debugView); - await assertLocation(3, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); -}); - -describe("next", () => { - describe("simpleProgram", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(simpleProgramPath, "simpleProgram", "test.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - it("debug tool bar", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const view = await getDebugView(); - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - await bar.stepOver(); - await assertLocation(3, view); - await bar.stepOver(); - await assertLocation(4, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - - it("debug console", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("(rdbg:command) n", ",n", debugView); - await view.click(); - await assertLocation(3, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); -}); - -describe("eval", () => { - describe("simpleProgram", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(simpleProgramPath, "simpleProgram", "test.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - it("debug console", async () => { - const editor = (await new EditorView().openEditor("test.rb")) as TextEditor; - const result = await editor.toggleBreakpoint(2); - assert.ok(result); - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(2, view); - const debugView = await new BottomBarPanel().openDebugConsoleView(); - await assertEvaluate("1", "a", debugView); - await assertEvaluate("nil", "b", debugView); - await bar.stepOver(); - await assertLocation(3, view); - await assertEvaluate("2", "b", debugView); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); - }); -}); - -describe("binding.break", () => { - beforeEach(async function () { - this.timeout(timeoutSec); - - await openSampleProgram(bindingBreakPath, "bindingBreak", "test.rb"); - }); - - afterEach(async () => { - await cleanup(); - }); - - it("debug tool bar", async () => { - const view = await getDebugView(); - await view.start(); - const bar = await DebugToolbar.create(timeoutSec); - await bar.waitForBreakPoint(); - await assertLocation(5, view); - await bar.continue(); - await assertLocation(8, view); - await bar.stop(); - return new Promise((resolve, _reject) => resolve()); - }); -}); - -async function assertLocation(expected: number, view: DebugView) { - const tree = await view.getContent().getSection("Call Stack") as DefaultTreeSection; - const items = await tree.getVisibleItems(); - if (items.length === 0) { - assert.fail("Call Stack Section is not visible"); - } - const text = await items[0].getText(); - const location = text.match(/(\d+):(\d+)$/); - if (location === null || location.length !== 3) { - assert.fail("Can't get location from Call Stack Section"); - } - const lineNumber = parseInt(location[1]); - assert.strictEqual(lineNumber, expected); -} - -async function getDebugView(): Promise { - const control = await new ActivityBar().getViewControl("Run"); - if (control === undefined) { - assert.fail("Can't find a View for debug"); - } - return await control.openView() as DebugView; -} - -async function openSampleProgram(path: string, sectionTitle: string, targetFileName: string) { - await VSBrowser.instance.openResources(path); - - await openFile(sectionTitle, targetFileName); -} - -async function openFile(sectionTitle: string, targetFileName: string) { - (await new ActivityBar().getViewControl("Explorer"))?.openView(); - - const view = new SideBarView(); - const tree = (await view.getContent().getSection(sectionTitle)) as DefaultTreeSection; - const item = await tree.findItem(targetFileName); - if (item === undefined) { - assert.fail(`Can't find item: ${item}`); - } - await item.select(); -} - -async function assertEvaluate(expected: string, expression: string, view: DebugConsoleView) { - await view.evaluateExpression(expression); - await new Promise(res => setTimeout(res, 1000)); - const text = await view.getText(); - assert.ok(text.includes(expected), `Expected to include ${expected} in ${text}, but not.`); - await view.clearText(); - await view.wait(timeoutSec); -} - -async function cleanup() { - await VSBrowser.instance.waitForWorkbench(); - await new Workbench().executeCommand("Remove All Breakpoints"); - await new Promise(res => setTimeout(res, 2000)); - await (await new ActivityBar().getViewControl("Run"))?.closeView(); - await (await new ActivityBar().getViewControl("Explorer"))?.closeView(); - await new TitleBar().select("File", "Close Folder"); - await new EditorView().closeAllEditors(); -} diff --git a/src/ui-test/testdata/bindingBreak/.vscode/launch.json b/src/ui-test/testdata/bindingBreak/.vscode/launch.json deleted file mode 100644 index 0a1cb971..00000000 --- a/src/ui-test/testdata/bindingBreak/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "rdbg", - "name": "Debug current file with rdbg", - "request": "launch", - "script": "${file}", - "args": [], - "waitLaunchTime": 40000 - } - ] -} diff --git a/src/ui-test/testdata/bindingBreak/test.rb b/src/ui-test/testdata/bindingBreak/test.rb deleted file mode 100644 index 7340fd93..00000000 --- a/src/ui-test/testdata/bindingBreak/test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'debug' - -a = 1 -b = 2 -binding.break # Program will stop here -c = 3 -d = 4 -binding.break # Program will stop here -p [a, b, c, d] diff --git a/src/ui-test/testdata/importAnotherFile/.vscode/launch.json b/src/ui-test/testdata/importAnotherFile/.vscode/launch.json deleted file mode 100644 index 0a1cb971..00000000 --- a/src/ui-test/testdata/importAnotherFile/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "rdbg", - "name": "Debug current file with rdbg", - "request": "launch", - "script": "${file}", - "args": [], - "waitLaunchTime": 40000 - } - ] -} diff --git a/src/ui-test/testdata/importAnotherFile/bar.rb b/src/ui-test/testdata/importAnotherFile/bar.rb deleted file mode 100644 index 11b48530..00000000 --- a/src/ui-test/testdata/importAnotherFile/bar.rb +++ /dev/null @@ -1,2 +0,0 @@ -require_relative 'foo' -Foo.new.foo diff --git a/src/ui-test/testdata/importAnotherFile/foo.rb b/src/ui-test/testdata/importAnotherFile/foo.rb deleted file mode 100644 index a376ab47..00000000 --- a/src/ui-test/testdata/importAnotherFile/foo.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Foo - def foo - a = 1 - foo2 - end - - def foo2 - b = 1 - end -end diff --git a/src/ui-test/testdata/simpleProgram/.vscode/launch.json b/src/ui-test/testdata/simpleProgram/.vscode/launch.json deleted file mode 100644 index 0a1cb971..00000000 --- a/src/ui-test/testdata/simpleProgram/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "rdbg", - "name": "Debug current file with rdbg", - "request": "launch", - "script": "${file}", - "args": [], - "waitLaunchTime": 40000 - } - ] -} diff --git a/src/ui-test/testdata/simpleProgram/test.rb b/src/ui-test/testdata/simpleProgram/test.rb deleted file mode 100644 index 0cb96680..00000000 --- a/src/ui-test/testdata/simpleProgram/test.rb +++ /dev/null @@ -1,5 +0,0 @@ -a = 1 -b = 2 -c = 3 -d = 4 -e = 5