ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / test / monaco / monaco.test.ts 263 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
import * as playwright from '@playwright/test' ;
import { assert } from 'chai' ;
import { injectAxe } from 'axe-playwright' ;
const PORT = 8563 ;
const TIMEOUT = 20 * 1000 ;
const APP = ` http://127.0.0.1: ${ PORT } /dist/core.html ` ;
let browser: playwright. Browser;
let page: playwright Page
browserType BrowserType process env BrowserType
browser playwright browserType
headless process argv
browser
pageErrors
page browser
viewport
width
height
pageErrors length
page e
e
pageErrors e
page e
e
pageErrors e
page
e pageErrors
e
page
assert page
page
assert page
page
assert page
page
page
assert page
page
page
page
violationCount
checkedElements
axeResults page
window axe document
runOnly
type
values
axeResults violations v
isCritical v impact
emoji isCritical
v nodes node
selector node target
selector emoji
checkedElements selector
violationCount isCritical
axeResults passes pass
pass nodes node
selector node target
selector checkedElements selector
checkedElements selector
playwright violationCount
violationCount
checkedElements
axeResults page
window axe document
runOnly
type
values
axeResults violations v
isCritical v impact
emoji isCritical
v nodes node
selector node target
selector emoji
checkedElements selector
violationCount
axeResults passes pass
pass nodes node
selector node target
selector checkedElements selector
checkedElements selector
playwright violationCount
role page
container document
container
assert role
ariaLabel page
container document
container
assert ariaLabel
buttonsWithoutLabel page
document btn
label btn btn textContent
label
btn btn outerHTML
assert buttonsWithoutLabel
.
;
type
BrowserType
=
'chromium'
|
'firefox'
|
'webkit'
;
const
:
=
.
.
BROWSER
as
||
'chromium'
;
before
(
async
function
(
)
{
this
.
timeout
(
TIMEOUT
)
;
console
.
log
(
` Starting browser: ${ browserType} `
)
;
=
await
[
]
.
launch
(
{
:
.
.
includes
(
'--headless'
)
,
}
)
;
}
)
;
after
(
async
function
(
)
{
this
.
timeout
(
TIMEOUT
)
;
await
.
close
(
)
;
}
)
;
const
:
any
[
]
=
[
]
;
beforeEach
(
async
function
(
)
{
this
.
timeout
(
TIMEOUT
)
;
=
await
.
newPage
(
{
:
{
:
800
,
:
600
}
}
)
;
.
=
0
;
.
on
(
'pageerror'
,
(
)
=>
{
console
.
log
(
)
;
.
push
(
)
;
}
)
;
.
on
(
'pageerror'
,
(
)
=>
{
console
.
log
(
)
;
.
push
(
)
;
}
)
;
}
)
;
afterEach
(
async
(
)
=>
{
await
.
close
(
)
;
for
(
const
of
)
{
throw
;
}
}
)
;
describe
(
'API Integration Tests'
,
function
(
)
:
void
{
this
.
timeout
(
TIMEOUT
)
;
beforeEach
(
async
(
)
=>
{
await
.
goto
(
APP
)
;
}
)
;
it
(
'`monaco` is not exposed as global'
,
async
function
(
)
:
Promise
<
any
>
{
.
strictEqual
(
await
.
evaluate
(
` typeof monaco `
)
,
'undefined'
)
;
}
)
;
it
(
'Focus and Type'
,
async
function
(
)
:
Promise
<
any
>
{
await
.
evaluate
(
`
(function () {
instance.focus();
instance.trigger('keyboard', 'cursorHome');
instance.trigger('keyboard', 'type', {
text: 'a'
});
})()
`
)
;
.
strictEqual
(
await
.
evaluate
(
` instance.getModel().getLineContent(1) `
)
,
'afrom banana import *'
)
;
}
)
;
it
(
'Type and Undo'
,
async
function
(
)
:
Promise
<
any
>
{
await
.
evaluate
(
`
(function () {
instance.focus();
instance.trigger('keyboard', 'cursorHome');
instance.trigger('keyboard', 'type', {
text: 'a'
});
instance.getModel().undo();
})()
`
)
;
.
strictEqual
(
await
.
evaluate
(
` instance.getModel().getLineContent(1) `
)
,
'from banana import *'
)
;
}
)
;
it
(
'Multi Cursor'
,
async
function
(
)
:
Promise
<
any
>
{
await
.
evaluate
(
`
(function () {
instance.focus();
instance.trigger('keyboard', 'editor.action.insertCursorBelow');
instance.trigger('keyboard', 'editor.action.insertCursorBelow');
instance.trigger('keyboard', 'editor.action.insertCursorBelow');
instance.trigger('keyboard', 'editor.action.insertCursorBelow');
instance.trigger('keyboard', 'editor.action.insertCursorBelow');
instance.trigger('keyboard', 'type', {
text: '# '
});
instance.focus();
})()
`
)
;
await
.
waitForTimeout
(
1000
)
;
.
deepStrictEqual
(
await
.
evaluate
(
`
[
instance.getModel().getLineContent(1),
instance.getModel().getLineContent(2),
instance.getModel().getLineContent(3),
instance.getModel().getLineContent(4),
instance.getModel().getLineContent(5),
instance.getModel().getLineContent(6),
instance.getModel().getLineContent(7),
]
`
)
,
[
'# from banana import *'
,
'# '
,
'# class Monkey:'
,
'# # Bananas the monkey can eat.'
,
'# capacity = 10'
,
'# def eat(self, N):'
,
'\t\t\'\'\'Make the monkey eat N bananas!\'\'\''
]
)
;
}
)
;
describe
(
'Accessibility'
,
function
(
)
:
void
{
beforeEach
(
async
(
)
=>
{
await
.
goto
(
APP
)
;
await
injectAxe
(
)
;
await
.
evaluate
(
`
(function () {
instance.focus();
instance.trigger('keyboard', 'cursorHome');
instance.trigger('keyboard', 'type', {
text: 'a'
});
})()
`
)
;
}
)
;
it
(
'Editor should not have critical accessibility violations'
,
async
(
)
=>
{
let
=
0
;
const
=
new
Set< string >
(
)
;
const
=
await
.
evaluate
(
(
)
=>
{
return
.
.
run
(
,
{
:
{
:
'tag'
,
:
[
'wcag2a'
,
'wcag2aa'
,
'wcag21a'
,
'wcag21aa'
,
'best-practice'
]
}
}
)
;
}
)
;
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
===
'critical'
;
const
=
?
'❌'
:
undefined
;
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
?.
join
(
' '
)
;
if
(
&&
)
{
.
add
(
)
;
console
.
log
(
` ${ emoji} FAIL: ${ selector} - ${ v. id} - ${ v. description} `
)
;
}
}
)
;
+=
?
1
:
0
;
}
)
;
.
.
forEach
(
(
:
any
)
=>
{
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
?.
join
(
' '
)
;
if
(
&&
!
.
has
(
)
)
{
.
add
(
)
;
}
}
)
;
}
)
;
.
expect
(
)
.
toBe
(
0
)
;
}
)
;
it
(
'Editor should not have color contrast accessibility violations'
,
async
(
)
=>
{
let
=
0
;
const
=
new
Set< string >
(
)
;
const
=
await
.
evaluate
(
(
)
=>
{
return
.
.
run
(
,
{
:
{
:
'rule'
,
:
[
'color-contrast'
]
}
}
)
;
}
)
;
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
===
'critical'
;
const
=
?
'❌'
:
undefined
;
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
?.
join
(
' '
)
;
if
(
&&
)
{
.
add
(
)
;
console
.
log
(
` ${ emoji} FAIL: ${ selector} - ${ v. id} - ${ v. description} `
)
;
}
}
)
;
+=
1
;
}
)
;
.
.
forEach
(
(
:
any
)
=>
{
.
.
forEach
(
(
:
any
)
=>
{
const
=
.
?.
join
(
' '
)
;
if
(
&&
!
.
has
(
)
)
{
.
add
(
)
;
}
}
)
;
}
)
;
.
expect
(
)
.
toBe
(
0
)
;
}
)
;
it
(
'Monaco editor container should have an ARIA role'
,
async
(
)
=>
{
const
=
await
.
evaluate
(
(
)
=>
{
const
=
.
querySelector
(
'.monaco-editor'
)
;
return
?.
getAttribute
(
'role'
)
;
}
)
;
.
isDefined
(
,
'Monaco editor container should have a role attribute'
)
;
}
)
;
it
(
'Monaco editor should have an ARIA label'
,
async
(
)
=>
{
const
=
await
.
evaluate
(
(
)
=>
{
const
=
.
querySelector
(
'.monaco-editor'
)
;
return
?.
getAttribute
(
'aria-label'
)
;
}
)
;
.
isDefined
(
,
'Monaco editor container should have an aria-label attribute'
)
;
}
)
;
it
(
'All toolbar buttons should have accessible names'
,
async
(
)
=>
{
const
=
await
.
evaluate
(
(
)
=>
{
return
Array
.
from
(
.
querySelectorAll
(
'button'
)
)
.
filter
(
=>
{
const
=
.
getAttribute
(
'aria-label'
)
||
.
?.
trim
(
)
;
return
!
;
}
)
.
map
(
=>
.
)
;
}
)
;
.
deepEqual
(
,
[
]
,
'All toolbar buttons should have accessible names'
)
;
}
)
;
}
)
;
}
)
;