mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
Search smoke tests (#13469)
* Add smoke test * add simple tests for searching in notebooks view * address pr comments * address pr comments * add search smoke tests to separate file * remove span from selector
This commit is contained in:
@@ -14,9 +14,11 @@ const winOrCtrl = process.platform === 'darwin' ? 'ctrl' : 'win';
|
||||
export class Notebook {
|
||||
|
||||
public readonly toolbar: NotebookToolbar;
|
||||
public readonly view: NotebookView;
|
||||
|
||||
constructor(private code: Code, private quickAccess: QuickAccess, private quickInput: QuickInput, private editors: Editors) {
|
||||
this.toolbar = new NotebookToolbar(code);
|
||||
this.view = new NotebookView(code, quickAccess);
|
||||
}
|
||||
|
||||
async openFile(fileName: string): Promise<void> {
|
||||
@@ -194,3 +196,29 @@ export class NotebookToolbar {
|
||||
await this.code.waitForElement(NotebookToolbar.notTrustedButtonSelector);
|
||||
}
|
||||
}
|
||||
|
||||
export class NotebookView {
|
||||
private static readonly inputBox = '.notebookExplorer-viewlet .search-widget .input-box';
|
||||
private static actualResult = '.search-view .result-messages';
|
||||
|
||||
constructor(private code: Code, private quickAccess: QuickAccess) { }
|
||||
|
||||
async focus(): Promise<void> {
|
||||
return this.quickAccess.runCommand('Notebooks: Focus on Search Results View');
|
||||
}
|
||||
|
||||
async searchInNotebook(expr: string): Promise<IElement> {
|
||||
await this.waitForSetSearchValue(expr);
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
let selector = `${NotebookView.actualResult} `;
|
||||
if (expr) {
|
||||
selector += '.message';
|
||||
}
|
||||
return await this.code.waitForElement(selector, undefined);
|
||||
}
|
||||
|
||||
async waitForSetSearchValue(text: string): Promise<void> {
|
||||
const textArea = `${NotebookView.inputBox} textarea`;
|
||||
await this.code.waitForTypeInEditor(textArea, text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user