parent
a88680fd78
commit
6f6320fc43
4 changed files with 14 additions and 4 deletions
|
@ -21,6 +21,8 @@ export interface IElement {
|
|||
textContent: string;
|
||||
attributes: { [name: string]: string; };
|
||||
children: IElement[];
|
||||
top: number;
|
||||
left: number;
|
||||
}
|
||||
|
||||
export interface IDriver {
|
||||
|
|
|
@ -30,12 +30,16 @@ function serializeElement(element: Element, recursive: boolean): IElement {
|
|||
}
|
||||
}
|
||||
|
||||
const { left, top } = getTopLeftOffset(element as HTMLElement);
|
||||
|
||||
return {
|
||||
tagName: element.tagName,
|
||||
className: element.className,
|
||||
textContent: element.textContent || '',
|
||||
attributes,
|
||||
children
|
||||
children,
|
||||
left,
|
||||
top
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,12 @@ export function setup() {
|
|||
await app.workbench.search.expandReplace();
|
||||
await app.workbench.search.setReplaceText('ydob');
|
||||
await app.workbench.search.replaceFileMatch('app.js');
|
||||
|
||||
await app.workbench.search.waitForResultText('17 results in 5 files');
|
||||
|
||||
await app.workbench.search.searchFor('ydob');
|
||||
await app.workbench.search.setReplaceText('body');
|
||||
await app.workbench.search.replaceFileMatch('app.js');
|
||||
await app.workbench.search.waitForNoResultText();
|
||||
});
|
||||
});
|
||||
}
|
|
@ -57,8 +57,7 @@ export class Search extends Viewlet {
|
|||
const fileMatch = FILE_MATCH(filename);
|
||||
|
||||
await this.code.waitAndClick(fileMatch);
|
||||
// give time for Chrome to show the remove label
|
||||
await new Promise(c => setTimeout(c, 500));
|
||||
await this.code.waitForElement(`${fileMatch} .action-label.icon.action-remove`, el => !!el && el.top > 0 && el.left > 0);
|
||||
await this.code.waitAndClick(`${fileMatch} .action-label.icon.action-remove`);
|
||||
await this.code.waitForElement(fileMatch, el => !el);
|
||||
}
|
||||
|
@ -79,6 +78,7 @@ export class Search extends Viewlet {
|
|||
const fileMatch = FILE_MATCH(filename);
|
||||
|
||||
await this.code.waitAndClick(fileMatch);
|
||||
await this.code.waitForElement(`${fileMatch} .action-label.icon.action-replace-all`, el => !!el && el.top > 0 && el.left > 0);
|
||||
await this.code.waitAndClick(`${fileMatch} .action-label.icon.action-replace-all`);
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,10 @@ export class Search extends Viewlet {
|
|||
await this.code.waitForTextContent(`${VIEWLET} .messages[aria-hidden="false"] .message>p`, text);
|
||||
}
|
||||
|
||||
async waitForNoResultText(): Promise<void> {
|
||||
await this.code.waitForElement(`${VIEWLET} .messages[aria-hidden="false"] .message>p`, el => !el);
|
||||
}
|
||||
|
||||
private async waitForInputFocus(selector: string): Promise<void> {
|
||||
let retries = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue