-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcomputer.test.ts
More file actions
172 lines (155 loc) · 6.41 KB
/
computer.test.ts
File metadata and controls
172 lines (155 loc) · 6.41 KB
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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import Kernel from '@onkernel/sdk';
const client = new Kernel({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
describe('resource computer', () => {
test('captureScreenshot: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.browsers.computer.captureScreenshot(
'id',
{ region: { height: 0, width: 0, x: 0, y: 0 } },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Kernel.NotFoundError);
});
// Prism tests are disabled
test.skip('clickMouse: only required params', async () => {
const responsePromise = client.browsers.computer.clickMouse('id', { x: 0, y: 0 });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('clickMouse: required and optional params', async () => {
const response = await client.browsers.computer.clickMouse('id', {
x: 0,
y: 0,
button: 'left',
click_type: 'down',
hold_keys: ['string'],
num_clicks: 0,
});
});
// Prism tests are disabled
test.skip('dragMouse: only required params', async () => {
const responsePromise = client.browsers.computer.dragMouse('id', {
path: [
[0, 0],
[0, 0],
],
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('dragMouse: required and optional params', async () => {
const response = await client.browsers.computer.dragMouse('id', {
path: [
[0, 0],
[0, 0],
],
button: 'left',
delay: 0,
hold_keys: ['string'],
step_delay_ms: 0,
steps_per_segment: 1,
});
});
// Prism tests are disabled
test.skip('moveMouse: only required params', async () => {
const responsePromise = client.browsers.computer.moveMouse('id', { x: 0, y: 0 });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('moveMouse: required and optional params', async () => {
const response = await client.browsers.computer.moveMouse('id', { x: 0, y: 0, hold_keys: ['string'] });
});
// Prism tests are disabled
test.skip('pressKey: only required params', async () => {
const responsePromise = client.browsers.computer.pressKey('id', { keys: ['string'] });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('pressKey: required and optional params', async () => {
const response = await client.browsers.computer.pressKey('id', {
keys: ['string'],
duration: 0,
hold_keys: ['string'],
});
});
// Prism tests are disabled
test.skip('scroll: only required params', async () => {
const responsePromise = client.browsers.computer.scroll('id', { x: 0, y: 0 });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('scroll: required and optional params', async () => {
const response = await client.browsers.computer.scroll('id', {
x: 0,
y: 0,
delta_x: 0,
delta_y: 0,
hold_keys: ['string'],
});
});
// Prism tests are disabled
test.skip('setCursorVisibility: only required params', async () => {
const responsePromise = client.browsers.computer.setCursorVisibility('id', { hidden: true });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('setCursorVisibility: required and optional params', async () => {
const response = await client.browsers.computer.setCursorVisibility('id', { hidden: true });
});
// Prism tests are disabled
test.skip('typeText: only required params', async () => {
const responsePromise = client.browsers.computer.typeText('id', { text: 'text' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
// Prism tests are disabled
test.skip('typeText: required and optional params', async () => {
const response = await client.browsers.computer.typeText('id', { text: 'text', delay: 0 });
});
});