Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/import*as cp from'child_process';import*as os from'os';import*as playwright from'playwright';import{ IElement, ILocaleInfo, ILocalizedStrings, ILogFile }from'./driver';import{ Logger, measureAndLog }from'./logger';import{ launch as launchPlaywrightBrowser }from'./playwrightBrowser';import{ PlaywrightDriver }from'./playwrightDriver';import launch launchPlaywrightElectron
teardown
Quality
playwright playwright
codePath
workspacePath
userDataDir
extensionsPath
logger Logger
logsPath
crashesPath
videosPath
verbose
useInMemorySecretStorage
extraArgs
remote
web
tracing
snapshots
headless
browser
quality Quality
version major minor patch
extensionDevelopmentPath
extraEnv ReadonlyRecord
instances
process cpChildProcess logger Logger type safeToKill
instance process logger
instancesinstance
safeToKill resolve
processstdout data
output data
output type
logger
processstderr error logger
process code signal
logger
instancesinstance
safeToKill
signal
stopped
instance instances
instance
signal
processsignal
stopped
process
process
process
options LaunchOptions Code
stopped
optionsweb
serverProcess driver options optionslogger
serverProcess optionslogger
driver optionslogger serverProcess optionsquality optionsversion
electronProcess driver options optionslogger
safeToKill electronProcess optionslogger
driver optionslogger electronProcess safeToKill optionsquality optionsversion
driver PlaywrightDriver
driver PlaywrightDriver
logger Logger
mainProcess cpChildProcess
safeToKill
quality Quality
version major minor patch
driver driver
target prop
prop
targetProp target prop
targetProp
targetProp
args
logger argsa a
args
quality QualityStable versionmajor versionminor
name
drivername
name persist
drivername persist
keybinding
driverkeybinding accept
driver
resolve
pid mainProcesspid
done
driver
safeToKill
safeToKill
logger
safeToKill
retries
done
retries
safeToKill
logger
pid
retries
logger
pid
logger
pid
done
processpid
error
logger
done
logger
pid
processpid
e
logger
logger
processpid
e
logger e
selector IElement
driverselector
selector recursive IElement
driverselector recursive
selector textContent accept result retryCount
accept accept result textContent textContent result result
driverselectorels elslength elstextContent
s accept s s
retryCount
selector xoffset yoffset retryCount
driverselector xoffset yoffset retryCount
selector
selector
driverselector
selector value
driverselector value
selector recursive result IElement result resultlength retryCount IElement
driverselector recursive accept retryCount
selector result IElement result result retryCount IElement
driverselectorels els accept retryCount
selector retryCount
driverselector r r retryCount
title
driver accept
selector text
driverselector text
selector selection selectionStart selectionEnd
driverselector accept
selector result
driverselector accept
selector value
driverselector value
driver
marker driver
drivermarker
ILocaleInfo
driver
ILocalizedStrings
driver
ILogFile
driver
millis
drivermillis
result
timeoutMessage
retryCount
retryInterval
trial
lastError
trial retryCount
logger
loggerlastError
logger
result
result
result
result
lastError
e
lastError estack estackos estack
retryInterval
trial
element IElement element IElement IElement
queue element
queuelength
element queue
element
element
queueelementchildren
element IElement element IElement IElement
result IElement
queue element
queuelength
element queue
element
resultelement
queueelementchildren
result
/**
* Extra environment variables merged on top of the inherited `process.env`
* when launching the Electron child process. Set a value to `undefined`
* to unset the variable. Used by tests that need to inject env-based
* mocks (e.g. `VSCODE_COPILOT_CHAT_TOKEN`).
*/
readonly
?
:
<
<
string
,
string
|
undefined
>>
;
}
interface
ICodeInstance
{
kill
:
(
)
=>
Promise
<
void
>
;
}
const
=
new
Set<ICodeInstance>
(
)
;
function
registerInstance
(
:
.
,
:
,
:
'electron'
|
'server'
)
:
{
:
Promise
<
void
>
}
{
const
=
{
kill
:
(
)
=>
teardown
(
,
)
}
;
.
add
(
)
;
const
=
new
Promise<void>
(
=>
{
.
?.
on
(
'data'
,
=>
{
const
=
.
toString
(
)
;
if
(
.
indexOf
(
'calling app.quit()'
)
>=
0
&&
===
'electron'
)
{
setTimeout
(
(
)
=>
resolve
(
)
,
500
/* give Electron some time to actually terminate fully */
)
;
}
.
log
(
`[${type}] stdout: ${output}`
)
;
}
)
;
.
?.
on
(
'data'
,
=>
.
log
(
`[${type}] stderr: ${error}`
)
)
;
}
)
;
.
once
(
'exit'
,
(
,
)
=>
{
.
log
(
`[${type}] Process terminated (pid: ${process.pid}, code: ${code}, signal: ${signal})`
/**
* Dispatch a keybinding to the application.
* @paramkeybinding The keybinding to dispatch, e.g. 'ctrl+shift+p'.
* @paramaccept The acceptance function to await before returning. Wherever
* possible this should verify that the keybinding did what was expected,
* otherwise it will likely be a cause of difficult to investigate race
* conditions. This is particularly insidious when used in the automation
* library as it can surface across many test suites.
*
* This requires an async function even when there's no implementation to
* force the author to think about the accept callback and prevent mistakes
* like not making it async.
*/
async
dispatchKeybinding
(
:
string
,
accept
:
(
)
=>
Promise
<
void
>
)
:
Promise
<
void
>
{
await
this
.
.
sendKeybinding
(
,
)
;
}
async
didFinishLoad
(
)
:
Promise
<
void
>
{
return
this
.
.
didFinishLoad
(
)
;
}
async
exit
(
)
:
Promise
<
void
>
{
return
measureAndLog
(
(
)
=>
new
Promise<void>
(
=>
{
const
=
this
.
.
!
;
let
=
false
;
// Start the exit flow via driver
this
.
.
close
(
)
;
let
=
false
;
this
.
?.
then
(
(
)
=>
{
this
.
.
log
(
'Smoke test exit(): safeToKill() called'
)
;
=
true
;
}
)
;
// Await the exit of the application
(
async
(
)
=>
{
let
=
0
;
while
(
!
)
{
++
;
if
(
)
{
this
.
.
log
(
'Smoke test exit(): call did not terminate the process yet, but safeToKill is true, so we can kill it'
)
;
this
.
kill
(
)
;
}
switch
(
)
{
// after 10 seconds: forcefully kill
case
20
:
{
this
.
.
log
(
'Smoke test exit(): call did not terminate process after 10s, forcefully exiting the application...'
)
;
this
.
kill
(
)
;
break
;
}
// after 20 seconds: give up
case
40
:
{
this
.
.
log
(
'Smoke test exit(): call did not terminate process after 20s, giving up'
)
;
this
.
kill
(
)
;
=
true
;
resolve
(
)
;
break
;
}
}
try
{
.
kill
(
,
0
)
;
// throws an exception if the process doesn't exist anymore.
await
this
.
wait
(
500
)
;
}
catch
(
)
{
this
.
.
log
(
'Smoke test exit(): call terminated process successfully'
)
;
=
true
;
resolve
(
)
;
}
}
}
)
(
)
;
}
)
,
'Code#exit()'
,
this
.
)
;
}
private
kill
(
:
number
)
:
void
{
try
{
.
kill
(
,
0
)
;
// throws an exception if the process doesn't exist anymore.
}
catch
(
)
{
this
.
.
log
(
'Smoke test kill(): returning early because process does not exist anymore'
)
;
return
;
}
try
{
this
.
.
log
(
`Smoke test kill(): Trying to SIGTERM process: ${pid}`
)
;
.
kill
(
)
;
}
catch
(
)
{
this
.
.
log
(
'Smoke test kill(): SIGTERM failed'
,
)
;
}
}
async
getElement
(
:
string
)
:
Promise
<
|
undefined
>
{
return
(
await
this
.
.
getElements
(
)
)
?.
[
0
]
;
}
async
getElements
(
:
string
,
:
boolean
)
:
Promise
<
[
]
|
undefined
>
{
return
this
.
.
getElements
(
,
)
;
}
async
waitForTextContent
(
:
string
,
?
:
string
,
?
:
(
:
string
)
=>
boolean
,
?
:
number
)
:
Promise
<
string
>
{
=
||
(
=>
!==
undefined
?
===
:
!
!
)
;
return
await
this
.
poll
(
(
)
=>
this
.
.
getElements
(
)
.
then
(
=>
.
>
0
?
Promise
.
resolve
(
[
0
]
.
)
:
Promise
.
reject
(
new
Error
(
'Element not found for textContent'
)
)
)
,
=>
!
(
typeof
===
'string'
?
:
''
)
,
`get text content '${selector}'`
,
)
;
}
async
waitAndClick
(
:
string
,
?
:
number
,
?
:
number
,
:
number
=
200
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
click
(
,
,
)
,
(
)
=>
true
,
`click '${selector}'`
,
)
;
}
/**
* Clicks an element using Playwright's actionability-checked `page.click` (which
* re-verifies `elementFromPoint` right before dispatching, so the element can't
* shift under the click), with a stable-coordinates fallback when actionability
* checks fail due to an overlay intercepting pointer events. Unlike
* {@link waitAndClick} this does not poll/retry the click — it waits for the
* element to exist first, then attempts a single click. Use for elements that
* may shift due to siblings being inserted asynchronously (e.g. status bar items
* in the editor area when extensions register a language status item).
*/
async
robustClick
(
:
string
)
:
Promise
<
void
>
{
await
this
.
waitForElement
(
)
;
await
this
.
.
robustClick
(
)
;
}
async
waitForSetValue
(
:
string
,
:
string
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
setValue
(
,
)
,
(
)
=>
true
,
`set value '${selector}'`
)
;
}
async
waitForElements
(
:
string
,
:
boolean
,
accept
:
(
:
[
]
)
=>
boolean
=
=>
.
>
0
,
?
:
number
)
:
Promise
<
[
]
>
{
return
await
this
.
poll
(
(
)
=>
this
.
.
getElements
(
,
)
,
,
`get elements '${selector}'`
,
)
;
}
async
waitForElement
(
:
string
,
accept
:
(
:
|
undefined
)
=>
boolean
=
=>
!
!
,
:
number
=
200
)
:
Promise
<
>
{
return
await
this
.
poll<IElement>
(
(
)
=>
this
.
.
getElements
(
)
.
then
(
=>
[
0
]
)
,
,
`get element '${selector}'`
,
)
;
}
async
waitForActiveElement
(
:
string
,
:
number
=
200
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
isActiveElement
(
)
,
=>
,
`is active element '${selector}'`
,
)
;
}
async
waitForTitle
(
accept
:
(
:
string
)
=>
boolean
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
getTitle
(
)
,
,
`get title`
)
;
}
async
waitForTypeInEditor
(
:
string
,
:
string
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
typeInEditor
(
,
)
,
(
)
=>
true
,
`type in editor '${selector}'`
)
;
}
async
waitForEditorSelection
(
:
string
,
accept
:
(
:
{
:
number
;
:
number
}
)
=>
boolean
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
getEditorSelection
(
)
,
,
`get editor selection '${selector}'`
)
;
}
async
waitForTerminalBuffer
(
:
string
,
accept
:
(
:
string
[
]
)
=>
boolean
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
getTerminalBuffer
(
)
,
,
`get terminal buffer '${selector}'`
)
;
}
async
writeInTerminal
(
:
string
,
:
string
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
writeInTerminal
(
,
)
,
(
)
=>
true
,
`writeInTerminal '${selector}'`
)
;
}
async
whenWorkbenchRestored
(
)
:
Promise
<
void
>
{
await
this
.
poll
(
(
)
=>
this
.
.
whenWorkbenchRestored
(
)
,
(
)
=>
true
,
`when workbench restored`
)
;
}
/**
* Triggers a window reload via `trigger` and waits until the new window is up
* and its workbench restored. Awaiting {@link whenWorkbenchRestored} alone is
* not enough because that call can still be answered by the old, already
* restored document before the reload took effect.
*/
async
reloadWindow
(
trigger
:
(
)
=>
Promise
<
void
>
)
:
Promise
<
void
>
{
const
=
await
this
.
.
markWindowForReload
(
)
;
await
trigger
(
)
;
await
this
.
.
waitForWindowReload
(
)
;
await
this
.
whenWorkbenchRestored
(
)
;
}
getLocaleInfo
(
)
:
Promise
<
>
{
return
this
.
.
getLocaleInfo
(
)
;
}
getLocalizedStrings
(
)
:
Promise
<
>
{
return
this
.
.
getLocalizedStrings
(
)
;
}
getLogs
(
)
:
Promise
<
[
]
>
{
return
this
.
.
getLogs
(
)
;
}
wait
(
:
number
)
:
Promise
<
void
>
{
return
this
.
.
wait
(
)
;
}
private
async
poll<T>
(
fn
:
(
)
=>
Promise
<
T
>
,
acceptFn
:
(
:
T
)
=>
boolean
,
:
string
,
=
200
,
=
100
// millis
)
:
Promise
<
T
>
{
let
=
1
;
let
:
string
=
''
;
while
(
true
)
{
if
(
>
)
{
this
.
.
log
(
'Timeout!'
)
;
this
.
.
log
(
)
;
this
.
.
log
(
`Timeout: ${timeoutMessage} after ${(retryCount * retryInterval)/1000} seconds.`
)
;
throw
new
Error
(
`Timeout: ${timeoutMessage} after ${(retryCount * retryInterval)/1000} seconds.`