Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
abe71f50
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,发现更多精彩内容 >>
提交
abe71f50
编写于
9月 04, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More improvements
上级
d8540e33
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
291 addition
and
100 deletion
+291
-100
test/smoke/src/areas/editor/editor.ts
test/smoke/src/areas/editor/editor.ts
+14
-0
test/smoke/src/areas/extensions/extensions.test.ts
test/smoke/src/areas/extensions/extensions.test.ts
+3
-0
test/smoke/src/areas/preferences/keybindings.test.ts
test/smoke/src/areas/preferences/keybindings.test.ts
+0
-28
test/smoke/src/areas/preferences/preferences.test.ts
test/smoke/src/areas/preferences/preferences.test.ts
+17
-5
test/smoke/src/areas/problems/problems.ts
test/smoke/src/areas/problems/problems.ts
+12
-15
test/smoke/src/areas/quickopen/quickopen.ts
test/smoke/src/areas/quickopen/quickopen.ts
+30
-5
test/smoke/src/areas/search/search.test.ts
test/smoke/src/areas/search/search.test.ts
+6
-0
test/smoke/src/areas/search/search.ts
test/smoke/src/areas/search/search.ts
+29
-5
test/smoke/src/areas/statusbar/statusbar.test.ts
test/smoke/src/areas/statusbar/statusbar.test.ts
+83
-0
test/smoke/src/areas/statusbar/statusbar.ts
test/smoke/src/areas/statusbar/statusbar.ts
+64
-0
test/smoke/src/areas/workbench/commandPallette.ts
test/smoke/src/areas/workbench/commandPallette.ts
+1
-1
test/smoke/src/areas/workbench/data-loss.test.ts
test/smoke/src/areas/workbench/data-loss.test.ts
+8
-28
test/smoke/src/areas/workbench/workbench.ts
test/smoke/src/areas/workbench/workbench.ts
+12
-0
test/smoke/src/main.ts
test/smoke/src/main.ts
+3
-3
test/smoke/src/spectron/application.ts
test/smoke/src/spectron/application.ts
+9
-9
test/smoke/src/spectron/client.ts
test/smoke/src/spectron/client.ts
+0
-1
未找到文件。
test/smoke/src/areas/editor/editor.ts
浏览文件 @
abe71f50
...
...
@@ -14,4 +14,18 @@ export class Editor {
const
result
=
await
this
.
spectron
.
client
.
waitForText
(
'
.monaco-editor.focused .view-lines span span:nth-child(1)
'
);
return
Array
.
isArray
(
result
)
?
result
.
join
()
:
result
;
}
public
async
waitForHighlightingLine
(
line
:
number
):
Promise
<
void
>
{
const
currentLineIndex
=
await
this
.
spectron
.
client
.
waitFor
<
number
>
(
async
()
=>
{
const
lineNumbers
=
await
this
.
spectron
.
webclient
.
selectorExecute
(
`.monaco-editor .line-numbers`
,
elements
=>
(
Array
.
isArray
(
elements
)
?
elements
:
[
elements
]).
map
(
element
=>
element
.
textContent
));
for
(
let
index
=
0
;
index
<
lineNumbers
.
length
;
index
++
)
{
if
(
lineNumbers
[
index
]
===
`
${
line
}
`
)
{
return
index
+
1
;
}
}
return
undefined
;
});
await
this
.
spectron
.
client
.
waitForElement
(
`.monaco-editor .view-overlays>:nth-child(
${
currentLineIndex
}
) .current-line`
);
}
}
\ No newline at end of file
test/smoke/src/areas/extensions/extensions.test.ts
浏览文件 @
abe71f50
...
...
@@ -15,6 +15,9 @@ describe('Extensions', () => {
// await Util.rimraf(EXTENSIONS_DIR);
it
(
`install and activate vscode-smoketest-check extension`
,
async
function
()
{
if
(
app
.
inDevMode
)
{
return
;
}
const
extensionName
=
'
vscode-smoketest-check
'
;
await
app
.
workbench
.
extensions
.
openExtensionsViewlet
();
...
...
test/smoke/src/areas/preferences/keybindings.test.ts
已删除
100644 → 0
浏览文件 @
d8540e33
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
,
LATEST_PATH
,
WORKSPACE_PATH
}
from
'
../../spectron/application
'
;
import
{
ActivityBarPosition
}
from
'
../../areas/activitybar/activityBar
'
;
import
{
KeybindingsEditor
}
from
'
./keybindings
'
;
describe
(
'
Keybindings Customisation
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
(
LATEST_PATH
,
''
,
0
,
[
WORKSPACE_PATH
]);
before
(()
=>
app
.
start
());
after
(()
=>
app
.
stop
());
it
(
`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`
,
async
function
()
{
let
activityBarElement
=
await
app
.
workbench
.
activitybar
.
getActivityBar
(
ActivityBarPosition
.
LEFT
);
assert
.
ok
(
activityBarElement
,
'
Activity bar should be positioned on the left.
'
);
const
keybindingsEditor
=
new
KeybindingsEditor
(
app
);
await
keybindingsEditor
.
openKeybindings
();
await
keybindingsEditor
.
updateKeybinding
(
'
workbench.action.toggleSidebarPosition
'
,
[
'
Control
'
,
'
u
'
,
'
NULL
'
],
'
Control+U
'
);
await
app
.
client
.
keys
([
'
Control
'
,
'
u
'
,
'
NULL
'
]);
activityBarElement
=
await
app
.
workbench
.
activitybar
.
getActivityBar
(
ActivityBarPosition
.
RIGHT
);
assert
.
ok
(
activityBarElement
,
'
Activity bar was not moved to right after toggling its position.
'
);
});
});
\ No newline at end of file
test/smoke/src/areas/preferences/
setting
s.test.ts
→
test/smoke/src/areas/preferences/
preference
s.test.ts
浏览文件 @
abe71f50
...
...
@@ -4,10 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
,
LATEST_PATH
,
WORKSPACE_PATH
}
from
'
../../spectron/application
'
;
import
{
SettingsEditor
}
from
'
./settings
'
;
import
{
ActivityBarPosition
}
from
'
../activitybar/activityBar
'
;
describe
(
'
Settings Customisation
'
,
()
=>
{
describe
(
'
Preferences
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
(
LATEST_PATH
,
''
,
0
,
[
WORKSPACE_PATH
]);
before
(()
=>
app
.
start
());
after
(()
=>
app
.
stop
());
...
...
@@ -17,9 +18,8 @@ describe('Settings Customisation', () => {
let
lineNumbers
=
await
app
.
client
.
waitForElements
(
'
.line-numbers
'
);
assert
.
ok
(
!!
lineNumbers
.
length
,
'
Line numbers are not present in the editor before disabling them.
'
);
const
settingsEditor
=
new
SettingsEditor
(
app
);
await
settingsEditor
.
openUserSettings
();
await
settingsEditor
.
focusEditableSettings
();
await
app
.
workbench
.
settingsEditor
.
openUserSettings
();
await
app
.
workbench
.
settingsEditor
.
focusEditableSettings
();
await
app
.
client
.
keys
(
`"editor.lineNumbers": "off"`
);
await
app
.
workbench
.
saveOpenedFile
();
...
...
@@ -27,4 +27,16 @@ describe('Settings Customisation', () => {
lineNumbers
=
await
app
.
client
.
waitForElements
(
'
.line-numbers
'
,
result
=>
!
result
||
result
.
length
===
0
);
assert
.
ok
(
!
lineNumbers
.
length
,
'
Line numbers are still present in the editor after disabling them.
'
);
});
it
(
`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`
,
async
function
()
{
let
activityBarElement
=
await
app
.
workbench
.
activitybar
.
getActivityBar
(
ActivityBarPosition
.
LEFT
);
assert
.
ok
(
activityBarElement
,
'
Activity bar should be positioned on the left.
'
);
await
app
.
workbench
.
keybindingsEditor
.
openKeybindings
();
await
app
.
workbench
.
keybindingsEditor
.
updateKeybinding
(
'
workbench.action.toggleSidebarPosition
'
,
[
'
Control
'
,
'
u
'
,
'
NULL
'
],
'
Control+U
'
);
await
app
.
client
.
keys
([
'
Control
'
,
'
u
'
,
'
NULL
'
]);
activityBarElement
=
await
app
.
workbench
.
activitybar
.
getActivityBar
(
ActivityBarPosition
.
RIGHT
);
assert
.
ok
(
activityBarElement
,
'
Activity bar was not moved to right after toggling its position.
'
);
});
});
\ No newline at end of file
test/smoke/src/areas/problems/problems.ts
浏览文件 @
abe71f50
...
...
@@ -12,32 +12,29 @@ export enum ProblemSeverity {
export
class
Problems
{
static
PROBLEMS_VIEW_SELECTOR
=
'
.panel.markers-panel
'
;
constructor
(
private
spectron
:
SpectronApplication
)
{
// noop
}
public
async
showProblemsView
():
Promise
<
any
>
{
const
panelSelector
=
'
.panel.markers-panel
'
;
const
result
=
await
this
.
spectron
.
client
.
element
(
panelSelector
);
if
(
result
)
{
return
;
if
(
!
await
this
.
isVisible
())
{
await
this
.
spectron
.
command
(
'
workbench.actions.view.problems
'
);
await
this
.
spectron
.
client
.
waitForElement
(
Problems
.
PROBLEMS_VIEW_SELECTOR
);
}
await
this
.
spectron
.
command
(
'
workbench.actions.view.problems
'
);
await
this
.
spectron
.
client
.
waitForElement
(
panelSelector
);
}
public
async
hideProblemsView
():
Promise
<
any
>
{
const
panelSelector
=
'
.panel.markers-panel
'
;
const
result
=
await
this
.
spectron
.
client
.
element
(
panelSelector
);
if
(
!
result
)
{
return
;
if
(
await
this
.
isVisible
())
{
await
this
.
spectron
.
command
(
'
workbench.actions.view.problems
'
);
await
this
.
spectron
.
client
.
waitForElement
(
Problems
.
PROBLEMS_VIEW_SELECTOR
,
el
=>
!
el
);
}
}
await
this
.
spectron
.
command
(
'
workbench.actions.view.problems
'
);
await
this
.
spectron
.
client
.
waitForElement
(
panelSelector
,
el
=>
!
el
);
public
async
isVisible
():
Promise
<
boolean
>
{
const
element
=
await
this
.
spectron
.
client
.
element
(
Problems
.
PROBLEMS_VIEW_SELECTOR
);
return
!!
element
;
}
public
static
getSelectorInProblemsView
(
problemType
:
ProblemSeverity
):
string
{
...
...
test/smoke/src/areas/quickopen/quickopen.ts
浏览文件 @
abe71f50
...
...
@@ -13,14 +13,14 @@ export class QuickOpen {
constructor
(
readonly
spectron
:
SpectronApplication
)
{
}
public
async
openQuickOpen
():
Promise
<
Element
>
{
public
async
openQuickOpen
():
Promise
<
void
>
{
await
this
.
spectron
.
command
(
'
workbench.action.quickOpen
'
);
return
this
.
waitForQuickOpen
();
await
this
.
waitForQuickOpenOpened
();
}
public
async
closeQuickOpen
():
Promise
<
Element
>
{
public
async
closeQuickOpen
():
Promise
<
void
>
{
await
this
.
spectron
.
command
(
'
workbench.action.closeQuickOpen
'
);
return
this
.
spectron
.
client
.
waitForElement
(
'
div.quick-open-widget[aria-hidden="true"]
'
);
await
this
.
waitForQuickOpenClosed
(
);
}
public
async
getQuickOpenElements
():
Promise
<
Element
[]
>
{
...
...
@@ -37,7 +37,32 @@ export class QuickOpen {
await
this
.
spectron
.
workbench
.
waitForEditorFocus
(
fileName
);
}
protected
waitForQuickOpen
():
Promise
<
Element
>
{
protected
waitForQuickOpen
Opened
():
Promise
<
Element
>
{
return
this
.
spectron
.
client
.
waitForElement
(
'
div.quick-open-widget[aria-hidden="false"]
'
);
}
protected
waitForQuickOpenClosed
():
Promise
<
Element
>
{
return
this
.
spectron
.
client
.
waitForElement
(
'
div.quick-open-widget[aria-hidden="true"]
'
);
}
public
async
isQuickOpenVisible
():
Promise
<
boolean
>
{
await
this
.
waitForQuickOpenOpened
();
return
true
;
}
public
async
submit
(
text
:
string
):
Promise
<
void
>
{
await
this
.
spectron
.
type
(
text
);
await
this
.
spectron
.
client
.
keys
([
'
Enter
'
,
'
NULL
'
]);
await
this
.
waitForQuickOpenClosed
();
}
public
async
selectQuickOpenElement
(
index
:
number
):
Promise
<
void
>
{
await
this
.
waitForQuickOpenOpened
();
for
(
let
from
=
0
;
from
<
index
;
from
++
)
{
await
this
.
spectron
.
client
.
keys
([
'
ArrowDown
'
,
'
NULL
'
]);
this
.
spectron
.
wait
(
3
);
}
await
this
.
spectron
.
client
.
keys
([
'
Enter
'
,
'
NULL
'
]);
await
this
.
waitForQuickOpenClosed
();
}
}
test/smoke/src/areas/search/search.test.ts
浏览文件 @
abe71f50
...
...
@@ -21,9 +21,15 @@ describe('Search', () => {
it
(
'
searches only for *.js files & checks for correct result number
'
,
async
function
()
{
await
app
.
workbench
.
search
.
openSearchViewlet
();
await
app
.
workbench
.
search
.
searchFor
(
'
body
'
);
await
app
.
workbench
.
search
.
showQueryDetails
();
await
app
.
workbench
.
search
.
setFilesToIncludeTextAndSearch
(
'
*.js
'
);
await
app
.
workbench
.
search
.
submitSearch
();
const
results
=
await
app
.
workbench
.
search
.
getResultText
();
await
app
.
workbench
.
search
.
setFilesToIncludeTextAndSearch
(
''
);
await
app
.
workbench
.
search
.
hideQueryDetails
();
assert
.
equal
(
results
,
'
4 results in 1 file
'
);
});
...
...
test/smoke/src/areas/search/search.ts
浏览文件 @
abe71f50
...
...
@@ -14,8 +14,15 @@ export class Search {
}
public
async
openSearchViewlet
():
Promise
<
any
>
{
await
this
.
spectron
.
command
(
'
workbench.view.search
'
);
await
this
.
spectron
.
client
.
waitForElement
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`
);
if
(
!
await
this
.
isSearchViewletFocused
())
{
await
this
.
spectron
.
command
(
'
workbench.view.search
'
);
await
this
.
spectron
.
client
.
waitForElement
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`
);
}
}
public
async
isSearchViewletFocused
():
Promise
<
boolean
>
{
const
element
=
await
this
.
spectron
.
client
.
element
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.search-widget .monaco-inputbox.synthetic-focus input[placeholder="Search"]`
);
return
!!
element
;
}
public
async
searchFor
(
text
:
string
):
Promise
<
void
>
{
...
...
@@ -38,13 +45,30 @@ export class Search {
}
public
async
setFilesToIncludeTextAndSearch
(
text
:
string
):
Promise
<
void
>
{
await
this
.
spectron
.
client
.
waitAndClick
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details .more`
);
await
this
.
spectron
.
client
.
click
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details .monaco-inputbox input[aria-label="Search Include Patterns"]`
);
await
this
.
spectron
.
client
.
element
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details .monaco-inputbox.synthetic-focus input[aria-label="Search Include Patterns"]`
);
await
this
.
spectron
.
client
.
clearElement
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details .monaco-inputbox.synthetic-focus input[aria-label="Search Include Patterns"]`
);
await
this
.
spectron
.
client
.
keys
(
text
);
if
(
text
)
{
await
this
.
spectron
.
client
.
keys
(
text
);
}
}
await
this
.
submitSearch
();
public
async
showQueryDetails
():
Promise
<
void
>
{
if
(
!
await
this
.
areDetailsVisible
())
{
await
this
.
spectron
.
client
.
waitAndClick
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details .more`
);
}
}
public
async
hideQueryDetails
():
Promise
<
void
>
{
if
(
await
this
.
areDetailsVisible
())
{
await
this
.
spectron
.
client
.
waitAndClick
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details.more .more`
);
}
}
public
async
areDetailsVisible
():
Promise
<
boolean
>
{
const
element
=
await
this
.
spectron
.
client
.
element
(
`
${
Search
.
SEARCH_VIEWLET_XPATH
}
.query-details.more`
);
return
!!
element
;
}
public
async
removeFileMatch
(
index
:
number
):
Promise
<
void
>
{
...
...
test/smoke/src/areas/statusbar/statusbar.test.ts
0 → 100644
浏览文件 @
abe71f50
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
,
LATEST_PATH
,
WORKSPACE_PATH
}
from
'
../../spectron/application
'
;
import
{
StatusBarElement
}
from
'
./statusbar
'
;
describe
(
'
Statusbar
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
(
LATEST_PATH
,
''
,
0
,
[
WORKSPACE_PATH
]);
before
(()
=>
app
.
start
());
after
(()
=>
app
.
stop
());
it
(
'
verifies presence of all default status bar elements
'
,
async
function
()
{
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
BRANCH_STATUS
),
'
Branch indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
FEEDBACK_ICON
),
'
Feedback icon is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
SYNC_STATUS
),
'
Sync indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
PROBLEMS_STATUS
),
'
Problems indicator is not visible.
'
);
await
app
.
workbench
.
quickopen
.
openFile
(
'
app.js
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
ENCODING_STATUS
),
'
Encoding indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
EOL_STATUS
),
'
EOL indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
INDENTATION_STATUS
),
'
Indentation indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
LANGUAGE_STATUS
),
'
Language indicator is not visible.
'
);
assert
.
ok
(
app
.
workbench
.
statusbar
.
isVisible
(
StatusBarElement
.
SELECTION_STATUS
),
'
Selection indicator is not visible.
'
);
});
it
(
`verifies that 'quick open' opens when clicking on status bar elements`
,
async
function
()
{
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
BRANCH_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened for branch indicator.
'
);
await
app
.
workbench
.
quickopen
.
closeQuickOpen
();
await
app
.
workbench
.
quickopen
.
openFile
(
'
app.js
'
);
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
INDENTATION_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened for indentation indicator.
'
);
await
app
.
workbench
.
quickopen
.
closeQuickOpen
();
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
ENCODING_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened for encoding indicator.
'
);
await
app
.
workbench
.
quickopen
.
closeQuickOpen
();
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
EOL_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened for EOL indicator.
'
);
await
app
.
workbench
.
quickopen
.
closeQuickOpen
();
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
LANGUAGE_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened for language indicator.
'
);
await
app
.
workbench
.
quickopen
.
closeQuickOpen
();
});
it
(
`verifies that 'Problems View' appears when clicking on 'Problems' status element`
,
async
function
()
{
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
PROBLEMS_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
problems
.
isVisible
());
});
it
(
`verifies that 'Tweet us feedback' pop-up appears when clicking on 'Feedback' icon`
,
async
function
()
{
if
(
app
.
inDevMode
)
{
return
;
}
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
FEEDBACK_ICON
);
assert
.
ok
(
!!
await
app
.
client
.
waitForElement
(
'
.feedback-form
'
));
});
it
(
`checks if 'Go to Line' works if called from the status bar`
,
async
function
()
{
await
app
.
workbench
.
quickopen
.
openFile
(
'
app.js
'
);
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
SELECTION_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened line number selection.
'
);
await
app
.
workbench
.
quickopen
.
submit
(
'
15
'
);
await
app
.
workbench
.
editor
.
waitForHighlightingLine
(
15
);
});
it
(
`verifies if changing EOL is reflected in the status bar`
,
async
function
()
{
await
app
.
workbench
.
quickopen
.
openFile
(
'
app.js
'
);
await
app
.
workbench
.
statusbar
.
clickOn
(
StatusBarElement
.
EOL_STATUS
);
assert
.
ok
(
await
app
.
workbench
.
quickopen
.
isQuickOpenVisible
(),
'
Quick open is not opened line number selection.
'
);
app
.
workbench
.
quickopen
.
selectQuickOpenElement
(
1
);
await
app
.
workbench
.
statusbar
.
waitForEOL
(
'
CRLF
'
);
});
});
\ No newline at end of file
test/smoke/src/areas/statusbar/statusbar.ts
0 → 100644
浏览文件 @
abe71f50
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
SpectronApplication
}
from
'
../../spectron/application
'
;
export
enum
StatusBarElement
{
BRANCH_STATUS
=
0
,
SYNC_STATUS
=
1
,
PROBLEMS_STATUS
=
2
,
SELECTION_STATUS
=
3
,
INDENTATION_STATUS
=
4
,
ENCODING_STATUS
=
5
,
EOL_STATUS
=
6
,
LANGUAGE_STATUS
=
7
,
FEEDBACK_ICON
=
8
}
export
class
StatusBar
{
// private selectorsMap: Map<StatusBarElement, string>;
private
readonly
mainSelector
=
'
div[id="workbench.parts.statusbar"]
'
;
constructor
(
private
spectron
:
SpectronApplication
)
{
}
public
async
isVisible
(
element
:
StatusBarElement
):
Promise
<
boolean
>
{
return
this
.
spectron
.
client
.
isVisible
(
this
.
getSelector
(
element
));
}
public
async
clickOn
(
element
:
StatusBarElement
):
Promise
<
void
>
{
await
this
.
spectron
.
client
.
waitAndClick
(
this
.
getSelector
(
element
));
}
public
async
waitForEOL
(
eol
:
string
):
Promise
<
string
>
{
return
this
.
spectron
.
client
.
waitForText
(
this
.
getSelector
(
StatusBarElement
.
EOL_STATUS
),
eol
);
}
private
getSelector
(
element
:
StatusBarElement
):
string
{
switch
(
element
)
{
case
StatusBarElement
.
BRANCH_STATUS
:
return
`
${
this
.
mainSelector
}
.octicon.octicon-git-branch`
;
case
StatusBarElement
.
SYNC_STATUS
:
return
`
${
this
.
mainSelector
}
.octicon.octicon-sync`
;
case
StatusBarElement
.
PROBLEMS_STATUS
:
return
`
${
this
.
mainSelector
}
.task-statusbar-item[title="Problems"]`
;
case
StatusBarElement
.
SELECTION_STATUS
:
return
`
${
this
.
mainSelector
}
.editor-status-selection`
;
case
StatusBarElement
.
INDENTATION_STATUS
:
return
`
${
this
.
mainSelector
}
.editor-status-indentation`
;
case
StatusBarElement
.
ENCODING_STATUS
:
return
`
${
this
.
mainSelector
}
.editor-status-encoding`
;
case
StatusBarElement
.
EOL_STATUS
:
return
`
${
this
.
mainSelector
}
.editor-status-eol`
;
case
StatusBarElement
.
LANGUAGE_STATUS
:
return
`
${
this
.
mainSelector
}
.editor-status-mode`
;
case
StatusBarElement
.
FEEDBACK_ICON
:
return
`
${
this
.
mainSelector
}
.dropdown.send-feedback`
;
default
:
throw
new
Error
(
element
);
}
}
}
\ No newline at end of file
test/smoke/src/areas/workbench/commandPallette.ts
浏览文件 @
abe71f50
...
...
@@ -14,7 +14,7 @@ export class CommandPallette extends QuickOpen {
public
async
runCommand
(
commandText
:
string
):
Promise
<
void
>
{
await
this
.
spectron
.
command
(
'
workbench.action.showCommands
'
);
await
this
.
waitForQuickOpen
();
await
this
.
waitForQuickOpen
Opened
();
await
this
.
spectron
.
type
(
commandText
);
await
this
.
spectron
.
client
.
waitForText
(
`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry a.label-name span.monaco-highlighted-label span.highlight`
,
commandText
);
await
this
.
spectron
.
client
.
waitAndClick
(
`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry`
);
...
...
test/smoke/src/areas/workbench/data-loss.test.ts
浏览文件 @
abe71f50
...
...
@@ -5,49 +5,29 @@
import
*
as
assert
from
'
assert
'
;
import
{
SpectronApplication
,
USER_DIR
,
LATEST_PATH
,
WORKSPACE_PATH
}
from
'
../../spectron/application
'
;
import
*
as
path
from
'
path
'
;
describe
(
'
Data
L
oss
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
(
LATEST_PATH
,
''
,
0
,
[
WORKSPACE_PATH
],
[
`--user-data-dir=
${
USER_DIR
}
`
]);
describe
(
'
Data
l
oss
'
,
()
=>
{
let
app
:
SpectronApplication
=
new
SpectronApplication
(
LATEST_PATH
,
''
,
0
,
[
WORKSPACE_PATH
],
[
`--user-data-dir=
${
path
.
join
(
USER_DIR
,
new
Date
().
getTime
().
toString
(),
'
dataloss
'
)
}
`
]);
before
(()
=>
app
.
start
());
after
(()
=>
app
.
stop
());
// this used to run before each test
// await Util.rimraf(USER_DIR);
it
(
`verifies that 'hot exit' works for dirty files`
,
async
function
()
{
const
textToType
=
'
Hello, Code
'
,
fileName
=
'
readme.md
'
,
untitled
=
'
Untitled-1
'
;
const
textToType
=
'
Hello, Code
'
,
textToTypeInUntitled
=
'
Hello, Unitled Code
'
,
fileName
=
'
readme.md
'
,
untitled
=
'
Untitled-1
'
;
await
app
.
workbench
.
newUntitledFile
();
await
app
.
client
.
type
(
textToType
);
await
app
.
client
.
type
(
textToType
InUntitled
);
await
app
.
workbench
.
explorer
.
openFile
(
fileName
);
await
app
.
client
.
type
(
textToType
);
await
app
.
reload
();
// check tab presence
assert
.
ok
(
await
app
.
workbench
.
waitForOpen
(
untitled
,
true
),
`
${
untitled
}
tab is not present after reopening.`
);
assert
.
ok
(
await
app
.
workbench
.
waitForActiveOpen
(
fileName
,
true
),
`
${
fileName
}
tab is not present or is not active after reopening.`
);
});
it
(
`verifies that contents of the dirty files are restored after 'hot exit'`
,
async
function
()
{
// make one dirty file,
// create one untitled file
const
textToType
=
'
Hello, Code
'
;
// create one untitled file
await
app
.
workbench
.
newUntitledFile
();
await
app
.
client
.
type
(
textToType
);
// make one dirty file,
await
app
.
workbench
.
explorer
.
openFile
(
'
readme.md
'
);
await
app
.
client
.
type
(
textToType
);
await
app
.
reload
();
await
app
.
workbench
.
selectTab
(
'
readme.md
'
);
let
actual
=
await
app
.
workbench
.
editor
.
getEditorFirstLineText
();
assert
.
ok
(
actual
.
startsWith
(
textToType
),
`
${
actual
}
did not start with
${
textToType
}
`
);
assert
.
ok
(
await
app
.
workbench
.
waitForOpen
(
untitled
,
true
),
`
${
untitled
}
tab is not present after reopening.`
);
await
app
.
workbench
.
selectTab
(
'
Untitled-1
'
,
true
);
actual
=
await
app
.
workbench
.
editor
.
getEditorFirstLineText
();
assert
.
ok
(
actual
.
startsWith
(
textToType
),
`
${
actual
}
did not start with
${
textToType
}
`
);
assert
.
ok
(
actual
.
startsWith
(
textToType
InUntitled
),
`
${
actual
}
did not start with
${
textToTypeInUntitled
}
`
);
});
});
\ No newline at end of file
test/smoke/src/areas/workbench/workbench.ts
浏览文件 @
abe71f50
...
...
@@ -13,6 +13,10 @@ import { CommandPallette } from './commandPallette';
import
{
Search
}
from
'
../search/search
'
;
import
{
Editor
}
from
'
../editor/editor
'
;
import
{
SCM
}
from
'
../git/scm
'
;
import
{
StatusBar
}
from
'
../statusbar/statusbar
'
;
import
{
Problems
}
from
'
../problems/problems
'
;
import
{
SettingsEditor
}
from
'
../preferences/settings
'
;
import
{
KeybindingsEditor
}
from
'
../preferences/keybindings
'
;
export
class
Workbench
{
...
...
@@ -24,6 +28,10 @@ export class Workbench {
readonly
extensions
:
Extensions
;
readonly
editor
:
Editor
;
readonly
scm
:
SCM
;
readonly
statusbar
:
StatusBar
;
readonly
problems
:
Problems
;
readonly
settingsEditor
:
SettingsEditor
;
readonly
keybindingsEditor
:
KeybindingsEditor
;
constructor
(
private
spectron
:
SpectronApplication
)
{
this
.
explorer
=
new
Explorer
(
spectron
);
...
...
@@ -34,6 +42,10 @@ export class Workbench {
this
.
extensions
=
new
Extensions
(
spectron
);
this
.
editor
=
new
Editor
(
spectron
);
this
.
scm
=
new
SCM
(
spectron
);
this
.
statusbar
=
new
StatusBar
(
spectron
);
this
.
problems
=
new
Problems
(
spectron
);
this
.
settingsEditor
=
new
SettingsEditor
(
spectron
);
this
.
keybindingsEditor
=
new
KeybindingsEditor
(
spectron
);
}
public
async
saveOpenedFile
():
Promise
<
any
>
{
...
...
test/smoke/src/main.ts
浏览文件 @
abe71f50
...
...
@@ -36,7 +36,7 @@ function getDevElectronPath(): string {
switch
(
process
.
platform
)
{
case
'
darwin
'
:
return
path
.
join
(
buildPath
,
`
${
product
.
nameLong
}
.app`
,
'
Contents
'
,
'
MacOS
'
,
'
Electron
'
);
return
path
.
join
(
buildPath
,
'
electron
'
,
`
${
product
.
nameLong
}
.app`
,
'
Contents
'
,
'
MacOS
'
,
'
Electron
'
);
case
'
linux
'
:
return
path
.
join
(
buildPath
,
'
electron
'
,
`
${
product
.
applicationName
}
`
);
case
'
win32
'
:
...
...
@@ -156,11 +156,11 @@ before(async () => main());
import
'
./areas/css/css.test
'
;
import
'
./areas/explorer/explorer.test
'
;
import
'
./areas/preferences/settings.test
'
;
import
'
./areas/preferences/keybindings.test
'
;
import
'
./areas/preferences/preferences.test
'
;
import
'
./areas/multiroot/multiroot.test
'
;
import
'
./areas/extensions/extensions.test
'
;
import
'
./areas/search/search.test
'
;
import
'
./areas/workbench/data-loss.test
'
;
import
'
./areas/git/git.test
'
;
import
'
./areas/statusbar/statusbar.test
'
;
// import './areas/workbench/data-migration.test';
\ No newline at end of file
test/smoke/src/spectron/application.ts
浏览文件 @
abe71f50
...
...
@@ -23,7 +23,6 @@ export const EXTENSIONS_DIR = path.join(__dirname, 'test_data/temp_extensions_di
export
class
SpectronApplication
{
public
readonly
client
:
SpectronClient
;
public
readonly
webclient
:
WebClient
;
public
readonly
workbench
:
Workbench
;
private
spectron
:
Application
;
...
...
@@ -57,7 +56,7 @@ export class SpectronApplication {
}
}
if
(
!
userDataDirIsSet
)
{
chromeDriverArgs
.
push
(
`--user-data-dir=
${
USER_DIR
}
/
${
new
Date
().
getTime
()}
`
);
chromeDriverArgs
.
push
(
`--user-data-dir=
${
path
.
join
(
USER_DIR
),
new
Date
().
getTime
().
toString
()}
`
);
}
const
repo
=
process
.
env
.
VSCODE_REPOSITORY
;
...
...
@@ -75,28 +74,29 @@ export class SpectronApplication {
this
.
testRetry
+=
1
;
// avoid multiplication by 0 for wait times
this
.
screenshot
=
args
.
indexOf
(
'
--no-screenshot
'
)
===
-
1
?
new
NullScreenshot
()
:
new
Screenshot
(
this
,
testName
,
testRetry
);
this
.
client
=
new
SpectronClient
(
this
.
spectron
,
this
.
screenshot
);
this
.
webclient
=
this
.
spectron
.
client
;
this
.
retrieveKeybindings
();
this
.
workbench
=
new
Workbench
(
this
);
}
public
get
inDevMode
():
boolean
{
return
process
.
env
.
VSCODE_DEV
===
'
1
'
;
}
public
get
app
():
Application
{
return
this
.
spectron
;
}
public
get
webclient
():
WebClient
{
return
this
.
spectron
.
client
;
}
public
async
start
():
Promise
<
any
>
{
await
this
.
spectron
.
start
();
await
this
.
focusOnWindow
(
1
);
// focuses on main renderer window
await
this
.
checkWindowReady
();
}
public
async
restart
():
Promise
<
any
>
{
await
this
.
stop
();
await
this
.
wait
(.
5
);
// wait until all resources are released (e.g. locked local storage)
await
this
.
start
();
}
public
async
reload
():
Promise
<
any
>
{
await
this
.
workbench
.
commandPallette
.
runCommand
(
'
Reload Window
'
);
// TODO @sandy: Find a proper condition to wait for reload
...
...
test/smoke/src/spectron/client.ts
浏览文件 @
abe71f50
...
...
@@ -173,7 +173,6 @@ export class SpectronClient {
try
{
result
=
await
func
();
}
catch
(
e
)
{
// TODO: what to do?
}
if
(
accept
(
result
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录