Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c6cc8127
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,发现更多精彩内容 >>
提交
c6cc8127
编写于
9月 12, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #58060
上级
a374daf7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
69 addition
and
27 deletion
+69
-27
test/smoke/src/application.ts
test/smoke/src/application.ts
+16
-5
test/smoke/src/areas/workbench/launch.test.ts
test/smoke/src/areas/workbench/launch.test.ts
+36
-0
test/smoke/src/main.ts
test/smoke/src/main.ts
+17
-22
未找到文件。
test/smoke/src/application.ts
浏览文件 @
c6cc8127
...
...
@@ -3,6 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
{
Workbench
}
from
'
./areas/workbench/workbench
'
;
import
{
Code
,
spawn
,
SpawnOptions
}
from
'
./vscode/code
'
;
import
{
Logger
}
from
'
./logger
'
;
...
...
@@ -17,6 +19,7 @@ export interface ApplicationOptions extends SpawnOptions {
quality
:
Quality
;
workspacePath
:
string
;
waitTime
:
number
;
screenshotsPath
:
string
|
null
;
}
export
class
Application
{
...
...
@@ -71,7 +74,7 @@ export class Application {
private
async
_start
(
workspaceOrFolder
=
this
.
workspacePathOrFolder
,
extraArgs
:
string
[]
=
[]):
Promise
<
any
>
{
this
.
_workspacePathOrFolder
=
workspaceOrFolder
;
await
this
.
startApplication
(
workspaceOrFolder
,
extraArgs
);
await
this
.
startApplication
(
extraArgs
);
await
this
.
checkWindowReady
();
}
...
...
@@ -91,14 +94,22 @@ export class Application {
}
}
async
capturePage
():
Promise
<
string
>
{
return
this
.
code
.
capturePage
();
async
captureScreenshot
(
name
:
string
):
Promise
<
void
>
{
if
(
this
.
options
.
screenshotsPath
)
{
const
raw
=
await
this
.
code
.
capturePage
();
const
buffer
=
Buffer
.
from
(
raw
,
'
base64
'
);
const
screenshotPath
=
path
.
join
(
this
.
options
.
screenshotsPath
,
`
${
name
}
.png`
);
if
(
this
.
options
.
log
)
{
this
.
logger
.
log
(
'
*** Screenshot recorded:
'
,
screenshotPath
);
}
fs
.
writeFileSync
(
screenshotPath
,
buffer
);
}
}
private
async
startApplication
(
workspaceOrFolder
:
string
,
extraArgs
:
string
[]
=
[]):
Promise
<
any
>
{
private
async
startApplication
(
extraArgs
:
string
[]
=
[]):
Promise
<
any
>
{
this
.
_code
=
await
spawn
({
codePath
:
this
.
options
.
codePath
,
workspacePath
:
workspace
OrFolder
,
workspacePath
:
this
.
workspacePath
OrFolder
,
userDataDir
:
this
.
options
.
userDataDir
,
extensionsPath
:
this
.
options
.
extensionsPath
,
logger
:
this
.
options
.
logger
,
...
...
test/smoke/src/areas/workbench/launch.test.ts
0 → 100644
浏览文件 @
c6cc8127
/*---------------------------------------------------------------------------------------------
* 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
,
ApplicationOptions
}
from
'
../../application
'
;
export
function
setup
()
{
let
app
:
Application
;
after
(
async
function
()
{
if
(
app
)
{
await
app
.
stop
();
}
});
afterEach
(
async
function
()
{
if
(
app
)
{
if
(
this
.
currentTest
.
state
===
'
failed
'
)
{
const
name
=
this
.
currentTest
.
fullTitle
().
replace
(
/
[^
a-z0-9
\-]
/ig
,
'
_
'
);
await
app
.
captureScreenshot
(
name
);
}
}
});
describe
(
'
Launch
'
,
()
=>
{
it
(
`verifies that application launches when user data directory has non-ascii characters`
,
async
function
()
{
const
defaultOptions
=
this
.
defaultOptions
as
ApplicationOptions
;
const
options
:
ApplicationOptions
=
{
...
defaultOptions
,
userDataDir
:
path
.
join
(
defaultOptions
.
userDataDir
,
'
abcdø
'
)
};
app
=
new
Application
(
options
);
await
app
.
start
();
});
});
}
\ No newline at end of file
test/smoke/src/main.ts
浏览文件 @
c6cc8127
...
...
@@ -11,9 +11,9 @@ import * as tmp from 'tmp';
import
*
as
rimraf
from
'
rimraf
'
;
import
*
as
mkdirp
from
'
mkdirp
'
;
import
{
ncp
}
from
'
ncp
'
;
import
{
Application
,
Quality
}
from
'
./application
'
;
import
{
Application
,
Quality
,
ApplicationOptions
}
from
'
./application
'
;
import
{
setup
as
setupDataMigrationTests
}
from
'
./areas/workbench/data-migration.test
'
;
//
import { setup as setupDataMigrationTests } from './areas/workbench/data-migration.test';
import
{
setup
as
setupDataLossTests
}
from
'
./areas/workbench/data-loss.test
'
;
import
{
setup
as
setupDataExplorerTests
}
from
'
./areas/explorer/explorer.test
'
;
import
{
setup
as
setupDataPreferencesTests
}
from
'
./areas/preferences/preferences.test
'
;
...
...
@@ -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
;
};
...
...
@@ -171,7 +172,7 @@ async function setup(): Promise<void> {
console
.
log
(
'
*** Smoketest setup done!
\n
'
);
}
function
create
App
(
quality
:
Quality
):
Application
{
function
create
Options
():
ApplicationOptions
{
const
loggers
:
Logger
[]
=
[];
if
(
opts
.
verbose
)
{
...
...
@@ -184,8 +185,7 @@ function createApp(quality: Quality): Application {
loggers
.
push
(
new
FileLogger
(
opts
.
log
));
log
=
'
trace
'
;
}
return
new
Application
({
return
{
quality
,
codePath
:
opts
.
build
,
workspacePath
,
...
...
@@ -194,14 +194,16 @@ function createApp(quality: Quality): Application {
waitTime
:
parseInt
(
opts
[
'
wait-time
'
]
||
'
0
'
)
||
20
,
logger
:
new
MultiLogger
(
loggers
),
verbose
:
opts
.
verbose
,
log
});
log
,
screenshotsPath
};
}
before
(
async
function
()
{
// allow two minutes for setup
this
.
timeout
(
2
*
60
*
1000
);
await
setup
();
this
.
defaultOptions
=
createOptions
();
});
after
(
async
function
()
{
...
...
@@ -216,13 +218,13 @@ after(async function () {
await
new
Promise
((
c
,
e
)
=>
rimraf
(
testDataPath
,
{
maxBusyTries
:
10
},
err
=>
err
?
e
(
err
)
:
c
()));
});
describe
(
'
Data Migration
'
,
()
=>
{
setupDataMigrationTests
(
userDataDir
,
createApp
);
});
//
describe('Data Migration', () => {
//
setupDataMigrationTests(userDataDir, createApp);
//
});
describe
(
'
Test
'
,
()
=>
{
describe
(
'
Running Code
'
,
()
=>
{
before
(
async
function
()
{
const
app
=
createApp
(
quality
);
const
app
=
new
Application
(
this
.
defaultOptions
);
await
app
!
.
start
();
this
.
app
=
app
;
});
...
...
@@ -236,19 +238,10 @@ describe('Test', () => {
if
(
this
.
currentTest
.
state
!==
'
failed
'
)
{
return
;
}
const
app
=
this
.
app
as
Application
;
const
raw
=
await
app
.
capturePage
();
const
buffer
=
Buffer
.
from
(
raw
,
'
base64
'
);
const
name
=
this
.
currentTest
.
fullTitle
().
replace
(
/
[^
a-z0-9
\-]
/ig
,
'
_
'
);
const
screenshotPath
=
path
.
join
(
screenshotsPath
,
`
${
name
}
.png`
);
if
(
opts
.
log
)
{
app
.
logger
.
log
(
'
*** Screenshot recorded:
'
,
screenshotPath
);
}
fs
.
writeFileSync
(
screenshotPath
,
buffer
);
await
app
.
captureScreenshot
(
name
);
});
}
...
...
@@ -275,3 +268,5 @@ describe('Test', () => {
setupDataMultirootTests
();
setupDataLocalizationTests
();
});
setupLaunchTests
();
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录