Skip to content

Commit af668a2

Browse files
authored
Fixed default vs code smoke tests for sagemaker (#83)
1 parent 724e8e9 commit af668a2

File tree

3 files changed

+371
-10
lines changed

3 files changed

+371
-10
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
sagemaker/sagemaker-smoke-testing-entry.diff
1+
sagemaker/sagemaker-smoke-testing-entry.diff
2+
sagemaker/fix-smoke-tests.diff
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
Index: code-editor-src/test/automation/src/quickaccess.ts
2+
===================================================================
3+
--- code-editor-src.orig/test/automation/src/quickaccess.ts
4+
+++ code-editor-src/test/automation/src/quickaccess.ts
5+
@@ -6,7 +6,7 @@
6+
import { Editors } from './editors';
7+
import { Code } from './code';
8+
import { QuickInput } from './quickinput';
9+
-import { basename, isAbsolute } from 'path';
10+
+import { basename } from 'path';
11+
12+
enum QuickAccessKind {
13+
Files = 1,
14+
@@ -110,13 +110,6 @@ export class QuickAccess {
15+
}
16+
17+
async openFile(path: string): Promise<void> {
18+
- if (!isAbsolute(path)) {
19+
- // we require absolute paths to get a single
20+
- // result back that is unique and avoid hitting
21+
- // the search process to reduce chances of
22+
- // search needing longer.
23+
- throw new Error('QuickAccess.openFile requires an absolute path');
24+
- }
25+
26+
const fileName = basename(path);
27+
28+
Index: code-editor-src/test/automation/src/terminal.ts
29+
===================================================================
30+
--- code-editor-src.orig/test/automation/src/terminal.ts
31+
+++ code-editor-src/test/automation/src/terminal.ts
32+
@@ -216,7 +216,7 @@ export class Terminal {
33+
const description: IElement | undefined = await this.code.waitForElement(`${Selector.Tabs}[data-index="${i}"] ${Selector.TabsEntry} ${Selector.Description}`, () => true);
34+
35+
const label: TerminalLabel = {
36+
- name: title.textContent.replace(/^[├┌└]\s*/, ''),
37+
+ name: title.textContent.replace(/^[├┌└]\s*/, '').replace(description?.textContent || '', '').trim(),
38+
description: description?.textContent
39+
};
40+
// It's a new group if the tab does not start with ├ or └
41+
Index: code-editor-src/test/automation/src/settings.ts
42+
===================================================================
43+
--- code-editor-src.orig/test/automation/src/settings.ts
44+
+++ code-editor-src/test/automation/src/settings.ts
45+
@@ -48,11 +48,23 @@ export class SettingsEditor {
46+
47+
async clearUserSettings(): Promise<void> {
48+
await this.openUserSettingsFile();
49+
+
50+
+ // Add delay to ensure editor is ready
51+
+ await new Promise(resolve => setTimeout(resolve, 500));
52+
+
53+
await this.quickaccess.runCommand('editor.action.selectAll');
54+
await this.code.sendKeybinding('Delete', async () => {
55+
await this.editor.waitForEditorContents('settings.json', contents => contents === '');
56+
});
57+
await this.editor.waitForTypeInEditor('settings.json', `{`); // will auto close }
58+
+
59+
+ // Add default settings before closing
60+
+ await this.editor.waitForTypeInEditor('settings.json', [
61+
+ '"extensions.openNotebookData": { "notebookKey": null, "clusterId": null, "region": null },',
62+
+ '"workbench.colorTheme": "Default Dark Modern",',
63+
+ '"editor.wordWrap": "on"'
64+
+ ].join(''));
65+
+
66+
await this.editors.saveOpenedFile();
67+
await this.quickaccess.runCommand('workbench.action.closeActiveEditor');
68+
}
69+
Index: code-editor-src/test/smoke/src/areas/terminal/terminal-profiles.test.ts
70+
===================================================================
71+
--- code-editor-src.orig/test/smoke/src/areas/terminal/terminal-profiles.test.ts
72+
+++ code-editor-src/test/smoke/src/areas/terminal/terminal-profiles.test.ts
73+
@@ -6,8 +6,8 @@
74+
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue, SettingsEditor } from '../../../../automation';
75+
import { setTerminalTestSettings } from './terminal-helpers';
76+
77+
-const CONTRIBUTED_PROFILE_NAME = `JavaScript Debug Terminal`;
78+
-const ANY_PROFILE_NAME = '^((?!JavaScript Debug Terminal).)*$';
79+
+const CONTRIBUTED_PROFILE_NAME = `sh`;
80+
+const ANY_PROFILE_NAME = '^(?!^sh$).*$';
81+
82+
export function setup(options?: { skipSuite: boolean }) {
83+
(options?.skipSuite ? describe.skip : describe)('Terminal Profiles', () => {
84+
Index: code-editor-src/test/smoke/src/areas/multiroot/multiroot.test.ts
85+
===================================================================
86+
--- code-editor-src.orig/test/smoke/src/areas/multiroot/multiroot.test.ts
87+
+++ code-editor-src/test/smoke/src/areas/multiroot/multiroot.test.ts
88+
@@ -3,51 +3,39 @@
89+
* Licensed under the MIT License. See License.txt in the project root for license information.
90+
*--------------------------------------------------------------------------------------------*/
91+
92+
-import { writeFileSync } from 'fs';
93+
-import { join, dirname } from 'path';
94+
+
95+
import { Application, Logger } from '../../../../automation';
96+
import { installAllHandlers } from '../../utils';
97+
98+
-function toUri(path: string): string {
99+
- if (process.platform === 'win32') {
100+
- return `${path.replace(/\\/g, '/')}`;
101+
- }
102+
-
103+
- return `${path}`;
104+
-}
105+
-
106+
-function createWorkspaceFile(workspacePath: string): string {
107+
- const workspaceFilePath = join(dirname(workspacePath), 'smoketest.code-workspace');
108+
- const workspace = {
109+
- folders: [
110+
- { path: toUri(join(workspacePath, 'public')) },
111+
- { path: toUri(join(workspacePath, 'routes')) },
112+
- { path: toUri(join(workspacePath, 'views')) }
113+
- ],
114+
- settings: {
115+
- 'workbench.startupEditor': 'none',
116+
- 'workbench.enableExperiments': false,
117+
- 'typescript.disableAutomaticTypeAcquisition': true,
118+
- 'json.schemaDownload.enable': false,
119+
- 'npm.fetchOnlinePackageInfo': false,
120+
- 'npm.autoDetect': 'off',
121+
- 'workbench.editor.languageDetection': false,
122+
- "workbench.localHistory.enabled": false
123+
- }
124+
- };
125+
-
126+
- writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, '\t'));
127+
-
128+
- return workspaceFilePath;
129+
+async function createWorkspaceFile(app: Application, workspacePath: string): Promise<void> {
130+
+ // Create workspace file in current directory (vscode-smoketest-express)
131+
+ await app.workbench.terminal.createTerminal();
132+
+ await app.workbench.terminal.runCommandInTerminal(`cd "${workspacePath}"`);
133+
+ await app.workbench.terminal.runCommandInTerminal('WORKSPACE_DIR=$(pwd)');
134+
+ await app.workbench.terminal.runCommandInTerminal('printf \'{"folders":[{"path":"%s/public"},{"path":"%s/routes"},{"path":"%s/views"}],"settings":{"workbench.startupEditor":"none","workbench.enableExperiments":false,"typescript.disableAutomaticTypeAcquisition":true,"json.schemaDownload.enable":false,"npm.fetchOnlinePackageInfo":false,"npm.autoDetect":"off","workbench.editor.languageDetection":false,"workbench.localHistory.enabled":false}}\' "$WORKSPACE_DIR" "$WORKSPACE_DIR" "$WORKSPACE_DIR" > smoketest.code-workspace');
135+
+ await new Promise(resolve => setTimeout(resolve, 500));
136+
+
137+
+ // Open the workspace
138+
+ await app.workbench.quickaccess.runCommand('workbench.action.openWorkspace');
139+
+ await app.workbench.quickinput.waitForQuickInputOpened();
140+
+ await app.workbench.quickinput.type(`${workspacePath}/smoketest.code-workspace`);
141+
+ await new Promise(resolve => setTimeout(resolve, 500));
142+
+ await app.code.sendKeybinding('enter');
143+
+ await new Promise(resolve => setTimeout(resolve, 5000));
144+
+ await app.code.waitForElement('.monaco-workbench')
145+
}
146+
147+
export function setup(logger: Logger) {
148+
describe('Multiroot', () => {
149+
150+
// Shared before/after handling
151+
- installAllHandlers(logger, opts => {
152+
- const workspacePath = createWorkspaceFile(opts.workspacePath);
153+
- return { ...opts, workspacePath };
154+
+ installAllHandlers(logger);
155+
+
156+
+ before(async function () {
157+
+ const app = this.app as Application;
158+
+ const workspacePath = this.defaultOptions.workspacePath;
159+
+ // The app already started with a regular folder, now we need to create the multiroot setup
160+
+ await createWorkspaceFile(app, workspacePath);
161+
});
162+
163+
it('shows results from all folders', async function () {
164+
@@ -72,4 +60,4 @@ export function setup(logger: Logger) {
165+
await app.code.waitForTitle(title => /smoketest \(Workspace\)/i.test(title));
166+
});
167+
});
168+
-}
169+
+}
170+
\ No newline at end of file

0 commit comments

Comments
 (0)