Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1613eac4
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1613eac4
编写于
6月 22, 2017
作者:
M
Michel Kaporin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Traverse extensions viewlet when looking for an extension to install.
上级
72d1df9b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
16 deletion
+66
-16
test/smoke/package.json
test/smoke/package.json
+3
-1
test/smoke/src/areas/extensions.ts
test/smoke/src/areas/extensions.ts
+49
-4
test/smoke/src/tests/extensions.ts
test/smoke/src/tests/extensions.ts
+14
-11
未找到文件。
test/smoke/package.json
浏览文件 @
1613eac4
...
@@ -13,12 +13,14 @@
...
@@ -13,12 +13,14 @@
"@types/webdriverio"
:
"^4.6.1"
,
"@types/webdriverio"
:
"^4.6.1"
,
"@types/electron"
:
"~1.4.37"
,
"@types/electron"
:
"~1.4.37"
,
"@types/rimraf"
:
"^0.0.28"
,
"@types/rimraf"
:
"^0.0.28"
,
"@types/htmlparser2"
:
"^3.7.29"
,
"mocha"
:
"^3.2.0"
,
"mocha"
:
"^3.2.0"
,
"spectron"
:
"~3.6.4"
,
"spectron"
:
"~3.6.4"
,
"typescript"
:
"^2.2.2"
,
"typescript"
:
"^2.2.2"
,
"rimraf"
:
"^2.6.1"
,
"rimraf"
:
"^2.6.1"
,
"commander"
:
"^2.9.0"
,
"commander"
:
"^2.9.0"
,
"simple-git"
:
"^1.73.0"
,
"simple-git"
:
"^1.73.0"
,
"strip-json-comments"
:
"^2.0.1"
"strip-json-comments"
:
"^2.0.1"
,
"htmlparser2"
:
"^3.9.2"
}
}
}
}
test/smoke/src/areas/extensions.ts
浏览文件 @
1613eac4
...
@@ -6,9 +6,12 @@
...
@@ -6,9 +6,12 @@
import
{
SpectronApplication
}
from
'
../spectron/application
'
;
import
{
SpectronApplication
}
from
'
../spectron/application
'
;
import
{
CommonActions
}
from
"
./common
"
;
import
{
CommonActions
}
from
"
./common
"
;
var
htmlparser
=
require
(
'
htmlparser2
'
);
export
class
Extensions
{
export
class
Extensions
{
private
readonly
extensionsViewletSelector
=
'
div[id="workbench.view.extensions"]
'
;
private
readonly
extensionsViewletSelector
=
'
div[id="workbench.view.extensions"]
'
;
private
viewletExtensionIndex
:
number
;
constructor
(
private
spectron
:
SpectronApplication
,
private
common
:
CommonActions
)
{
constructor
(
private
spectron
:
SpectronApplication
,
private
common
:
CommonActions
)
{
}
}
...
@@ -27,12 +30,14 @@ export class Extensions {
...
@@ -27,12 +30,14 @@ export class Extensions {
return
this
.
spectron
.
client
.
keys
([
'
NULL
'
,
'
Enter
'
,
'
NULL
'
]);
return
this
.
spectron
.
client
.
keys
([
'
NULL
'
,
'
Enter
'
,
'
NULL
'
]);
}
}
public
installFirstResult
():
Promise
<
any
>
{
public
async
installExtension
(
name
:
string
):
Promise
<
any
>
{
return
this
.
spectron
.
client
.
click
(
`
${
this
.
extensionsViewletSelector
}
.monaco-list-rows>:nth-child(1) .extension .extension-action.install`
);
const
extensionListSelector
=
`
${
this
.
extensionsViewletSelector
}
.monaco-list-rows`
;
this
.
viewletExtensionIndex
=
await
this
.
getExtensionIndex
(
name
,
extensionListSelector
);
return
this
.
spectron
.
client
.
click
(
`
${
extensionListSelector
}
>:nth-child(
${
this
.
viewletExtensionIndex
}
) .extension .extension-action.install`
);
}
}
public
get
First
ReloadText
():
Promise
<
any
>
{
public
get
Extension
ReloadText
():
Promise
<
any
>
{
return
this
.
spectron
.
waitFor
(
this
.
spectron
.
client
.
getText
,
`
${
this
.
extensionsViewletSelector
}
.monaco-list-rows>:nth-child(
1
) .extension .extension-action.reload`
);
return
this
.
spectron
.
waitFor
(
this
.
spectron
.
client
.
getText
,
`
${
this
.
extensionsViewletSelector
}
.monaco-list-rows>:nth-child(
${
this
.
viewletExtensionIndex
}
) .extension .extension-action.reload`
);
}
}
public
async
selectMinimalIconsTheme
():
Promise
<
any
>
{
public
async
selectMinimalIconsTheme
():
Promise
<
any
>
{
...
@@ -46,4 +51,44 @@ export class Extensions {
...
@@ -46,4 +51,44 @@ export class Extensions {
public
async
verifyFolderIconAppearance
():
Promise
<
any
>
{
public
async
verifyFolderIconAppearance
():
Promise
<
any
>
{
return
this
.
spectron
.
waitFor
(
this
.
spectron
.
client
.
getHTML
,
'
style[class="contributedIconTheme"]
'
);
return
this
.
spectron
.
waitFor
(
this
.
spectron
.
client
.
getHTML
,
'
style[class="contributedIconTheme"]
'
);
}
}
private
getExtensionIndex
(
name
:
string
,
extensionListSelector
:
string
):
Promise
<
number
>
{
return
new
Promise
(
async
(
res
,
rej
)
=>
{
const
html
=
await
this
.
spectron
.
waitFor
(
this
.
spectron
.
client
.
getHTML
,
extensionListSelector
);
let
extensionIndex
:
number
=
0
;
let
extension
:
boolean
;
var
domelems
:
string
[]
=
[];
var
parser
=
new
htmlparser
.
Parser
({
onopentag
:
function
(
name
,
attribs
)
{
if
(
name
===
'
div
'
&&
attribs
.
class
===
'
extension
'
)
{
extensionIndex
++
;
extension
=
true
;
}
if
(
extension
)
{
domelems
.
push
(
name
);
}
},
ontext
:
function
(
text
)
{
if
(
extension
&&
text
===
name
)
{
parser
.
end
();
}
},
onclosetag
:
function
(
name
)
{
if
(
extension
)
{
domelems
.
pop
();
}
if
(
extension
&&
domelems
.
length
===
0
)
{
extension
=
false
;
}
},
onend
:
function
()
{
if
(
extensionIndex
===
0
)
{
rej
(
`
${
name
}
extension was not found.`
);
}
res
(
extensionIndex
);
}
});
parser
.
write
(
html
);
});
}
}
}
\ No newline at end of file
test/smoke/src/tests/extensions.ts
浏览文件 @
1613eac4
...
@@ -14,16 +14,17 @@ var dns = require('dns');
...
@@ -14,16 +14,17 @@ var dns = require('dns');
let
app
:
SpectronApplication
;
let
app
:
SpectronApplication
;
let
common
:
CommonActions
;
let
common
:
CommonActions
;
export
async
function
testExtensions
()
{
export
function
testExtensions
()
{
const
network
=
await
networkAttached
();
if
(
!
network
)
{
return
;
}
context
(
'
Extensions
'
,
()
=>
{
context
(
'
Extensions
'
,
()
=>
{
let
extensions
:
Extensions
;
let
extensions
:
Extensions
;
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
const
network
=
await
networkAttached
();
if
(
!
network
)
{
return
Promise
.
reject
(
'
There is no network connection for testing extensions.
'
);
}
app
=
new
SpectronApplication
(
LATEST_PATH
,
this
.
currentTest
.
fullTitle
(),
(
this
.
currentTest
as
any
).
currentRetry
(),
[
WORKSPACE_PATH
,
`--extensions-dir=
${
EXTENSIONS_DIR
}
`
]);
app
=
new
SpectronApplication
(
LATEST_PATH
,
this
.
currentTest
.
fullTitle
(),
(
this
.
currentTest
as
any
).
currentRetry
(),
[
WORKSPACE_PATH
,
`--extensions-dir=
${
EXTENSIONS_DIR
}
`
]);
common
=
new
CommonActions
(
app
);
common
=
new
CommonActions
(
app
);
extensions
=
new
Extensions
(
app
,
common
);
extensions
=
new
Extensions
(
app
,
common
);
...
@@ -37,21 +38,23 @@ export async function testExtensions() {
...
@@ -37,21 +38,23 @@ export async function testExtensions() {
});
});
it
(
`installs 'vscode-icons' extension and verifies reload is prompted`
,
async
function
()
{
it
(
`installs 'vscode-icons' extension and verifies reload is prompted`
,
async
function
()
{
const
name
=
'
vscode-icons
'
;
await
extensions
.
openExtensionsViewlet
();
await
extensions
.
openExtensionsViewlet
();
await
extensions
.
searchForExtension
(
'
vscode-icons
'
);
await
extensions
.
searchForExtension
(
name
);
await
app
.
wait
();
await
app
.
wait
();
await
extensions
.
install
FirstResult
(
);
await
extensions
.
install
Extension
(
name
);
await
app
.
wait
();
await
app
.
wait
();
assert
.
ok
(
await
extensions
.
get
FirstReloadText
()
);
assert
.
ok
(
await
extensions
.
get
ExtensionReloadText
(),
'
Reload was not prompted after extension installation.
'
);
});
});
it
(
`installs an extension and checks if it works on restart`
,
async
function
()
{
it
(
`installs an extension and checks if it works on restart`
,
async
function
()
{
const
name
=
'
vscode-icons
'
;
await
extensions
.
openExtensionsViewlet
();
await
extensions
.
openExtensionsViewlet
();
await
extensions
.
searchForExtension
(
'
vscode-icons
'
);
await
extensions
.
searchForExtension
(
name
);
await
app
.
wait
();
await
app
.
wait
();
await
extensions
.
install
FirstResult
(
);
await
extensions
.
install
Extension
(
name
);
await
app
.
wait
();
await
app
.
wait
();
await
extensions
.
get
First
ReloadText
();
await
extensions
.
get
Extension
ReloadText
();
await
app
.
stop
();
await
app
.
stop
();
await
app
.
wait
();
// wait until all resources are released (e.g. locked local storage)
await
app
.
wait
();
// wait until all resources are released (e.g. locked local storage)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录