MCPcopy Create free account
hub / github.com/GCWing/BitFun / clear

Method clear

tests/e2e/page-objects/components/ChatInput.ts:157–185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155 }
156
157 async clear(): Promise<void> {
158 const input = await this.findTextarea();
159 if (input) {
160 const isContentEditable = await input.getAttribute('contenteditable');
161
162 if (isContentEditable === 'true') {
163 await input.click();
164 await browser.pause(50);
165 await browser.execute((element: HTMLElement) => {
166 element.focus();
167 element.textContent = '';
168 const inputEvent = typeof InputEvent !== 'undefined'
169 ? new InputEvent('input', { bubbles: true, inputType: 'deleteContentBackward', data: null })
170 : new Event('input', { bubbles: true });
171 element.dispatchEvent(inputEvent);
172 element.dispatchEvent(new Event('change', { bubbles: true }));
173 }, input);
174
175 await browser.waitUntil(async () => (await this.getValue()) === '', {
176 timeout: 2000,
177 interval: 100,
178 timeoutMsg: 'Chat input was not cleared',
179 });
180 } else {
181 // Regular textarea
182 await input.clearValue();
183 }
184 }
185 }
186
187 async clickSend(): Promise<void> {
188 const selectors = [

Callers 4

l1-chat.spec.tsFile · 0.45
basic-chat.spec.tsFile · 0.45

Calls 6

findTextareaMethod · 0.95
getValueMethod · 0.95
clickMethod · 0.80
pauseMethod · 0.80
executeMethod · 0.65
focusMethod · 0.65

Tested by 1