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();