Skip to content

Commit

Permalink
Added state management tests for Planning and Installation Type Tabs
Browse files Browse the repository at this point in the history
Signed-off-by: sagar-1310 <[email protected]>
  • Loading branch information
sagaryadavs committed Nov 15, 2024
1 parent f2a06ae commit 0505031
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 416 deletions.
27 changes: 20 additions & 7 deletions playwright_test/Pages/apfAuth.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 Down Expand Up @@ -41,6 +42,11 @@ class ApfAuthPage{
dataset_prefix_value:Locator;
apf_auth_tab: Locator;






constructor(page: Page) {
this.page = page;
this.continueButtonSelector = page.locator('.MuiButton-containedPrimary.MuiButton-sizeMedium')
Expand Down Expand Up @@ -82,8 +88,13 @@ class ApfAuthPage{

//this.select_SMPE = page.getByLabel('//button[contains(text(),"SMP/E")]')
this.select_SMPE = page.locator('span:has-text("SMP/E")');

this.apf_auth_tab = page.locator("//span[text()='APF Auth']")
}

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

async returnTitleOfApfAuthPage(){
const ApfAuthTitle = await this.APFAUTH_TITLE.textContent();
return ApfAuthTitle;
Expand All @@ -94,6 +105,13 @@ class ApfAuthPage{
await this.click_ApfAuth.click({timeout: 9000})
}

async movetoInstallationPage(){
await this.page.waitForTimeout(5000)
await this.click_Installation.click({timeout: 9000})
}
async isContinueButtonEnabled(){
return await this.continue_security_setup.isEnabled();
}
async selectInstallationType(){
await this.select_SMPE.waitFor({ state: 'visible', timeout: 9000 }); // Adjust timeout if needed
console.log('SMP/E span is visible.');
Expand Down Expand Up @@ -174,14 +192,9 @@ class ApfAuthPage{
return editor_title;
}

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

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

async click_saveAndClose(){
this.save_and_close.click({ timeout: 2000 })
}
Expand Down
5 changes: 5 additions & 0 deletions playwright_test/Pages/connection.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class ConnectionPage{
return await this.connectionPageTitle.textContent();
}

async fillPassword(password: string){
await this.page.waitForTimeout(2000);
await this.password.fill(password);
}

async SubmitValidateCredential(){
console.log("Submitting credentials...");
await this.validateCredential.click();
Expand Down
18 changes: 14 additions & 4 deletions playwright_test/Pages/installationType.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class InstallationTypePage{
validateLocationGreenCheck: Locator;
licenseAgreementGreenCheck: Locator;
disagreeLicense: Locator;

installation_Type_Tab: Locator;
continueToUnpaxButton: Locator;

constructor(page: Page) {
this.page = page;
Expand All @@ -33,7 +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()='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']")
Expand All @@ -42,12 +43,17 @@ class InstallationTypePage{
this.retrieveExampleZoweYaml = page.locator("//button[contains(text(),'Retrieve example-zowe.yaml')]")

Check failure on line 43 in playwright_test/Pages/installationType.page.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
this.continueCompInstallation = page.locator("//button[contains(text(),'Continue to Components Installation')]")

Check failure on line 44 in playwright_test/Pages/installationType.page.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
this.skipUnpaxButton = page.locator("//button[text()='Skip ']")

Check failure on line 45 in playwright_test/Pages/installationType.page.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
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 });
}
Expand Down Expand Up @@ -200,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(){
Expand Down
24 changes: 20 additions & 4 deletions playwright_test/Pages/planning.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,23 @@ class PlanningPage{
await this.previousStep.click();
}

private async waitForContinueButtonToBeEnabled(): Promise<boolean> {
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;
Expand Down Expand Up @@ -271,19 +288,18 @@ class PlanningPage{
}


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){
async fillPlanningPageWithRequiredFields(runtimeDir: any, workspaceDir: any, extensionDir: any, logDir: any, javaLocation:any,nodejsLocation:any,zOSMFHost:any,zOSMFPort:any,zOSMFAppID:any){
await this.clickSaveValidate();
await this.enterRuntimeDir(runtimeDir);
await this.enterWorkspaceDir(workspaceDir);
await this.enterLogsDir(logDir);
await this.enterExtensionsDir(extensionDir);
await this.enterJavaLocation(javaLocation);
await this.enterNodeJsLocation(nodejsLocation);
//await this.enterZosmfHost(zOSMFHost);
//await this.enterZosmfPort(zOSMFPort);
await this.enterZosmfHost(zOSMFHost);
await this.enterZosmfPort(zOSMFPort);
await this.enterZosmfApplicationId(zOSMFAppID);
await this.page.waitForTimeout(2000);
}

}
export default PlanningPage;
14 changes: 2 additions & 12 deletions playwright_test/Pages/security.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class SecurityPage{
product: Locator;
APFAUTH_TITLE: Locator;
continueToComponentInstallation: Locator;
security_tab: Locator;



constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -66,9 +67,6 @@ class SecurityPage{
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.security_tab = page.locator("//span[text()='Security']")
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');

Expand Down Expand Up @@ -102,10 +100,6 @@ class SecurityPage{

}

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

async fillAdmin(admin:string){
await this.admin.fill(admin,{ timeout: 10000 })
}
Expand Down Expand Up @@ -179,10 +173,6 @@ 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
8 changes: 4 additions & 4 deletions playwright_test/Tests/Planning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test.describe('PlanningTab', () => {
})

test('Test Validate Locations with Valid Data', async () => {
await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR,
await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR,
config.ZOWE_WORKSPACE_DIR,
config.ZOWE_EXTENSION_DIR,
config.ZOWE_LOG_DIR,
Expand Down Expand Up @@ -125,10 +125,10 @@ test.describe('PlanningTab', () => {
const is_Continue_Button_enable = await planningPage.isContinueToInstallationDisabled();
expect(is_Continue_Button_enable).toBe(true);
})


test('Test Save and Close and Resume Progress', async () => {
await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR,
await planningPage.fillPlanningPageWithRequiredFields(config.ZOWE_ROOT_DIR,
config.ZOWE_WORKSPACE_DIR,
config.ZOWE_EXTENSION_DIR,
config.ZOWE_LOG_DIR,
Expand All @@ -139,7 +139,7 @@ test.describe('PlanningTab', () => {
config.ZOSMF_APP_ID
);
await planningPage.clickValidateLocations()
await planningPage.click_saveAndClose()
await planningPage.click_saveAndClose()
await titlePage.clickOnResumeProgress();
await connectionPage.fillConnectionDetails(config.SSH_HOST, config.SSH_PORT, config.SSH_USER, config.SSH_PASSWD);
await connectionPage.SubmitValidateCredential();
Expand Down
Loading

0 comments on commit 0505031

Please sign in to comment.