diff --git a/playwright_test/Pages/installationType.page.ts b/playwright_test/Pages/installationType.page.ts index 010a833..dae7457 100644 --- a/playwright_test/Pages/installationType.page.ts +++ b/playwright_test/Pages/installationType.page.ts @@ -17,7 +17,9 @@ class InstallationTypePage{ validateLocation: Locator; validateLocationGreenCheck: Locator; licenseAgreementGreenCheck: Locator; - + disagreeLicense: Locator; + installation_Type_Tab: Locator; + continueToUnpaxButton: Locator; constructor(page: Page) { this.page = page; @@ -32,6 +34,7 @@ class InstallationTypePage{ this.continueToComponentInstallation = page.locator("//button[text()='Continue to Components Installation']") this.zoweLink = page.locator("//a[@href='zowe.org']") this.agreeLicense = page.locator("//button[text()='Agree']") + this.disagreeLicense = page.locator("//button[text()='Disagree']") this.uploadPaxButton = page.locator("//button[text()='Upload PAX']") this.runtimeDir = page.locator("//label[contains(text(),'Runtime Directory')]//following-sibling::div/input") this.validateLocation = page.locator("//button[text()= 'Validate location']") @@ -40,12 +43,17 @@ class InstallationTypePage{ this.retrieveExampleZoweYaml = page.locator("//button[contains(text(),'Retrieve example-zowe.yaml')]") this.continueCompInstallation = page.locator("//button[contains(text(),'Continue to Components Installation')]") this.skipUnpaxButton = page.locator("//button[text()='Skip ']") - this.continueToUnpax = page.locator("//button[contains(text(),'Continue to Unpax')]") + this.continueToUnpaxButton = 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"]') + this.installation_Type_Tab = page.locator('//span[text()="Installation Type"]') } + async clickInstallationTypeTab(){ + await this.installation_Type_Tab.click({timeout: 9000}) + } + async getInstallationTypePageTitle(){ return await this.pageTitle.textContent({ timeout: 2000 }); } @@ -54,10 +62,20 @@ class InstallationTypePage{ await this.downloadPax.click({timeout: 5000}) } + async isDownloadZowePaxSelected(){ + await this.page.waitForTimeout(1000) + return await this.downloadPax.isChecked() + } + async selectUploadZowePax(){ await this.uploadPax.click({timeout: 5000}); } + async isUploadZowePaxSelected(){ + await this.page.waitForTimeout(1000) + return await this.uploadPax.isChecked() + } + async selectSmpe(){ await this.smpe.click({timeout: 5000}); } @@ -84,12 +102,12 @@ class InstallationTypePage{ } private async waitForInstallationPageVisible(): Promise { - const timeout = 1000000; - const interval = 500; + const timeout = 1000000; + const interval = 500; const endTime = Date.now() + timeout; while (Date.now() < endTime) { if (await this.installationPageTitle.isVisible()) { - return; + return; } await this.page.waitForTimeout(interval); } @@ -97,6 +115,11 @@ class InstallationTypePage{ throw new Error('Timed out waiting for the Installation Page to become visible.'); } + async isSmpeSelected(){ + await this.page.waitForTimeout(1000) + return await this.smpe.isChecked() + } + async clickZoweLink(){ await this.zoweLink.click(); } @@ -133,6 +156,11 @@ class InstallationTypePage{ await this.agreeLicense.click({timeout: 5000}); } + async clickDisagreeLicense(){ + await this.page.waitForTimeout(1000) + await this.disagreeLicense.click({timeout: 5000}); + } + async isLicenseAgreementGreenCheckVisible(){ await this.page.waitForTimeout(5000); return await this.licenseAgreementGreenCheck.isVisible({timeout: 5000}); @@ -178,7 +206,11 @@ class InstallationTypePage{ this.clickValidateLocation() } async clickOnContinueToUnpax(){ - this.continueToUnpax.click({ timeout: 2000 }) + this.continueToUnpaxButton.click({ timeout: 2000 }) + } + + async isContinueToUnpaxEnabled(){ + return await this.continueToUnpaxButton.isEnabled() } async clickSkipUnpaxButton(){ diff --git a/playwright_test/Pages/planning.page.ts b/playwright_test/Pages/planning.page.ts index 658f20c..091fe43 100644 --- a/playwright_test/Pages/planning.page.ts +++ b/playwright_test/Pages/planning.page.ts @@ -29,6 +29,7 @@ class PlanningPage{ continueInstallationOptions: Locator; readyToProceedMessage: Locator; errorMessage: Locator; + save_and_close: Locator; constructor(page: Page) { this.page = page; @@ -71,6 +72,11 @@ class PlanningPage{ return await this.planningPageTitle.textContent(); } + async getJobStatement(){ + await this.page.waitForTimeout(1000); + return await this.jobStatement.textContent(); + } + async click_saveAndClose(){ await this.page.waitForTimeout(5000); await this.save_and_close.click({ timeout: 2000 }) @@ -223,6 +229,23 @@ class PlanningPage{ await this.previousStep.click(); } + private async waitForContinueButtonToBeEnabled(): Promise { + const timeout = 100000; // Adjust the timeout as needed + const interval = 500; + const endTime = Date.now() + timeout; + + while (Date.now() < endTime) { + if (await this.isContinueToInstallationEnabled()) { + console.log("Continue button is enabled."); + return true; // Button became enabled + } + await this.page.waitForTimeout(interval); + } + + console.log("Continue button did not enabled "); + return false; // Button did not become enabled + } + async clickContinueToInstallation(){ const timeout = 30000; const interval = 100; @@ -278,6 +301,5 @@ class PlanningPage{ await this.enterZosmfApplicationId(zOSMFAppID); await this.page.waitForTimeout(2000); } - } export default PlanningPage; diff --git a/playwright_test/Tests/StateManagementInstallationType.spec.ts b/playwright_test/Tests/StateManagementInstallationType.spec.ts new file mode 100644 index 0000000..2ed58ca --- /dev/null +++ b/playwright_test/Tests/StateManagementInstallationType.spec.ts @@ -0,0 +1,139 @@ +import { test, ElectronApplication, expect, _electron as electron, Page } from '@playwright/test'; +import ConnectionPage from '../Pages/connection.page.ts'; +import TitlePage from '../Pages/title.page.ts'; +import PlanningPage from '../Pages/planning.page.ts'; +import InstallationTypePage from '../Pages/installationType.page.ts'; +import config from '../utils/config.ts'; +let page: Page; + +let electronApp: ElectronApplication + +test.describe('InstallationTypeTab', () => { + let connectionPage: ConnectionPage; + let titlePage: TitlePage; + let planningPage: PlanningPage; + let installationTypePage: InstallationTypePage; + + async function launch_Zen({ 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); + await page.waitForTimeout(5000) + } + + test.beforeEach(async () => { + await launch_Zen({page}) + titlePage.navigateToConnectionTab(); + await connectionPage.fillConnectionDetails(config.SSH_HOST, config.SSH_PORT, config.SSH_USER, config.SSH_PASSWD); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR, + config.ZOWE_WORKSPACE_DIR, + config.ZOWE_EXTENSION_DIR, + config.ZOWE_LOG_DIR, + config.JAVA_HOME, + config.NODE_HOME, + config.ZOSMF_HOST, + config.ZOSMF_PORT, + config.ZOSMF_APP_ID + ); + await planningPage.clickValidateLocations() + await planningPage.clickContinueToInstallation() + }) + + test.afterEach(async () => { + await electronApp.close() + }) + + test('Test Select Downlad Zowe Pax', async ({ page }) => { + installationTypePage.selectDownloadZowePax() + const is_Download_Zowe_Pax_Selected = await installationTypePage.isDownloadZowePaxSelected(); + expect(is_Download_Zowe_Pax_Selected).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + installationTypePage.clickInstallationTypeTab(); + await page.waitForTimeout(2000); + expect(is_Download_Zowe_Pax_Selected).toBe(true); + }) + + test('Test Select Upload Zowe Pax', async ({ page }) => { + installationTypePage.selectUploadZowePax() + const is_Upload_Zowe_Pax_Selected = await installationTypePage.isUploadZowePaxSelected(); + expect(is_Upload_Zowe_Pax_Selected).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + installationTypePage.clickInstallationTypeTab(); + await page.waitForTimeout(2000); + expect(is_Upload_Zowe_Pax_Selected).toBe(true); + }) + + test('Test Select SMPE', async ({ page }) => { + installationTypePage.selectSmpe(); + const is_SMPE_Selected = await installationTypePage.isSmpeSelected(); + expect(is_SMPE_Selected).toBe(true); + const Is_Continue_Button_Enable = await installationTypePage.isContinueToUnpaxEnabled(); + expect(Is_Continue_Button_Enable).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + installationTypePage.clickInstallationTypeTab(); + await page.waitForTimeout(2000); + expect(is_SMPE_Selected).toBe(true); + expect(Is_Continue_Button_Enable).toBe(true); + }) + + test('Test Agree License Agreement', async ({ page }) => { + installationTypePage.selectDownloadZowePax() + installationTypePage.clickLicenseAgreement() + installationTypePage.clickAgreeLicense() + const is_GreenCheck_Visible = await installationTypePage.isLicenseAgreementGreenCheckVisible(); + expect(is_GreenCheck_Visible).toBe(true); + const Is_Continue_Button_Enable = await installationTypePage.isContinueToUnpaxEnabled(); + expect(Is_Continue_Button_Enable).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + installationTypePage.clickInstallationTypeTab(); + await page.waitForTimeout(2000); + expect(is_GreenCheck_Visible).toBe(true); + expect(Is_Continue_Button_Enable).toBe(true); + }) + + test('Test Disagree License Agreement', async ({ page }) => { + installationTypePage.selectDownloadZowePax() + installationTypePage.clickLicenseAgreement() + installationTypePage.clickDisagreeLicense() + const is_GreenCheck_Visible = await installationTypePage.isLicenseAgreementGreenCheckVisible(); + expect(is_GreenCheck_Visible).toBe(false); + const Is_Continue_Button_Enable = await installationTypePage.isContinueToUnpaxEnabled(); + expect(Is_Continue_Button_Enable).toBe(false); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + installationTypePage.clickInstallationTypeTab(); + await page.waitForTimeout(2000); + expect(is_GreenCheck_Visible).toBe(false); + expect(Is_Continue_Button_Enable).toBe(false); + }) +}) \ No newline at end of file diff --git a/playwright_test/Tests/StateManagementPlanning.spec.ts b/playwright_test/Tests/StateManagementPlanning.spec.ts new file mode 100644 index 0000000..0a5e898 --- /dev/null +++ b/playwright_test/Tests/StateManagementPlanning.spec.ts @@ -0,0 +1,139 @@ +import { test, ElectronApplication, expect, _electron as electron, Page } from '@playwright/test'; +import ConnectionPage from '../Pages/connection.page.ts'; +import TitlePage from '../Pages/title.page.ts'; +import PlanningPage from '../Pages/planning.page.ts'; +import config from '../utils/config.ts'; +let page: Page; + +let electronApp: ElectronApplication +const VALID_JOB_STATEMENT = "//ZWEJOB01 JOB IZUACCT,'SYSPROG',CLASS=A,\n// MSGLEVEL=(1,1),MSGCLASS=A"; +const INVALID_JOB_STATEMENT = "//HELLOJOB JOB 'HELLO, WORLD!',CLASS=A,MSGCLASS"; + +test.describe('State_Management_PlanningTab', () => { + let connectionPage: ConnectionPage; + let titlePage : TitlePage; + let planningPage: PlanningPage; + + async function launch_Zen({ 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); + await page.waitForTimeout(5000) + } + + test.beforeEach(async () => { + await launch_Zen({page}) + titlePage.navigateToConnectionTab(); + await connectionPage.fillConnectionDetails(config.SSH_HOST, config.SSH_PORT, config.SSH_USER, config.SSH_PASSWD); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + }) + + test.afterEach(async () => { + await electronApp.close() + }) + + test('Test Added Job Statement and Not Validated', async ({page}) => { + planningPage.enterJobStatement(INVALID_JOB_STATEMENT); + await page.waitForTimeout(2000) + planningPage.clickSaveAndValidate(); + await page.waitForTimeout(5000) + const jobstatement = await planningPage.getJobStatement(); + expect(jobstatement).toBe(INVALID_JOB_STATEMENT); + const isGreen_check_visible = await planningPage.isSaveAndValidateGreenCheckVisible(); + expect(isGreen_check_visible).toBe(false); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + await page.waitForTimeout(2000); + expect(jobstatement).toBe(INVALID_JOB_STATEMENT); + expect(isGreen_check_visible).toBe(false); + }) + + test('Test Added Job Statement and Validated Successfully', async ({page}) => { + planningPage.enterJobStatement(VALID_JOB_STATEMENT); + await page.waitForTimeout(2000) + planningPage.clickSaveAndValidate(); + await page.waitForTimeout(5000); + const isGreen_check_visible = await planningPage.isSaveAndValidateGreenCheckVisible(); + expect(isGreen_check_visible).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + await page.waitForTimeout(2000); + expect(isGreen_check_visible).toBe(true); + }) + + test('Test Locations Validated and Planning Step Completed', async ({page}) => { + await page.waitForTimeout(2000); + await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR, + config.ZOWE_WORKSPACE_DIR, + config.ZOWE_EXTENSION_DIR, + config.ZOWE_LOG_DIR, + config.JAVA_HOME, + config.NODE_HOME, + config.ZOSMF_HOST, + config.ZOSMF_PORT, + config.ZOSMF_APP_ID + ); + await page.waitForTimeout(2000); + planningPage.clickValidateLocations() + await page.waitForTimeout(5000); + const is_GreenCheck_Visible = await planningPage.isValidateLocationsGreenCheckVisible(); + expect(is_GreenCheck_Visible).toBe(true); + const is_Continue_Button_enable = await planningPage.isContinueToInstallationEnabled(); + expect(is_Continue_Button_enable).toBe(true); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + await page.waitForTimeout(2000); + expect(is_GreenCheck_Visible).toBe(true); + expect(is_Continue_Button_enable).toBe(true); + }) + + test('Test Locations Not Validated and Planning Step Pending', async ({page}) => { + await page.waitForTimeout(2000) + await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR, + 'TESTABC', + config.ZOWE_EXTENSION_DIR, + config.ZOWE_LOG_DIR, + 'JAVA_HOME', + '12345', + config.ZOSMF_HOST, + config.ZOSMF_PORT, + config.ZOSMF_APP_ID + ); + await page.waitForTimeout(2000) + planningPage.clickValidateLocations() + await page.waitForTimeout(5000); + const is_GreenCheck_Visible = await planningPage.isValidateLocationsGreenCheckVisible(); + expect(is_GreenCheck_Visible).toBe(false); + const is_Continue_Button_enable = await planningPage.isContinueToInstallationEnabled(); + expect(is_Continue_Button_enable).toBe(false); + await electronApp.close() + await launch_Zen({page}) + titlePage.clickOnResumeProgress(); + connectionPage.fillPassword(config.SSH_PASSWD) + await page.waitForTimeout(2000); + await connectionPage.SubmitValidateCredential(); + await connectionPage.clickContinueButton(); + await page.waitForTimeout(2000); + expect(is_GreenCheck_Visible).toBe(false); + expect(is_Continue_Button_enable).toBe(false); + }) +}) diff --git a/playwright_test/utils/config.ts b/playwright_test/utils/config.ts index 95e1457..5c9d65b 100644 --- a/playwright_test/utils/config.ts +++ b/playwright_test/utils/config.ts @@ -19,6 +19,7 @@ interface Config { AUTH_PLUGIN_LIB: string | undefined; PROC_LIB: string | undefined; PARM_LIB: string | undefined; + ZIS: string | undefined; JCL_LIB: string | undefined; LOAD_LIB: string | undefined; DOMAIN_NAME: string | undefined; @@ -58,6 +59,7 @@ const config: Config = { AUTH_PLUGIN_LIB: process.env.AUTH_PLUGIN_LIB, PROC_LIB: process.env.PROC_LIB, PARM_LIB: process.env.PARM_LIB, + ZIS: process.env.ZIS, JCL_LIB: process.env.JCL_LIB, LOAD_LIB: process.env.LOAD_LIB, EXTERNAL_PORT: process.env.EXTERNAL_PORT,