Namespace: Util
January 18, 2022 · View on GitHub
Kui API Documentation - v11.0.0 / @kui-shell/test / Util
Namespace: Util
@kui-shell/test.Util
Table of contents
Interfaces
Functions
- clickBlockActionButton
- clickNewTabButton
- clickSidecarButtonCustomized
- clickSidecarModeButton
- clickToExpandMonacoFold
- closeAllExceptFirstTab
- copyBlockLink
- doCancel
- doClear
- doList
- expectArray
- expectStruct
- expectSubset
- expectText
- expectYAML
- expectYAMLSubset
- getValueFromMonaco
- listAndOpenSidecarNoWait
- markBlockAsSection
- openSidecarByClick
- outputOf
- removeBlock
- rerunCommand
- switchToTab
- switchToTopLevelTabViaClick
- tabCount
- uniqueFileForSnapshot
- waitForXtermInput
Functions
clickBlockActionButton
▸ clickBlockActionButton(res, buttonSelector): Promise<void>
Click the specified button action button
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
buttonSelector | string |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:317
clickNewTabButton
▸ clickNewTabButton(ctx, expectedNewTabIndex): Promise<Application>
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
expectedNewTabIndex | number |
Returns
Promise<Application>
Defined in
packages/test/src/api/util.ts:490
clickSidecarButtonCustomized
▸ clickSidecarButtonCustomized(ctx, res, selector): Promise<void>
Click a sidecar button with selector
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
res | AppAndCount |
selector | string |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:446
clickSidecarModeButton
▸ clickSidecarModeButton(ctx, res, mode): Promise<void>
Click sidecar mode button by mode
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
res | AppAndCount |
mode | string |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:435
clickToExpandMonacoFold
▸ clickToExpandMonacoFold(res, lineIdx): Promise<void>
Expand the fold on the given line of a monaco editor
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
lineIdx | number |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:183
closeAllExceptFirstTab
▸ closeAllExceptFirstTab(expectedInitialNTabs): void
Close all except the first tab
Parameters
| Name | Type |
|---|---|
expectedInitialNTabs | number |
Returns
void
Defined in
packages/test/src/api/util.ts:286
copyBlockLink
▸ copyBlockLink(res): Promise<void>
Click the section button on a block, and expect it to be a section
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:340
doCancel
▸ doCancel(cmd): Promise<unknown>
Parameters
| Name | Type |
|---|---|
cmd | string |
Returns
Promise<unknown>
Defined in
packages/test/src/api/util.ts:453
doClear
▸ doClear(residualBlockCount, splitIndex?): Promise<unknown>
Parameters
| Name | Type | Default value |
|---|---|---|
residualBlockCount | number | undefined |
splitIndex | number | 1 |
Returns
Promise<unknown>
Defined in
packages/test/src/api/util.ts:483
doList
▸ doList(ctx, command, name): Promise<string>
Execute command and expect a table with name
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
command | string |
name | string |
Returns
Promise<string>
Defined in
packages/test/src/api/util.ts:371
expectArray
▸ Const expectArray(expected, failFast?, subset?): (actual: string | string[]) => boolean
is the given actual array the same as the given expected array?
Parameters
| Name | Type | Default value |
|---|---|---|
expected | string[] | undefined |
failFast | boolean | true |
subset | boolean | false |
Returns
fn
▸ (actual): boolean
Parameters
| Name | Type |
|---|---|
actual | string | string[] |
Returns
boolean
Defined in
packages/test/src/api/util.ts:157
expectStruct
▸ Const expectStruct(struct1, noParse?, failFast?): (str: string) => boolean
is the given struct2 the same as the given struct2 (given as a string)
Parameters
| Name | Type | Default value |
|---|---|---|
struct1 | object | undefined |
noParse | boolean | false |
failFast | boolean | true |
Returns
fn
▸ (str): boolean
Parameters
| Name | Type |
|---|---|
str | string |
Returns
boolean
Defined in
packages/test/src/api/util.ts:119
expectSubset
▸ Const expectSubset(struct1, failFast?): (str: string) => boolean
Parameters
| Name | Type | Default value |
|---|---|---|
struct1 | object | undefined |
failFast | boolean | true |
Returns
fn
▸ (str): boolean
Parameters
| Name | Type |
|---|---|
str | string |
Returns
boolean
Defined in
packages/test/src/api/util.ts:105
expectText
▸ Const expectText(app, expectedText, exact?, timeout?): (selector: string) => Promise<Application>
Parameters
| Name | Type | Default value |
|---|---|---|
app | Application | undefined |
expectedText | string | undefined |
exact | boolean | true |
timeout | number | CLI.waitTimeout |
Returns
fn
▸ (selector): Promise<Application>
Parameters
| Name | Type |
|---|---|
selector | string |
Returns
Promise<Application>
Defined in
packages/test/src/api/util.ts:253
expectYAML
▸ Const expectYAML(struct1, subset?, failFast?): (str: string) => boolean
Parameters
| Name | Type | Default value |
|---|---|---|
struct1 | object | undefined |
subset | boolean | false |
failFast | boolean | true |
Returns
fn
▸ (str): boolean
Parameters
| Name | Type |
|---|---|
str | string |
Returns
boolean
Defined in
packages/test/src/api/util.ts:132
expectYAMLSubset
▸ Const expectYAMLSubset(struct1, failFast?): (str: string) => boolean
Parameters
| Name | Type | Default value |
|---|---|---|
struct1 | object | undefined |
failFast | boolean | true |
Returns
fn
▸ (str): boolean
Parameters
| Name | Type |
|---|---|
str | string |
Returns
boolean
Defined in
packages/test/src/api/util.ts:154
getValueFromMonaco
▸ Const getValueFromMonaco(res, container?): Promise<string>
get the monaco editor text
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
container? | string |
Returns
Promise<string>
Defined in
packages/test/src/api/util.ts:214
listAndOpenSidecarNoWait
▸ listAndOpenSidecarNoWait(ctx, command, name, mode?): Promise<AppAndCount>
Execute command and expect a table with name,
and then open sidecar by clicking the name
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
command | string |
name | string |
mode? | string |
Returns
Promise<AppAndCount>
Defined in
packages/test/src/api/util.ts:426
markBlockAsSection
▸ markBlockAsSection(res): Promise<void>
Click the section button on a block, and expect it to be a section
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:335
openSidecarByClick
▸ openSidecarByClick(ctx, selector, name, mode?, activationId?, splitIndex?, inNotebook?): Promise<AppAndCount>
Parameters
| Name | Type | Default value |
|---|---|---|
ctx | ISuite | undefined |
selector | string | undefined |
name | string | undefined |
mode? | string | undefined |
activationId? | string | undefined |
splitIndex | number | 2 |
inNotebook | boolean | false |
Returns
Promise<AppAndCount>
Defined in
packages/test/src/api/util.ts:380
outputOf
▸ outputOf(res): Promise<string>
Output of the given block
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<string>
Defined in
packages/test/src/api/util.ts:363
removeBlock
▸ removeBlock(res): Promise<void>
Click the close button on a block, and expect it to be gone
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:330
rerunCommand
▸ rerunCommand(res): Promise<void>
Click the section button on a block, and expect it to be a section
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<void>
Defined in
packages/test/src/api/util.ts:345
switchToTab
▸ switchToTab(mode): (res: AppAndCount) => Promise<AppAndCount>
Switch sidecar tab
Parameters
| Name | Type |
|---|---|
mode | string |
Returns
fn
▸ (res): Promise<AppAndCount>
Parameters
| Name | Type |
|---|---|
res | AppAndCount |
Returns
Promise<AppAndCount>
Defined in
packages/test/src/api/util.ts:350
switchToTopLevelTabViaClick
▸ switchToTopLevelTabViaClick(ctx, N): Promise<unknown>
Parameters
| Name | Type |
|---|---|
ctx | ISuite |
N | number |
Returns
Promise<unknown>
Defined in
packages/test/src/api/util.ts:474
tabCount
▸ tabCount(app): Promise<number>
Parameters
| Name | Type |
|---|---|
app | Application |
Returns
Promise<number>
the current number of tabs
Defined in
packages/test/src/api/util.ts:280
uniqueFileForSnapshot
▸ uniqueFileForSnapshot(): string
Returns
string
Defined in
packages/test/src/api/util.ts:312
waitForXtermInput
▸ Const waitForXtermInput(app, N): Promise<boolean>
Parameters
| Name | Type |
|---|---|
app | Application |
N | number |
Returns
Promise<boolean>