diff --git a/playwright_test/Pages/connection.page.ts b/playwright_test/Pages/connection.page.ts index b1ff61a7..e6f2c0a9 100644 --- a/playwright_test/Pages/connection.page.ts +++ b/playwright_test/Pages/connection.page.ts @@ -24,8 +24,7 @@ class ConnectionPage{ this.resumeProgress = page.locator('//button[contains(text(),"Resume Progress")]') this.continueButton = page.locator('.MuiButton-containedPrimary.MuiButton-sizeMedium') this.greenCheckIconSelector = page.locator('.MuiContainer-root svg[data-testid="CheckCircleIcon"]') - - + this.status_check = page.locator(".svg.MuiSvgIcon-root.MuiSvgIcon-fontSizeMedium[data-testid='CheckCircleIcon']") } async fillConnectionDetails(host: string, port: string, username: string, password: string){ @@ -37,6 +36,12 @@ class ConnectionPage{ await this.userName.fill(username) await this.page.waitForTimeout(1000); await this.password.fill(password) + await this.page.waitForTimeout(1000); + } + + async fillpassword(password: string){ + await this.password.fill(password,{timeout: 5000}); + await this.page.waitForTimeout(1000); } async getHostValue(){ @@ -81,6 +86,7 @@ class ConnectionPage{ async isGreenCheckIconVisible() { return await this.greenCheckIconSelector.isHidden(); } + } export default ConnectionPage; \ No newline at end of file diff --git a/playwright_test/Pages/installation.page.ts b/playwright_test/Pages/installation.page.ts index e4752476..20f972d3 100644 --- a/playwright_test/Pages/installation.page.ts +++ b/playwright_test/Pages/installation.page.ts @@ -177,5 +177,17 @@ class InstallationPage{ await this.page.waitForTimeout(500) await this.closeEditorButton.click(); } + + async fillInstallationPage(DATASET_PREFIX: string, PROC_LIB: string, PARM_LIB: string, ZIS: string, JCL_LIB:string,LOAD_LIB:string,AUTH_LOAD_LIB:string,AUTH_PLUGIN_LIB:string){ + await this.page.waitForTimeout(2000); + await this.enterPrefix(DATASET_PREFIX) + await this.enterProcLib(PROC_LIB) + await this.enterParmLib(PARM_LIB) + await this.enterZis(ZIS) + await this.enterJclLib(JCL_LIB) + await this.enterLoadLib(LOAD_LIB) + await this.enterAuthLoadLib(AUTH_LOAD_LIB) + await this.enterAuthPluginLib(AUTH_PLUGIN_LIB) + } } export default InstallationPage; diff --git a/playwright_test/Pages/installationType.page.ts b/playwright_test/Pages/installationType.page.ts index b451ce2c..7dd89b06 100644 --- a/playwright_test/Pages/installationType.page.ts +++ b/playwright_test/Pages/installationType.page.ts @@ -26,7 +26,7 @@ class InstallationTypePage{ this.uploadPax = page.locator("//span[text()='Upload Zowe PAX for offline install']/preceding-sibling::span/input") this.smpe = page.locator("//span[text()='SMP/E']/preceding-sibling::span/input") this.licenseAgreement = page.locator("//button[text()='License Agreement']") - this.saveAndClose = page.locator("//button[contains(text(),'Save & close')]") + this.saveAndClose = page.locator("//button[contains(text(),'Save & close')]") this.previousStep = page.locator("//button[contains(text(),'Previous step')]") this.continueToComponentInstallation = page.locator("//button[text()='Continue to Components Installation']") this.zoweLink = page.locator("//a[@href='zowe.org']") @@ -36,6 +36,10 @@ class InstallationTypePage{ this.validateLocation = page.locator("//button[text()= 'Validate location']") this.validateLocationGreenCheck = page.locator("//button[text()='Validate location']//following-sibling::*[@data-testid='CheckCircleIcon']") this.licenseAgreementGreenCheck = page.locator("//button[text()='License Agreement']//following-sibling::*[@data-testid='CheckCircleIcon']") + this.continueToUnpax = page.locator("//button[contains(text(),'Continue to Unpax')]") + this.SkipUnpax = page.locator('//button[contains(text(),"Skip")]') + this.retrieveExampleZoweYaml= page.locator('//button[contains(text(),"Retrieve example-zowe.yaml")]') + this.click_InitializationStage = page.locator('//span[text()="Initialization"]') } async getInstallationTypePageTitle(){ @@ -132,19 +136,35 @@ class InstallationTypePage{ this.selectDownloadZowePax() this.clickLicenseAgreement() this.clickAgreeLicense() - } + } async uploadZowePaxAndNavigateToInstallationPage(uploadPaxPath: any){ this.selectUploadZowePax() await this.page.waitForTimeout(2000) await this.uploadPaxButton.setInputFiles(uploadPaxPath) await this.page.waitForTimeout(2000) - } + } async smpeZowePaxAndNavigateToInstallationPage(runtimeDir: any){ this.selectSmpe() this.enterRuntimeDir(runtimeDir) this.clickValidateLocation() - } + } + + async clickOnContinueToUnpax(){ + this.continueToUnpax.click({ timeout: 2000 }) + } + + async clickSkipUnpaxButton(){ + this.SkipUnpax.click({ timeout: 2000 }) + } + + async clickRetrieveExZoweYaml(){ + this.retrieveExampleZoweYaml.click({ timeout: 15000 }) + } + + async MoveToInitializationStage(){ + this.click_InitializationStage.click({ timeout: 15000 }) + } } - export default InstallationTypePage; + export default InstallationTypePage; \ No newline at end of file diff --git a/playwright_test/Pages/planning.page.ts b/playwright_test/Pages/planning.page.ts index 63b8c87e..febdfb20 100644 --- a/playwright_test/Pages/planning.page.ts +++ b/playwright_test/Pages/planning.page.ts @@ -45,8 +45,8 @@ class PlanningPage{ this.jobName = page.locator("//label[contains(text(),'Job Name')]//following-sibling::div/input") this.jobPrefix = page.locator("//label[contains(text(),'Job Prefix')]//following-sibling::div/input") this.cookieIdentifier = page.locator("//label[contains(text(),'Cookie Identifier')]//following-sibling::div/input") - this.javaLocation = page.locator("//label[contains(text(),'Java location')]//following-sibling::div/input") - this.nodeJsLocation = page.locator("//label[contains(text(),'Node.js location')]//following-sibling::div/input") + this.javaLocation = page.locator("//label[contains(text(),'Java Home Directory')]//following-sibling::div/input") + this.nodeJsLocation = page.locator("//label[contains(text(),'Node.js Home Directory')]//following-sibling::div/input") this.setZosmf = page.locator("//span[text()='Set z/OSMF Attributes (optional)']/preceding-sibling::span/input") this.zosmfHost = page.locator("//label[contains(text(),'z/OSMF Host')]//following-sibling::div/input") this.zosmfPort = page.locator("//label[contains(text(),'z/OSMF Port')]//following-sibling::div/input") @@ -235,10 +235,10 @@ class PlanningPage{ await this.page.waitForTimeout(500); await this.jobStatement.fill("//HELLOJOB JOB 'HELLO, WORLD!',CLASS=A,MSGCLASS=A\n//STEP01 EXEC PGM=IEFBR14\n//SYSPRINT DD SYSOUT=A\n//SYSIN DD DUMMY") await this.saveAndValidate.click(); + await this.page.waitForTimeout(7000); } - async fillPlanningPageWithRequiredFields(runtimeDir: any, workspaceDir: any, extensionDir: any, logDir: any, profileIdentifier:any, jobPrefix:any,jobname:any, javaLocation:any,nodejsLocation:any,zOSMFHost:any,zOSMFPort:any,zOSMFAppID:any){ - await this.page.waitForTimeout(2000); - await this.clickSaveValidate(); + async fillPlanningPageWithRequiredFields(runtimeDir: any, workspaceDir: any, extensionDir: any, logDir: any, profileIdentifier:any,jobname:any,jobPrefix:any, javaLocation:any,nodejsLocation:any,zOSMFHost:any,zOSMFPort:any,zOSMFAppID:any){ + await this.page.waitForTimeout(5000); await this.enterRuntimeDir(runtimeDir); await this.enterWorkspaceDir(workspaceDir); await this.enterLogsDir(logDir); @@ -251,7 +251,7 @@ class PlanningPage{ await this.enterZosmfHost(zOSMFHost); await this.enterZosmfPort(zOSMFPort); await this.enterZosmfApplicationId(zOSMFAppID); - await this.page.waitForTimeout(2000); + await this.page.waitForTimeout(25000); } } diff --git a/playwright_test/Pages/security.page.ts b/playwright_test/Pages/security.page.ts index 621fd5cb..f8d2a9b0 100644 --- a/playwright_test/Pages/security.page.ts +++ b/playwright_test/Pages/security.page.ts @@ -45,8 +45,8 @@ class SecurityPage{ this.licenseAgreement = page.locator('//button[contains(text(), "License Agreement")]') this.acceptLicense = page.locator('//html/body/div[2]/div[3]/div/div[2]/button[1]') this.continueToComponentInstallation = page.locator('//button[contains(text(), "Continue to Components Installation")]') - this.mainXpath = '//html/body/div/div[2]/div/div[4]/div/form/div/div[3]/div[1]/div[3]/div/div[2]/div/div/div' - this.stc_mainXpath = '//html/body/div[1]/div[2]/div/div[4]/div/form/div/div[3]/div[1]/div[4]/div/div[2]/div/div/div/' + this.mainXpath = '//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[1]/div[3]/div/div[2]/div/div/div' + this.stc_mainXpath = '//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[1]/div[4]/div/div[2]/div/div/div' this.product = page.locator('input[role="combobox"]') this.view_yaml = page.locator('//button[contains(text(),"View/Edit Yaml")]') this.viewAndSubmitJob = page.locator('//button[contains(text(), "View Job Output")]') @@ -59,41 +59,43 @@ class SecurityPage{ this.certificateTab_title = page.locator('//div[text()="Certificates"]') this.securityTab_title = page.locator('//div[text()="Security"]') this.continue_CertificateSelector = page.locator('//button[contains(text(), "Continue to Certificates Setup")]') - + this.click_security = page.locator('//span[text()="Security"]') this.admin = page.getByLabel('Admin'); this.stc = page.getByLabel('Stc'); this.sys_prog = page.getByLabel('Sys Prog'); - this.user_zis = page.locator(this.mainXpath +'/div/div/div[2]/div/div/input'); - this.user_zowe = page.locator(this.mainXpath +'/div/div/div[1]/div/div/input'); + this.user_zis = page.locator(this.mainXpath +'/div/div/div[2]/div/label'); + this.user_zowe = page.locator(this.mainXpath +'/div/div/div[1]/div/label'); this.aux = page.getByLabel('Aux'); - this.stc_zowe = page.locator(this.stc_mainXpath + 'div[1]/div/div[1]/div/div/input'); - this.stc_zis = page.locator(this.stc_mainXpath + 'div[1]/div/div[2]/div/div/input'); + this.stc_zowe = page.locator(this.stc_mainXpath + '/div[1]/div/div[1]/div/label'); + this.stc_zis = page.locator(this.stc_mainXpath + '/div[1]/div/div[2]/div/label'); } async movetoSecurityPage(){ - await this.licenseAgreement.click({timeout: 9000}) - await this.acceptLicense.click({timeout: 9000}) - await this.continueToComponentInstallation.click({timeout: 5000}) - await this.skip_button.click() - await this.skip_button.click() + await this.click_security.click({timeout: 5000}) } async fillProduct(product:string){ await this.product.fill(product,{ timeout: 10000 }) } async fillSecurityDetails(product:string, admin:string,stc:string,sys_prog:string,user_zis:string,user_zowe:string,aux: string, stc_zowe: string, stc_zis:string){ - await this.product.fill(product,{ timeout: 10000 }) - await this.page.waitForTimeout(8000); - await this.admin.fill(admin,{ timeout: 10000 }) - await this.stc.fill(stc,{ timeout: 10000 }) - await this.sys_prog.fill(sys_prog,{ timeout: 10000 }) - await this.page.waitForTimeout(8000); - await this.user_zis.fill(user_zis,{ timeout: 10000 }) - await this.user_zowe.fill(user_zowe,{ timeout: 10000 }) - await this.page.waitForTimeout(8000); - await this.aux.fill(aux,{ timeout: 10000 }) - await this.stc_zowe.fill(stc_zowe,{ timeout: 10000 }) - await this.stc_zis.fill(stc_zis,{ timeout: 10000 }) + await this.page.waitForTimeout(1000); + await this.product.fill(product) + await this.page.waitForTimeout(1000); + await this.admin.fill(admin) + await this.page.waitForTimeout(1000); + await this.stc.fill(stc); + await this.page.waitForTimeout(1000); + await this.sys_prog.fill(sys_prog) + await this.page.waitForTimeout(1000); + await this.user_zis.fill(user_zis) + await this.page.waitForTimeout(1000); + await this.user_zowe.fill(user_zowe) + await this.page.waitForTimeout(1000); + await this.aux.fill(aux) + await this.page.waitForTimeout(1000); + await this.stc_zowe.fill(stc_zowe) + await this.page.waitForTimeout(1000); + await this.stc_zis.fill(stc_zis) } async fillAdmin(admin:string){ diff --git a/playwright_test/Pages/stcs.page.ts b/playwright_test/Pages/stcs.page.ts new file mode 100644 index 00000000..f886d701 --- /dev/null +++ b/playwright_test/Pages/stcs.page.ts @@ -0,0 +1,233 @@ +import { Page,ElectronApplication, Locator,_electron as electron } from '@playwright/test'; +let electronApp: ElectronApplication + +class StcsPage{ + page: Page; + click_stcs = Locator; + Security_title = Locator; + zis = Locator; + zowe = Locator; + aux = Locator; + dataset_proclib = Locator; + readYaml = Locator; + initSTC = Locator; + previous_step_button = Locator; + skip_button = Locator; + editor_title_element = Locator; + STCS_TITLE = Locator; + continueToComponentInstallation = Locator; + view_yaml = Locator; + viewAndSubmitJob = Locator; + view_job_output = Locator; + save_and_close = Locator; + previous_step = Locator; + skip_button = Locator; + close_button = Locator; + certificateTab_title = Locator; + continue_ReviewSelector = Locator; + errorMsg = Locator; + continue_CertificateSelector = Locator; + get_zoweValue = Locator; + get_zisValue = Locator; + get_auxValue = Locator; + get_datasetProclib = Locator; + writeConfig_greenCheckXpath = Locator; + uploadYaml_greenCheckXpath = Locator; + init_stcs_greenCheckXpath = Locator; + + + + constructor(page: Page) { + this.page = page; + this.click_stcs = page.locator('//span[text()="Stcs"]') + this.Security_title = page.locator('//div[text()="Security"]') + this.zis = page.getByLabel('Zis'); + this.zowe = page.getByLabel('Zowe'); + this.aux = page.getByLabel('Aux'); + this.dataset_proclib = page.getByLabel('Dataset Proclib'); + this.readYaml = page.locator('div.view-lines') + this.initSTC = page.locator('//button[contains(text(),"Initialize STC Config")]') + this.previous_step_button = page.locator('//button[contains(text(),"Previous step")]') + this.skip_button = page.locator('//button[contains(text(),"Skip")]') + this.editor_title_element = page.locator('//h2[text()="Editor"]') + this.STCS_TITLE = page.locator(' //div[text()="Stcs"]') + this.continueToComponentInstallation = page.locator('//button[contains(text(), "Continue to Components Installation")]') + this.view_yaml = page.locator('//button[contains(text(),"View/Edit Yaml")]') + this.viewAndSubmitJob = page.locator('//button[contains(text(), "Preview Job")]') + this.view_job_output = page.locator('//button[contains(text(), "View Job Output")]') + this.save_and_close = page.locator('//button[contains(text(),"Save & close")]') + this.previous_step = page.locator('//button[contains(text(),"Previous step")]') + this.skip_button = page.locator('//button[contains(text(),"Skip")]') + this.close_button = page.locator('//button[contains(text(), "Close")]') + this.certificateTab_title = page.locator('//div[text()="Certificates"]') + this.continue_ReviewSelector = page.locator('//button[contains(text(), "Review")]') + this.errorMsg = page.locator('//p[text()="is a required property"]') + this.continue_CertificateSelector = page.locator('//button[contains(text(), "Continue to Certificates Setup")]') + this.get_zoweValue = page.locator('//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[2]/div[1]/div/input') + this.get_zisValue = page.locator('//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[2]/div[2]/div/input') + this.get_auxValue = page.locator('//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[2]/div[3]/div/input') + this.get_datasetProclib = page.locator('//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div[2]/div[4]/div/input') + this.writeConfig_greenCheckXpath = page.locator('#card-init-stcs-progress-card') + this.uploadYaml_greenCheckXpath = page.locator('#card-download-progress-card') + this.init_stcs_greenCheckXpath = page.locator("#card-success-progress-card") + } + + async movetoStcsPage(){ + await this.click_stcs.click({timeout: 5000}) + } + async returnTitleOfStcsPage(){ + const Stcs_title = await this.STCS_TITLE.textContent(); + return Stcs_title; + } + async get_zowe_value(){ + const value = await this.get_zoweValue.evaluate(el => el.value); + console.log('Input field value:', value); + return value; + } + + async get_validation_error_msg(){ + const errorText = await this.page.locator('//p[text()="is a required property"]').textContent(); + console.log(errorText); + return errorText; + } + + async get_zis_value(){ + const value = await this.get_zisValue.evaluate(el => el.value); + console.log('Input field value:', value); + return value; + } + + async get_aux_value(){ + const value = await this.get_auxValue.evaluate(el => el.value); + console.log('Input field value:', value); + return value; + } + + async get_datasetProclib_value(){ + const value = await this.get_datasetProclib.evaluate(el => el.value); + console.log('Input field value:', value); + return value; + } + + async viewYaml(){ + await this.view_yaml.click({ timeout: 5000 }) + } + async closeButton(){ + this.close_button.click({ timeout: 2000 }) + } + async click_viewAndSubmitJob(){ + this.viewAndSubmitJob.click({ timeout: 2000 }) + } + async click_previewJob(){ + this.view_job_output.click({ timeout: 2000 }) + } + async click_skipStcsButton(){ + await this.skip_button.click({ timeout: 2000 }); + const certificate_title = await this.certificateTab_title.textContent(); + return certificate_title; + } + async is_skipStcsButtonEnable(){ + return await this.skip_button.isEnabled({ timeout: 5000 }); + } + + + async isPreviousButtonEnable(){ + return await this.previous_step.isEnabled({ timeout: 50000 }); + } + + async returnTitleOfPrevPage(){ + await this.previous_step_button.click({ timeout: 2000 }); + const security_title = await this.Security_title.textContent(); + return security_title; + } + + async open_monacoEditor(){ + this.view_yaml.click({ timeout: 5000 }) + const editor_title = await this.editor_title_element.textContent(); + return editor_title; + } + + async initializeSTC(){ + await this.initSTC.click({ timeout: 5000 }) + } + async isWriteConfigGreenCheckVisible(){ + return await this.writeConfig_greenCheckXpath.isVisible({ timeout: 50000 }); + } + async isUploadConfigGreenCheckVisible(){ + return await this.uploadYaml_greenCheckXpath.isVisible({ timeout: 50000 }); + } + async isInitSTCSGreenCheckVisible(){ + return await this.init_stcs_greenCheckXpath.isVisible({ timeout: 50000 }); + } + async isContinueButtonDisable(){ + return await this.continue_ReviewSelector.isDisabled({ timeout: 5000 }); + } + async click_saveAndClose(){ + this.save_and_close.click({ timeout: 5000 }) + } + + async isContinueButtonDisable(){ + return await this.continue_CertificateSelector.isDisabled({ timeout: 5000 }); + } + + async read_yaml() { + let previousScrollHeight = 0; + let allText = ''; + + while (true) { + const newText = await this.page.evaluate(() => { + const viewLines = document.querySelectorAll('.view-lines .view-line'); + let text = ''; + viewLines.forEach((line) => { + text += line.textContent + '\n'; + }); + return text; + }); + allText += newText; + console.log(allText) + await this.page.evaluate(() => { + const editor = document.querySelector('.monaco-scrollable-element.editor-scrollable.vs'); + editor.scrollTop += 100; + }); + + await this.page.waitForTimeout(1000); + + const currentScrollHeight = await this.page.evaluate(() => { + const editor = document.querySelector('.monaco-scrollable-element.editor-scrollable.vs'); + return editor.scrollHeight; + }); + + if (currentScrollHeight === previousScrollHeight) { + break; + } + previousScrollHeight = currentScrollHeight; + } + + console.log('All text:', allText); + return allText; +} + async isStatusChecked() { + try { + await this.page.waitForTimeout(1000); + + const isGreen = await this.page.evaluate(() => { + const svgElement = document.querySelector('#zen-root-container > div.wizard-container > div > div.MuiStepper-root.MuiStepper-horizontal.substepper.css-m5vj9m-MuiStepper-root > div:nth-child(9) > span > span.MuiStepLabel-iconContainer.Mui-active.Mui-error.css-vnkopk-MuiStepLabel-iconContainer > svg'); + + if (!svgElement) { + return false; + } + const style = window.getComputedStyle(svgElement); + + return style.color === 'green' || style.fill === 'green'; + }); + + return isGreen; + } catch (error) { + console.error('Error in isStatusChecked:', error); + return false; + } +} + + +} + export default StcsPage; \ No newline at end of file diff --git a/playwright_test/Tests/Stcs.spec.ts b/playwright_test/Tests/Stcs.spec.ts new file mode 100644 index 00000000..cc46ff76 --- /dev/null +++ b/playwright_test/Tests/Stcs.spec.ts @@ -0,0 +1,252 @@ +import { test, ElectronApplication, expect, _electron as electron } from '@playwright/test'; +import TitlePage from '../Pages/title.page.ts'; +import ConnectionPage from '../Pages/connection.page.ts'; +import PlanningPage from '../Pages/planning.page.ts'; +import InstallationTypePage from '../Pages/installationType.page.ts'; +import InstallationPage from '../Pages/installation.page.ts'; +import NetworkingPage from '../Pages/networking.page.ts'; +import SecurityPage from '../Pages/security.page.ts' +import StcsPage from '../Pages/stcs.page.ts' + +let electronApp: ElectronApplication +const STCS_TITLE = 'Stcs' +const SECURITY_TITLE = 'Security'; +const CERTIFICATE_TITLE = 'Certificates' +const RUNTIME_DIR = process.env.ZOWE_ROOT_DIR; +const SSH_HOST = process.env.SSH_HOST; +const SSH_PASSWD = process.env.SSH_PASSWD; +const SSH_PORT = process.env.SSH_PORT; +const SSH_USER = process.env.SSH_USER; +const ZOWE_EXTENSION_DIR= process.env.ZOWE_EXTENSION_DIR; +const ZOWE_LOG_DIR=process.env.ZOWE_LOG_DIR; +const ZOWE_WORKSPACE_DIR=process.env.ZOWE_WORKSPACE_DIR; +const JOB_NAME= process.env.JOB_NAME; +const JOB_PREFIX=process.env.JOB_PREFIX; +const JAVA_HOME=process.env.JAVA_HOME; +const NODE_HOME=process.env.NODE_HOME; +const ZOSMF_HOST=process.env.ZOSMF_HOST; +const ZOSMF_PORT=process.env.ZOSMF_PORT; +const ZOSMF_APP_ID=process.env.ZOSMF_APP_ID; +const DATASET_PREFIX= process.env.DATASET_PREFIX; +const PROC_LIB = process.env.PROC_LIB; +const PARM_LIB = process.env.PARM_LIB; +const ZIS = process.env.SECURITY_STC_ZIS; +const JCL_LIB = process.env.JCL_LIB; +const LOAD_LIB = process.env.LOAD_LIB; +const AUTH_LOAD_LIB = process.env.AUTH_LOAD_LIB; +const AUTH_PLUGIN_LIB = process.env.AUTH_PLUGIN_LIB; +const SECURITY_ADMIN = process.env.SECURITY_ADMIN; +const SECURITY_STC = process.env.SECURITY_STC; +const SECURITY_SYSPROG = process.env.SECURITY_SYSPROG; +const SECURITY_USER_ZIS = process.env.SECURITY_USER_ZIS; +const SECURITY_USER_ZOWE = process.env.SECURITY_USER_ZOWE; +const SECURITY_AUX = process.env.SECURITY_AUX; +const SECURITY_STC_ZOWE = process.env.SECURITY_STC_ZOWE; +const SECURITY_STC_ZIS = process.env.SECURITY_STC_ZIS; + +test.describe('StcsTab', () => { + let connectionPage: ConnectionPage; + let titlePage : TitlePage; + let installationTypePage : InstallationTypePage; + let planningPage : PlanningPage; + let installationPage : InstallationPage; + let networkingPage : NetworkingPage + let stcsPage : StcsPage + let securityPage : SecurityPage + + + test.beforeEach(async ({ page }) => { + test.setTimeout(900000); + electronApp = await electron.launch({ args: ['.webpack/main/index.js'] }) + page= await electronApp.firstWindow() + connectionPage = new ConnectionPage(page); + titlePage = new TitlePage(page); + planningPage = new PlanningPage(page); + installationTypePage = new InstallationTypePage(page); + installationPage = new InstallationPage(page); + networkingPage = new NetworkingPage(page); + securityPage = new SecurityPage(page); + stcsPage = new StcsPage(page); + titlePage.navigateToConnectionTab() + connectionPage.fillConnectionDetails(SSH_HOST,SSH_PORT,SSH_USER,SSH_PASSWD) + await page.waitForTimeout(5000); + connectionPage.SubmitValidateCredential() + await page.waitForTimeout(5000); + connectionPage.clickContinueButton() + await page.waitForTimeout(2000); + planningPage.clickSaveValidate() + await page.waitForTimeout(20000); + planningPage.fillPlanningPageWithRequiredFields(RUNTIME_DIR, ZOWE_WORKSPACE_DIR,ZOWE_EXTENSION_DIR,ZOWE_LOG_DIR,'1',JOB_NAME,JOB_PREFIX,JAVA_HOME,NODE_HOME,ZOSMF_HOST,ZOSMF_PORT,ZOSMF_APP_ID) + await page.waitForTimeout(20000); + planningPage.clickValidateLocations() + await page.waitForTimeout(20000); + planningPage.clickContinueToInstallation() + await page.waitForTimeout(5000); + installationTypePage.selectSmpe() + installationTypePage.clickOnContinueToUnpax() + await page.waitForTimeout(30000); + installationTypePage.clickSkipUnpaxButton() + await page.waitForTimeout(2000); + installationPage.fillInstallationPage(DATASET_PREFIX, PROC_LIB, PARM_LIB, ZIS, JCL_LIB,LOAD_LIB,AUTH_LOAD_LIB,AUTH_PLUGIN_LIB) + await page.waitForTimeout(10000) + installationPage.clickInstallMvsDatasets() + await page.waitForTimeout(70000); + const is_Continue_Button_enable = await installationPage.isContinueToNetworkSetupEnabled(); + expect(is_Continue_Button_enable).toBe(true); + await page.waitForTimeout(10000); + installationPage.clickContinueToNetworkSetup() + await page.waitForTimeout(10000); + securityPage.movetoSecurityPage() + await page.waitForTimeout(10000); + securityPage.fillSecurityDetails('RACF',SECURITY_ADMIN,SECURITY_STC,SECURITY_SYSPROG,SECURITY_USER_ZIS,SECURITY_USER_ZOWE,SECURITY_AUX,SECURITY_STC_ZOWE,SECURITY_STC_ZIS) + await page.waitForTimeout(30000); + stcsPage.movetoStcsPage() + }) + + test.afterEach(async () => { + await electronApp.close() + }) + + test('test title of page', async ({ page }) => { + await page.waitForTimeout(5000); + const title = await stcsPage.returnTitleOfStcsPage(); + expect(title).toBe(STCS_TITLE); + }) + + test('test all required fields', async ({ page }) => { + await page.waitForTimeout(5000); + await expect(stcsPage.zis).toBeTruthy() + await expect(stcsPage.zowe).toBeTruthy() + await expect(stcsPage.aux).toBeTruthy() + await expect(stcsPage.dataset_proclib).toBeTruthy() + }) + + test('Test view yaml button', async ({ page }) => { + await page.waitForTimeout(7000); + stcsPage.viewYaml() + await page.waitForTimeout(5000); + await expect(stcsPage.editor_title_element).toBeTruthy(); + await page.waitForTimeout(5000); + stcsPage.closeButton() + await page.waitForTimeout(2000); + }) + + test('Test view job', async ({ page }) => { + await page.waitForTimeout(5000); + stcsPage.click_previewJob() + await page.waitForTimeout(5000); + await expect(stcsPage.editor_title_element).toBeTruthy() + stcsPage.closeButton() + await page.waitForTimeout(5000); + }) + + test('click Previous step button', async ({ page }) => { + await page.waitForTimeout(5000); + const title = await stcsPage.returnTitleOfPrevPage(); + expect(title).toBe(SECURITY_TITLE); + }) + test('Test previous button is enabled', async ({ page }) => { + const is_prevButtonEnable = await stcsPage.isPreviousButtonEnable(); + expect(is_prevButtonEnable).toBe(true); + await page.waitForTimeout(2000); + }) + + test('Test Skip Stcs button is enable', async ({ page }) => { + await page.waitForTimeout(2000); + const isSkipStcsEnable = await stcsPage.is_skipStcsButtonEnable(); + expect(isSkipStcsEnable).toBe(true); + await page.waitForTimeout(2000); + }) + + test('test click skip STCS button', async ({ page }) => { + await page.waitForTimeout(5000); + const certificate_title = await stcsPage.click_skipStcsButton(); + expect(certificate_title).toBe(CERTIFICATE_TITLE); + + }) + + test('Test continue to certificate button is disable', async ({ page }) => { + await page.waitForTimeout(2000); + const is_ContinueButtonDisable = await stcsPage.isContinueButtonDisable(); + expect(is_ContinueButtonDisable).toBe(true); + await page.waitForTimeout(2000); + }) + + test('Test yaml should be updated', async ({ page }) => { + await page.waitForTimeout(5000); + await stcsPage.viewYaml(); + await page.waitForTimeout(10000); + await expect(stcsPage.editor_title_element).toBeTruthy(); + await page.waitForTimeout(5000); + const yaml = await stcsPage.read_yaml(); + await page.waitForTimeout(5000); + expect(yaml).toContain(SECURITY_AUX); + expect(yaml).toContain(SECURITY_STC_ZOWE); + expect(yaml).toContain(SECURITY_STC_ZIS); + }) + + test('Test Resume Progress', async ({ page }) => { + await page.waitForTimeout(8000); + stcsPage.click_saveAndClose() + titlePage.clickOnResumeProgress() + connectionPage.fillpassword(SSH_PASSWD) + await page.waitForTimeout(5000); + connectionPage.SubmitValidateCredential() + await page.waitForTimeout(8000); + const title = await stcsPage.returnTitleOfStcsPage(); + expect(title).toBe(STCS_TITLE); + const ZoweValue = await stcsPage.get_zowe_value(); + const Zis_Value = await stcsPage.get_zis_value(); + const Aux_Value = await stcsPage.get_aux_value(); + const DatasetProclib_Value = await stcsPage.get_datasetProclib_value(); + expect(ZoweValue).toBe(SECURITY_STC_ZOWE); + expect(Zis_Value).toBe(SECURITY_STC_ZIS); + expect(Aux_Value).toBe(SECURITY_AUX); + expect(DatasetProclib_Value).toBe(PROC_LIB); + }) + + test('Test initialize stcs', async ({ page }) => { + await page.waitForTimeout(8000); + stcsPage.initializeSTC() + await page.waitForTimeout(10000); + const isWriteConfig_check_visible = await stcsPage.isWriteConfigGreenCheckVisible(); + expect(isWriteConfig_check_visible).toBe(true); + const isUploadConfig_check_visible = await stcsPage.isUploadConfigGreenCheckVisible(); + expect(isUploadConfig_check_visible).toBe(true); + const isInitStcs_check_visible = await stcsPage.isInitSTCSGreenCheckVisible(); + expect(isInitStcs_check_visible).toBe(true); + }) + + test('Test continue Button enabled after init stcs', async ({ page }) => { + await page.waitForTimeout(8000); + stcsPage.initializeSTC() + await page.waitForTimeout(10000); + const isWriteConfig_check_visible = await stcsPage.isWriteConfigGreenCheckVisible(); + expect(isWriteConfig_check_visible).toBe(true); + const isUploadConfig_check_visible = await stcsPage.isUploadConfigGreenCheckVisible(); + expect(isUploadConfig_check_visible).toBe(true); + const isInitStcs_check_visible = await stcsPage.isInitSTCSGreenCheckVisible(); + expect(isInitStcs_check_visible).toBe(true); + await page.waitForTimeout(2000); + const is_ContinueButtonDisable = await stcsPage.isContinueButtonDisable(); + expect(is_ContinueButtonDisable).toBe(false); + await page.waitForTimeout(2000); + }) + + test('Test status after successfull init stcs', async ({ page }) => { + await page.waitForTimeout(8000); + stcsPage.initializeSTC() + await page.waitForTimeout(10000); + const isWriteConfig_check_visible = await stcsPage.isWriteConfigGreenCheckVisible(); + expect(isWriteConfig_check_visible).toBe(true); + const isUploadConfig_check_visible = await stcsPage.isUploadConfigGreenCheckVisible(); + expect(isUploadConfig_check_visible).toBe(true); + const isInitStcs_check_visible = await stcsPage.isInitSTCSGreenCheckVisible(); + expect(isInitStcs_check_visible).toBe(true); + await page.waitForTimeout(2000); + const is_GreenCheck_Visible = await stcsPage.isStatusChecked(); + expect(is_GreenCheck_Visible).toBe(false); + await page.waitForTimeout(2000); + }) + +})