Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9e40cc9d
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e40cc9d
编写于
9月 12, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
smoke test: Improve quick open behaviour
上级
526c71c4
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
54 addition
and
70 deletion
+54
-70
test/smoke/src/areas/css/css.test.ts
test/smoke/src/areas/css/css.test.ts
+3
-3
test/smoke/src/areas/debug/debug.ts
test/smoke/src/areas/debug/debug.ts
+1
-1
test/smoke/src/areas/editor/editor.test.ts
test/smoke/src/areas/editor/editor.test.ts
+1
-3
test/smoke/src/areas/editor/editor.ts
test/smoke/src/areas/editor/editor.ts
+4
-4
test/smoke/src/areas/explorer/explorer.test.ts
test/smoke/src/areas/explorer/explorer.test.ts
+5
-9
test/smoke/src/areas/extensions/extensions.test.ts
test/smoke/src/areas/extensions/extensions.test.ts
+1
-1
test/smoke/src/areas/git/git.test.ts
test/smoke/src/areas/git/git.test.ts
+1
-1
test/smoke/src/areas/multiroot/multiroot.test.ts
test/smoke/src/areas/multiroot/multiroot.test.ts
+5
-7
test/smoke/src/areas/quickopen/quickopen.ts
test/smoke/src/areas/quickopen/quickopen.ts
+30
-3
test/smoke/src/areas/terminal/terminal.ts
test/smoke/src/areas/terminal/terminal.ts
+1
-1
test/smoke/src/areas/workbench/commandPallette.ts
test/smoke/src/areas/workbench/commandPallette.ts
+0
-32
test/smoke/src/areas/workbench/workbench.ts
test/smoke/src/areas/workbench/workbench.ts
+0
-3
test/smoke/src/spectron/application.ts
test/smoke/src/spectron/application.ts
+2
-2
未找到文件。
test/smoke/src/areas/css/css.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -15,10 +15,10 @@ describe('CSS', () => {
it
(
'
verifies quick outline
'
,
async
()
=>
{
await
app
.
workbench
.
quickopen
.
openFile
(
'
style.css
'
);
const
outline
=
await
app
.
workbench
.
editor
.
openOutline
();
const
elements
=
await
outline
.
getQuickOpenElements
();
await
app
.
screenCapturer
.
capture
(
'
CSS Outline result
'
);
assert
.
equal
(
elements
.
length
,
2
,
`Did not find two outline elements`
);
await
outline
.
waitForQuickOpenElements
(
2
);
});
it
(
'
verifies warnings for the empty rule
'
,
async
()
=>
{
...
...
test/smoke/src/areas/debug/debug.ts
浏览文件 @
9e40cc9d
...
...
@@ -104,7 +104,7 @@ export class Debug extends Viewlet {
}
async
console
(
text
:
string
,
type
:
string
):
Promise
<
string
>
{
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Debug: Focus Debug Console
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
Debug: Focus Debug Console
'
);
await
this
.
spectron
.
client
.
waitForElement
(
REPL_FOCUSED
);
await
this
.
spectron
.
client
.
type
(
text
);
await
this
.
spectron
.
client
.
waitForElement
(
CONSOLE_INPUT_OUTPUT
+
` .
${
type
}
`
);
...
...
test/smoke/src/areas/editor/editor.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -18,9 +18,7 @@ describe('Editor', () => {
const
outline
=
await
app
.
workbench
.
editor
.
openOutline
();
const
symbols
=
await
outline
.
getQuickOpenElements
();
await
app
.
screenCapturer
.
capture
(
'
Javascript Outline result
'
);
assert
.
equal
(
symbols
.
length
,
12
,
'
Quick outline elements count does not match to expected.
'
);
await
outline
.
waitForQuickOpenElements
(
12
);
});
it
(
`finds 'All References' to 'app'`
,
async
function
()
{
...
...
test/smoke/src/areas/editor/editor.ts
浏览文件 @
9e40cc9d
...
...
@@ -35,7 +35,7 @@ export class Editor {
public
async
findReferences
(
term
:
string
,
line
:
number
):
Promise
<
References
>
{
await
this
.
clickOnTerm
(
term
,
line
);
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Find All References
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
Find All References
'
);
const
references
=
new
References
(
this
.
spectron
);
await
references
.
waitUntilOpen
();
return
references
;
...
...
@@ -43,7 +43,7 @@ export class Editor {
public
async
rename
(
term
:
string
,
line
:
number
):
Promise
<
Rename
>
{
await
this
.
clickOnTerm
(
term
,
line
);
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Rename Symbol
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
Rename Symbol
'
);
const
rename
=
new
Rename
(
term
,
this
.
spectron
);
await
rename
.
waitUntilOpen
();
return
rename
;
...
...
@@ -51,12 +51,12 @@ export class Editor {
public
async
gotoDefinition
(
term
:
string
,
line
:
number
):
Promise
<
void
>
{
await
this
.
clickOnTerm
(
term
,
line
);
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Go to Definition
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
Go to Definition
'
);
}
public
async
peekDefinition
(
term
:
string
,
line
:
number
):
Promise
<
References
>
{
await
this
.
clickOnTerm
(
term
,
line
);
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
Peek Definition
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
Peek Definition
'
);
const
peek
=
new
References
(
this
.
spectron
);
await
peek
.
waitUntilOpen
();
return
peek
;
...
...
test/smoke/src/areas/explorer/explorer.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
}
from
'
../../spectron/application
'
;
describe
(
'
Explorer
'
,
()
=>
{
...
...
@@ -14,22 +13,19 @@ describe('Explorer', () => {
it
(
'
quick open search produces correct result
'
,
async
function
()
{
await
app
.
workbench
.
quickopen
.
openQuickOpen
();
await
app
.
client
.
type
(
'
.js
'
);
const
elements
=
await
app
.
workbench
.
quickopen
.
getQuickOpenElements
();
await
app
.
client
.
keys
([
'
Escape
'
,
'
NULL
'
]);
await
app
.
screenCapturer
.
capture
(
'
Quick open result
'
);
a
ssert
.
equal
(
elements
.
length
,
7
,
'
There are 7 elements in quick open
'
);
await
app
.
workbench
.
quickopen
.
waitForQuickOpenElements
(
7
);
a
wait
app
.
client
.
keys
([
'
Escape
'
,
'
NULL
'
]
);
});
it
(
'
quick open respects fuzzy matching
'
,
async
function
()
{
await
app
.
workbench
.
quickopen
.
openQuickOpen
();
await
app
.
client
.
type
(
'
a.s
'
);
const
elements
=
await
app
.
workbench
.
quickopen
.
getQuickOpenElements
(
);
await
app
.
workbench
.
quickopen
.
waitForQuickOpenElements
(
3
);
await
app
.
client
.
keys
([
'
Escape
'
,
'
NULL
'
]);
await
app
.
screenCapturer
.
capture
(
'
fuzzy match result
'
);
assert
.
equal
(
elements
.
length
,
3
,
'
There are 3 elements in quick open
'
);
});
});
\ No newline at end of file
test/smoke/src/areas/extensions/extensions.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -22,7 +22,7 @@ describe('Extensions', () => {
await
app
.
reload
();
await
app
.
workbench
.
extensions
.
waitForExtensionsViewlet
();
await
app
.
workbench
.
commandPallette
.
runCommand
(
'
Smoke Test Check
'
);
await
app
.
workbench
.
quickopen
.
runCommand
(
'
Smoke Test Check
'
);
const
statusbarText
=
await
app
.
workbench
.
statusbar
.
getStatusbarTextByTitle
(
'
smoke test
'
);
await
app
.
screenCapturer
.
capture
(
'
Statusbar
'
);
...
...
test/smoke/src/areas/git/git.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -68,7 +68,7 @@ describe('Git', () => {
await
app
.
workbench
.
scm
.
commit
(
'
first commit
'
);
await
app
.
client
.
waitForText
(
SYNC_STATUSBAR
,
'
0↓ 1↑
'
);
await
app
.
workbench
.
commandPallette
.
runCommand
(
'
Git: Stage All Changes
'
);
await
app
.
workbench
.
quickopen
.
runCommand
(
'
Git: Stage All Changes
'
);
await
app
.
workbench
.
scm
.
waitForChange
(
c
=>
c
.
name
===
'
index.jade
'
&&
c
.
type
===
'
Index Modified
'
);
await
app
.
workbench
.
scm
.
commit
(
'
second commit
'
);
...
...
test/smoke/src/areas/multiroot/multiroot.test.ts
浏览文件 @
9e40cc9d
...
...
@@ -5,7 +5,6 @@
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
,
CODE_WORKSPACE_PATH
,
VSCODE_BUILD
}
from
'
../../spectron/application
'
;
import
{
QuickOpen
}
from
'
../quickopen/quickopen
'
;
import
{
Window
}
from
'
../window
'
;
describe
(
'
Multi Root
'
,
()
=>
{
...
...
@@ -19,12 +18,11 @@ describe('Multi Root', () => {
beforeEach
(
function
()
{
app
.
screenCapturer
.
testName
=
this
.
currentTest
.
title
;
});
it
(
'
shows results from all folders
'
,
async
function
()
{
let
quickOpen
=
new
QuickOpen
(
app
);
await
quickOpen
.
openQuickOpen
();
await
app
.
client
.
type
(
'
*.*
'
);
const
elements
=
await
quickOpen
.
getQuickOpenElements
();
await
app
.
screenCapturer
.
capture
(
'
quick open result
'
);
assert
.
equal
(
elements
.
length
,
6
);
await
app
.
workbench
.
quickopen
.
openQuickOpen
();
await
app
.
workbench
.
quickopen
.
type
(
'
*.*
'
);
await
app
.
workbench
.
quickopen
.
waitForQuickOpenElements
(
6
);
});
it
(
'
shows workspace name in title
'
,
async
function
()
{
...
...
test/smoke/src/areas/quickopen/quickopen.ts
浏览文件 @
9e40cc9d
...
...
@@ -8,6 +8,10 @@ import { Element } from 'webdriverio';
export
class
QuickOpen
{
static
QUICK_OPEN_HIDDEN
=
'
div.quick-open-widget[aria-hidden="true"]
'
;
static
QUICK_OPEN
=
'
div.quick-open-widget[aria-hidden="false"]
'
;
static
QUICK_OPEN_FOCUSSED_INPUT
=
`
${
QuickOpen
.
QUICK_OPEN
}
.quick-open-input input:focus`
;
static
QUICK_OPEN_FOCUSED_ELEMENT
=
`
${
QuickOpen
.
QUICK_OPEN
}
.quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label`
;
static
QUICK_OPEN_ENTRY_SELECTOR
=
'
div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties .monaco-tree-row .quick-open-entry
'
;
constructor
(
readonly
spectron
:
SpectronApplication
)
{
...
...
@@ -23,13 +27,23 @@ export class QuickOpen {
await
this
.
waitForQuickOpenClosed
();
}
public
async
type
(
text
:
string
):
Promise
<
void
>
{
await
this
.
spectron
.
client
.
keys
([
text
,
'
NULL
'
]);
await
this
.
spectron
.
client
.
waitForValue
(
QuickOpen
.
QUICK_OPEN_FOCUSSED_INPUT
,
text
);
}
public
async
getQuickOpenElements
():
Promise
<
Element
[]
>
{
return
this
.
spectron
.
client
.
waitForElements
(
QuickOpen
.
QUICK_OPEN_ENTRY_SELECTOR
);
}
public
async
waitForQuickOpenElements
(
count
:
number
):
Promise
<
Element
[]
>
{
return
this
.
spectron
.
client
.
waitForElements
(
QuickOpen
.
QUICK_OPEN_ENTRY_SELECTOR
,
elements
=>
elements
&&
elements
.
length
===
count
);
}
public
async
openFile
(
fileName
:
string
):
Promise
<
void
>
{
await
this
.
openQuickOpen
();
await
this
.
spectron
.
client
.
type
(
fileName
);
await
this
.
type
(
fileName
);
await
this
.
getQuickOpenElements
();
await
this
.
spectron
.
client
.
keys
([
'
Enter
'
,
'
NULL
'
]);
await
this
.
spectron
.
client
.
waitForElement
(
`.tabs-container div[aria-selected="true"][aria-label="
${
fileName
}
, tab"]`
);
...
...
@@ -37,12 +51,25 @@ export class QuickOpen {
await
this
.
spectron
.
workbench
.
waitForEditorFocus
(
fileName
);
}
public
async
runCommand
(
commandText
:
string
):
Promise
<
void
>
{
await
this
.
openQuickOpen
();
// type the text
await
this
.
type
(
`>
${
commandText
}
`
);
// wait for best choice to be focused
await
this
.
spectron
.
client
.
waitForTextContent
(
QuickOpen
.
QUICK_OPEN_FOCUSED_ELEMENT
,
commandText
);
// wait and click on best choice
await
this
.
spectron
.
client
.
waitAndClick
(
QuickOpen
.
QUICK_OPEN_FOCUSED_ELEMENT
);
}
protected
waitForQuickOpenOpened
():
Promise
<
Element
>
{
return
this
.
spectron
.
client
.
waitForElement
(
'
.quick-open-widget .quick-open-input input:focus
'
);
return
this
.
spectron
.
client
.
waitForElement
(
QuickOpen
.
QUICK_OPEN_FOCUSSED_INPUT
);
}
protected
waitForQuickOpenClosed
():
Promise
<
Element
>
{
return
this
.
spectron
.
client
.
waitForElement
(
'
div.quick-open-widget[aria-hidden="true"]
'
);
return
this
.
spectron
.
client
.
waitForElement
(
QuickOpen
.
QUICK_OPEN_HIDDEN
);
}
public
async
isQuickOpenVisible
():
Promise
<
boolean
>
{
...
...
test/smoke/src/areas/terminal/terminal.ts
浏览文件 @
9e40cc9d
...
...
@@ -16,7 +16,7 @@ export class Terminal {
public
async
showTerminal
():
Promise
<
void
>
{
if
(
!
await
this
.
isVisible
())
{
await
this
.
spectron
.
workbench
.
commandPallette
.
runCommand
(
'
View: Toggle Integrated Terminal
'
);
await
this
.
spectron
.
workbench
.
quickopen
.
runCommand
(
'
View: Toggle Integrated Terminal
'
);
await
this
.
spectron
.
client
.
waitForElement
(
Terminal
.
TERMINAL_CURSOR
);
await
this
.
waitForTerminalText
(
text
=>
text
.
length
>
0
,
'
Waiting for Terminal to be ready
'
);
}
...
...
test/smoke/src/areas/workbench/commandPallette.ts
已删除
100644 → 0
浏览文件 @
526c71c4
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
QuickOpen
}
from
'
../quickopen/quickopen
'
;
const
QUICK_OPEN_INPUT
=
'
.quick-open-widget .quick-open-input input
'
;
const
QUICK_OPEN_FOCUSED_ELEMENT
=
'
.quick-open-widget .quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label
'
;
export
class
CommandPallette
extends
QuickOpen
{
public
async
runCommand
(
commandText
:
string
):
Promise
<
void
>
{
// run command
await
this
.
spectron
.
command
(
'
workbench.action.showCommands
'
);
// wait for quick open
await
this
.
waitForQuickOpenOpened
();
// type the text
await
this
.
spectron
.
client
.
keys
([
commandText
,
'
NULL
'
]);
// wait for text to be in input box
await
this
.
spectron
.
client
.
waitForValue
(
QUICK_OPEN_INPUT
,
`>
${
commandText
}
`
);
// wait for best choice to be focused
await
this
.
spectron
.
client
.
waitForTextContent
(
QUICK_OPEN_FOCUSED_ELEMENT
,
commandText
);
// wait and click on best choice
await
this
.
spectron
.
client
.
waitAndClick
(
QUICK_OPEN_FOCUSED_ELEMENT
);
}
}
test/smoke/src/areas/workbench/workbench.ts
浏览文件 @
9e40cc9d
...
...
@@ -8,7 +8,6 @@ import { Explorer } from '../explorer/explorer';
import
{
ActivityBar
}
from
'
../activitybar/activityBar
'
;
import
{
QuickOpen
}
from
'
../quickopen/quickopen
'
;
import
{
Extensions
}
from
'
../extensions/extensions
'
;
import
{
CommandPallette
}
from
'
./commandPallette
'
;
import
{
Search
}
from
'
../search/search
'
;
import
{
Editor
}
from
'
../editor/editor
'
;
import
{
SCM
}
from
'
../git/scm
'
;
...
...
@@ -23,7 +22,6 @@ export class Workbench {
readonly
explorer
:
Explorer
;
readonly
activitybar
:
ActivityBar
;
readonly
commandPallette
:
CommandPallette
;
readonly
quickopen
:
QuickOpen
;
readonly
search
:
Search
;
readonly
extensions
:
Extensions
;
...
...
@@ -40,7 +38,6 @@ export class Workbench {
this
.
explorer
=
new
Explorer
(
spectron
);
this
.
activitybar
=
new
ActivityBar
(
spectron
);
this
.
quickopen
=
new
QuickOpen
(
spectron
);
this
.
commandPallette
=
new
CommandPallette
(
spectron
);
this
.
search
=
new
Search
(
spectron
);
this
.
extensions
=
new
Extensions
(
spectron
);
this
.
editor
=
new
Editor
(
spectron
);
...
...
test/smoke/src/spectron/application.ts
浏览文件 @
9e40cc9d
...
...
@@ -79,7 +79,7 @@ export class SpectronApplication {
}
public
async
reload
():
Promise
<
any
>
{
await
this
.
workbench
.
commandPallette
.
runCommand
(
'
Reload Window
'
);
await
this
.
workbench
.
quickopen
.
runCommand
(
'
Reload Window
'
);
// TODO @sandy: Find a proper condition to wait for reload
await
this
.
wait
(.
5
);
await
this
.
checkWindowReady
();
...
...
@@ -165,7 +165,7 @@ export class SpectronApplication {
public
command
(
command
:
string
,
capture
?:
boolean
):
Promise
<
any
>
{
const
binding
=
this
.
keybindings
.
find
(
x
=>
x
[
'
command
'
]
===
command
);
if
(
!
binding
)
{
return
this
.
workbench
.
commandPallette
.
runCommand
(
command
);
return
this
.
workbench
.
quickopen
.
runCommand
(
command
);
}
const
keys
:
string
=
binding
.
key
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录