From 643167f1488bef8e8cf2f423d6abe7e1c9c291e7 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 15 Nov 2024 13:59:41 -0500 Subject: [PATCH 01/16] Upload test results in CI when there are failing tests Signed-off-by: Timothy Johnson --- .github/workflows/zowe-explorer-ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zowe-explorer-ci.yml b/.github/workflows/zowe-explorer-ci.yml index d096730d30..3fc48cb8ef 100644 --- a/.github/workflows/zowe-explorer-ci.yml +++ b/.github/workflows/zowe-explorer-ci.yml @@ -44,7 +44,10 @@ jobs: # install pnpm - run: npm install -g pnpm@8 - - run: pnpm config set network-timeout 60000 && pnpm install && pnpm build + - run: pnpm config set network-timeout 60000 && pnpm install + + - run: pnpm build + id: build - run: pnpm test env: @@ -55,7 +58,7 @@ jobs: id: unlock-keyring if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' uses: t1m0thyj/unlock-keyring@v1 - + - name: Integration tests if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' run: xvfb-run pnpm test:integration --exclude "Activation.feature" @@ -63,14 +66,14 @@ jobs: - name: Upload test results uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' + if: always() && steps.build.outcome == 'success' && matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' with: name: zowe-explorer-results path: packages/zowe-explorer/results/ - name: Upload API test results uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' + if: always() && steps.build.outcome == 'success' && matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' with: name: zowe-explorer-api-results path: packages/zowe-explorer-api/results/ From 53f0b883f4760830fd853f0c0c577643f4a06f4b Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 15 Nov 2024 14:37:04 -0500 Subject: [PATCH 02/16] Add integration test results dir to artifact Signed-off-by: Timothy Johnson --- .github/workflows/zowe-explorer-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zowe-explorer-ci.yml b/.github/workflows/zowe-explorer-ci.yml index 3fc48cb8ef..851cf62c2c 100644 --- a/.github/workflows/zowe-explorer-ci.yml +++ b/.github/workflows/zowe-explorer-ci.yml @@ -69,7 +69,9 @@ jobs: if: always() && steps.build.outcome == 'success' && matrix.os == 'ubuntu-22.04' && matrix.node-version == '20.x' with: name: zowe-explorer-results - path: packages/zowe-explorer/results/ + path: | + packages/zowe-explorer/results/ + packages/zowe-explorer/__tests__/__integration__/bdd/results/ - name: Upload API test results uses: actions/upload-artifact@v4 From a60aa917c0703beb08175c6180ed7a00b353d9be Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 15 Nov 2024 15:05:41 -0500 Subject: [PATCH 03/16] Try to fix ShowConfigErrorDialog integration test Signed-off-by: Timothy Johnson --- .../dialogs/ShowConfigErrorDialog.steps.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index 074421bfab..e24aabc831 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -11,7 +11,7 @@ import { Then, When } from "@cucumber/cucumber"; import { getZoweExplorerContainer } from "../../../../__common__/shared.wdio"; -import { Notification, Workbench } from "wdio-vscode-service"; +import { Notification, NotificationType, Workbench } from "wdio-vscode-service"; When("a user opens Zowe Explorer", async function () { this.zoweExplorerPane = await getZoweExplorerContainer(); @@ -22,8 +22,12 @@ Then("the Show Config dialog should appear", async function () { this.workbench = await browser.getWorkbench(); let configNotification: Notification; + const notificationCenter = await (this.workbench as Workbench).openNotificationsCenter(); await browser.waitUntil(async () => { - const notifications = await (this.workbench as Workbench).getNotifications(); + const notifications = [ + ...(await (this.workbench as Workbench).getNotifications()), + ...(await notificationCenter.getNotifications(NotificationType.Error)), + ]; for (const n of notifications) { const msg = await n.getMessage(); if (msg.startsWith("Error encountered when loading your Zowe config.")) { From 4c41d9a3a69fdc99675a7322c0341577ee4dc1de Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 15 Nov 2024 15:10:35 -0500 Subject: [PATCH 04/16] Try to fix esm import error in tests Signed-off-by: Timothy Johnson --- .../step_definitions/dialogs/ShowConfigErrorDialog.steps.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index e24aabc831..beff536303 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -11,7 +11,7 @@ import { Then, When } from "@cucumber/cucumber"; import { getZoweExplorerContainer } from "../../../../__common__/shared.wdio"; -import { Notification, NotificationType, Workbench } from "wdio-vscode-service"; +import { Notification, Workbench } from "wdio-vscode-service"; When("a user opens Zowe Explorer", async function () { this.zoweExplorerPane = await getZoweExplorerContainer(); @@ -26,7 +26,7 @@ Then("the Show Config dialog should appear", async function () { await browser.waitUntil(async () => { const notifications = [ ...(await (this.workbench as Workbench).getNotifications()), - ...(await notificationCenter.getNotifications(NotificationType.Error)), + ...(await notificationCenter.getNotifications("error" as any)), ]; for (const n of notifications) { const msg = await n.getMessage(); From 72c4764fb0f282b3fce88eb82fb13b7ad77af1f9 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 18 Nov 2024 10:21:55 -0500 Subject: [PATCH 05/16] Try to fix update credentials test Signed-off-by: Timothy Johnson --- .../profiles/UpdateCredentials.steps.ts | 53 +++++++------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts index 3b77784897..36e8ade2a0 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts @@ -15,6 +15,7 @@ import { AfterAll, Then, When } from "@cucumber/cucumber"; import { paneDivForTree } from "../../../../__common__/shared.wdio"; import quickPick from "../../../../__pageobjects__/QuickPick"; import { Key } from "webdriverio"; +import { TreeItem } from "wdio-vscode-service"; const USER_CONFIG_FILE = path.join(process.env.ZOWE_CLI_HOME, "zowe.config.user.json"); @@ -25,45 +26,29 @@ When(/a user who has profile with (.*) auth in team config/, function (authType: // TODO: We need to copy from Global Config until Imperative API is fixed // See https://github.com/zowe/zowe-cli/issues/2273 this.authType = authType; - const tempCfg = JSON.parse(fs.readFileSync(USER_CONFIG_FILE.replace(".user", ""), "utf-8")); - const testConfig = { - $schema: "./zowe.schema.json", - profiles: { - ...tempCfg.profiles, - zosmf1: { - type: null, // Disable default global zosmf profile - }, - [`zosmf_${authType}`]: { - type: "zosmf", - properties: {}, - secure: [], - }, - }, - defaults: { - ...tempCfg.defaults, - zosmf: `zosmf_${authType}`, - }, + const testConfig = JSON.parse(fs.readFileSync(USER_CONFIG_FILE.replace(".user", ""), "utf-8")); + testConfig.profile[`zosmf_${authType}`] = { + type: "zosmf", + properties: {}, + secure: authType === "basic" ? ["user", "password"] : ["tokenValue"], }; - if (authType === "basic") { - testConfig.profiles.zosmf_basic.secure.push("user", "password"); - } else if (authType === "token") { - testConfig.profiles.zosmf_token.secure.push("tokenValue"); - } fs.writeFileSync(USER_CONFIG_FILE, JSON.stringify(testConfig, null, 2)); }); When("the user has a profile in their Data Sets tree", async function () { + // add profile via quick pick this.treePane = await paneDivForTree("Data Sets"); - await browser.waitUntil(async () => { - const visibleItems = await this.treePane.getVisibleItems(); - for (const item of visibleItems) { - if ((await item.getLabel()) === `zosmf_${this.authType as string}`) { - this.profileNode = item; - return true; - } - } - - return false; - }); + await this.treePane.elem.moveTo(); + const plusIcon = await this.treePane.getAction(`Add Profile to Data Sets View`); + await expect(plusIcon).toBeDefined(); + await plusIcon.elem.click(); + await browser.waitUntil((): Promise => quickPick.isClickable()); + const firstProfileEntry = await quickPick.findItemByIndex(2); + await expect(firstProfileEntry).toBeClickable(); + await firstProfileEntry.click(); + this.yesOpt = await quickPick.findItem("Yes, Apply to all trees"); + await expect(this.yesOpt).toBeClickable(); + await this.yesOpt.click(); + this.profileNode = (await this.treePane.findItem(`zosmf_${this.authType as string}`)) as TreeItem; }); When("a user clicks search button for the profile", async function () { await this.profileNode.elem.moveTo(); From f5113e58d054932c041988e77c11f24af8590f02 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 18 Nov 2024 10:30:12 -0500 Subject: [PATCH 06/16] Fix integration tests and update cross-spawn Signed-off-by: Timothy Johnson --- .../dialogs/ShowConfigErrorDialog.steps.ts | 1 + .../profiles/UpdateCredentials.steps.ts | 2 +- pnpm-lock.yaml | 20 +++++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index beff536303..10d1079e3d 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -24,6 +24,7 @@ Then("the Show Config dialog should appear", async function () { let configNotification: Notification; const notificationCenter = await (this.workbench as Workbench).openNotificationsCenter(); await browser.waitUntil(async () => { + // Notification may be visible or hidden, handle both cases const notifications = [ ...(await (this.workbench as Workbench).getNotifications()), ...(await notificationCenter.getNotifications("error" as any)), diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts index 36e8ade2a0..180c996dee 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts @@ -27,7 +27,7 @@ When(/a user who has profile with (.*) auth in team config/, function (authType: // See https://github.com/zowe/zowe-cli/issues/2273 this.authType = authType; const testConfig = JSON.parse(fs.readFileSync(USER_CONFIG_FILE.replace(".user", ""), "utf-8")); - testConfig.profile[`zosmf_${authType}`] = { + testConfig.profiles[`zosmf_${authType}`] = { type: "zosmf", properties: {}, secure: authType === "basic" ? ["user", "password"] : ["tokenValue"], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ab810f064..4b68245af4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3588,7 +3588,7 @@ packages: chalk: 4.1.2 cli-table3: 0.6.5 comment-json: 4.2.5 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 dataobject-parser: 1.2.25 deepmerge: 4.3.1 diff: 5.2.0 @@ -4933,8 +4933,8 @@ packages: - encoding dev: true - /cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + /cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} dependencies: path-key: 3.1.1 @@ -5833,7 +5833,7 @@ packages: '@humanwhocodes/config-array': 0.5.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.4(supports-color@8.1.1) doctrine: 3.0.0 enquirer: 2.4.1 @@ -5887,7 +5887,7 @@ packages: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.4(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -5989,7 +5989,7 @@ packages: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -6004,7 +6004,7 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 8.0.1 human-signals: 5.0.0 is-stream: 3.0.0 @@ -6382,7 +6382,7 @@ packages: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 dev: true @@ -6391,7 +6391,7 @@ packages: engines: {node: '>=14'} requiresBuild: true dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 /fork-ts-checker-webpack-plugin@9.0.2(typescript@5.4.5)(webpack@5.94.0): @@ -12190,7 +12190,7 @@ packages: '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack@5.94.0) colorette: 2.0.20 commander: 10.0.1 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 envinfo: 7.13.0 fastest-levenshtein: 1.0.16 import-local: 3.1.0 From f77e0e8fc6401f90f9642a150ca402f87403ec27 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 18 Nov 2024 10:37:41 -0500 Subject: [PATCH 07/16] Fix adding profile via quick pick Signed-off-by: Timothy Johnson --- .../step_definitions/profiles/UpdateCredentials.steps.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts index 180c996dee..9e9a816fe3 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts @@ -42,9 +42,9 @@ When("the user has a profile in their Data Sets tree", async function () { await expect(plusIcon).toBeDefined(); await plusIcon.elem.click(); await browser.waitUntil((): Promise => quickPick.isClickable()); - const firstProfileEntry = await quickPick.findItemByIndex(2); - await expect(firstProfileEntry).toBeClickable(); - await firstProfileEntry.click(); + const testProfileEntry = await quickPick.findItem(`zosmf_${this.authType as string}`); + await expect(testProfileEntry).toBeClickable(); + await testProfileEntry.click(); this.yesOpt = await quickPick.findItem("Yes, Apply to all trees"); await expect(this.yesOpt).toBeClickable(); await this.yesOpt.click(); From 75c11d21340cef1ca6e55c97fbf2497c8b6a072c Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 18 Nov 2024 10:52:49 -0500 Subject: [PATCH 08/16] Handle codicons when finding quickpick items Signed-off-by: Timothy Johnson --- .../__e2e__/step_definitions/list/ListTreeItems.steps.ts | 8 ++++---- .../step_definitions/profiles/UpdateCredentials.steps.ts | 2 +- .../zowe-explorer/__tests__/__pageobjects__/QuickPick.ts | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__e2e__/step_definitions/list/ListTreeItems.steps.ts b/packages/zowe-explorer/__tests__/__e2e__/step_definitions/list/ListTreeItems.steps.ts index 7a69ebf935..66dab4f3cb 100644 --- a/packages/zowe-explorer/__tests__/__e2e__/step_definitions/list/ListTreeItems.steps.ts +++ b/packages/zowe-explorer/__tests__/__e2e__/step_definitions/list/ListTreeItems.steps.ts @@ -38,10 +38,10 @@ async function setFilterForProfile(world: IWorld, profileNode: TreeItem, tree: s if (isJobs) { // Jobs - const createFilterSelector = await quickPick.findItem("plus Create job search filter"); + const createFilterSelector = await quickPick.findItem("$(plus) Create job search filter"); await expect(createFilterSelector).toBeClickable(); await createFilterSelector.click(); - const submitSelector = await quickPick.findItem("check Submit this query"); + const submitSelector = await quickPick.findItem("$(check) Submit this query"); await expect(submitSelector).toBeClickable(); await submitSelector.click(); } else { @@ -49,8 +49,8 @@ async function setFilterForProfile(world: IWorld, profileNode: TreeItem, tree: s if (await quickPick.hasOptions()) { // Only click the "Create a new filter" button if there are existing filters and the option is presented const filterLabel = isUss - ? "plus Create a new filter" - : "plus Create a new filter. For example: HLQ.*, HLQ.aaa.bbb, HLQ.ccc.ddd(member)"; + ? "$(plus) Create a new filter" + : "$(plus) Create a new filter. For example: HLQ.*, HLQ.aaa.bbb, HLQ.ccc.ddd(member)"; const createFilterSelector = await quickPick.findItem(filterLabel); await expect(createFilterSelector).toBeClickable(); diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts index 9e9a816fe3..14a6eca49f 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts @@ -42,7 +42,7 @@ When("the user has a profile in their Data Sets tree", async function () { await expect(plusIcon).toBeDefined(); await plusIcon.elem.click(); await browser.waitUntil((): Promise => quickPick.isClickable()); - const testProfileEntry = await quickPick.findItem(`zosmf_${this.authType as string}`); + const testProfileEntry = await quickPick.findItem(`$(home) zosmf_${this.authType as string}`); await expect(testProfileEntry).toBeClickable(); await testProfileEntry.click(); this.yesOpt = await quickPick.findItem("Yes, Apply to all trees"); diff --git a/packages/zowe-explorer/__tests__/__pageobjects__/QuickPick.ts b/packages/zowe-explorer/__tests__/__pageobjects__/QuickPick.ts index 73a946b12a..7e050468db 100644 --- a/packages/zowe-explorer/__tests__/__pageobjects__/QuickPick.ts +++ b/packages/zowe-explorer/__tests__/__pageobjects__/QuickPick.ts @@ -44,6 +44,8 @@ class QuickPick { } public async findItem(label: string): Promise { + // Handle labels that start with a codicon + label = label.replace(/^\$\(([^)]+)\)\s/, "$1 "); return this.elem.$(`.monaco-list-row[role="option"][aria-label="${label}"]`); } From 592f01d13c76688af668897d3ccf4d31f599460c Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 09:24:58 -0500 Subject: [PATCH 09/16] Add CustomConfig tag to integration tests Signed-off-by: Timothy Johnson --- .gitignore | 4 +-- .../dialogs/ShowConfigErrorDialog.feature | 1 + .../profiles/UpdateCredentials.feature | 6 ++--- .../profiles/UpdateCredentials.steps.ts | 22 ++------------- .../__integration__/bdd/wdio.conf.ts | 23 +++------------- .../ci/ShowConfigErrorDialog/zowe.config.json | 1 + .../ci/UpdateCredentials/zowe.config.json | 27 +++++++++++++++++++ .../src/trees/ZoweTreeProvider.ts | 2 +- 8 files changed, 41 insertions(+), 45 deletions(-) create mode 100644 packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json create mode 100644 packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json diff --git a/.gitignore b/.gitignore index a158a3e2b6..41f06fa57b 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ prebuilds/ packages/zowe-explorer/**/.wdio-vscode-service packages/zowe-explorer/__tests__/**/.zowe packages/zowe-explorer/__tests__/**/.env -packages/zowe-explorer/__tests__/__integration__/ci -!packages/zowe-explorer/__tests__/__integration__/ci/zowe.config.json +packages/zowe-explorer/__tests__/__integration__/ci/**/.events +packages/zowe-explorer/__tests__/__integration__/ci/**/settings package.nls.*.json bundle.l10n.*.json bundle.l10n.json.template diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature index 3a68bf267f..150e293c01 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature @@ -1,3 +1,4 @@ +@CustomConfig Feature: Show Config Error Dialog Scenario: Initializing Zowe Explorer with a broken profile diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature b/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature index 4c6a5d715e..24dc265481 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature @@ -1,9 +1,9 @@ +@CustomConfig Feature: Update credentials for z/OSMF profile Scenario: Prompt for missing credentials - Given a user who has profile with auth in team config - And a user who is looking at the Zowe Explorer tree views - And the user has a profile in their Data Sets tree + Given a user who is looking at the Zowe Explorer tree views + And the user has a profile in their Data Sets tree When a user clicks search button for the profile Then the user will be prompted for credentials And the profile node icon will be marked as inactive diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts index 14a6eca49f..0126bfbf74 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/profiles/UpdateCredentials.steps.ts @@ -9,32 +9,14 @@ * */ -import * as fs from "fs"; -import * as path from "path"; -import { AfterAll, Then, When } from "@cucumber/cucumber"; +import { Then, When } from "@cucumber/cucumber"; import { paneDivForTree } from "../../../../__common__/shared.wdio"; import quickPick from "../../../../__pageobjects__/QuickPick"; import { Key } from "webdriverio"; import { TreeItem } from "wdio-vscode-service"; -const USER_CONFIG_FILE = path.join(process.env.ZOWE_CLI_HOME, "zowe.config.user.json"); - -AfterAll(() => { - fs.rmSync(USER_CONFIG_FILE, { force: true }); -}); -When(/a user who has profile with (.*) auth in team config/, function (authType: string) { - // TODO: We need to copy from Global Config until Imperative API is fixed - // See https://github.com/zowe/zowe-cli/issues/2273 +When(/the user has a (.*) profile in their Data Sets tree/, async function (authType: string) { this.authType = authType; - const testConfig = JSON.parse(fs.readFileSync(USER_CONFIG_FILE.replace(".user", ""), "utf-8")); - testConfig.profiles[`zosmf_${authType}`] = { - type: "zosmf", - properties: {}, - secure: authType === "basic" ? ["user", "password"] : ["tokenValue"], - }; - fs.writeFileSync(USER_CONFIG_FILE, JSON.stringify(testConfig, null, 2)); -}); -When("the user has a profile in their Data Sets tree", async function () { // add profile via quick pick this.treePane = await paneDivForTree("Data Sets"); await this.treePane.elem.moveTo(); diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts index a0ff1bcaa8..0b775fac2a 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts @@ -10,15 +10,13 @@ */ import type { Options } from "@wdio/types"; -import { join as joinPath, resolve as resolvePath } from "path"; +import { join as joinPath, parse as parsePath, resolve as resolvePath } from "path"; import { emptyDirSync } from "fs-extra"; import { baseConfig } from "../../__common__/base.wdio.conf"; -import { renameSync, rmSync, writeFileSync } from "fs"; const dataDir = joinPath(__dirname, "..", "..", "__common__", ".wdio-vscode-service", "data"); const screenshotDir = joinPath(__dirname, "results", "screenshots"); - -process.env["ZOWE_CLI_HOME"] = resolvePath("../ci"); +const zoweHomeDir = resolvePath("../ci"); export const config: Options.Testrunner = { ...baseConfig, @@ -154,21 +152,8 @@ export const config: Options.Testrunner = { }, beforeFeature: async function (uri, feature) { - if (feature.name === "Show Config Error Dialog") { - const configPath = joinPath(process.env["ZOWE_CLI_HOME"], "zowe.config.json"); - const backupConfigPath = joinPath(process.env["ZOWE_CLI_HOME"], "zowe.config.bkp"); - renameSync(configPath, backupConfigPath); - writeFileSync(configPath, "invalidjson"); - } - }, - - afterFeature: async function (uri, feature) { - if (feature.name === "Show Config Error Dialog") { - const backupConfigPath = joinPath(process.env["ZOWE_CLI_HOME"], "zowe.config.bkp"); - const configPath = joinPath(process.env["ZOWE_CLI_HOME"], "zowe.config.json"); - rmSync(configPath); - renameSync(backupConfigPath, configPath); - } + const useCustomConfig = feature.tags.find((tag) => tag.name === "CustomConfig") != null; + process.env.ZOWE_CLI_HOME = useCustomConfig ? joinPath(zoweHomeDir, parsePath(uri).name) : zoweHomeDir; }, afterStep: async function (step, scenario, result, context) { diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json b/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json new file mode 100644 index 0000000000..a5ead79306 --- /dev/null +++ b/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json @@ -0,0 +1 @@ +invalidJson diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json b/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json new file mode 100644 index 0000000000..e635169cd3 --- /dev/null +++ b/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json @@ -0,0 +1,27 @@ +{ + "$schema": "../zowe.schema.json", + "profiles": { + "zosmf_basic": { + "type": "zosmf", + "properties": {}, + "secure": ["user", "password"] + }, + "zosmf_token": { + "type": "zosmf", + "properties": {}, + "secure": ["tokenValue"] + }, + "base": { + "type": "base", + "properties": { + "host": "localhost", + "rejectUnauthorized": false + }, + "secure": [] + } + }, + "defaults": { + "base": "base" + }, + "autoStore": true +} diff --git a/packages/zowe-explorer/src/trees/ZoweTreeProvider.ts b/packages/zowe-explorer/src/trees/ZoweTreeProvider.ts index c1616f38bf..f9222818dd 100644 --- a/packages/zowe-explorer/src/trees/ZoweTreeProvider.ts +++ b/packages/zowe-explorer/src/trees/ZoweTreeProvider.ts @@ -252,7 +252,7 @@ export class ZoweTreeProvider { private static updateSessionContext(profileName: string, status: Validation.ValidationType): void { for (const provider of Object.values(SharedTreeProviders.providers)) { const session = (provider as IZoweTree).mSessionNodes.find((n) => n.getProfileName() === profileName); - (provider as ZoweTreeProvider)?.setStatusForSession(session, status); + (provider as ZoweTreeProvider).setStatusForSession(session, status); } } From d906d52f919a4facf98fa205fe2f73dab013d29b Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 09:44:49 -0500 Subject: [PATCH 10/16] Fix quotes in tests creating invalid artifact names Signed-off-by: Timothy Johnson --- .prettierignore | 1 + .../bdd/features/dialogs/AddConfigQuickPick.feature | 6 +++--- .../step_definitions/dialogs/AddConfigQuickPick.steps.ts | 4 ++-- .../__tests__/__integration__/bdd/wdio.conf.ts | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.prettierignore b/.prettierignore index 931d5c614a..17f4c2f56b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,4 +9,5 @@ node_modules pnpm-lock.yaml **/bundle.l10n.json **/.wdio-vscode-service +**/__tests__/__integration__/ci zedc/target \ No newline at end of file diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/AddConfigQuickPick.feature b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/AddConfigQuickPick.feature index eab9ff9741..8884dfa38c 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/AddConfigQuickPick.feature +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/AddConfigQuickPick.feature @@ -6,7 +6,7 @@ Scenario: User opens and dismisses the Team Configuration quick pick # Scenario: User creates a global Team Configuration file # Given a user who is looking at the Add Config quick pick -# When a user selects "Create a new Team Configuration file" +# When a user selects 'Create a new Team Configuration file' # Then a new configuration file will be created and opened in the editor # Then it will ask the user for the desired config location # When the user selects the global option @@ -14,7 +14,7 @@ Scenario: User opens and dismisses the Team Configuration quick pick Scenario: User edits Team Configuration file Given a user who is looking at the Add Config quick pick - When a user selects "Edit Team Configuration File" + When a user selects 'Edit Team Configuration File' Then it will open the config in the editor Scenario Outline: User wants to add a profile to the tree views @@ -23,7 +23,7 @@ Scenario Outline: User wants to add a profile to the tree views Then it will prompt the user to add the profile to one or all trees When a user selects to apply to all trees Then it will add a tree item for the profile to the correct trees - + Examples: | opt | | No | diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/AddConfigQuickPick.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/AddConfigQuickPick.steps.ts index f7f77afc31..2319dfa489 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/AddConfigQuickPick.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/AddConfigQuickPick.steps.ts @@ -29,7 +29,7 @@ Given("a user who is looking at the Add Config quick pick", async function () { // // Scenario: User wants to create a new Team Configuration file // -When('a user selects "Create a new Team Configuration file"', async function () { +When("a user selects 'Create a new Team Configuration file'", async function () { const createTeamConfigEntry = await quickPick.findItem("+ Create a New Team Configuration File"); await expect(createTeamConfigEntry).toBeClickable(); await createTeamConfigEntry.click(); @@ -70,7 +70,7 @@ Then("it will open the config in the editor", async function () { // // Scenario: User wants to edit existing Team Configuration file // -When('a user selects "Edit Team Configuration File"', async function () { +When("a user selects 'Edit Team Configuration File'", async function () { const editTeamConfigEntry = await quickPick.findItem("✏ Edit Team Configuration File"); await expect(editTeamConfigEntry).toBeClickable(); await editTeamConfigEntry.click(); diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts index 0b775fac2a..a90d9530ed 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts @@ -151,8 +151,8 @@ export const config: Options.Testrunner = { emptyDirSync(screenshotDir); }, - beforeFeature: async function (uri, feature) { - const useCustomConfig = feature.tags.find((tag) => tag.name === "CustomConfig") != null; + beforeFeature: function (uri, feature) { + const useCustomConfig = feature.tags.find((tag) => tag.name === "@CustomConfig") != null; process.env.ZOWE_CLI_HOME = useCustomConfig ? joinPath(zoweHomeDir, parsePath(uri).name) : zoweHomeDir; }, From e4ed376ae90c7bbe8c8533045e7787a24a1e2513 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 16:28:30 -0500 Subject: [PATCH 11/16] Try to copy config files into place for tests Signed-off-by: Timothy Johnson --- .gitignore | 4 ++-- .../dialogs/ShowConfigErrorDialog.steps.ts | 6 +---- .../__integration__/bdd/wdio.conf.ts | 23 ++++++++++++++++--- ...json => ShowConfigErrorDialog.config.json} | 0 ...fig.json => UpdateCredentials.config.json} | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) rename packages/zowe-explorer/__tests__/__integration__/ci/{ShowConfigErrorDialog/zowe.config.json => ShowConfigErrorDialog.config.json} (100%) rename packages/zowe-explorer/__tests__/__integration__/ci/{UpdateCredentials/zowe.config.json => UpdateCredentials.config.json} (92%) diff --git a/.gitignore b/.gitignore index 41f06fa57b..310b7476c1 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ prebuilds/ packages/zowe-explorer/**/.wdio-vscode-service packages/zowe-explorer/__tests__/**/.zowe packages/zowe-explorer/__tests__/**/.env -packages/zowe-explorer/__tests__/__integration__/ci/**/.events -packages/zowe-explorer/__tests__/__integration__/ci/**/settings +packages/zowe-explorer/__tests__/__integration__/ci +!packages/zowe-explorer/__tests__/__integration__/ci/*.config.json package.nls.*.json bundle.l10n.*.json bundle.l10n.json.template diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index 10d1079e3d..3f7a76f490 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -22,13 +22,9 @@ Then("the Show Config dialog should appear", async function () { this.workbench = await browser.getWorkbench(); let configNotification: Notification; - const notificationCenter = await (this.workbench as Workbench).openNotificationsCenter(); await browser.waitUntil(async () => { // Notification may be visible or hidden, handle both cases - const notifications = [ - ...(await (this.workbench as Workbench).getNotifications()), - ...(await notificationCenter.getNotifications("error" as any)), - ]; + const notifications = await (this.workbench as Workbench).getNotifications(); for (const n of notifications) { const msg = await n.getMessage(); if (msg.startsWith("Error encountered when loading your Zowe config.")) { diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts index a90d9530ed..a728c768d9 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts @@ -13,10 +13,12 @@ import type { Options } from "@wdio/types"; import { join as joinPath, parse as parsePath, resolve as resolvePath } from "path"; import { emptyDirSync } from "fs-extra"; import { baseConfig } from "../../__common__/base.wdio.conf"; +import { cpSync, existsSync, renameSync } from "fs"; const dataDir = joinPath(__dirname, "..", "..", "__common__", ".wdio-vscode-service", "data"); const screenshotDir = joinPath(__dirname, "results", "screenshots"); -const zoweHomeDir = resolvePath("../ci"); + +process.env.ZOWE_CLI_HOME = resolvePath("../ci"); export const config: Options.Testrunner = { ...baseConfig, @@ -79,7 +81,8 @@ export const config: Options.Testrunner = { capabilities: [ { browserName: "vscode", - browserVersion: "stable", // also possible: "insiders" or a specific version e.g. "1.80.0" + // version can be "stable", "insiders", or a specific version e.g. "1.80.0" + browserVersion: process.env.ZE_TEST_VSCODE_VER || "stable", "wdio:vscodeOptions": { // points to directory where extension package.json is located extensionPath: joinPath(__dirname, "..", "..", ".."), @@ -153,7 +156,21 @@ export const config: Options.Testrunner = { beforeFeature: function (uri, feature) { const useCustomConfig = feature.tags.find((tag) => tag.name === "@CustomConfig") != null; - process.env.ZOWE_CLI_HOME = useCustomConfig ? joinPath(zoweHomeDir, parsePath(uri).name) : zoweHomeDir; + if (useCustomConfig) { + const configPath = joinPath(process.env.ZOWE_CLI_HOME, "zowe.config.json"); + if (!existsSync(configPath + ".bak")) { + cpSync(configPath, configPath + ".bak"); + } + cpSync(joinPath(process.env.ZOWE_CLI_HOME, `${parsePath(uri).name}.config.json`), configPath); + } + }, + + afterFeature: function (uri, feature) { + const useCustomConfig = feature.tags.find((tag) => tag.name === "@CustomConfig") != null; + if (useCustomConfig) { + const configPath = joinPath(process.env.ZOWE_CLI_HOME, "zowe.config.json"); + renameSync(configPath + ".bak", configPath); + } }, afterStep: async function (step, scenario, result, context) { diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json b/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog.config.json similarity index 100% rename from packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog/zowe.config.json rename to packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog.config.json diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json b/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials.config.json similarity index 92% rename from packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json rename to packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials.config.json index e635169cd3..f6cf8b860c 100644 --- a/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials/zowe.config.json +++ b/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials.config.json @@ -1,5 +1,5 @@ { - "$schema": "../zowe.schema.json", + "$schema": "./zowe.schema.json", "profiles": { "zosmf_basic": { "type": "zosmf", From 45fe0220e6e8cce55ca96633a6ac371d193eb64f Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 17:25:17 -0500 Subject: [PATCH 12/16] Generalize logic for copying test resources Signed-off-by: Timothy Johnson --- .gitignore | 2 +- .prettierignore | 1 - packages/zowe-explorer/.prettierignore | 3 +- .../dialogs/ShowConfigErrorDialog.feature | 1 - .../profiles/UpdateCredentials.feature | 1 - .../ShowConfigErrorDialog/zowe.config.json} | 0 .../UpdateCredentials/zowe.config.json} | 0 .../dialogs/ShowConfigErrorDialog.steps.ts | 6 +++- .../__integration__/bdd/wdio.conf.ts | 28 +++++++++++-------- 9 files changed, 25 insertions(+), 17 deletions(-) rename packages/zowe-explorer/__tests__/__integration__/{ci/ShowConfigErrorDialog.config.json => bdd/resources/ShowConfigErrorDialog/zowe.config.json} (100%) rename packages/zowe-explorer/__tests__/__integration__/{ci/UpdateCredentials.config.json => bdd/resources/UpdateCredentials/zowe.config.json} (100%) diff --git a/.gitignore b/.gitignore index 310b7476c1..a158a3e2b6 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ packages/zowe-explorer/**/.wdio-vscode-service packages/zowe-explorer/__tests__/**/.zowe packages/zowe-explorer/__tests__/**/.env packages/zowe-explorer/__tests__/__integration__/ci -!packages/zowe-explorer/__tests__/__integration__/ci/*.config.json +!packages/zowe-explorer/__tests__/__integration__/ci/zowe.config.json package.nls.*.json bundle.l10n.*.json bundle.l10n.json.template diff --git a/.prettierignore b/.prettierignore index 17f4c2f56b..931d5c614a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,5 +9,4 @@ node_modules pnpm-lock.yaml **/bundle.l10n.json **/.wdio-vscode-service -**/__tests__/__integration__/ci zedc/target \ No newline at end of file diff --git a/packages/zowe-explorer/.prettierignore b/packages/zowe-explorer/.prettierignore index 9fdb7c6b5d..b9454dc8fd 100644 --- a/packages/zowe-explorer/.prettierignore +++ b/packages/zowe-explorer/.prettierignore @@ -3,4 +3,5 @@ results scripts src/webviews/dist l10n/bundle.l10n.json -__tests__/__common__/.wdio-vscode-service \ No newline at end of file +__tests__/__common__/.wdio-vscode-service +__tests__/__integration__/bdd/resources \ No newline at end of file diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature index 150e293c01..3a68bf267f 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/features/dialogs/ShowConfigErrorDialog.feature @@ -1,4 +1,3 @@ -@CustomConfig Feature: Show Config Error Dialog Scenario: Initializing Zowe Explorer with a broken profile diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature b/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature index 24dc265481..304f426208 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/features/profiles/UpdateCredentials.feature @@ -1,4 +1,3 @@ -@CustomConfig Feature: Update credentials for z/OSMF profile Scenario: Prompt for missing credentials diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog.config.json b/packages/zowe-explorer/__tests__/__integration__/bdd/resources/ShowConfigErrorDialog/zowe.config.json similarity index 100% rename from packages/zowe-explorer/__tests__/__integration__/ci/ShowConfigErrorDialog.config.json rename to packages/zowe-explorer/__tests__/__integration__/bdd/resources/ShowConfigErrorDialog/zowe.config.json diff --git a/packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials.config.json b/packages/zowe-explorer/__tests__/__integration__/bdd/resources/UpdateCredentials/zowe.config.json similarity index 100% rename from packages/zowe-explorer/__tests__/__integration__/ci/UpdateCredentials.config.json rename to packages/zowe-explorer/__tests__/__integration__/bdd/resources/UpdateCredentials/zowe.config.json diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index 3f7a76f490..10d1079e3d 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -22,9 +22,13 @@ Then("the Show Config dialog should appear", async function () { this.workbench = await browser.getWorkbench(); let configNotification: Notification; + const notificationCenter = await (this.workbench as Workbench).openNotificationsCenter(); await browser.waitUntil(async () => { // Notification may be visible or hidden, handle both cases - const notifications = await (this.workbench as Workbench).getNotifications(); + const notifications = [ + ...(await (this.workbench as Workbench).getNotifications()), + ...(await notificationCenter.getNotifications("error" as any)), + ]; for (const n of notifications) { const msg = await n.getMessage(); if (msg.startsWith("Error encountered when loading your Zowe config.")) { diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts index a728c768d9..2454596f56 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts @@ -13,7 +13,7 @@ import type { Options } from "@wdio/types"; import { join as joinPath, parse as parsePath, resolve as resolvePath } from "path"; import { emptyDirSync } from "fs-extra"; import { baseConfig } from "../../__common__/base.wdio.conf"; -import { cpSync, existsSync, renameSync } from "fs"; +import { cpSync, existsSync, readdirSync, renameSync } from "fs"; const dataDir = joinPath(__dirname, "..", "..", "__common__", ".wdio-vscode-service", "data"); const screenshotDir = joinPath(__dirname, "results", "screenshots"); @@ -155,21 +155,27 @@ export const config: Options.Testrunner = { }, beforeFeature: function (uri, feature) { - const useCustomConfig = feature.tags.find((tag) => tag.name === "@CustomConfig") != null; - if (useCustomConfig) { - const configPath = joinPath(process.env.ZOWE_CLI_HOME, "zowe.config.json"); - if (!existsSync(configPath + ".bak")) { - cpSync(configPath, configPath + ".bak"); + const resourceDir = joinPath(__dirname, "resources", parsePath(uri).name); + if (existsSync(resourceDir)) { + for (const resourceFile of readdirSync(resourceDir)) { + const resourcePath = joinPath(process.env.ZOWE_CLI_HOME, resourceFile); + if (!existsSync(resourcePath + ".bak")) { + cpSync(resourcePath, resourcePath + ".bak"); + } + cpSync(joinPath(resourceDir, resourceFile), resourcePath); } - cpSync(joinPath(process.env.ZOWE_CLI_HOME, `${parsePath(uri).name}.config.json`), configPath); } }, afterFeature: function (uri, feature) { - const useCustomConfig = feature.tags.find((tag) => tag.name === "@CustomConfig") != null; - if (useCustomConfig) { - const configPath = joinPath(process.env.ZOWE_CLI_HOME, "zowe.config.json"); - renameSync(configPath + ".bak", configPath); + const resourceDir = joinPath(__dirname, "resources", parsePath(uri).name); + if (existsSync(resourceDir)) { + for (const resourceFile of readdirSync(resourceDir)) { + const resourcePath = joinPath(process.env.ZOWE_CLI_HOME, resourceFile); + if (existsSync(resourcePath + ".bak")) { + renameSync(resourcePath + ".bak", resourcePath); + } + } } }, From 73cf33a3b0bf330c95be38ad4a2adfe5fab3ea9b Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 18:47:07 -0500 Subject: [PATCH 13/16] Use before/after instead of beforeFeature/afterFeature Signed-off-by: Timothy Johnson --- .../__tests__/__common__/base.wdio.conf.ts | 4 ++++ .../zowe-explorer/__tests__/__e2e__/wdio.conf.ts | 3 ++- .../dialogs/ShowConfigErrorDialog.steps.ts | 7 +------ .../__tests__/__integration__/bdd/wdio.conf.ts | 12 +++++------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__common__/base.wdio.conf.ts b/packages/zowe-explorer/__tests__/__common__/base.wdio.conf.ts index d67eff65f4..1ebf9e4d2d 100644 --- a/packages/zowe-explorer/__tests__/__common__/base.wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__common__/base.wdio.conf.ts @@ -10,6 +10,8 @@ */ import type { Options } from "@wdio/types"; +import { tmpdir } from "os"; +import { join as joinPath } from "path"; export const baseConfig: Partial = { // @@ -207,3 +209,5 @@ export const baseConfig: Partial = { // afterAssertion: function(params) { // } }; + +export const dataDir = joinPath(process.platform === "darwin" ? tmpdir() : __dirname, ".wdio-vscode-service", "data"); diff --git a/packages/zowe-explorer/__tests__/__e2e__/wdio.conf.ts b/packages/zowe-explorer/__tests__/__e2e__/wdio.conf.ts index 397d24472d..f2f9578eef 100644 --- a/packages/zowe-explorer/__tests__/__e2e__/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__e2e__/wdio.conf.ts @@ -13,7 +13,7 @@ import type { Options } from "@wdio/types"; import { existsSync } from "fs"; import { emptyDirSync, mkdirpSync } from "fs-extra"; import { join as joinPath, relative as relativePath } from "path"; -import { baseConfig } from "../__common__/base.wdio.conf"; +import { baseConfig, dataDir } from "../__common__/base.wdio.conf"; if (process.env.ZOWE_TEST_DIR) { const homeDir = (process.env["ZOWE_CLI_HOME"] = joinPath(__dirname, relativePath(__dirname, process.env.ZOWE_TEST_DIR))); @@ -99,6 +99,7 @@ export const config: Options.Testrunner = { "wdio:vscodeOptions": { // points to directory where extension package.json is located extensionPath: joinPath(__dirname, "..", ".."), + storagePath: dataDir, // optional VS Code settings userSettings: { "editor.fontSize": 14, diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts index 10d1079e3d..074421bfab 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/step_definitions/dialogs/ShowConfigErrorDialog.steps.ts @@ -22,13 +22,8 @@ Then("the Show Config dialog should appear", async function () { this.workbench = await browser.getWorkbench(); let configNotification: Notification; - const notificationCenter = await (this.workbench as Workbench).openNotificationsCenter(); await browser.waitUntil(async () => { - // Notification may be visible or hidden, handle both cases - const notifications = [ - ...(await (this.workbench as Workbench).getNotifications()), - ...(await notificationCenter.getNotifications("error" as any)), - ]; + const notifications = await (this.workbench as Workbench).getNotifications(); for (const n of notifications) { const msg = await n.getMessage(); if (msg.startsWith("Error encountered when loading your Zowe config.")) { diff --git a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts index 2454596f56..dad36f2b89 100644 --- a/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts +++ b/packages/zowe-explorer/__tests__/__integration__/bdd/wdio.conf.ts @@ -12,12 +12,10 @@ import type { Options } from "@wdio/types"; import { join as joinPath, parse as parsePath, resolve as resolvePath } from "path"; import { emptyDirSync } from "fs-extra"; -import { baseConfig } from "../../__common__/base.wdio.conf"; +import { baseConfig, dataDir } from "../../__common__/base.wdio.conf"; import { cpSync, existsSync, readdirSync, renameSync } from "fs"; -const dataDir = joinPath(__dirname, "..", "..", "__common__", ".wdio-vscode-service", "data"); const screenshotDir = joinPath(__dirname, "results", "screenshots"); - process.env.ZOWE_CLI_HOME = resolvePath("../ci"); export const config: Options.Testrunner = { @@ -154,8 +152,8 @@ export const config: Options.Testrunner = { emptyDirSync(screenshotDir); }, - beforeFeature: function (uri, feature) { - const resourceDir = joinPath(__dirname, "resources", parsePath(uri).name); + before: function (caps, specs) { + const resourceDir = joinPath(__dirname, "resources", parsePath(specs[0]).name); if (existsSync(resourceDir)) { for (const resourceFile of readdirSync(resourceDir)) { const resourcePath = joinPath(process.env.ZOWE_CLI_HOME, resourceFile); @@ -167,8 +165,8 @@ export const config: Options.Testrunner = { } }, - afterFeature: function (uri, feature) { - const resourceDir = joinPath(__dirname, "resources", parsePath(uri).name); + after: function (result, caps, specs) { + const resourceDir = joinPath(__dirname, "resources", parsePath(specs[0]).name); if (existsSync(resourceDir)) { for (const resourceFile of readdirSync(resourceDir)) { const resourcePath = joinPath(process.env.ZOWE_CLI_HOME, resourceFile); From ea5d695a33d180c6f2b29c7bf51ffec926aa1f27 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Tue, 19 Nov 2024 20:08:43 -0500 Subject: [PATCH 14/16] Update changelog and add debounce unit tests Signed-off-by: Timothy Johnson --- packages/zowe-explorer-api/CHANGELOG.md | 2 +- packages/zowe-explorer/CHANGELOG.md | 4 +-- .../trees/shared/SharedUtils.unit.test.ts | 30 +++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/zowe-explorer-api/CHANGELOG.md b/packages/zowe-explorer-api/CHANGELOG.md index 9f3f73042f..7c36b18e72 100644 --- a/packages/zowe-explorer-api/CHANGELOG.md +++ b/packages/zowe-explorer-api/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t ### New features and enhancements -- Update Zowe SDKs to `8.8.2` to get the latest enhancements from Imperative. +- Update Zowe SDKs to `8.8.2` to get the latest enhancements from Imperative. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296) ### Bug fixes diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 89a1c28fbc..61aebf9cff 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -29,9 +29,9 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen - Fixed issue where users were not prompted to enter credentials if a 401 error was encountered when opening files, data sets or spools in the editor. [#3197](https://github.com/zowe/zowe-explorer-vscode/issues/3197) - Fixed issue where profile credential updates or token changes were not reflected within the filesystem. [#3289](https://github.com/zowe/zowe-explorer-vscode/issues/3289) - Fixed issue to update the success message when changing authentication from token to basic through the 'Change Authentication' option. [#3316](https://github.com/zowe/zowe-explorer-vscode/pull/3316) -- Fixed an issue where editing a team config file or updating credentials in OS vault could trigger multiple events for a single action. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296) +- Fixed an issue where fetching a USS file using `UssFSProvider.stat()` with a `fetch=true` query would cause Zowe Explorer to get stuck in an infinite loop. [#3321](https://github.com/zowe/zowe-explorer-vscode/pull/3321) +- Fixed an issue where editing a team config file or updating secrets in the OS credential vault could trigger multiple events for a single action. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296) - Updated Zowe SDKs to `8.8.2` for technical currency. [#3296](https://github.com/zowe/zowe-explorer-vscode/pull/3296) -- Fixed an issue where fetching a USS file using `UssFSProvider.stat()` with a `fetch=true` query would cause Zowe Explorer to get stuck in an infinite loop. ## `3.0.2` diff --git a/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts index 0edb4acfe2..fccbd8ae12 100644 --- a/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts @@ -680,3 +680,33 @@ describe("Shared utils unit tests - function copyExternalLink", () => { expect(copyClipboardMock).toHaveBeenCalledWith(`vscode://Zowe.vscode-extension-for-zowe?${ussNode.resourceUri?.toString()}`); }); }); + +describe("Shared utils unit tests - function debounce", () => { + beforeAll(() => { + jest.useFakeTimers(); + }); + + afterAll(() => { + jest.useRealTimers(); + }); + + it("executes a function twice when time between calls is long", () => { + const mockEventHandler = jest.fn(); + const debouncedFn = SharedUtils.debounce(mockEventHandler, 100); + debouncedFn(); + jest.runAllTimers(); + debouncedFn(); + jest.runAllTimers(); + expect(mockEventHandler).toHaveBeenCalledTimes(2); + }); + + it("executes a function only once when time between calls is short", () => { + const mockEventHandler = jest.fn(); + const debouncedFn = SharedUtils.debounce(mockEventHandler, 100); + debouncedFn(); + jest.advanceTimersByTime(0); + debouncedFn(); + jest.runAllTimers(); + expect(mockEventHandler).toHaveBeenCalledTimes(1); + }); +}); From 56ff4f07375e9db73e929c62a681abc129f92e04 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Wed, 20 Nov 2024 10:41:51 -0500 Subject: [PATCH 15/16] Fix JSON parse error shown multiple times Signed-off-by: Timothy Johnson --- .../trees/shared/SharedUtils.unit.test.ts | 2 +- .../__unit__/utils/ProfilesUtils.unit.test.ts | 40 +++++++++++-------- .../src/configuration/Profiles.ts | 1 - .../zowe-explorer/src/utils/ProfilesUtils.ts | 24 ++++++----- 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts index fccbd8ae12..f075fa22fd 100644 --- a/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/trees/shared/SharedUtils.unit.test.ts @@ -704,7 +704,7 @@ describe("Shared utils unit tests - function debounce", () => { const mockEventHandler = jest.fn(); const debouncedFn = SharedUtils.debounce(mockEventHandler, 100); debouncedFn(); - jest.advanceTimersByTime(0); + jest.advanceTimersByTime(10); debouncedFn(); jest.runAllTimers(); expect(mockEventHandler).toHaveBeenCalledTimes(1); diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts index c22891e44c..bc6da9145d 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts @@ -13,7 +13,7 @@ import * as fs from "fs"; import * as path from "path"; import * as util from "util"; import * as vscode from "vscode"; -import { FileManagement, Gui, imperative, ProfilesCache, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api"; +import { Gui, imperative, ProfilesCache, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api"; import { createAltTypeIProfile, createInstanceOfProfile, createValidIProfile } from "../../__mocks__/mockCreators/shared"; import { MockedProperty } from "../../__mocks__/mockUtils"; import { Constants } from "../../../src/configuration/Constants"; @@ -238,10 +238,6 @@ describe("ProfilesUtils unit tests", () => { }); describe("readConfigFromDisk", () => { - afterEach(() => { - jest.clearAllMocks(); - jest.resetAllMocks(); - }); Object.defineProperty(vscode.workspace, "workspaceFolders", { value: [ { @@ -253,9 +249,10 @@ describe("ProfilesUtils unit tests", () => { ], configurable: true, }); - it("should readConfigFromDisk and log 'Not Available'", async () => { + + it("should readConfigFromDisk and find default profiles", async () => { const mockReadProfilesFromDisk = jest.fn(); - const profInfoSpy = jest.spyOn(ProfilesUtils, "setupProfileInfo").mockReturnValue({ + jest.spyOn(ProfilesUtils, "setupProfileInfo").mockReturnValueOnce({ readProfilesFromDisk: mockReadProfilesFromDisk, getTeamConfig: () => ({ exists: true, @@ -275,36 +272,48 @@ describe("ProfilesUtils unit tests", () => { ], }), } as never); + const loggerSpy = jest.spyOn(ZoweLogger, "debug"); await expect(ProfilesUtils.readConfigFromDisk()).resolves.not.toThrow(); expect(mockReadProfilesFromDisk).toHaveBeenCalledTimes(1); - profInfoSpy.mockRestore(); + expect(loggerSpy).toHaveBeenLastCalledWith(expect.stringContaining(`Path: test, Found with the following defaults: "test"`)); }); - it("should readConfigFromDisk and find with defaults", async () => { + it("should readConfigFromDisk and log 'Not Available'", async () => { const mockReadProfilesFromDisk = jest.fn(); - const profInfoSpy = jest.spyOn(ProfilesUtils, "setupProfileInfo").mockReturnValue({ + jest.spyOn(ProfilesUtils, "setupProfileInfo").mockResolvedValueOnce({ readProfilesFromDisk: mockReadProfilesFromDisk, - getTeamConfig: () => ({ exists: true, layers: [] }), + getTeamConfig: () => ({ + exists: true, + layers: [ + { + path: "test", + exists: false, + properties: {}, + }, + ], + }), } as never); + const loggerSpy = jest.spyOn(ZoweLogger, "debug"); await expect(ProfilesUtils.readConfigFromDisk()).resolves.not.toThrow(); expect(mockReadProfilesFromDisk).toHaveBeenCalledTimes(1); - profInfoSpy.mockRestore(); + expect(loggerSpy).toHaveBeenLastCalledWith(expect.stringContaining("Path: test, Not available")); }); it("should keep Imperative error details if readConfigFromDisk fails", async () => { const impErr = new imperative.ImperativeError({ msg: "Unexpected Imperative error" }); const mockReadProfilesFromDisk = jest.fn().mockRejectedValue(impErr); - const profInfoSpy = jest.spyOn(ProfilesUtils, "setupProfileInfo").mockResolvedValue({ + jest.spyOn(ProfilesUtils, "setupProfileInfo").mockResolvedValueOnce({ readProfilesFromDisk: mockReadProfilesFromDisk, getTeamConfig: () => ({ exists: true }), } as never); + (ProfilesUtils as any).mProfileInfo = undefined; await expect(ProfilesUtils.readConfigFromDisk()).rejects.toBe(impErr); expect(mockReadProfilesFromDisk).toHaveBeenCalledTimes(1); - profInfoSpy.mockRestore(); + expect((ProfilesUtils as any).mProfileInfo).toBeUndefined(); }); it("should warn the user when using team config with a missing schema", async () => { - const profInfoSpy = jest.spyOn(ProfilesUtils, "setupProfileInfo").mockReturnValueOnce({ + jest.spyOn(ProfilesUtils, "setupProfileInfo").mockResolvedValueOnce({ readProfilesFromDisk: jest.fn(), hasValidSchema: false, getTeamConfig: () => ({ @@ -330,7 +339,6 @@ describe("ProfilesUtils unit tests", () => { expect(warnMsgSpy).toHaveBeenCalledWith( "No valid schema was found for the active team configuration. This may introduce issues with profiles in Zowe Explorer." ); - profInfoSpy.mockRestore(); }); }); diff --git a/packages/zowe-explorer/src/configuration/Profiles.ts b/packages/zowe-explorer/src/configuration/Profiles.ts index 4fc6234b9a..b2f9ce5a29 100644 --- a/packages/zowe-explorer/src/configuration/Profiles.ts +++ b/packages/zowe-explorer/src/configuration/Profiles.ts @@ -47,7 +47,6 @@ export class Profiles extends ProfilesCache { await Profiles.getInstance().getProfileInfo(); } catch (err) { ZoweLogger.error(err); - ZoweExplorerExtender.showZoweConfigError(err.message); } return Profiles.loader; } diff --git a/packages/zowe-explorer/src/utils/ProfilesUtils.ts b/packages/zowe-explorer/src/utils/ProfilesUtils.ts index 4e11589f69..c0d2ece423 100644 --- a/packages/zowe-explorer/src/utils/ProfilesUtils.ts +++ b/packages/zowe-explorer/src/utils/ProfilesUtils.ts @@ -334,36 +334,37 @@ export class ProfilesUtils { public static async readConfigFromDisk(warnForMissingSchema?: boolean): Promise { ZoweLogger.trace("ProfilesUtils.readConfigFromDisk called."); let rootPath: string; - ProfilesUtils.mProfileInfo = await ProfilesUtils.setupProfileInfo(); + const profInfo = await ProfilesUtils.setupProfileInfo(); const workspacePath = ZoweVsCodeExtension.workspaceRoot?.uri.fsPath; if (workspacePath) { rootPath = workspacePath; - await ProfilesUtils.mProfileInfo.readProfilesFromDisk({ + await profInfo.readProfilesFromDisk({ homeDir: FileManagement.getZoweDir(), projectDir: FileManagement.getFullPath(rootPath), }); } else { - await ProfilesUtils.mProfileInfo.readProfilesFromDisk({ homeDir: FileManagement.getZoweDir(), projectDir: undefined }); + await profInfo.readProfilesFromDisk({ homeDir: FileManagement.getZoweDir(), projectDir: undefined }); } - if (ProfilesUtils.mProfileInfo.getTeamConfig().exists) { - if (warnForMissingSchema && !ProfilesUtils.mProfileInfo.hasValidSchema) { + ProfilesUtils.mProfileInfo = profInfo; + if (profInfo.getTeamConfig().exists) { + if (warnForMissingSchema && !profInfo.hasValidSchema) { const schemaWarning = vscode.l10n.t( "No valid schema was found for the active team configuration. This may introduce issues with profiles in Zowe Explorer." ); Gui.warningMessage(schemaWarning); ZoweLogger.warn(schemaWarning); } - ZoweLogger.info(`Zowe Explorer is using the team configuration file "${ProfilesUtils.mProfileInfo.getTeamConfig().configName}"`); - const layers = ProfilesUtils.mProfileInfo.getTeamConfig().layers || []; + ZoweLogger.info(`Zowe Explorer is using the team configuration file "${profInfo.getTeamConfig().configName}"`); + const layers = profInfo.getTeamConfig().layers || []; const layerSummary = layers.map( (config: imperative.IConfigLayer) => - `Path: ${config.path}: ${ + `Path: ${config.path}, ${ config.exists - ? "Found, with the following defaults:" + JSON.stringify(config.properties?.defaults || "Undefined default") + ? "Found with the following defaults: " + JSON.stringify(config.properties?.defaults || "Undefined default") : "Not available" } ` ); - ZoweLogger.debug(`Summary of team configuration files considered for Zowe Explorer: ${JSON.stringify(layerSummary)}`); + ZoweLogger.debug(["Summary of team configuration files considered for Zowe Explorer:", ...layerSummary].join("\t\n")); } } @@ -564,7 +565,8 @@ export class ProfilesUtils { await ProfilesUtils.readConfigFromDisk(true); ZoweLogger.info(vscode.l10n.t("Zowe profiles initialized successfully.")); } catch (err) { - if (err instanceof imperative.ImperativeError) { + // JSON parsing errors in team config files will have suppressDump=true + if (err instanceof imperative.ImperativeError && !err.mDetails.suppressDump) { await AuthUtils.errorHandling(err, { scenario: err.mDetails.causeErrors }); } else { ZoweLogger.error(err); From 86a1b4eec1661db784f9cdf991125b6979bd4770 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Wed, 20 Nov 2024 11:01:18 -0500 Subject: [PATCH 16/16] Update changelog Signed-off-by: Timothy Johnson --- packages/zowe-explorer/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/zowe-explorer/CHANGELOG.md b/packages/zowe-explorer/CHANGELOG.md index 61aebf9cff..2c54d8562f 100644 --- a/packages/zowe-explorer/CHANGELOG.md +++ b/packages/zowe-explorer/CHANGELOG.md @@ -6,6 +6,14 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen ### New features and enhancements +### Bug fixes + +- Fixed an issue during initialization where the error dialog shown for a broken team configuration file was missing the "Show Config" action. [#3322](https://github.com/zowe/zowe-explorer-vscode/pull/3322) + +## `3.0.3` + +### New features and enhancements + - Update Zowe SDKs to `8.2.0` to get the latest enhancements from Imperative. - Added expired JSON web token detection for profiles in each tree view (Data Sets, USS, Jobs). When a user performs a search on a profile, they are prompted to log in if their token expired. [#3175](https://github.com/zowe/zowe-explorer-vscode/issues/3175) - Add a data set or USS resource to a virtual workspace with the new "Add to Workspace" context menu option. [#3265](https://github.com/zowe/zowe-explorer-vscode/issues/3265)