Skip to content

Commit

Permalink
Added State Management tests for Installation, Apf Auth, and Security…
Browse files Browse the repository at this point in the history
… tabs

Signed-off-by: sagar-1310 <[email protected]>
  • Loading branch information
sagaryadavs committed May 28, 2024
1 parent e71dceb commit c75dc59
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 23 deletions.
23 changes: 14 additions & 9 deletions playwright_test/Pages/apfAuth.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ApfAuthPage{
skip_apf_auth_button: Locator;
continue_apfauth_setup: Locator;
continue_security_setup: Locator;
continueButtonSelector: Locator;
editor_title_element: Locator;
installationTitle: Locator;
APFAUTH_TITLE: Locator;
Expand All @@ -40,12 +39,7 @@ class ApfAuthPage{
auth_load_lib_value:Locator;
auth_plugin_lib_value:Locator;
dataset_prefix_value:Locator;






apf_auth_tab: Locator;

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -83,6 +77,7 @@ class ApfAuthPage{
this.dataset_prefix_value = page.getByLabel('Dataset Prefix')
this.auth_load_lib_value = page.getByLabel('APF Authorized Load Library')
this.auth_plugin_lib_value = page.getByLabel('Zowe ZIS Plugins Load Library')
this.apf_auth_tab = page.locator("//span[text()='APF Auth']")

}
async returnTitleOfApfAuthPage(){
Expand All @@ -93,7 +88,12 @@ class ApfAuthPage{
async movetoApfAuthPage(){
await this.click_ApfAuth.click({timeout: 9000})
}
async movetoInstallationPage(){

async clickApfAuthTab(){
await this.apf_auth_tab.click({timeout: 9000})
}

async movetoInstallationPage(){
await this.licenseAgreement.click({timeout: 9000})
await this.acceptLicense.click({timeout: 9000})
await this.continueToComponentInstallation.click({timeout: 5000})
Expand Down Expand Up @@ -153,9 +153,14 @@ class ApfAuthPage{
return editor_title;
}

async isContinueButtonDisable(){
async isContinueButtonEnabled(){
return await this.continue_security_setup.isEnabled({ timeout: 5000 });
}

async isContinueButtonDisable(){
return await this.continue_security_setup.isDisabled({ timeout: 5000 });
}

async click_saveAndClose(){
this.save_and_close.click({ timeout: 2000 })
}
Expand Down
2 changes: 1 addition & 1 deletion playwright_test/Pages/installation.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InstallationPage{
this.viewEditYaml = page.locator("//button[text()='View/Edit Yaml']")
this.viewSubmitJob = page.locator("//button[text()='View/Submit Job']")
this.viewJobOutput = page.locator("//button[text()='View Job Output']")
this.saveAndClose = page.locator("//button[text()='Save & close']")
this.saveAndClose = page.locator("//button[text()='Save & close']")

Check failure on line 40 in playwright_test/Pages/installation.page.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
this.previousStep = page.locator("//button[text()='Previous step']")
this.skipInstallation = page.locator("//button[contains(text(),'Skip')]")
this.continueToNetworkSetup = page.locator("//button[text()='Continue to Network Setup']")
Expand Down
11 changes: 7 additions & 4 deletions playwright_test/Pages/networking.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class NetworkingPage{
close_button:Locator;
CONFPAGE_TITLE: Locator;
continueToComponentInstallation: Locator;


contiuneToApfAuth: Locator;

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -101,7 +100,7 @@ class NetworkingPage{
this.close_button = page.locator('//button[contains(text(), "Close")]');
this.APFAUTH_TITLE = page.locator('//div[text()="APF Authorize Load Libraries"]');
this.continue_ReviewSelector = page.locator('//button[contains(text(), "Continue to APF Auth Setup")]');
this.installationTitle = page.locator('//div[text()="Installation"]');
this.contiuneToApfAuth = page.locator('//button[text()="Continue to APF Auth Setup"]');
}

async movetoNetworkingPage(){
Expand Down Expand Up @@ -193,6 +192,7 @@ class NetworkingPage{
async delete_DomainNameField(){
await this.deleteDomainName.click();
}

async add_DomainNameField(){
await this.addDomainField.click()
}
Expand All @@ -211,7 +211,10 @@ class NetworkingPage{
async is_skipNetworkingButtonEnable(){
return await this.skip_button.isEnabled({ timeout: 5000 });
}

async clickContinueToApfAuth(){
this.contiuneToApfAuth.click({ timeout: 2000 })
}

async click_skipNetworking(){
await this.skip_button.click({ timeout: 2000 });
const apfAuth_title = await this.APFAUTH_TITLE.textContent();
Expand Down
14 changes: 10 additions & 4 deletions playwright_test/Pages/security.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class SecurityPage{
product: Locator;
APFAUTH_TITLE: Locator;
continueToComponentInstallation: Locator;


security_tab: Locator;

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -59,7 +58,6 @@ 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.admin = page.getByLabel('Admin');
this.stc = page.getByLabel('Stc');
this.sys_prog = page.getByLabel('Sys Prog');
Expand All @@ -68,7 +66,7 @@ class SecurityPage{
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.security_tab = page.locator("//span[text()='Security']")
}

async movetoSecurityPage(){
Expand Down Expand Up @@ -96,6 +94,10 @@ class SecurityPage{
await this.stc_zis.fill(stc_zis,{ timeout: 10000 })
}

async clickSecurityTab(){
await this.security_tab.click({ timeout: 2000 })
}

async fillAdmin(admin:string){
await this.admin.fill(admin,{ timeout: 10000 })
}
Expand Down Expand Up @@ -151,6 +153,10 @@ class SecurityPage{
return editor_title;
}

async isContinueButtonEnabled(){
return await this.continue_CertificateSelector.isEnabled({ timeout: 5000 });
}

async isContinueButtonDisable(){
return await this.continue_CertificateSelector.isDisabled({ timeout: 5000 });
}
Expand Down
170 changes: 170 additions & 0 deletions playwright_test/Tests/StateManagementApfAuthSecurity.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import { test, ElectronApplication, expect, _electron as electron, Page } from '@playwright/test';
import ApfAuthPage from '../Pages/ApfAuth.page.js';
import TitlePage from '../Pages/title.page.js';
import ConnectionPage from '../Pages/connection.page.js';
import PlanningPage from '../Pages/planning.page.js';
import InstallationTypePage from '../Pages/installationType.page.js';
import InstallationPage from '../Pages/installation.page.js';
import NetworkingPage from '../Pages/networking.page.js';
import SecurityPage from '../Pages/security.page';
let page: Page;

let electronApp: ElectronApplication
const DATASET_PREFIX = 'IBMUSER.ZWEV1'
const AUTH_LOAD_LIB = 'IBMUSER.ZWEV1.ZWEAUTH'
const AUTH_PLUGIN_LIB = 'IBMUSER.ZWEV1.CUST.ZWESAPL'
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 RUNTIME_DIR=process.env.ZOWE_ROOT_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 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('ApfAuthTab', () => {
let connectionPage: ConnectionPage;
let titlePage : TitlePage;
let apfAuthPage : ApfAuthPage;
let planningPage : PlanningPage;
let installationTypePage : InstallationTypePage;
let installationPage : InstallationPage;
let networkingPage : NetworkingPage
let securityPage : SecurityPage;

async function launch_Zen_and_Navigate_to_Installation_Tab({ 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);
apfAuthPage = new ApfAuthPage(page);
securityPage = new SecurityPage(page);
await page.waitForTimeout(5000)
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.downloadZowePaxAndNavigateToInstallationPage()
installationTypePage.clickContinueToInstallation()
}

test.beforeEach(async () => {
await launch_Zen_and_Navigate_to_Installation_Tab({page})
})

test.afterEach(async () => {
await electronApp.close()
})

test('Test Apf Auth Completed', async ({ page }) => {
await page.waitForTimeout(2000);
apfAuthPage.fillApfDetails(DATASET_PREFIX,AUTH_LOAD_LIB,AUTH_PLUGIN_LIB)
await page.waitForTimeout(5000);
installationPage.clickSkipInstallation()
await page.waitForTimeout(2000);
networkingPage.clickContinueToApfAuth()
await page.waitForTimeout(2000);
const isWriteConfig_check_visible = await apfAuthPage.isWriteConfigGreenCheckVisible();
expect(isWriteConfig_check_visible).toBe(true);
const isUploadConfig_check_visible = await apfAuthPage.isUploadConfigGreenCheckVisible();
expect(isUploadConfig_check_visible).toBe(true);
const isInitApf_check_visible = await apfAuthPage.isInitApfGreenCheckVisible();
expect(isInitApf_check_visible).toBe(true);
const isContinueSecurityButtonEnabled = await apfAuthPage.isContinueButtonEnabled();
expect(isContinueSecurityButtonEnabled).toBe(true);
await electronApp.close()
await launch_Zen_and_Navigate_to_Installation_Tab({page})
apfAuthPage.clickApfAuthTab()
await page.waitForTimeout(2000);
expect(isWriteConfig_check_visible).toBe(true);
expect(isUploadConfig_check_visible).toBe(true);
expect(isInitApf_check_visible).toBe(true);
expect(isContinueSecurityButtonEnabled).toBe(true);
})

test('Test Apf Auth Pending', async ({ page }) => {
await page.waitForTimeout(2000);
apfAuthPage.fillApfDetails(DATASET_PREFIX,AUTH_LOAD_LIB,AUTH_PLUGIN_LIB)
await page.waitForTimeout(5000);
installationPage.clickSkipInstallation()
await page.waitForTimeout(2000);
const isContinueSecurityButtonEnabled = await apfAuthPage.isContinueButtonEnabled();
expect(isContinueSecurityButtonEnabled).toBe(false);
await electronApp.close()
await launch_Zen_and_Navigate_to_Installation_Tab({page})
apfAuthPage.clickApfAuthTab()
await page.waitForTimeout(2000);
expect(isContinueSecurityButtonEnabled).toBe(false);
})

test('Test Security Setup Completed', async ({ page }) => {
await page.waitForTimeout(5000);
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(5000);
securityPage.initializeSecurity()
await page.waitForTimeout(5000);
const isWriteConfig_check_visible = await securityPage.isWriteConfigGreenCheckVisible();
expect(isWriteConfig_check_visible).toBe(true);
const isUploadConfig_check_visible = await securityPage.isUploadConfigGreenCheckVisible();
expect(isUploadConfig_check_visible).toBe(true);
const isInitSecurity_check_visible = await securityPage.isInitSecurityGreenCheckVisible();
expect(isInitSecurity_check_visible).toBe(true);
const isContinueCertificatesButtonEnabled = await securityPage.isContinueButtonEnabled();
expect(isContinueCertificatesButtonEnabled).toBe(true);
await page.waitForTimeout(2000);
await electronApp.close()
await launch_Zen_and_Navigate_to_Installation_Tab({page})
securityPage.clickSecurityTab()
await page.waitForTimeout(2000);
expect(isWriteConfig_check_visible).toBe(true);
expect(isUploadConfig_check_visible).toBe(true);
expect(isInitSecurity_check_visible).toBe(true);
expect(isContinueCertificatesButtonEnabled).toBe(true);
})

test('Test Security Setup Pending', async ({ page }) => {
await page.waitForTimeout(5000);
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(5000);
const isContinueCertificatesButtonEnabled = await securityPage.isContinueButtonEnabled();
expect(isContinueCertificatesButtonEnabled).toBe(false);
await page.waitForTimeout(2000);
await electronApp.close()
await launch_Zen_and_Navigate_to_Installation_Tab({page})
securityPage.clickSecurityTab()
await page.waitForTimeout(2000);
expect(isContinueCertificatesButtonEnabled).toBe(false);
})

})
Loading

0 comments on commit c75dc59

Please sign in to comment.