From 48cce8e6ea6e34639b14f0895e795a373d3d03c4 Mon Sep 17 00:00:00 2001 From: katelynienaber Date: Tue, 30 Mar 2021 15:11:24 +0200 Subject: [PATCH 1/3] Adding fix for job names with a hash in them Signed-off-by: katelynienaber --- .github/workflows/zowe-explorer-ftp-ci.yml | 2 - .../__theia__/extension.theia.test.ts | 5 +- .../__tests__/__theia__/theia/Locators.ts | 11 +- .../__theia__/theia/extension.theiaChrome.ts | 280 +++++++++++------- .../__theia__/theia/extension.theiaFirefox.ts | 105 ++++--- .../__unit__/SpoolProvider.unit.test.ts | 22 +- .../__unit__/job/actions.unit.test.ts | 30 +- packages/zowe-explorer/src/SpoolProvider.ts | 6 +- 8 files changed, 297 insertions(+), 164 deletions(-) diff --git a/.github/workflows/zowe-explorer-ftp-ci.yml b/.github/workflows/zowe-explorer-ftp-ci.yml index 45d42329c7..478e55615f 100644 --- a/.github/workflows/zowe-explorer-ftp-ci.yml +++ b/.github/workflows/zowe-explorer-ftp-ci.yml @@ -43,14 +43,12 @@ jobs: env: CI: true NODE_OPTIONS: --max_old_space_size=4096 - # - name: Upload test results # uses: actions/upload-artifact@v1 # # if: matrix.os == 'windows-latest' && matrix.node-version == '12.x' # with: # name: zowe-explorer-ftp-extension-results # path: packages/zowe-explorer-ftp-extension/results/ - # Run codecov upload for only one run # - name: Upload Results to Codecov from Windows / Node 12.x # if: matrix.os == 'windows-latest' && matrix.node-version == '12.x' diff --git a/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts b/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts index c6996267df..4113f12ff4 100644 --- a/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts +++ b/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts @@ -16,13 +16,12 @@ import * as driverChrome from "./theia/extension.theiaChrome"; const TIMEOUT = 45000; const SLEEPTIME = 10000; -const SHORTSLEEPTIME = 2000; +const SHORTSLEEPTIME = 2000; declare var it: any; const expect = chai.expect; chai.use(chaiAsPromised); describe("Add Default Profile", () => { - before(async () => { await driverFirefox.openBrowser(); await driverFirefox.sleepTime(SHORTSLEEPTIME); @@ -79,7 +78,6 @@ describe("Add Default Profile", () => { }); describe("Add Profiles", () => { - before(async () => { await driverFirefox.openBrowser(); await driverFirefox.sleepTime(SHORTSLEEPTIME); @@ -205,7 +203,6 @@ describe("Remove Profile from Favorites", () => { expect(favoriteProfile).to.equal(true); }); - after(async () => driverChrome.closeBrowser()); }); diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts index bf5265c43c..4282711fef 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts @@ -10,11 +10,10 @@ */ export const TheiaLocator = { - theiaUrl: "http://localhost:3000", zoweExplorerxId: "shell-tab-plugin-view-container:zowe", - }; +}; export const DatasetsLocators = { datasetTabId: "plugin-view-container:zowe--plugin-view:zowe.explorer", @@ -31,7 +30,7 @@ export const DatasetsLocators = { removeFavoriteProfileFromDatasetsOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.removeFavProfile']", secondDatasetProfileBeforeDeletingId: "/1:TestSeleniumProfile", deleteProfileFromDatasetsXpath: "(//li[@data-command='__plugin.menu.action.zowe.deleteProfile'])", - }; +}; export const UssLocators = { ussTabId: "plugin-view-container:zowe--plugin-view:zowe.uss.explorer", @@ -48,7 +47,7 @@ export const UssLocators = { removeFavoriteProfileFromUssOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.uss.removeFavProfile']", hideProfileFromUssOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.uss.removeSession']", searchSymbolInFavoriteXpath: "//*[@id='/0:Favorites/0:TestSeleniumProfile/0:']", - }; +}; export const JobsLocators = { jobTabId: "plugin-view-container:zowe--plugin-view:zowe.jobs", @@ -68,9 +67,9 @@ export const JobsLocators = { hideProfileFromJobsOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.removeJobsSession']", secondJobsProfileIdBeforeHidingXpath: "(//div[@id='/2:TestSeleniumProfile'])[2]", favoriteprofilexpath: "//div[@id='/0:Favorites/0:TestSeleniumProfile']", - }; +}; export const TheiaNotificationMessages = { closeTheiaNotificationWarningMsgXpath: "/html/body/div[3]/div/div[1]/div/div/div/div/ul/li", deleteProfileNotificationMsg: "/html/body/div[3]/div/div[1]/div/div/div/div/div[2]/span", - }; +}; diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 5f51676c51..4e164c948a 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -18,238 +18,320 @@ const WAITTIME = 30000; const SHORTSLEEPTIME = 2000; let driverChrome: any; -export async function openBrowser(){ +export async function openBrowser() { const chromeOptions = new chrome.Options(); chromeOptions.addArguments("headless"); chromeOptions.addArguments("window-size=1200,1100"); driverChrome = new Builder().forBrowser("chrome").setChromeOptions(chromeOptions).build(); } -export async function OpenTheiaInChrome(){ +export async function OpenTheiaInChrome() { await driverChrome.get(TheiaLocator.theiaUrl); } -export async function clickOnZoweExplorer(){ +export async function clickOnZoweExplorer() { await driverChrome.wait(until.elementLocated(By.id(TheiaLocator.zoweExplorerxId))).click(); } -export async function clickOnFavoriteTabInDatasets(){ +export async function clickOnFavoriteTabInDatasets() { await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME).click(); } -export async function clickOnFavoriteTabInUss(){ +export async function clickOnFavoriteTabInUss() { await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteTabXpath)), WAITTIME).click(); } -export async function clickOnFavoriteTabInJobs(){ +export async function clickOnFavoriteTabInJobs() { await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabXpath)), WAITTIME).click(); } -export async function clickOnFavoriteTabInJobsAfterRefresh(){ - await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabAfterRefreshXpath)), WAITTIME).click(); +export async function clickOnFavoriteTabInJobsAfterRefresh() { + await driverChrome + .wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabAfterRefreshXpath)), WAITTIME) + .click(); } -export async function clickOnDatasetsTab(){ +export async function clickOnDatasetsTab() { await driverChrome.findElement(By.xpath(DatasetsLocators.datasetTabXpath)).click(); } -export async function clickOnUssTab(){ +export async function clickOnUssTab() { await driverChrome.findElement(By.id(UssLocators.ussTabId)).click(); } -export async function clickOnUssTabs(){ +export async function clickOnUssTabs() { await driverChrome.findElement(By.xpath(UssLocators.ussTabXpath)).click(); } -export async function clickOnJobsTab(){ +export async function clickOnJobsTab() { await driverChrome.findElement(By.id(JobsLocators.jobTabId)).click(); } -export async function getFavoritePrfileNameFromDatasets(){ - const favoriteProfile = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME).getText(); +export async function getFavoritePrfileNameFromDatasets() { + const favoriteProfile = await driverChrome + .wait(until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME) + .getText(); return favoriteProfile; } -export async function getFavoritePrfileNameFromUss(){ - const favoriteProfile = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssXpath)), WAITTIME).getText(); +export async function getFavoritePrfileNameFromUss() { + const favoriteProfile = await driverChrome + .wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssXpath)), WAITTIME) + .getText(); return favoriteProfile; } -export async function getFavoritePrfileNameFromJobs(){ - const favoriteProfile = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteProfileInJobsXpath)), WAITTIME).getText(); +export async function getFavoritePrfileNameFromJobs() { + const favoriteProfile = await driverChrome + .wait(until.elementLocated(By.xpath(JobsLocators.favoriteProfileInJobsXpath)), WAITTIME) + .getText(); return favoriteProfile; } -export async function removeFavoriteProfileFromDatasets(){ - const removeFromFavorite = await driverChrome.wait(until.elementLocated( - By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME); +export async function removeFavoriteProfileFromDatasets() { + const removeFromFavorite = await driverChrome.wait( + until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), + WAITTIME + ); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.removeFavoriteProfileFromDatasetsOptionXpath)), WAITTIME).click(); - const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); + await driverChrome + .wait(until.elementLocated(By.xpath(DatasetsLocators.removeFavoriteProfileFromDatasetsOptionXpath)), WAITTIME) + .click(); + const removeFavoriteInputBox = await driverChrome.wait( + until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), + WAITTIME + ); removeFavoriteInputBox.sendKeys("Continue"); await driverChrome.sleep(SHORTSLEEPTIME); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function removeFavoriteProfileFromUss(){ - const removeFromFavorite = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssBeforeRemovingXpath)), WAITTIME); +export async function removeFavoriteProfileFromUss() { + const removeFromFavorite = await driverChrome.wait( + until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssBeforeRemovingXpath)), + WAITTIME + ); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.removeFavoriteProfileFromUssOptionXpath)), WAITTIME).click(); - const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); + await driverChrome + .wait(until.elementLocated(By.xpath(UssLocators.removeFavoriteProfileFromUssOptionXpath)), WAITTIME) + .click(); + const removeFavoriteInputBox = await driverChrome.wait( + until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), + WAITTIME + ); removeFavoriteInputBox.sendKeys("Continue"); await driverChrome.sleep(SHORTSLEEPTIME); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function removeFavoriteProfileFromJobs(){ - const removeFromFavorite = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteprofile)), WAITTIME); +export async function removeFavoriteProfileFromJobs() { + const removeFromFavorite = await driverChrome.wait( + until.elementLocated(By.xpath(JobsLocators.favoriteprofile)), + WAITTIME + ); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.removeFavoriteProfileFromJobsOptionXpath)), WAITTIME).click(); - const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME); + await driverChrome + .wait(until.elementLocated(By.xpath(JobsLocators.removeFavoriteProfileFromJobsOptionXpath)), WAITTIME) + .click(); + const removeFavoriteInputBox = await driverChrome.wait( + until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), + WAITTIME + ); removeFavoriteInputBox.sendKeys("Continue"); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function addProfileToFavoritesInDatasets(){ - const addTofavorite = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), WAITTIME); +export async function addProfileToFavoritesInDatasets() { + const addTofavorite = await driverChrome.wait( + until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), + WAITTIME + ); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.addToFavoriteOptionXpath)), WAITTIME).click(); + await driverChrome + .wait(until.elementLocated(By.xpath(DatasetsLocators.addToFavoriteOptionXpath)), WAITTIME) + .click(); } -export async function addProfileToFavoritesInUss(){ - const addTofavorite = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME); +export async function addProfileToFavoritesInUss() { + const addTofavorite = await driverChrome.wait( + until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), + WAITTIME + ); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.addToFavoriteOptionXpath)), WAITTIME).click(); } -export async function addProfileToFavoritesInJobs(){ - const addTofavorite = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME); +export async function addProfileToFavoritesInJobs() { + const addTofavorite = await driverChrome.wait( + until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), + WAITTIME + ); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.addToFavoriteOptionXpath)), WAITTIME).click(); } -export async function hideProfileInUss(){ - const hideProfileFromUss = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME); +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(); + await driverChrome + .wait(until.elementLocated(By.xpath(UssLocators.hideProfileFromUssOptionXpath)), WAITTIME) + .click(); } -export async function hideProfileInJobs(){ - const hideProfileFromJobs = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)), WAITTIME); +export async function hideProfileInJobs() { + const hideProfileFromJobs = await driverChrome.wait( + until.elementLocated(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)), + WAITTIME + ); await driverChrome.actions().click(hideProfileFromJobs, Button.RIGHT).perform(); - await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.hideProfileFromJobsOptionXpath)), WAITTIME).click(); -} - -export async function verifyProfileIsHideInUss(){ - const hideProfileFromUss = await driverChrome.findElements(By.xpath(UssLocators.secondUssProfileXpath)).then((found) => !!found.length); - if(!hideProfileFromUss){ - return true; - }else{ + await driverChrome + .wait(until.elementLocated(By.xpath(JobsLocators.hideProfileFromJobsOptionXpath)), WAITTIME) + .click(); +} + +export async function verifyProfileIsHideInUss() { + const hideProfileFromUss = await driverChrome + .findElements(By.xpath(UssLocators.secondUssProfileXpath)) + .then((found) => !!found.length); + if (!hideProfileFromUss) { + return true; + } else { return false; } } -export async function verifyProfileIsHideInJobs(){ - const hideProfileFromJobs = await driverChrome.findElements( - By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)).then((found) => !!found.length); - if(!hideProfileFromJobs){ - return true; - }else{ +export async function verifyProfileIsHideInJobs() { + const hideProfileFromJobs = await driverChrome + .findElements(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)) + .then((found) => !!found.length); + if (!hideProfileFromJobs) { + return true; + } else { return false; } } -export async function deleteDefaultProfileInDatasets(){ - const profileName = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), WAITTIME); +export async function deleteDefaultProfileInDatasets() { + const profileName = await driverChrome.wait( + until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), + 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.deleteProfileFromDatasetsXpath)), WAITTIME) + .click(); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); + const deleteProfile = driverChrome.wait( + until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), + WAITTIME + ); deleteProfile.sendKeys("Delete"); deleteProfile.sendKeys(Key.ENTER); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteConfrmationMsg = await driverChrome.wait(until.elementLocated( - By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME).getText(); + const deleteConfrmationMsg = await driverChrome + .wait(until.elementLocated(By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME) + .getText(); return deleteConfrmationMsg; } -export async function deleteProfileInDatasets(){ - const favprofile = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileBeforeDeletingId)), WAITTIME); +export async function deleteProfileInDatasets() { + const favprofile = await driverChrome.wait( + until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileBeforeDeletingId)), + 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.deleteProfileFromDatasetsXpath)), WAITTIME) + .click(); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); + const deleteProfile = driverChrome.wait( + until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), + WAITTIME + ); deleteProfile.sendKeys("Delete"); deleteProfile.sendKeys(Key.ENTER); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteConfrmationMsg = await driverChrome.wait(until.elementLocated( - By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME).getText(); + const deleteConfrmationMsg = await driverChrome + .wait(until.elementLocated(By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME) + .getText(); return deleteConfrmationMsg; } -export async function verifyRemovedFavoriteProfileInDatasets(){ - const favoriteProfile = await driverChrome.findElements(By.id(DatasetsLocators.favoriteProfileInDatasetId)).then((found) => !!found.length); - if(!favoriteProfile){ - return true; - }else{ +export async function verifyRemovedFavoriteProfileInDatasets() { + const favoriteProfile = await driverChrome + .findElements(By.id(DatasetsLocators.favoriteProfileInDatasetId)) + .then((found) => !!found.length); + if (!favoriteProfile) { + return true; + } else { return false; } } -export async function verifyRemovedFavoriteProfileInUss(){ - const favoriteProfile = await driverChrome.findElements(By.xpath(UssLocators.favoriteProfileInUssXpath)).then((found) => !!found.length); - if(!favoriteProfile){ - return true; - }else{ +export async function verifyRemovedFavoriteProfileInUss() { + const favoriteProfile = await driverChrome + .findElements(By.xpath(UssLocators.favoriteProfileInUssXpath)) + .then((found) => !!found.length); + if (!favoriteProfile) { + return true; + } else { return false; } } -export async function verifyRemovedFavoriteProfileInJobs(){ - const favoriteProfile = await driverChrome.findElements(By.xpath(JobsLocators.favoriteProfileInJobsXpath)).then((found) => !!found.length); - if(!favoriteProfile){ - return true; - }else{ +export async function verifyRemovedFavoriteProfileInJobs() { + const favoriteProfile = await driverChrome + .findElements(By.xpath(JobsLocators.favoriteProfileInJobsXpath)) + .then((found) => !!found.length); + if (!favoriteProfile) { + return true; + } else { return false; } } -export async function verifyRemovedDefaultProfileInUss(){ - const defaultProfile = await driverChrome.findElements(By.xpath(UssLocators.defaultUssProfileXpath)).then((found) => !!found.length); - if(!defaultProfile){ - return true; - }else{ +export async function verifyRemovedDefaultProfileInUss() { + const defaultProfile = await driverChrome + .findElements(By.xpath(UssLocators.defaultUssProfileXpath)) + .then((found) => !!found.length); + if (!defaultProfile) { + return true; + } else { return false; } } -export async function verifyRemovedDefaultProfileInJobs(){ - const defaultProfile = await driverChrome.findElements(By.xpath(JobsLocators.defaultJobsProfileXpath)).then((found) => !!found.length); - if(!defaultProfile){ - return true; - }else{ +export async function verifyRemovedDefaultProfileInJobs() { + const defaultProfile = await driverChrome + .findElements(By.xpath(JobsLocators.defaultJobsProfileXpath)) + .then((found) => !!found.length); + if (!defaultProfile) { + return true; + } else { return false; } } -export async function closeNotificationMessage(){ +export async function closeNotificationMessage() { await driverChrome.findElement(By.xpath(TheiaNotificationMessages.closeTheiaNotificationWarningMsgXpath)).click(); } -export async function sleepTime(sleeptime: number){ +export async function sleepTime(sleeptime: number) { await driverChrome.sleep(sleeptime); } -export async function refreshBrowser(){ +export async function refreshBrowser() { await driverChrome.navigate().refresh(); } -export function closeBrowser() -{ +export function closeBrowser() { driverChrome.close(); } diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index ce4ca24f2e..416f0e4088 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -18,66 +18,69 @@ const WAITTIME = 30000; const SHORTSLEEPTIME = 2000; let driverFirefox: any; -export async function openBrowser(){ +export async function openBrowser() { const firefoxOptions = new firefox.Options(); firefoxOptions.headless(); driverFirefox = new Builder().forBrowser("firefox").setFirefoxOptions(firefoxOptions).build(); } -export async function OpenTheiaInFirefox(){ +export async function OpenTheiaInFirefox() { await driverFirefox.get(TheiaLocator.theiaUrl); } -export async function clickOnZoweExplorer(){ +export async function clickOnZoweExplorer() { driverFirefox.wait(until.elementLocated(By.id(TheiaLocator.zoweExplorerxId))).click(); } -export async function clickOnDatasetsTab(){ +export async function clickOnDatasetsTab() { await driverFirefox.findElement(By.xpath(DatasetsLocators.datasetTabXpath)).click(); } -export async function clickOnUssTab(){ +export async function clickOnUssTab() { await driverFirefox.findElement(By.id(UssLocators.ussTabId)).click(); } -export async function clickOnUssTabs(){ +export async function clickOnUssTabs() { await driverFirefox.findElement(By.xpath(UssLocators.ussTabXpath)).click(); } -export async function clickOnJobsTab(){ +export async function clickOnJobsTab() { await driverFirefox.findElement(By.id(JobsLocators.jobTabId)).click(); } -export async function clickOnDatasetsPanel(){ +export async function clickOnDatasetsPanel() { await driverFirefox.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); } -export async function clickOnAddSessionInDatasets(){ +export async function clickOnAddSessionInDatasets() { await driverFirefox.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); } -export async function clickOnUssPanel(){ +export async function clickOnUssPanel() { await driverFirefox.findElement(By.id(UssLocators.ussPanelId)).click(); } -export async function clickOnAddSessionInUss(){ +export async function clickOnAddSessionInUss() { await driverFirefox.findElement(By.id(UssLocators.ussAddSessionId)).click(); } -export async function clickOnJobsPanel(){ - await driverFirefox.findElement(By.id (JobsLocators.jobsPanelId)).click(); +export async function clickOnJobsPanel() { + await driverFirefox.findElement(By.id(JobsLocators.jobsPanelId)).click(); } -export async function clickOnAddSessionInJobs(){ +export async function clickOnAddSessionInJobs() { await driverFirefox.findElement(By.id(JobsLocators.jobsAddSessionId)).click(); } -export async function addProfileDetails(profileName: string){ +export async function addProfileDetails(profileName: string) { await driverFirefox.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); await driverFirefox.sleep(SHORTSLEEPTIME); await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)).sendKeys(Key.ENTER); await driverFirefox.sleep(SHORTSLEEPTIME); - const datasetProfileName = await driverFirefox.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)),WAITTIME); + const datasetProfileName = await driverFirefox.wait( + until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), + WAITTIME + ); datasetProfileName.sendKeys(profileName); datasetProfileName.sendKeys(Key.ENTER); await driverFirefox.sleep(SHORTSLEEPTIME); @@ -106,78 +109,98 @@ export async function addProfileDetails(profileName: string){ await driverFirefox.sleep(SHORTSLEEPTIME); } -export async function addProfileDetailsInUss(profileName: string){ +export async function addProfileDetailsInUss(profileName: string) { const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); } -export async function addProfileDetailsInJobs(profileName: string){ +export async function addProfileDetailsInJobs(profileName: string) { const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); } -export async function getDatasetsDefaultProfilename(){ - const datasetProfile = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)),WAITTIME).getText(); +export async function getDatasetsDefaultProfilename() { + const datasetProfile = await driverFirefox + .wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), WAITTIME) + .getText(); return datasetProfile; } -export async function getUssDefaultProfilename(){ - const ussProfile = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.defaultUssProfileXpath)), WAITTIME).getText(); +export async function getUssDefaultProfilename() { + const ussProfile = await driverFirefox + .wait(until.elementLocated(By.xpath(UssLocators.defaultUssProfileXpath)), WAITTIME) + .getText(); return ussProfile; } -export async function getJobsDefaultProfilename(){ - const jobsProfile = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.defaultJobsProfileXpath)), WAITTIME).getText(); +export async function getJobsDefaultProfilename() { + const jobsProfile = await driverFirefox + .wait(until.elementLocated(By.xpath(JobsLocators.defaultJobsProfileXpath)), WAITTIME) + .getText(); return jobsProfile; } -export async function getDatasetsProfilename(){ - const datasetProfile = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)),WAITTIME).getText(); +export async function getDatasetsProfilename() { + const datasetProfile = await driverFirefox + .wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), WAITTIME) + .getText(); return datasetProfile; } -export async function getUssProfilename(){ - const ussProfile = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME).getText(); +export async function getUssProfilename() { + const ussProfile = await driverFirefox + .wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME) + .getText(); return ussProfile; } -export async function getJobsProfilename(){ - const jobsProfile = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME).getText(); +export async function getJobsProfilename() { + const jobsProfile = await driverFirefox + .wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME) + .getText(); return jobsProfile; } -export async function getFavouritesNode(){ - const favoriteLink = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME).getAttribute("title"); +export async function getFavouritesNode() { + const favoriteLink = await driverFirefox + .wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME) + .getAttribute("title"); return favoriteLink; } -export async function getDatasetNode(){ +export async function getDatasetNode() { await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.datasetTabId)), WAITTIME); - const datasetLink = await driverFirefox.wait(until.elementLocated(By.xpath(DatasetsLocators.datasetTabXpath)), WAITTIME).getText(); + const datasetLink = await driverFirefox + .wait(until.elementLocated(By.xpath(DatasetsLocators.datasetTabXpath)), WAITTIME) + .getText(); return datasetLink; } -export async function getUssNode(){ +export async function getUssNode() { await driverFirefox.wait(until.elementLocated(By.id(UssLocators.ussTabId)), WAITTIME); - const ussLink = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.ussTabXpath)), WAITTIME).getText(); + const ussLink = await driverFirefox + .wait(until.elementLocated(By.xpath(UssLocators.ussTabXpath)), WAITTIME) + .getText(); return ussLink; } -export async function getJobsNode(){ +export async function getJobsNode() { await driverFirefox.wait(until.elementLocated(By.id(JobsLocators.jobTabId)), WAITTIME); - const jobsLink = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.jobTabXpath)), WAITTIME).getText(); + const jobsLink = await driverFirefox + .wait(until.elementLocated(By.xpath(JobsLocators.jobTabXpath)), WAITTIME) + .getText(); return jobsLink; } -export async function sleepTime(sleeptime: number){ +export async function sleepTime(sleeptime: number) { await driverFirefox.sleep(sleeptime); } -export async function refreshBrowser(){ +export async function refreshBrowser() { await driverFirefox.navigate().refresh(); } -export function closeBrowser(){ +export function closeBrowser() { driverFirefox.close(); } diff --git a/packages/zowe-explorer/__tests__/__unit__/SpoolProvider.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/SpoolProvider.unit.test.ts index fbd1547508..9331b74f82 100644 --- a/packages/zowe-explorer/__tests__/__unit__/SpoolProvider.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/SpoolProvider.unit.test.ts @@ -87,14 +87,30 @@ describe("SpoolProvider Unit Tests", () => { it("Tests that the URI is encoded", () => { const uriMock = jest.fn(); Object.defineProperty(vscode, "Uri", { value: uriMock }); - const parse = jest.fn(); + const mockUri = { + scheme: "testScheme", + authority: "testAuthority", + path: "testPath", + query: "testQuery", + fragment: "testFragment", + fsPath: "testFsPath", + with: jest.fn().mockReturnValue(uriString), + toJSON: jest.fn(), + }; + + const parse = jest.fn().mockReturnValue(mockUri); Object.defineProperty(uriMock, "parse", { value: parse }); const query = jest.fn(); Object.defineProperty(uriMock, "query", { value: query }); const uri = spoolprovider.encodeJobFile("sessionName", iJobFile); - expect(parse.mock.calls.length).toEqual(1); - expect(parse.mock.calls[0][0]).toEqual(uriString); + expect(mockUri.with.mock.calls.length).toEqual(1); + expect(mockUri.with.mock.calls[0][0]).toEqual({ + path: "TESTJOB.100.STDOUT", + query: + '["sessionName",{"byte-count":128,"job-correlator":"","record-count":1,"records-url":"fake/records","class":"A","ddname":"STDOUT","id":100,"jobid":"100","jobname":"TESTJOB","lrecl":80,"procstep":"","recfm":"FB","stepname":"","subsystem":""}]', + scheme: "zosspool", + }); }); it("Tests that the URI is decoded", () => { diff --git a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts index 84911bb3fa..6e55110073 100644 --- a/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/job/actions.unit.test.ts @@ -29,6 +29,7 @@ import * as dsActions from "../../../src/dataset/actions"; import * as globals from "../../../src/globals"; import { createDatasetSessionNode, createDatasetTree } from "../../../__mocks__/mockCreators/datasets"; import { Profiles } from "../../../src/Profiles"; +import * as SpoolProvider from "../../../src/SpoolProvider"; const activeTextEditorDocument = jest.fn(); @@ -57,8 +58,10 @@ function createGlobalMocks() { Object.defineProperty(Profiles, "getInstance", { value: jest.fn(), configurable: true }); Object.defineProperty(vscode, "Uri", { value: jest.fn(), configurable: true }); Object.defineProperty(vscode.Uri, "parse", { value: jest.fn(), configurable: true }); + Object.defineProperty(vscode.Uri.parse, "with", { value: jest.fn(), configurable: true }); const executeCommand = jest.fn(); Object.defineProperty(vscode.commands, "executeCommand", { value: executeCommand, configurable: true }); + Object.defineProperty(SpoolProvider, "encodeJobFile", { value: jest.fn(), configurable: true }); } // Idea is borrowed from: https://github.com/kulshekhar/ts-jest/blob/master/src/util/testing.ts @@ -660,6 +663,16 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { const testJobTree = createJobsTree(session, iJob, imperativeProfile, treeView); const jesApi = createJesApi(imperativeProfile); const mockCheckCurrentProfile = jest.fn(); + const mockUri: vscode.Uri = { + scheme: "testScheme", + authority: "testAuthority", + path: "testPath", + query: "testQuery", + fragment: "testFragment", + fsPath: "testFsPath", + with: jest.fn(), + toJSON: jest.fn(), + }; bindJesApi(jesApi); return { @@ -672,6 +685,7 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { jesApi, testJobTree, mockCheckCurrentProfile, + mockUri, }; } @@ -679,11 +693,11 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { createGlobalMocks(); const blockMocks = createBlockMocks(); - mocked(vscode.Uri.parse).mockReturnValueOnce("test" as any); + mocked(SpoolProvider.encodeJobFile).mockReturnValueOnce(blockMocks.mockUri); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); await jobActions.getSpoolContent(blockMocks.testJobTree, "sessionName", blockMocks.iJobFile); - expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith("test"); + expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(blockMocks.mockUri); expect(mocked(vscode.window.showTextDocument)).toBeCalled(); }); it("Checking opening of Spool Content with Unverified profile", async () => { @@ -702,18 +716,18 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { }), }); - mocked(vscode.Uri.parse).mockReturnValueOnce("test" as any); + mocked(SpoolProvider.encodeJobFile).mockReturnValueOnce(blockMocks.mockUri); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); await jobActions.getSpoolContent(blockMocks.testJobTree, "sessionName", blockMocks.iJobFile); - expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith("test"); + expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(blockMocks.mockUri); expect(mocked(vscode.window.showTextDocument)).toBeCalled(); }); it("Checking failed attempt to open Spool Content", async () => { createGlobalMocks(); const blockMocks = createBlockMocks(); - mocked(vscode.Uri.parse).mockImplementationOnce(() => { + mocked(SpoolProvider.encodeJobFile).mockImplementationOnce(() => { throw new Error("Test"); }); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); @@ -728,11 +742,11 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { const blockMocks = createBlockMocks(); blockMocks.profileInstance.promptCredentials.mockReturnValue(["fake", "fake", "fake"]); - mocked(vscode.Uri.parse).mockReturnValueOnce("test" as any); + mocked(SpoolProvider.encodeJobFile).mockReturnValueOnce(blockMocks.mockUri); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); await jobActions.getSpoolContent(blockMocks.testJobTree, "sessionName", blockMocks.iJobFile); - expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith("test"); + expect(mocked(vscode.workspace.openTextDocument)).toBeCalledWith(blockMocks.mockUri); expect(mocked(vscode.window.showTextDocument)).toBeCalled(); }); it("Checking failed attempt to open Spool Content with credentials prompt", async () => { @@ -740,7 +754,7 @@ describe("Jobs Actions Unit Tests - Function getSpoolContent", () => { const blockMocks = createBlockMocks(); blockMocks.profileInstance.promptCredentials.mockReturnValue(["fake", "fake", "fake"]); - mocked(vscode.Uri.parse).mockImplementationOnce(() => { + mocked(SpoolProvider.encodeJobFile).mockImplementationOnce(() => { throw new Error("Test"); }); mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance); diff --git a/packages/zowe-explorer/src/SpoolProvider.ts b/packages/zowe-explorer/src/SpoolProvider.ts index c003bf9c1d..e623731895 100644 --- a/packages/zowe-explorer/src/SpoolProvider.ts +++ b/packages/zowe-explorer/src/SpoolProvider.ts @@ -43,7 +43,11 @@ export default class SpoolProvider implements vscode.TextDocumentContentProvider */ export function encodeJobFile(session: string, spool: zowe.IJobFile): vscode.Uri { const query = JSON.stringify([session, spool]); - return vscode.Uri.parse(`${SpoolProvider.scheme}:${spool.jobname}.${spool.jobid}.${spool.ddname}?${query}`); + return vscode.Uri.parse("").with({ + scheme: SpoolProvider.scheme, + path: `${spool.jobname}.${spool.jobid}.${spool.ddname}`, + query, + }); } /** From 95fc32bbf1d4f5ed20001fdd0a357fb764832fcd Mon Sep 17 00:00:00 2001 From: zFernand0 Date: Thu, 8 Apr 2021 14:24:07 -0400 Subject: [PATCH 2/3] update y18n in yarn.lock Signed-off-by: zFernand0 --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 59264cf511..33d401ea6f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11427,9 +11427,9 @@ y18n@^3.2.1: integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + version "4.0.3" + resolved "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== yallist@^2.1.2: version "2.1.2" From 4ebbb93a1f6cc392d9639a2f971dbdc49e7b2b51 Mon Sep 17 00:00:00 2001 From: chladnefazole Date: Tue, 20 Apr 2021 17:13:16 +0200 Subject: [PATCH 3/3] Removing weird committed files Signed-off-by: chladnefazole --- .github/workflows/zowe-explorer-ftp-ci.yml | 2 + .../__theia__/extension.theia.test.ts | 5 +- .../__tests__/__theia__/theia/Locators.ts | 11 +- .../__theia__/theia/extension.theiaChrome.ts | 280 +++++++----------- .../__theia__/theia/extension.theiaFirefox.ts | 105 +++---- 5 files changed, 152 insertions(+), 251 deletions(-) diff --git a/.github/workflows/zowe-explorer-ftp-ci.yml b/.github/workflows/zowe-explorer-ftp-ci.yml index 478e55615f..45d42329c7 100644 --- a/.github/workflows/zowe-explorer-ftp-ci.yml +++ b/.github/workflows/zowe-explorer-ftp-ci.yml @@ -43,12 +43,14 @@ jobs: env: CI: true NODE_OPTIONS: --max_old_space_size=4096 + # - name: Upload test results # uses: actions/upload-artifact@v1 # # if: matrix.os == 'windows-latest' && matrix.node-version == '12.x' # with: # name: zowe-explorer-ftp-extension-results # path: packages/zowe-explorer-ftp-extension/results/ + # Run codecov upload for only one run # - name: Upload Results to Codecov from Windows / Node 12.x # if: matrix.os == 'windows-latest' && matrix.node-version == '12.x' diff --git a/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts b/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts index 4113f12ff4..c6996267df 100644 --- a/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts +++ b/packages/zowe-explorer/__tests__/__theia__/extension.theia.test.ts @@ -16,12 +16,13 @@ import * as driverChrome from "./theia/extension.theiaChrome"; const TIMEOUT = 45000; const SLEEPTIME = 10000; -const SHORTSLEEPTIME = 2000; +const SHORTSLEEPTIME = 2000; declare var it: any; const expect = chai.expect; chai.use(chaiAsPromised); describe("Add Default Profile", () => { + before(async () => { await driverFirefox.openBrowser(); await driverFirefox.sleepTime(SHORTSLEEPTIME); @@ -78,6 +79,7 @@ describe("Add Default Profile", () => { }); describe("Add Profiles", () => { + before(async () => { await driverFirefox.openBrowser(); await driverFirefox.sleepTime(SHORTSLEEPTIME); @@ -203,6 +205,7 @@ describe("Remove Profile from Favorites", () => { expect(favoriteProfile).to.equal(true); }); + after(async () => driverChrome.closeBrowser()); }); diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts index 4282711fef..bf5265c43c 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/Locators.ts @@ -10,10 +10,11 @@ */ export const TheiaLocator = { + theiaUrl: "http://localhost:3000", zoweExplorerxId: "shell-tab-plugin-view-container:zowe", -}; + }; export const DatasetsLocators = { datasetTabId: "plugin-view-container:zowe--plugin-view:zowe.explorer", @@ -30,7 +31,7 @@ export const DatasetsLocators = { removeFavoriteProfileFromDatasetsOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.removeFavProfile']", secondDatasetProfileBeforeDeletingId: "/1:TestSeleniumProfile", deleteProfileFromDatasetsXpath: "(//li[@data-command='__plugin.menu.action.zowe.deleteProfile'])", -}; + }; export const UssLocators = { ussTabId: "plugin-view-container:zowe--plugin-view:zowe.uss.explorer", @@ -47,7 +48,7 @@ export const UssLocators = { removeFavoriteProfileFromUssOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.uss.removeFavProfile']", hideProfileFromUssOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.uss.removeSession']", searchSymbolInFavoriteXpath: "//*[@id='/0:Favorites/0:TestSeleniumProfile/0:']", -}; + }; export const JobsLocators = { jobTabId: "plugin-view-container:zowe--plugin-view:zowe.jobs", @@ -67,9 +68,9 @@ export const JobsLocators = { hideProfileFromJobsOptionXpath: "//li[@data-command='__plugin.menu.action.zowe.removeJobsSession']", secondJobsProfileIdBeforeHidingXpath: "(//div[@id='/2:TestSeleniumProfile'])[2]", favoriteprofilexpath: "//div[@id='/0:Favorites/0:TestSeleniumProfile']", -}; + }; export const TheiaNotificationMessages = { closeTheiaNotificationWarningMsgXpath: "/html/body/div[3]/div/div[1]/div/div/div/div/ul/li", deleteProfileNotificationMsg: "/html/body/div[3]/div/div[1]/div/div/div/div/div[2]/span", -}; + }; diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts index 4e164c948a..5f51676c51 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaChrome.ts @@ -18,320 +18,238 @@ const WAITTIME = 30000; const SHORTSLEEPTIME = 2000; let driverChrome: any; -export async function openBrowser() { +export async function openBrowser(){ const chromeOptions = new chrome.Options(); chromeOptions.addArguments("headless"); chromeOptions.addArguments("window-size=1200,1100"); driverChrome = new Builder().forBrowser("chrome").setChromeOptions(chromeOptions).build(); } -export async function OpenTheiaInChrome() { +export async function OpenTheiaInChrome(){ await driverChrome.get(TheiaLocator.theiaUrl); } -export async function clickOnZoweExplorer() { +export async function clickOnZoweExplorer(){ await driverChrome.wait(until.elementLocated(By.id(TheiaLocator.zoweExplorerxId))).click(); } -export async function clickOnFavoriteTabInDatasets() { +export async function clickOnFavoriteTabInDatasets(){ await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME).click(); } -export async function clickOnFavoriteTabInUss() { +export async function clickOnFavoriteTabInUss(){ await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteTabXpath)), WAITTIME).click(); } -export async function clickOnFavoriteTabInJobs() { +export async function clickOnFavoriteTabInJobs(){ await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabXpath)), WAITTIME).click(); } -export async function clickOnFavoriteTabInJobsAfterRefresh() { - await driverChrome - .wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabAfterRefreshXpath)), WAITTIME) - .click(); +export async function clickOnFavoriteTabInJobsAfterRefresh(){ + await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteTabAfterRefreshXpath)), WAITTIME).click(); } -export async function clickOnDatasetsTab() { +export async function clickOnDatasetsTab(){ await driverChrome.findElement(By.xpath(DatasetsLocators.datasetTabXpath)).click(); } -export async function clickOnUssTab() { +export async function clickOnUssTab(){ await driverChrome.findElement(By.id(UssLocators.ussTabId)).click(); } -export async function clickOnUssTabs() { +export async function clickOnUssTabs(){ await driverChrome.findElement(By.xpath(UssLocators.ussTabXpath)).click(); } -export async function clickOnJobsTab() { +export async function clickOnJobsTab(){ await driverChrome.findElement(By.id(JobsLocators.jobTabId)).click(); } -export async function getFavoritePrfileNameFromDatasets() { - const favoriteProfile = await driverChrome - .wait(until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME) - .getText(); +export async function getFavoritePrfileNameFromDatasets(){ + const favoriteProfile = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME).getText(); return favoriteProfile; } -export async function getFavoritePrfileNameFromUss() { - const favoriteProfile = await driverChrome - .wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssXpath)), WAITTIME) - .getText(); +export async function getFavoritePrfileNameFromUss(){ + const favoriteProfile = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssXpath)), WAITTIME).getText(); return favoriteProfile; } -export async function getFavoritePrfileNameFromJobs() { - const favoriteProfile = await driverChrome - .wait(until.elementLocated(By.xpath(JobsLocators.favoriteProfileInJobsXpath)), WAITTIME) - .getText(); +export async function getFavoritePrfileNameFromJobs(){ + const favoriteProfile = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteProfileInJobsXpath)), WAITTIME).getText(); return favoriteProfile; } -export async function removeFavoriteProfileFromDatasets() { - const removeFromFavorite = await driverChrome.wait( - until.elementLocated(By.id(DatasetsLocators.favoriteProfileInDatasetId)), - WAITTIME - ); +export async function removeFavoriteProfileFromDatasets(){ + const removeFromFavorite = await driverChrome.wait(until.elementLocated( + By.id(DatasetsLocators.favoriteProfileInDatasetId)), WAITTIME); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome - .wait(until.elementLocated(By.xpath(DatasetsLocators.removeFavoriteProfileFromDatasetsOptionXpath)), WAITTIME) - .click(); - const removeFavoriteInputBox = await driverChrome.wait( - until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), - WAITTIME - ); + await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.removeFavoriteProfileFromDatasetsOptionXpath)), WAITTIME).click(); + const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); removeFavoriteInputBox.sendKeys("Continue"); await driverChrome.sleep(SHORTSLEEPTIME); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function removeFavoriteProfileFromUss() { - const removeFromFavorite = await driverChrome.wait( - until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssBeforeRemovingXpath)), - WAITTIME - ); +export async function removeFavoriteProfileFromUss(){ + const removeFromFavorite = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.favoriteProfileInUssBeforeRemovingXpath)), WAITTIME); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome - .wait(until.elementLocated(By.xpath(UssLocators.removeFavoriteProfileFromUssOptionXpath)), WAITTIME) - .click(); - const removeFavoriteInputBox = await driverChrome.wait( - until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), - WAITTIME - ); + await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.removeFavoriteProfileFromUssOptionXpath)), WAITTIME).click(); + const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.emptyInputBoxXpath)), WAITTIME); removeFavoriteInputBox.sendKeys("Continue"); await driverChrome.sleep(SHORTSLEEPTIME); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function removeFavoriteProfileFromJobs() { - const removeFromFavorite = await driverChrome.wait( - until.elementLocated(By.xpath(JobsLocators.favoriteprofile)), - WAITTIME - ); +export async function removeFavoriteProfileFromJobs(){ + const removeFromFavorite = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.favoriteprofile)), WAITTIME); await driverChrome.actions().click(removeFromFavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome - .wait(until.elementLocated(By.xpath(JobsLocators.removeFavoriteProfileFromJobsOptionXpath)), WAITTIME) - .click(); - const removeFavoriteInputBox = await driverChrome.wait( - until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), - WAITTIME - ); + await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.removeFavoriteProfileFromJobsOptionXpath)), WAITTIME).click(); + const removeFavoriteInputBox = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.emptyInputBoxXpath)), WAITTIME); removeFavoriteInputBox.sendKeys("Continue"); removeFavoriteInputBox.sendKeys(Key.ENTER); } -export async function addProfileToFavoritesInDatasets() { - const addTofavorite = await driverChrome.wait( - until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), - WAITTIME - ); +export async function addProfileToFavoritesInDatasets(){ + const addTofavorite = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), WAITTIME); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); - await driverChrome - .wait(until.elementLocated(By.xpath(DatasetsLocators.addToFavoriteOptionXpath)), WAITTIME) - .click(); + await driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.addToFavoriteOptionXpath)), WAITTIME).click(); } -export async function addProfileToFavoritesInUss() { - const addTofavorite = await driverChrome.wait( - until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), - WAITTIME - ); +export async function addProfileToFavoritesInUss(){ + const addTofavorite = await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.addToFavoriteOptionXpath)), WAITTIME).click(); } -export async function addProfileToFavoritesInJobs() { - const addTofavorite = await driverChrome.wait( - until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), - WAITTIME - ); +export async function addProfileToFavoritesInJobs(){ + const addTofavorite = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME); await driverChrome.actions().click(addTofavorite, Button.RIGHT).perform(); await driverChrome.sleep(SHORTSLEEPTIME); await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.addToFavoriteOptionXpath)), WAITTIME).click(); } -export async function hideProfileInUss() { - const hideProfileFromUss = await driverChrome.wait( - until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), - WAITTIME - ); +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(); + await driverChrome.wait(until.elementLocated(By.xpath(UssLocators.hideProfileFromUssOptionXpath)), WAITTIME).click(); } -export async function hideProfileInJobs() { - const hideProfileFromJobs = await driverChrome.wait( - until.elementLocated(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)), - WAITTIME - ); +export async function hideProfileInJobs(){ + const hideProfileFromJobs = await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)), WAITTIME); await driverChrome.actions().click(hideProfileFromJobs, Button.RIGHT).perform(); - await driverChrome - .wait(until.elementLocated(By.xpath(JobsLocators.hideProfileFromJobsOptionXpath)), WAITTIME) - .click(); -} - -export async function verifyProfileIsHideInUss() { - const hideProfileFromUss = await driverChrome - .findElements(By.xpath(UssLocators.secondUssProfileXpath)) - .then((found) => !!found.length); - if (!hideProfileFromUss) { - return true; - } else { + await driverChrome.wait(until.elementLocated(By.xpath(JobsLocators.hideProfileFromJobsOptionXpath)), WAITTIME).click(); +} + +export async function verifyProfileIsHideInUss(){ + const hideProfileFromUss = await driverChrome.findElements(By.xpath(UssLocators.secondUssProfileXpath)).then((found) => !!found.length); + if(!hideProfileFromUss){ + return true; + }else{ return false; } } -export async function verifyProfileIsHideInJobs() { - const hideProfileFromJobs = await driverChrome - .findElements(By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)) - .then((found) => !!found.length); - if (!hideProfileFromJobs) { - return true; - } else { +export async function verifyProfileIsHideInJobs(){ + const hideProfileFromJobs = await driverChrome.findElements( + By.xpath(JobsLocators.secondJobsProfileIdBeforeHidingXpath)).then((found) => !!found.length); + if(!hideProfileFromJobs){ + return true; + }else{ return false; } } -export async function deleteDefaultProfileInDatasets() { - const profileName = await driverChrome.wait( - until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), - WAITTIME - ); +export async function deleteDefaultProfileInDatasets(){ + const profileName = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), 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.deleteProfileFromDatasetsXpath)), WAITTIME).click(); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteProfile = driverChrome.wait( - until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), - WAITTIME - ); + const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); deleteProfile.sendKeys("Delete"); deleteProfile.sendKeys(Key.ENTER); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteConfrmationMsg = await driverChrome - .wait(until.elementLocated(By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME) - .getText(); + const deleteConfrmationMsg = await driverChrome.wait(until.elementLocated( + By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME).getText(); return deleteConfrmationMsg; } -export async function deleteProfileInDatasets() { - const favprofile = await driverChrome.wait( - until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileBeforeDeletingId)), - WAITTIME - ); +export async function deleteProfileInDatasets(){ + const favprofile = await driverChrome.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileBeforeDeletingId)), 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.deleteProfileFromDatasetsXpath)), WAITTIME).click(); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteProfile = driverChrome.wait( - until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), - WAITTIME - ); + const deleteProfile = driverChrome.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), WAITTIME); deleteProfile.sendKeys("Delete"); deleteProfile.sendKeys(Key.ENTER); await driverChrome.sleep(SHORTSLEEPTIME); - const deleteConfrmationMsg = await driverChrome - .wait(until.elementLocated(By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME) - .getText(); + const deleteConfrmationMsg = await driverChrome.wait(until.elementLocated( + By.xpath(TheiaNotificationMessages.deleteProfileNotificationMsg)), WAITTIME).getText(); return deleteConfrmationMsg; } -export async function verifyRemovedFavoriteProfileInDatasets() { - const favoriteProfile = await driverChrome - .findElements(By.id(DatasetsLocators.favoriteProfileInDatasetId)) - .then((found) => !!found.length); - if (!favoriteProfile) { - return true; - } else { +export async function verifyRemovedFavoriteProfileInDatasets(){ + const favoriteProfile = await driverChrome.findElements(By.id(DatasetsLocators.favoriteProfileInDatasetId)).then((found) => !!found.length); + if(!favoriteProfile){ + return true; + }else{ return false; } } -export async function verifyRemovedFavoriteProfileInUss() { - const favoriteProfile = await driverChrome - .findElements(By.xpath(UssLocators.favoriteProfileInUssXpath)) - .then((found) => !!found.length); - if (!favoriteProfile) { - return true; - } else { +export async function verifyRemovedFavoriteProfileInUss(){ + const favoriteProfile = await driverChrome.findElements(By.xpath(UssLocators.favoriteProfileInUssXpath)).then((found) => !!found.length); + if(!favoriteProfile){ + return true; + }else{ return false; } } -export async function verifyRemovedFavoriteProfileInJobs() { - const favoriteProfile = await driverChrome - .findElements(By.xpath(JobsLocators.favoriteProfileInJobsXpath)) - .then((found) => !!found.length); - if (!favoriteProfile) { - return true; - } else { +export async function verifyRemovedFavoriteProfileInJobs(){ + const favoriteProfile = await driverChrome.findElements(By.xpath(JobsLocators.favoriteProfileInJobsXpath)).then((found) => !!found.length); + if(!favoriteProfile){ + return true; + }else{ return false; } } -export async function verifyRemovedDefaultProfileInUss() { - const defaultProfile = await driverChrome - .findElements(By.xpath(UssLocators.defaultUssProfileXpath)) - .then((found) => !!found.length); - if (!defaultProfile) { - return true; - } else { +export async function verifyRemovedDefaultProfileInUss(){ + const defaultProfile = await driverChrome.findElements(By.xpath(UssLocators.defaultUssProfileXpath)).then((found) => !!found.length); + if(!defaultProfile){ + return true; + }else{ return false; } } -export async function verifyRemovedDefaultProfileInJobs() { - const defaultProfile = await driverChrome - .findElements(By.xpath(JobsLocators.defaultJobsProfileXpath)) - .then((found) => !!found.length); - if (!defaultProfile) { - return true; - } else { +export async function verifyRemovedDefaultProfileInJobs(){ + const defaultProfile = await driverChrome.findElements(By.xpath(JobsLocators.defaultJobsProfileXpath)).then((found) => !!found.length); + if(!defaultProfile){ + return true; + }else{ return false; } } -export async function closeNotificationMessage() { +export async function closeNotificationMessage(){ await driverChrome.findElement(By.xpath(TheiaNotificationMessages.closeTheiaNotificationWarningMsgXpath)).click(); } -export async function sleepTime(sleeptime: number) { +export async function sleepTime(sleeptime: number){ await driverChrome.sleep(sleeptime); } -export async function refreshBrowser() { +export async function refreshBrowser(){ await driverChrome.navigate().refresh(); } -export function closeBrowser() { +export function closeBrowser() +{ driverChrome.close(); } diff --git a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts index 416f0e4088..ce4ca24f2e 100644 --- a/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts +++ b/packages/zowe-explorer/__tests__/__theia__/theia/extension.theiaFirefox.ts @@ -18,69 +18,66 @@ const WAITTIME = 30000; const SHORTSLEEPTIME = 2000; let driverFirefox: any; -export async function openBrowser() { +export async function openBrowser(){ const firefoxOptions = new firefox.Options(); firefoxOptions.headless(); driverFirefox = new Builder().forBrowser("firefox").setFirefoxOptions(firefoxOptions).build(); } -export async function OpenTheiaInFirefox() { +export async function OpenTheiaInFirefox(){ await driverFirefox.get(TheiaLocator.theiaUrl); } -export async function clickOnZoweExplorer() { +export async function clickOnZoweExplorer(){ driverFirefox.wait(until.elementLocated(By.id(TheiaLocator.zoweExplorerxId))).click(); } -export async function clickOnDatasetsTab() { +export async function clickOnDatasetsTab(){ await driverFirefox.findElement(By.xpath(DatasetsLocators.datasetTabXpath)).click(); } -export async function clickOnUssTab() { +export async function clickOnUssTab(){ await driverFirefox.findElement(By.id(UssLocators.ussTabId)).click(); } -export async function clickOnUssTabs() { +export async function clickOnUssTabs(){ await driverFirefox.findElement(By.xpath(UssLocators.ussTabXpath)).click(); } -export async function clickOnJobsTab() { +export async function clickOnJobsTab(){ await driverFirefox.findElement(By.id(JobsLocators.jobTabId)).click(); } -export async function clickOnDatasetsPanel() { +export async function clickOnDatasetsPanel(){ await driverFirefox.findElement(By.id(DatasetsLocators.datasetsPanelId)).click(); } -export async function clickOnAddSessionInDatasets() { +export async function clickOnAddSessionInDatasets(){ await driverFirefox.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); } -export async function clickOnUssPanel() { +export async function clickOnUssPanel(){ await driverFirefox.findElement(By.id(UssLocators.ussPanelId)).click(); } -export async function clickOnAddSessionInUss() { +export async function clickOnAddSessionInUss(){ await driverFirefox.findElement(By.id(UssLocators.ussAddSessionId)).click(); } -export async function clickOnJobsPanel() { - await driverFirefox.findElement(By.id(JobsLocators.jobsPanelId)).click(); +export async function clickOnJobsPanel(){ + await driverFirefox.findElement(By.id (JobsLocators.jobsPanelId)).click(); } -export async function clickOnAddSessionInJobs() { +export async function clickOnAddSessionInJobs(){ await driverFirefox.findElement(By.id(JobsLocators.jobsAddSessionId)).click(); } -export async function addProfileDetails(profileName: string) { +export async function addProfileDetails(profileName: string){ await driverFirefox.findElement(By.id(DatasetsLocators.datasetsAddSessionId)).click(); await driverFirefox.sleep(SHORTSLEEPTIME); await driverFirefox.findElement(By.xpath(DatasetsLocators.emptyInputBoxXpath)).sendKeys(Key.ENTER); await driverFirefox.sleep(SHORTSLEEPTIME); - const datasetProfileName = await driverFirefox.wait( - until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)), - WAITTIME - ); + const datasetProfileName = await driverFirefox.wait(until.elementLocated(By.xpath(DatasetsLocators.emptyInputBoxXpath)),WAITTIME); datasetProfileName.sendKeys(profileName); datasetProfileName.sendKeys(Key.ENTER); await driverFirefox.sleep(SHORTSLEEPTIME); @@ -109,98 +106,78 @@ export async function addProfileDetails(profileName: string) { await driverFirefox.sleep(SHORTSLEEPTIME); } -export async function addProfileDetailsInUss(profileName: string) { +export async function addProfileDetailsInUss(profileName: string){ const ussProfileName = await driverFirefox.findElement(By.xpath(UssLocators.emptyInputBoxXpath)); ussProfileName.sendKeys(profileName); ussProfileName.sendKeys(Key.ENTER); } -export async function addProfileDetailsInJobs(profileName: string) { +export async function addProfileDetailsInJobs(profileName: string){ const jobsProfileName = await driverFirefox.findElement(By.xpath(JobsLocators.emptyInputBoxXpath)); jobsProfileName.sendKeys(profileName); jobsProfileName.sendKeys(Key.ENTER); } -export async function getDatasetsDefaultProfilename() { - const datasetProfile = await driverFirefox - .wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)), WAITTIME) - .getText(); +export async function getDatasetsDefaultProfilename(){ + const datasetProfile = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.defaultDatasetsProfileId)),WAITTIME).getText(); return datasetProfile; } -export async function getUssDefaultProfilename() { - const ussProfile = await driverFirefox - .wait(until.elementLocated(By.xpath(UssLocators.defaultUssProfileXpath)), WAITTIME) - .getText(); +export async function getUssDefaultProfilename(){ + const ussProfile = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.defaultUssProfileXpath)), WAITTIME).getText(); return ussProfile; } -export async function getJobsDefaultProfilename() { - const jobsProfile = await driverFirefox - .wait(until.elementLocated(By.xpath(JobsLocators.defaultJobsProfileXpath)), WAITTIME) - .getText(); +export async function getJobsDefaultProfilename(){ + const jobsProfile = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.defaultJobsProfileXpath)), WAITTIME).getText(); return jobsProfile; } -export async function getDatasetsProfilename() { - const datasetProfile = await driverFirefox - .wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)), WAITTIME) - .getText(); +export async function getDatasetsProfilename(){ + const datasetProfile = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.secondDatasetProfileId)),WAITTIME).getText(); return datasetProfile; } -export async function getUssProfilename() { - const ussProfile = await driverFirefox - .wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME) - .getText(); +export async function getUssProfilename(){ + const ussProfile = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.secondUssProfileXpath)), WAITTIME).getText(); return ussProfile; } -export async function getJobsProfilename() { - const jobsProfile = await driverFirefox - .wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME) - .getText(); +export async function getJobsProfilename(){ + const jobsProfile = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.secondJobsProfileXpath)), WAITTIME).getText(); return jobsProfile; } -export async function getFavouritesNode() { - const favoriteLink = await driverFirefox - .wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME) - .getAttribute("title"); +export async function getFavouritesNode(){ + const favoriteLink = await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.favoriteTabId)), WAITTIME).getAttribute("title"); return favoriteLink; } -export async function getDatasetNode() { +export async function getDatasetNode(){ await driverFirefox.wait(until.elementLocated(By.id(DatasetsLocators.datasetTabId)), WAITTIME); - const datasetLink = await driverFirefox - .wait(until.elementLocated(By.xpath(DatasetsLocators.datasetTabXpath)), WAITTIME) - .getText(); + const datasetLink = await driverFirefox.wait(until.elementLocated(By.xpath(DatasetsLocators.datasetTabXpath)), WAITTIME).getText(); return datasetLink; } -export async function getUssNode() { +export async function getUssNode(){ await driverFirefox.wait(until.elementLocated(By.id(UssLocators.ussTabId)), WAITTIME); - const ussLink = await driverFirefox - .wait(until.elementLocated(By.xpath(UssLocators.ussTabXpath)), WAITTIME) - .getText(); + const ussLink = await driverFirefox.wait(until.elementLocated(By.xpath(UssLocators.ussTabXpath)), WAITTIME).getText(); return ussLink; } -export async function getJobsNode() { +export async function getJobsNode(){ await driverFirefox.wait(until.elementLocated(By.id(JobsLocators.jobTabId)), WAITTIME); - const jobsLink = await driverFirefox - .wait(until.elementLocated(By.xpath(JobsLocators.jobTabXpath)), WAITTIME) - .getText(); + const jobsLink = await driverFirefox.wait(until.elementLocated(By.xpath(JobsLocators.jobTabXpath)), WAITTIME).getText(); return jobsLink; } -export async function sleepTime(sleeptime: number) { +export async function sleepTime(sleeptime: number){ await driverFirefox.sleep(sleeptime); } -export async function refreshBrowser() { +export async function refreshBrowser(){ await driverFirefox.navigate().refresh(); } -export function closeBrowser() { +export function closeBrowser(){ driverFirefox.close(); }