Reenable disabled smoke and integration tests (#23976)

* Smoke tests run locally

* Re-enable smoke tests for pipeline

* Resolves merge conflict with distro

* Runs smoke tests with xvfb

* Updates distro commit hash to fix merge conflict

* Install xvfb

* Install xvfb for fail on error

* Removing log path temporarily

* Clarifies edit comments

* Darwin SQL build publishes log files

* Resolve merge conflicts

* Revert "Resolve merge conflicts"

This reverts commit fb53d5662745d4ba5c897be0b0c9eb2ed093a38e.

* Update distro hash

* List all files to find full product.json path

* Fix script

* Fix script

* Adjust test path for arm64

* List all files for darwin

* always list all files

* Specify Darwin logs directory

* Adjust publish log files condition

* Fix condition

* Removes apt from script

* Add missing import

* Fix issues stopping smoke tests from running

* Disables failing tests

* Updates distro hash

* Remove list all files scripts

* Clean up

* Update distro hash
This commit is contained in:
Lewis Sanchez
2023-07-26 10:39:30 -07:00
committed by GitHub
parent cc778ad69f
commit 1d28f838a0
18 changed files with 261 additions and 195 deletions

View File

@@ -3,7 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { join } from 'path';
// import { join } from 'path'; // {{SQL CARBON EDIT}} - not used
import * as cp from 'child_process';
import * as os from 'os';
import * as treekill from 'tree-kill';
import { IElement, ILocaleInfo, ILocalizedStrings, ILogFile } from './driver';
@@ -198,29 +199,30 @@ export class Code {
accept = accept || (result => textContent !== undefined ? textContent === result : !!result);
// {{SQL CARBON EDIT}} Print out found element
return await poll(
() => this.driver.getElements(windowId, selector).then(els => els.length > 0 ? Promise.resolve(els[0].textContent) : Promise.reject(new Error('Element not found for textContent'))),
s => accept!(typeof s.textContent === 'string' ? s.textContent : ''),
return await this.poll(
() => this.driver.getElements(selector).then(els => els.length > 0 ? Promise.resolve(els[0].textContent) : Promise.reject(new Error('Element not found for textContent'))),
s => accept!(typeof s === 'string' ? s : ''),
`get text content '${selector}'`,
retryCount
);
this.logger.log(`got text content element ${JSON.stringify(element)}`);
return element.textContent;
}
async waitAndClick(selector: string, xoffset?: number, yoffset?: number, retryCount: number = 200): Promise<void> {
await this.poll(() => this.driver.click(selector, xoffset, yoffset), () => true, `click '${selector}'`, retryCount);
}
// {{SQL CARBON EDIT}} - defined waitAndDoubleClick
async waitAndDoubleClick(selector: string): Promise<void> {
await this.poll(() => this.driver.doubleClick(selector), () => true, `double click '${selector}'`);
}
async waitForSetValue(selector: string, value: string): Promise<void> {
await this.poll(() => this.driver.setValue(selector, value), () => true, `set value '${selector}'`);
}
async waitForElements(selector: string, recursive: boolean, accept: (result: IElement[]) => boolean = result => result.length > 0): Promise<IElement[]> {
// {{SQL CARBON EDIT}} Print out found element
return await poll(() => this.driver.getElements(windowId, selector, recursive), accept, this.logger, `get elements '${selector}'`);
this.logger.log(`got elements ${elements.map(element => JSON.stringify(element)).join('\n')}`);
return elements;
return await this.poll(() => this.driver.getElements(selector, recursive), accept, `get elements '${selector}'`);
}
async waitForElement(selector: string, accept: (result: IElement | undefined) => boolean = result => !!result, retryCount: number = 200): Promise<IElement> {
@@ -230,6 +232,11 @@ export class Code {
return element;
}
// {{SQL CARBON EDIT}} - defined waitForElementGone
async waitForElementGone(selector: string, accept: (result: IElement | undefined) => boolean = result => !result, retryCount: number = 200): Promise<IElement> {
return await this.poll<IElement>(() => this.driver.getElements(selector).then(els => els[0]), accept, `get element gone '${selector}'`, retryCount);
}
async waitForActiveElement(selector: string, retryCount: number = 200): Promise<void> {
await this.poll(() => this.driver.isActiveElement(selector), r => r, `is active element '${selector}'`, retryCount);
}

View File

@@ -187,6 +187,14 @@ export class PlaywrightDriver {
await this.page.mouse.click(x + (xoffset ? xoffset : 0), y + (yoffset ? yoffset : 0));
}
// {{SQL CARBON EDIT}} - defined doubleClick
async doubleClick(selector: string) {
await this.click(selector, 0, 0);
await this.timeout(60);
await this.click(selector, 0, 0);
await this.timeout(100);
}
async setValue(selector: string, text: string) {
return this.page.evaluate(([driver, selector, text]) => driver.setValue(selector, text), [await this.getDriverHandle(), selector, text] as const);
}

View File

@@ -8,7 +8,8 @@ import { Code } from './code';
import { QuickInput } from './quickinput';
import { basename, isAbsolute } from 'path';
enum QuickAccessKind {
// {{SQL CARBON EDIT}} - exporting enum for openQuickAccessWithRetry call to work in other test files
export enum QuickAccessKind {
Files = 1,
Commands,
Symbols
@@ -131,7 +132,8 @@ export class QuickAccess {
await this.editors.selectTab(fileName);
}
private async openQuickAccessWithRetry(kind: QuickAccessKind, value?: string): Promise<void> {
// {{ SQL CARBON EDIT }} - Removed private access specifier
async openQuickAccessWithRetry(kind: QuickAccessKind, value?: string): Promise<void> {
let retries = 0;
// Other parts of code might steal focus away from quickinput :(

View File

@@ -17,6 +17,13 @@ export class QuickInput {
constructor(private code: Code) { }
// {{SQL CARBON EDIT}} - defined submit
async submit(text: string): Promise<void> {
await this.code.waitForSetValue(QuickInput.QUICK_INPUT_INPUT, text);
await this.code.dispatchKeybinding('enter');
await this.waitForQuickInputClosed();
}
async waitForQuickInputOpened(retryCount?: number): Promise<void> {
await this.code.waitForActiveElement(QuickInput.QUICK_INPUT_INPUT, retryCount);
}

View File

@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import { Code } from '../code';
import { QuickAccess } from '../quickaccess';
import { QuickAccess, QuickAccessKind } from '../quickaccess';
import { QuickInput } from '../quickinput';
import { Editors } from '../editors';
import { IElement } from '..';
import { IElement } from '../driver';
import * as constants from '../sql/constants';
const activeCellSelector = '.notebook-cell.active';
@@ -27,7 +27,7 @@ export class Notebook {
}
async openFile(fileName: string): Promise<void> {
await this.quickAccess.openQuickAccess(fileName);
await this.quickAccess.openQuickAccessWithRetry(QuickAccessKind.Files, fileName);
await this.quickInput.waitForQuickInputElements(names => names[0] === fileName);
await this.code.waitAndClick('.quick-input-widget .quick-input-list .monaco-list-row');
await this.editors.waitForActiveTab(fileName);

View File

@@ -19,7 +19,7 @@ import { KeybindingsEditor } from './keybindings';
import { Editors } from './editors';
import { Code } from './code';
import { Terminal } from './terminal';
import { Notebook } from './notebook';
// import { Notebook } from './notebook'; // {{SQL CARBON EDIT}} - This is for VSCode notebooks and not SQL notebooks
import { Localization } from './localization';
import { Task } from './task';
@@ -58,7 +58,7 @@ export class Workbench {
readonly settingsEditor: SettingsEditor;
readonly keybindingsEditor: KeybindingsEditor;
readonly terminal: Terminal;
readonly notebook: Notebook;
// readonly notebook: Notebook; // {{SQL CARBON EDIT}} - This is for VSCode notebooks and not SQL notebooks
readonly localization: Localization;
readonly task: Task;
@@ -105,7 +105,7 @@ export class Workbench {
this.addRemoteBookDialog = new AddRemoteBookDialog(code);
this.taskPanel = new TaskPanel(code, this.quickaccess);
// {{END}}
this.notebook = new Notebook(this.quickaccess, this.quickinput, code);
// this.notebook = new Notebook(this.quickaccess, code); // {{SQL CARBON EDIT}} - This is for VSCode notebooks and not SQL notebooks
this.localization = new Localization(code);
this.task = new Task(code, this.editor, this.editors, this.quickaccess, this.quickinput, this.terminal);
}