|
| 1 | +Index: code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-extensions-install.test.ts |
| 2 | +=================================================================== |
| 3 | +--- /dev/null |
| 4 | ++++ code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-extensions-install.test.ts |
| 5 | +@@ -0,0 +1,31 @@ |
| 6 | ++/*--------------------------------------------------------------------------------------------- |
| 7 | ++* Copyright Amazon.com Inc. or its affiliates. All rights reserved. |
| 8 | ++* Licensed under the MIT License. See License.txt in the project root for license information. |
| 9 | ++*--------------------------------------------------------------------------------------------*/ |
| 10 | ++ |
| 11 | ++import { Application, TerminalCommandId} from '../../../../automation'; |
| 12 | ++ |
| 13 | ++export function setup() { |
| 14 | ++ describe('Extensions', () => { |
| 15 | ++ let app: Application; |
| 16 | ++ |
| 17 | ++ before(async function () { |
| 18 | ++ app = this.app as Application; |
| 19 | ++ await app.workbench.terminal.createTerminal(); |
| 20 | ++ }); |
| 21 | ++ |
| 22 | ++ after(async function () { |
| 23 | ++ await app.workbench.terminal.runCommand(TerminalCommandId.KillAll); |
| 24 | ++ }); |
| 25 | ++ |
| 26 | ++ it('extensions can be installed via terminal', async function () { |
| 27 | ++ |
| 28 | ++ // Install Amazon EMR extension via terminal command |
| 29 | ++ const emrInstallCommand = 'sagemaker-code-editor --install-extension AmazonEMR.emr-tools --extensions-dir /home/sagemaker-user/sagemaker-code-editor-server-data/extensions'; |
| 30 | ++ await app.workbench.terminal.runCommandInTerminal(emrInstallCommand); |
| 31 | ++ |
| 32 | ++ // Wait for extension to be installed and verify it appears in activity bar |
| 33 | ++ await app.code.waitForElement('.activitybar ul[role="tablist"] li a[aria-label="Amazon EMR"]', undefined, 150); |
| 34 | ++ }); |
| 35 | ++ }); |
| 36 | ++} |
| 37 | +\ No newline at end of file |
| 38 | +Index: code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-extensions.test.ts |
| 39 | +=================================================================== |
| 40 | +--- /dev/null |
| 41 | ++++ code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-extensions.test.ts |
| 42 | +@@ -0,0 +1,22 @@ |
| 43 | ++/*--------------------------------------------------------------------------------------------- |
| 44 | ++* Copyright Amazon.com Inc. or its affiliates. All rights reserved. |
| 45 | ++* Licensed under the MIT License. See License.txt in the project root for license information. |
| 46 | ++*--------------------------------------------------------------------------------------------*/ |
| 47 | ++ |
| 48 | ++import { Logger } from '../../../../automation'; |
| 49 | ++import { installAllHandlers } from '../../utils'; |
| 50 | ++import { setup as setupSageMakerExtensionsInstallTests } from './sagemaker-extensions-install.test'; |
| 51 | ++import { setup as setupSageMakerIdleExtensionTests } from './sagemaker-idle-extension.test'; |
| 52 | ++import { setup as setupSageMakerDarkThemeTests } from './sagemaker-dark-theme.test'; |
| 53 | ++ |
| 54 | ++export function setup(logger: Logger) { |
| 55 | ++ describe('SageMaker Extensions', function () { |
| 56 | ++ |
| 57 | ++ // Shared before/after handling |
| 58 | ++ installAllHandlers(logger); |
| 59 | ++ |
| 60 | ++ setupSageMakerExtensionsInstallTests(); |
| 61 | ++ setupSageMakerIdleExtensionTests(); |
| 62 | ++ setupSageMakerDarkThemeTests(); |
| 63 | ++ }); |
| 64 | ++} |
| 65 | +Index: code-editor-src/test/smoke/src/main.ts |
| 66 | +=================================================================== |
| 67 | +--- code-editor-src.orig/test/smoke/src/main.ts |
| 68 | ++++ code-editor-src/test/smoke/src/main.ts |
| 69 | +@@ -19,6 +19,7 @@ import { setup as setupLocalizationTests |
| 70 | + import { setup as setupLaunchTests } from './areas/workbench/launch.test'; |
| 71 | + import { setup as setupTerminalTests } from './areas/terminal/terminal.test'; |
| 72 | + import { setup as setupTaskTests } from './areas/task/task.test'; |
| 73 | ++import { setup as setupSageMakerExtensionsTests } from './areas/sagemaker-extensions/sagemaker-extensions.test'; |
| 74 | + |
| 75 | + const rootPath = path.join(__dirname, '..', '..', '..'); |
| 76 | + |
| 77 | +@@ -249,6 +250,7 @@ describe(`VSCode Smoke Tests (${opts.web |
| 78 | + setupTerminalTests(logger); |
| 79 | + setupTaskTests(logger); |
| 80 | + setupStatusbarTests(logger); |
| 81 | ++ if (opts.web) { setupSageMakerExtensionsTests(logger); } |
| 82 | + if (quality !== Quality.Dev && quality !== Quality.OSS) { setupExtensionTests(logger); } |
| 83 | + if (!opts.web && !opts.remote && quality !== Quality.Dev && quality !== Quality.OSS) { setupLocalizationTests(logger); } |
| 84 | + if (!opts.web && !opts.remote) { setupLaunchTests(logger); } |
| 85 | +Index: code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-idle-extension.test.ts |
| 86 | +=================================================================== |
| 87 | +--- /dev/null |
| 88 | ++++ code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-idle-extension.test.ts |
| 89 | +@@ -0,0 +1,48 @@ |
| 90 | ++/*--------------------------------------------------------------------------------------------- |
| 91 | ++* Copyright Amazon.com Inc. or its affiliates. All rights reserved. |
| 92 | ++* Licensed under the MIT License. See License.txt in the project root for license information. |
| 93 | ++*--------------------------------------------------------------------------------------------*/ |
| 94 | ++ |
| 95 | ++import { Application, TerminalCommandId } from '../../../../automation'; |
| 96 | ++ |
| 97 | ++export function setup() { |
| 98 | ++ describe('Idle Extension', () => { |
| 99 | ++ let app: Application; |
| 100 | ++ |
| 101 | ++ before(async function () { |
| 102 | ++ app = this.app as Application; |
| 103 | ++ await app.workbench.terminal.createTerminal(); |
| 104 | ++ }); |
| 105 | ++ |
| 106 | ++ after(async function () { |
| 107 | ++ await app.workbench.terminal.runCommand(TerminalCommandId.KillAll); |
| 108 | ++ }); |
| 109 | ++ |
| 110 | ++ it('last active timestamp is updated on IDE operations', async function () { |
| 111 | ++ |
| 112 | ++ // Get initial timestamp |
| 113 | ++ await app.workbench.terminal.runCommandInTerminal('cat /tmp/.sagemaker-last-active-timestamp'); |
| 114 | ++ await new Promise<void>(resolve => setTimeout(resolve, 500)); |
| 115 | ++ const initialBuffer = await app.code.driver.getTerminalBuffer('.terminal-wrapper'); |
| 116 | ++ const initialTimestamp = initialBuffer.join('\n').match(/\d{4}-\d{2}-\d{2}T[\d:.]+Z/)?.[0]; |
| 117 | ++ |
| 118 | ++ // Perform terminal operation |
| 119 | ++ await app.workbench.terminal.runCommandInTerminal('ls'); |
| 120 | ++ |
| 121 | ++ // Wait 60 seconds |
| 122 | ++ await new Promise<void>(resolve => setTimeout(resolve, 60000)); |
| 123 | ++ |
| 124 | ++ // Check timestamp was updated |
| 125 | ++ await app.workbench.terminal.runCommandInTerminal('cat /tmp/.sagemaker-last-active-timestamp'); |
| 126 | ++ await new Promise<void>(resolve => setTimeout(resolve, 500)); |
| 127 | ++ const updatedBuffer = await app.code.driver.getTerminalBuffer('.terminal-wrapper'); |
| 128 | ++ const allTimestamps = updatedBuffer.join('\n').match(/\d{4}-\d{2}-\d{2}T[\d:.]+Z/g); |
| 129 | ++ const updatedTimestamp = allTimestamps?.[allTimestamps.length - 1]; |
| 130 | ++ |
| 131 | ++ |
| 132 | ++ if (initialTimestamp === updatedTimestamp) { |
| 133 | ++ throw new Error('Last active timestamp was not updated'); |
| 134 | ++ } |
| 135 | ++ }); |
| 136 | ++ }); |
| 137 | ++} |
| 138 | +Index: code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-dark-theme.test.ts |
| 139 | +=================================================================== |
| 140 | +--- /dev/null |
| 141 | ++++ code-editor-src/test/smoke/src/areas/sagemaker-extensions/sagemaker-dark-theme.test.ts |
| 142 | +@@ -0,0 +1,33 @@ |
| 143 | ++/*--------------------------------------------------------------------------------------------- |
| 144 | ++* Copyright Amazon.com Inc. or its affiliates. All rights reserved. |
| 145 | ++* Licensed under the MIT License. See License.txt in the project root for license information. |
| 146 | ++*--------------------------------------------------------------------------------------------*/ |
| 147 | ++ |
| 148 | ++import { Application } from '../../../../automation'; |
| 149 | ++ |
| 150 | ++export function setup() { |
| 151 | ++ describe('Dark Theme', () => { |
| 152 | ++ it('should automatically set dark theme on startup', async function () { |
| 153 | ++ const app = this.app as Application; |
| 154 | ++ |
| 155 | ++ // Open color theme picker without auto-selecting |
| 156 | ++ await new Promise<void>(resolve => setTimeout(resolve, 3000)); |
| 157 | ++ await app.workbench.quickaccess.runCommand('workbench.action.selectTheme', { keepOpen: true }); |
| 158 | ++ |
| 159 | ++ // Wait for quick input to open |
| 160 | ++ await app.workbench.quickinput.waitForQuickInputOpened(); |
| 161 | ++ await new Promise<void>(resolve => setTimeout(resolve, 1000)); |
| 162 | ++ // Get the focused theme (currently selected) |
| 163 | ++ const focusedTheme = await app.code.waitForElement('.quick-input-widget .quick-input-list .monaco-list-row.focused .monaco-highlighted-label'); |
| 164 | ++ const selectedTheme = focusedTheme.textContent; |
| 165 | ++ |
| 166 | ++ // Close quick input |
| 167 | ++ await app.workbench.quickinput.closeQuickInput(); |
| 168 | ++ console.log(`Selected theme: ${selectedTheme}`); |
| 169 | ++ // Verify it's a dark theme |
| 170 | ++ if (!selectedTheme.toLowerCase().includes('dark')) { |
| 171 | ++ throw new Error(`Expected dark theme but got: ${selectedTheme}`); |
| 172 | ++ } |
| 173 | ++ }); |
| 174 | ++ }); |
| 175 | ++} |
0 commit comments