mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Add intellisense checks in code cell smoke test (#16362)
* check colorization and completion suggestions * check for suggestions widget * make selector more specific
This commit is contained in:
@@ -75,6 +75,11 @@ export class Notebook {
|
||||
return this.code.waitForTextContent(selector, undefined, c => accept(c.replace(/\u00a0/g, ' ')));
|
||||
}
|
||||
|
||||
async waitForColorization(spanNumber: string, color: string): Promise<void> {
|
||||
const span = `span:nth-child(${spanNumber})[class="${color}"]`;
|
||||
await this.code.waitForElement(span);
|
||||
}
|
||||
|
||||
public async selectAllTextInEditor(): Promise<void> {
|
||||
const editor = '.notebook-cell.active .monaco-editor';
|
||||
await this.code.waitAndClick(editor);
|
||||
@@ -115,6 +120,18 @@ export class Notebook {
|
||||
return (await this.code.waitForElements('div.notebook-cell', false)).map(cell => cell.attributes['id']);
|
||||
}
|
||||
|
||||
// Code Cell Actions
|
||||
|
||||
async waitForSuggestionWidget(): Promise<void> {
|
||||
const suggestionWidgetSelector = 'div.editor-widget.suggest-widget';
|
||||
await this.code.waitForElement(suggestionWidgetSelector);
|
||||
}
|
||||
|
||||
async waitForSuggestionResult(expectedResult: string): Promise<void> {
|
||||
const expectedResultSelector = `div.editor-widget.suggest-widget div.monaco-list-row.focused[aria-label="${expectedResult}"]`;
|
||||
await this.code.waitForElement(expectedResultSelector);
|
||||
}
|
||||
|
||||
// Text Cell Actions
|
||||
|
||||
private static readonly textCellPreviewSelector = 'div.notebook-preview';
|
||||
|
||||
@@ -31,11 +31,26 @@ export function setup() {
|
||||
it('can perform basic code cell functionality', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.sqlNotebook.newUntitledNotebook();
|
||||
await app.workbench.sqlNotebook.notebookToolbar.waitForKernel('SQL');
|
||||
await app.workbench.sqlNotebook.addCellFromPlaceholder('Code');
|
||||
await app.workbench.sqlNotebook.waitForPlaceholderGone();
|
||||
|
||||
const sampleText: string = 'SELECT * FROM sys.tables';
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor(sampleText);
|
||||
const text1: string = 'SEL';
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor(text1);
|
||||
await app.code.dispatchKeybinding('ctrl+space bar');
|
||||
|
||||
// check for completion suggestions
|
||||
await app.workbench.sqlNotebook.waitForSuggestionWidget();
|
||||
await app.workbench.sqlNotebook.waitForSuggestionResult('SELECT');
|
||||
await app.code.dispatchKeybinding('tab');
|
||||
|
||||
const text2: string = ' * FROM employees';
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor(text2);
|
||||
|
||||
await app.workbench.sqlNotebook.waitForColorization('1', 'mtk5'); // SELECT
|
||||
await app.workbench.sqlNotebook.waitForColorization('3', 'mtk13'); // *
|
||||
await app.workbench.sqlNotebook.waitForColorization('5', 'mtk5'); // FROM
|
||||
await app.workbench.sqlNotebook.waitForColorization('6', 'mtk1'); // employees
|
||||
});
|
||||
|
||||
// Python Notebooks
|
||||
|
||||
Reference in New Issue
Block a user