Skip to content

Commit

Permalink
Merge pull request #2472 from zowe/profile-management
Browse files Browse the repository at this point in the history
Profile management
  • Loading branch information
JillieBeanSim authored Oct 10, 2023
2 parents 5f77386 + 60e3c9d commit ccccc65
Show file tree
Hide file tree
Showing 18 changed files with 699 additions and 147 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
### New features and enhancements

- Added "Sort Jobs" feature for job nodes in Jobs tree view. [#2257](https://github.com/zowe/vscode-extension-for-zowe/issues/2251)
- Introduce a new user interface for managing profiles via right-click action "Manage Profile".
- Added new edit feature on `Edit Attributes` view for changing file tags on USS [#2113](https://github.com/zowe/vscode-extension-for-zowe/issues/2113)
- Added new API {ZE Extender MetaData} to allow extenders to have the metadata of registered extenders to aid in team configuration file creation from a view that isn't Zowe Explorer's. [#2394](https://github.com/zowe/vscode-extension-for-zowe/issues/2394)

Expand Down
34 changes: 34 additions & 0 deletions packages/zowe-explorer/__mocks__/mockCreators/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,40 @@ export function createValidIProfile(): imperative.IProfileLoaded {
};
}

export function createTokenAuthIProfile(): imperative.IProfileLoaded {
return {
name: "sestest",
profile: {
type: "zosmf",
host: "test",
port: 1443,
rejectUnauthorized: false,
tokenType: "apimlAuthenticationToken",
tokenValue: "stringofletters",
name: "testName",
},
type: "zosmf",
message: "",
failNotFound: false,
};
}

export function createNoAuthIProfile(): imperative.IProfileLoaded {
return {
name: "sestest",
profile: {
type: "zosmf",
host: null,
port: 1443,
rejectUnauthorized: false,
name: "testName",
},
type: "zosmf",
message: "",
failNotFound: false,
};
}

export function createAltTypeIProfile(): imperative.IProfileLoaded {
return {
name: "altTypeProfile",
Expand Down
4 changes: 3 additions & 1 deletion packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const DatasetsLocators = {
favoriteProfileInDatasetXpath: "(//div[contains(@id,'Favorites') and contains(@id,'TestSeleniumProfile')])",
addToFavoriteOptionXpath: "//li[@data-command='zowe.ds.saveSearch']",
removeFavoriteProfileFromDatasetsOptionXpath: "//li[@data-command='zowe.ds.removeFavProfile']",
deleteProfileFromDatasetsXpath: "(//li[@data-command='zowe.ds.deleteProfile'])",
manageProfileFromDatasetsXpath: "(//li[@data-command='zowe.profileManagement'])",
};

export const UssLocators = {
Expand All @@ -44,6 +44,7 @@ export const UssLocators = {
addToFavoriteOptionXpath: "//li[@data-command='zowe.uss.addFavorite']",
removeFavoriteProfileFromUssOptionXpath: "//li[@data-command='zowe.uss.removeFavProfile']",
hideProfileFromUssOptionXpath: "//li[@data-command='zowe.uss.removeSession']",
manageProfileFromUnixXpath: "(//li[@data-command='zowe.profileManagement'])",
};

export const JobsLocators = {
Expand All @@ -60,6 +61,7 @@ export const JobsLocators = {
removeFavoriteProfileFromJobsOptionXpath: "//li[@data-command='zowe.jobs.removeFavProfile']",
hideProfileFromJobsOptionXpath: "//li[@data-command='zowe.jobs.removeJobsSession']",
secondJobsProfileBeforeHidingXpath: "(//div[contains(@id,'TestSeleniumProfile')])[2]",
manageProfileFromJobsXpath: "(//li[@data-command='zowe.profileManagement'])",
};

export const TheiaNotificationMessages = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,21 @@ export async function addProfileToFavoritesInJobs() {
export async function hideProfileInUss() {
const hideProfileFromUss = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME);
await driverChrome.actions().click(hideProfileFromUss, Button.RIGHT).perform();
await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.hideProfileFromUssOptionXpath)), WAITTIME).click();
driverChrome.wait(until.elementLocated(By.xpath(UssLocators.manageProfileFromUnixXpath)), WAITTIME).click();
await driverChrome.sleep(SHORTSLEEPTIME);
const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME);
manageProfile.sendKeys("Hide Profile");
manageProfile.sendKeys(Key.ENTER);
}

export async function hideProfileInJobs() {
const hideProfileFromJobs = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileBeforeHidingXpath)), WAITTIME);
await driverChrome.actions().click(hideProfileFromJobs, Button.RIGHT).perform();
await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.hideProfileFromJobsOptionXpath)), WAITTIME).click();
driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.manageProfileFromJobsXpath)), WAITTIME).click();
await driverChrome.sleep(SHORTSLEEPTIME);
const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME);
manageProfile.sendKeys("Hide Profile");
manageProfile.sendKeys(Key.ENTER);
}

export async function verifyProfileIsHideInUss() {
Expand All @@ -170,23 +178,29 @@ export async function verifyProfileIsHideInJobs() {
export async function deleteDefaultProfileInDatasets() {
const profileName = await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.defaultDatasetsProfileXpath)), WAITTIME);
await driverChrome.actions().click(profileName, Button.RIGHT).perform();
await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.deleteProfileFromDatasetsXpath)), WAITTIME).click();
await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.manageProfileFromDatasetsXpath)), WAITTIME).click();
await driverChrome.sleep(SHORTSLEEPTIME);
const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME);
manageProfile.sendKeys("Delete Profile");
manageProfile.sendKeys(Key.ENTER);
await driverChrome.sleep(SHORTSLEEPTIME);
const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME);
deleteProfile.sendKeys("Delete");
deleteProfile.sendKeys(Key.ENTER);
return;
}

export async function deleteProfileInDatasets() {
const favprofile = await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.secondDatasetProfileXpath)), WAITTIME);
await driverChrome.actions().click(favprofile, Button.RIGHT).perform();
await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.deleteProfileFromDatasetsXpath)), WAITTIME).click();
await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.manageProfileFromDatasetsXpath)), WAITTIME).click();
await driverChrome.sleep(SHORTSLEEPTIME);
const manageProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME);
manageProfile.sendKeys("Delete Profile");
manageProfile.sendKeys(Key.ENTER);
await driverChrome.sleep(SHORTSLEEPTIME);
const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME);
deleteProfile.sendKeys("Delete");
deleteProfile.sendKeys(Key.ENTER);
return;
}

export async function verifyRemovedFavoriteProfileInDatasets() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ describe("Profiles Unit Tests - function checkCurrentProfile", () => {
it("should throw an error if using token auth and is logged out or has expired token", async () => {
const globalMocks = await createGlobalMocks();
jest.spyOn(utils, "errorHandling").mockImplementation();
jest.spyOn(utils, "isUsingTokenAuth").mockResolvedValue(true);
jest.spyOn(utils.ProfilesUtils, "isUsingTokenAuth").mockResolvedValue(true);
setupProfilesCheck(globalMocks);
await expect(Profiles.getInstance().checkCurrentProfile(globalMocks.testProfile)).resolves.toEqual({ name: "sestest", status: "unverified" });
});
Expand Down Expand Up @@ -1569,6 +1569,7 @@ describe("Profiles Unit Tests - function ssoLogin", () => {
],
configurable: true,
});
Object.defineProperty(utils.ProfilesUtils, "isProfileUsingBasicAuth", { value: jest.fn(), configurable: true });
jest.spyOn(Gui, "showMessage").mockImplementation();
});
it("should perform an SSOLogin successfully while fetching the base profile", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ async function createGlobalMocks() {
"zowe.manualPoll",
"zowe.updateSecureCredentials",
"zowe.promptCredentials",
"zowe.profileManagement",
"zowe.openRecentMember",
"zowe.searchInAllLoadedItems",
"zowe.ds.deleteProfile",
Expand Down
Loading

0 comments on commit ccccc65

Please sign in to comment.