Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7de4737b
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,发现更多精彩内容 >>
提交
7de4737b
编写于
9月 06, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #58060
上级
58c34085
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
35 deletion
+48
-35
test/smoke/src/application.ts
test/smoke/src/application.ts
+15
-21
test/smoke/src/areas/multiroot/multiroot.test.ts
test/smoke/src/areas/multiroot/multiroot.test.ts
+1
-1
test/smoke/src/areas/workbench/launch.test.ts
test/smoke/src/areas/workbench/launch.test.ts
+16
-0
test/smoke/src/main.ts
test/smoke/src/main.ts
+16
-13
未找到文件。
test/smoke/src/application.ts
浏览文件 @
7de4737b
...
...
@@ -16,7 +16,7 @@ export enum Quality {
export
interface
ApplicationOptions
extends
SpawnOptions
{
quality
:
Quality
;
workspace
Path
:
string
;
folder
Path
:
string
;
workspaceFilePath
:
string
;
waitTime
:
number
;
}
...
...
@@ -61,20 +61,29 @@ export class Application {
}
async
start
():
Promise
<
any
>
{
this
.
options
.
workspacePath
=
this
.
options
.
folderPath
;
await
this
.
_start
();
await
this
.
code
.
waitForElement
(
'
.explorer-folders-view
'
);
await
this
.
code
.
waitForActiveElement
(
`.editor-instance[id="workbench.editor.walkThroughPart"] > div > div[tabIndex="0"]`
);
}
async
restart
(
options
:
{
workspace
OrFolde
r
?:
string
,
extraArgs
?:
string
[]
}):
Promise
<
any
>
{
async
restart
(
options
:
{
workspace
FilePath
?:
string
,
userDataDi
r
?:
string
,
extraArgs
?:
string
[]
}):
Promise
<
any
>
{
await
this
.
stop
();
await
new
Promise
(
c
=>
setTimeout
(
c
,
1000
));
await
this
.
_start
(
options
.
workspaceOrFolder
,
options
.
extraArgs
);
Object
.
keys
(
options
).
forEach
(
key
=>
{
if
(
options
[
key
]
===
null
||
options
[
key
]
===
undefined
)
{
delete
options
[
key
];
}
});
this
.
options
=
{
...
this
.
options
,
...
options
};
this
.
options
.
workspacePath
=
options
.
workspaceFilePath
?
options
.
workspaceFilePath
:
this
.
options
.
workspacePath
;
await
this
.
_start
();
}
private
async
_start
(
workspaceOrFolder
=
this
.
options
.
workspacePath
,
extraArgs
:
string
[]
=
[]):
Promise
<
any
>
{
cp
.
execSync
(
'
git checkout .
'
,
{
cwd
:
this
.
options
.
workspacePath
});
await
this
.
startApplication
(
workspaceOrFolder
,
extraArgs
);
private
async
_start
():
Promise
<
any
>
{
cp
.
execSync
(
'
git checkout .
'
,
{
cwd
:
this
.
options
.
folderPath
});
this
.
_code
=
await
spawn
(
this
.
options
);
this
.
_workbench
=
new
Workbench
(
this
.
_code
,
this
.
userDataPath
);
await
this
.
checkWindowReady
();
}
...
...
@@ -98,21 +107,6 @@ export class Application {
return
this
.
code
.
capturePage
();
}
private
async
startApplication
(
workspaceOrFolder
:
string
,
extraArgs
:
string
[]
=
[]):
Promise
<
any
>
{
this
.
_code
=
await
spawn
({
codePath
:
this
.
options
.
codePath
,
workspacePath
:
workspaceOrFolder
,
userDataDir
:
this
.
options
.
userDataDir
,
extensionsPath
:
this
.
options
.
extensionsPath
,
logger
:
this
.
options
.
logger
,
verbose
:
this
.
options
.
verbose
,
log
:
this
.
options
.
log
,
extraArgs
,
});
this
.
_workbench
=
new
Workbench
(
this
.
_code
,
this
.
userDataPath
);
}
private
async
checkWindowReady
():
Promise
<
any
>
{
if
(
!
this
.
code
)
{
console
.
error
(
'
No code instance found
'
);
...
...
test/smoke/src/areas/multiroot/multiroot.test.ts
浏览文件 @
7de4737b
...
...
@@ -13,7 +13,7 @@ export function setup() {
// restart with preventing additional windows from restoring
// to ensure the window after restart is the multi-root workspace
await
app
.
restart
({
workspace
OrFolder
:
app
.
workspaceFilePath
,
extraArgs
:
[
'
--disable-restore-windows
'
]
});
await
app
.
restart
({
workspace
FilePath
:
app
.
workspaceFilePath
,
extraArgs
:
[
'
--disable-restore-windows
'
]
});
});
it
(
'
shows results from all folders
'
,
async
function
()
{
...
...
test/smoke/src/areas/workbench/launch.test.ts
0 → 100644
浏览文件 @
7de4737b
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
path
from
'
path
'
;
import
{
Application
}
from
'
../../application
'
;
export
function
setup
()
{
describe
(
'
Launch
'
,
()
=>
{
it
(
`verifies that application launches when user data directory has non-ascii characters`
,
async
function
()
{
const
app
=
this
.
app
as
Application
;
await
app
.
restart
({
userDataDir
:
path
.
join
(
app
.
userDataPath
,
'
abcdø
'
)
});
});
});
}
\ No newline at end of file
test/smoke/src/main.ts
浏览文件 @
7de4737b
...
...
@@ -27,6 +27,7 @@ import { setup as setupDataExtensionTests } from './areas/extensions/extensions.
import
{
setup
as
setupTerminalTests
}
from
'
./areas/terminal/terminal.test
'
;
import
{
setup
as
setupDataMultirootTests
}
from
'
./areas/multiroot/multiroot.test
'
;
import
{
setup
as
setupDataLocalizationTests
}
from
'
./areas/workbench/localization.test
'
;
import
{
setup
as
setupLaunchTests
}
from
'
./areas/workbench/launch.test
'
;
import
{
MultiLogger
,
Logger
,
ConsoleLogger
,
FileLogger
}
from
'
./logger
'
;
const
tmpDir
=
tmp
.
dirSync
({
prefix
:
'
t
'
})
as
{
name
:
string
;
removeCallback
:
Function
;
};
...
...
@@ -53,7 +54,7 @@ const opts = minimist(args, {
const
workspaceFilePath
=
path
.
join
(
testDataPath
,
'
smoketest.code-workspace
'
);
const
testRepoUrl
=
'
https://github.com/Microsoft/vscode-smoketest-express
'
;
const
workspace
Path
=
path
.
join
(
testDataPath
,
'
vscode-smoketest-express
'
);
const
folder
Path
=
path
.
join
(
testDataPath
,
'
vscode-smoketest-express
'
);
const
extensionsPath
=
path
.
join
(
testDataPath
,
'
extensions-dir
'
);
mkdirp
.
sync
(
extensionsPath
);
...
...
@@ -158,13 +159,13 @@ async function createWorkspaceFile(): Promise<void> {
const
workspace
=
{
folders
:
[
{
path
:
toUri
(
path
.
join
(
workspace
Path
,
'
public
'
))
path
:
toUri
(
path
.
join
(
folder
Path
,
'
public
'
))
},
{
path
:
toUri
(
path
.
join
(
workspace
Path
,
'
routes
'
))
path
:
toUri
(
path
.
join
(
folder
Path
,
'
routes
'
))
},
{
path
:
toUri
(
path
.
join
(
workspace
Path
,
'
views
'
))
path
:
toUri
(
path
.
join
(
folder
Path
,
'
views
'
))
}
]
};
...
...
@@ -175,22 +176,22 @@ async function createWorkspaceFile(): Promise<void> {
async
function
setupRepository
():
Promise
<
void
>
{
if
(
opts
[
'
test-repo
'
])
{
console
.
log
(
'
*** Copying test project repository:
'
,
opts
[
'
test-repo
'
]);
rimraf
.
sync
(
workspace
Path
);
rimraf
.
sync
(
folder
Path
);
// not platform friendly
cp
.
execSync
(
`cp -R "
${
opts
[
'
test-repo
'
]}
" "
${
workspace
Path
}
"`
);
cp
.
execSync
(
`cp -R "
${
opts
[
'
test-repo
'
]}
" "
${
folder
Path
}
"`
);
}
else
{
if
(
!
fs
.
existsSync
(
workspace
Path
))
{
if
(
!
fs
.
existsSync
(
folder
Path
))
{
console
.
log
(
'
*** Cloning test project repository...
'
);
cp
.
spawnSync
(
'
git
'
,
[
'
clone
'
,
testRepoUrl
,
workspace
Path
]);
cp
.
spawnSync
(
'
git
'
,
[
'
clone
'
,
testRepoUrl
,
folder
Path
]);
}
else
{
console
.
log
(
'
*** Cleaning test project repository...
'
);
cp
.
spawnSync
(
'
git
'
,
[
'
fetch
'
],
{
cwd
:
workspace
Path
});
cp
.
spawnSync
(
'
git
'
,
[
'
reset
'
,
'
--hard
'
,
'
FETCH_HEAD
'
],
{
cwd
:
workspace
Path
});
cp
.
spawnSync
(
'
git
'
,
[
'
clean
'
,
'
-xdf
'
],
{
cwd
:
workspace
Path
});
cp
.
spawnSync
(
'
git
'
,
[
'
fetch
'
],
{
cwd
:
folder
Path
});
cp
.
spawnSync
(
'
git
'
,
[
'
reset
'
,
'
--hard
'
,
'
FETCH_HEAD
'
],
{
cwd
:
folder
Path
});
cp
.
spawnSync
(
'
git
'
,
[
'
clean
'
,
'
-xdf
'
],
{
cwd
:
folder
Path
});
}
console
.
log
(
'
*** Running yarn...
'
);
cp
.
execSync
(
'
yarn
'
,
{
cwd
:
workspace
Path
,
stdio
:
'
inherit
'
});
cp
.
execSync
(
'
yarn
'
,
{
cwd
:
folder
Path
,
stdio
:
'
inherit
'
});
}
}
...
...
@@ -221,7 +222,8 @@ function createApp(quality: Quality): Application {
return
new
Application
({
quality
,
codePath
:
opts
.
build
,
workspacePath
,
folderPath
,
workspacePath
:
folderPath
,
userDataDir
,
extensionsPath
,
workspaceFilePath
,
...
...
@@ -308,4 +310,5 @@ describe('Test', () => {
setupTerminalTests
();
setupDataMultirootTests
();
setupDataLocalizationTests
();
setupLaunchTests
();
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录