generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 13
Fixed default vs code smoke tests for sagemaker E2E testing #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| sagemaker/sagemaker-smoke-testing-entry.diff | ||
| sagemaker/sagemaker-smoke-testing-entry.diff | ||
| sagemaker/fix-smoke-tests.diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| Index: code-editor-src/test/automation/src/quickaccess.ts | ||
| =================================================================== | ||
| --- code-editor-src.orig/test/automation/src/quickaccess.ts | ||
| +++ code-editor-src/test/automation/src/quickaccess.ts | ||
| @@ -6,7 +6,7 @@ | ||
| import { Editors } from './editors'; | ||
| import { Code } from './code'; | ||
| import { QuickInput } from './quickinput'; | ||
| -import { basename, isAbsolute } from 'path'; | ||
| +import { basename } from 'path'; | ||
|
|
||
| enum QuickAccessKind { | ||
| Files = 1, | ||
| @@ -110,13 +110,6 @@ export class QuickAccess { | ||
| } | ||
|
|
||
| async openFile(path: string): Promise<void> { | ||
| - if (!isAbsolute(path)) { | ||
| - // we require absolute paths to get a single | ||
| - // result back that is unique and avoid hitting | ||
| - // the search process to reduce chances of | ||
| - // search needing longer. | ||
| - throw new Error('QuickAccess.openFile requires an absolute path'); | ||
| - } | ||
|
|
||
| const fileName = basename(path); | ||
|
|
||
| Index: code-editor-src/test/automation/src/terminal.ts | ||
| =================================================================== | ||
| --- code-editor-src.orig/test/automation/src/terminal.ts | ||
| +++ code-editor-src/test/automation/src/terminal.ts | ||
| @@ -216,7 +216,7 @@ export class Terminal { | ||
| const description: IElement | undefined = await this.code.waitForElement(`${Selector.Tabs}[data-index="${i}"] ${Selector.TabsEntry} ${Selector.Description}`, () => true); | ||
|
|
||
| const label: TerminalLabel = { | ||
| - name: title.textContent.replace(/^[├┌└]\s*/, ''), | ||
| + name: title.textContent.replace(/^[├┌└]\s*/, '').replace(description?.textContent || '', '').trim(), | ||
| description: description?.textContent | ||
| }; | ||
| // It's a new group if the tab does not start with ├ or └ | ||
| Index: code-editor-src/test/automation/src/settings.ts | ||
| =================================================================== | ||
| --- code-editor-src.orig/test/automation/src/settings.ts | ||
| +++ code-editor-src/test/automation/src/settings.ts | ||
| @@ -48,11 +48,23 @@ export class SettingsEditor { | ||
|
|
||
| async clearUserSettings(): Promise<void> { | ||
| await this.openUserSettingsFile(); | ||
| + | ||
| + // Add delay to ensure editor is ready | ||
| + await new Promise(resolve => setTimeout(resolve, 500)); | ||
| + | ||
| await this.quickaccess.runCommand('editor.action.selectAll'); | ||
| await this.code.sendKeybinding('Delete', async () => { | ||
| await this.editor.waitForEditorContents('settings.json', contents => contents === ''); | ||
| }); | ||
| await this.editor.waitForTypeInEditor('settings.json', `{`); // will auto close } | ||
| + | ||
| + // Add default settings before closing | ||
| + await this.editor.waitForTypeInEditor('settings.json', [ | ||
| + '"extensions.openNotebookData": { "notebookKey": null, "clusterId": null, "region": null },', | ||
| + '"workbench.colorTheme": "Default Dark Modern",', | ||
| + '"editor.wordWrap": "on"' | ||
| + ].join('')); | ||
| + | ||
| await this.editors.saveOpenedFile(); | ||
| await this.quickaccess.runCommand('workbench.action.closeActiveEditor'); | ||
| } | ||
| Index: code-editor-src/test/smoke/src/areas/terminal/terminal-profiles.test.ts | ||
| =================================================================== | ||
| --- code-editor-src.orig/test/smoke/src/areas/terminal/terminal-profiles.test.ts | ||
| +++ code-editor-src/test/smoke/src/areas/terminal/terminal-profiles.test.ts | ||
| @@ -6,8 +6,8 @@ | ||
| import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue, SettingsEditor } from '../../../../automation'; | ||
| import { setTerminalTestSettings } from './terminal-helpers'; | ||
|
|
||
| -const CONTRIBUTED_PROFILE_NAME = `JavaScript Debug Terminal`; | ||
| -const ANY_PROFILE_NAME = '^((?!JavaScript Debug Terminal).)*$'; | ||
| +const CONTRIBUTED_PROFILE_NAME = `sh`; | ||
| +const ANY_PROFILE_NAME = '^(?!^sh$).*$'; | ||
|
|
||
| export function setup(options?: { skipSuite: boolean }) { | ||
| (options?.skipSuite ? describe.skip : describe)('Terminal Profiles', () => { | ||
| Index: code-editor-src/test/smoke/src/areas/multiroot/multiroot.test.ts | ||
| =================================================================== | ||
| --- code-editor-src.orig/test/smoke/src/areas/multiroot/multiroot.test.ts | ||
| +++ code-editor-src/test/smoke/src/areas/multiroot/multiroot.test.ts | ||
| @@ -3,51 +3,39 @@ | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| -import { writeFileSync } from 'fs'; | ||
| -import { join, dirname } from 'path'; | ||
| + | ||
| import { Application, Logger } from '../../../../automation'; | ||
| import { installAllHandlers } from '../../utils'; | ||
|
|
||
| -function toUri(path: string): string { | ||
| - if (process.platform === 'win32') { | ||
| - return `${path.replace(/\\/g, '/')}`; | ||
| - } | ||
| - | ||
| - return `${path}`; | ||
| -} | ||
| - | ||
| -function createWorkspaceFile(workspacePath: string): string { | ||
| - const workspaceFilePath = join(dirname(workspacePath), 'smoketest.code-workspace'); | ||
| - const workspace = { | ||
| - folders: [ | ||
| - { path: toUri(join(workspacePath, 'public')) }, | ||
| - { path: toUri(join(workspacePath, 'routes')) }, | ||
| - { path: toUri(join(workspacePath, '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 | ||
| - } | ||
| - }; | ||
| - | ||
| - writeFileSync(workspaceFilePath, JSON.stringify(workspace, null, '\t')); | ||
| - | ||
| - return workspaceFilePath; | ||
| +async function createWorkspaceFile(app: Application, workspacePath: string): Promise<void> { | ||
| + // Create workspace file in current directory (vscode-smoketest-express) | ||
| + await app.workbench.terminal.createTerminal(); | ||
| + await app.workbench.terminal.runCommandInTerminal(`cd "${workspacePath}"`); | ||
| + await app.workbench.terminal.runCommandInTerminal('WORKSPACE_DIR=$(pwd)'); | ||
| + 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'); | ||
| + await new Promise(resolve => setTimeout(resolve, 500)); | ||
| + | ||
| + // Open the workspace | ||
| + await app.workbench.quickaccess.runCommand('workbench.action.openWorkspace'); | ||
| + await app.workbench.quickinput.waitForQuickInputOpened(); | ||
| + await app.workbench.quickinput.type(`${workspacePath}/smoketest.code-workspace`); | ||
| + await new Promise(resolve => setTimeout(resolve, 500)); | ||
| + await app.code.sendKeybinding('enter'); | ||
| + await new Promise(resolve => setTimeout(resolve, 5000)); | ||
| + await app.code.waitForElement('.monaco-workbench') | ||
| } | ||
|
|
||
| export function setup(logger: Logger) { | ||
| describe('Multiroot', () => { | ||
|
|
||
| // Shared before/after handling | ||
| - installAllHandlers(logger, opts => { | ||
| - const workspacePath = createWorkspaceFile(opts.workspacePath); | ||
| - return { ...opts, workspacePath }; | ||
| + installAllHandlers(logger); | ||
| + | ||
| + before(async function () { | ||
| + const app = this.app as Application; | ||
| + const workspacePath = this.defaultOptions.workspacePath; | ||
| + // The app already started with a regular folder, now we need to create the multiroot setup | ||
| + await createWorkspaceFile(app, workspacePath); | ||
| }); | ||
|
|
||
| it('shows results from all folders', async function () { | ||
| @@ -72,4 +60,4 @@ export function setup(logger: Logger) { | ||
| await app.code.waitForTitle(title => /smoketest \(Workspace\)/i.test(title)); | ||
| }); | ||
| }); | ||
| -} | ||
| +} | ||
| \ No newline at end of file | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This is just for SageMaker, let's add this as a comment that we will need to change this for different integrators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be fixed in a later PR.