mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Pin and unpin notebook smoke test (#15936)
* add pin/unpin smoketest * fix simple search query assert
This commit is contained in:
@@ -316,26 +316,70 @@ export class NotebookToolbar {
|
||||
|
||||
export class NotebookView {
|
||||
private static readonly inputBox = '.notebookExplorer-viewlet .search-widget .input-box';
|
||||
private static actualResult = '.search-view .result-messages';
|
||||
private static searchResult = '.search-view .result-messages';
|
||||
private static notebookTreeItem = '.split-view-view .tree-explorer-viewlet-tree-view .monaco-list-row';
|
||||
private static selectedItem = '.focused.selected';
|
||||
private static pinnedNotebooksSelector = '.split-view-view .tree-explorer-viewlet-tree-view .monaco-list[aria-label="Pinned notebooks"] .monaco-list-row';
|
||||
|
||||
constructor(private code: Code, private quickAccess: QuickAccess) { }
|
||||
|
||||
async focus(): Promise<void> {
|
||||
async focusSearchResultsView(): Promise<void> {
|
||||
return this.quickAccess.runCommand('Notebooks: Focus on Search Results View');
|
||||
}
|
||||
|
||||
async focusNotebooksView(): Promise<void> {
|
||||
return this.quickAccess.runCommand('Notebooks: Focus on Notebooks View');
|
||||
}
|
||||
|
||||
async focusPinnedNotebooksView(): Promise<void> {
|
||||
return this.quickAccess.runCommand('Notebooks: Focus on Pinned notebooks View');
|
||||
}
|
||||
|
||||
async searchInNotebook(expr: string): Promise<IElement> {
|
||||
await this.waitForSetSearchValue(expr);
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
let selector = `${NotebookView.actualResult} `;
|
||||
let selector = NotebookView.searchResult;
|
||||
if (expr) {
|
||||
selector += '.message';
|
||||
selector += ' .message';
|
||||
}
|
||||
return await this.code.waitForElement(selector, undefined);
|
||||
return this.code.waitForElement(selector, undefined);
|
||||
}
|
||||
|
||||
async waitForSetSearchValue(text: string): Promise<void> {
|
||||
const textArea = `${NotebookView.inputBox} textarea`;
|
||||
await this.code.waitForTypeInEditor(textArea, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function
|
||||
* @returns tree item ids from Notebooks View
|
||||
*/
|
||||
async getNotebookTreeItemIds(): Promise<string[]> {
|
||||
return (await this.code.waitForElements(NotebookView.notebookTreeItem, false)).map(item => item.attributes['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pin the first notebook in the Notebooks View
|
||||
*/
|
||||
async pinNotebook(): Promise<void> {
|
||||
const notebookIds = await this.getNotebookTreeItemIds();
|
||||
await this.code.waitAndDoubleClick(`${NotebookView.notebookTreeItem}[id="${notebookIds[0]}"]`);
|
||||
await this.code.waitAndClick(`${NotebookView.notebookTreeItem}${NotebookView.selectedItem} .codicon-pinned`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpin the only pinned notebook.
|
||||
* Previously pinned by the pinNotebook method.
|
||||
*/
|
||||
async unpinNotebook(): Promise<void> {
|
||||
await this.code.waitAndClick(NotebookView.pinnedNotebooksSelector);
|
||||
await this.code.waitAndClick(`${NotebookView.pinnedNotebooksSelector} .actions a[title="Unpin Notebook"]`);
|
||||
}
|
||||
|
||||
/**
|
||||
* When pinning a notebook, the pinned notebook view will show.
|
||||
*/
|
||||
async waitForPinnedNotebookView(): Promise<void> {
|
||||
await this.code.waitForElement(NotebookView.pinnedNotebooksSelector);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user