Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Review Page Tests #264

Merged
merged 8 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions playwright_test/Pages/apfAuth.page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Page,ElectronApplication, Locator,_electron as electron } from '@playwright/test';

Check failure on line 1 in playwright_test/Pages/apfAuth.page.ts

View workflow job for this annotation

GitHub Actions / lint

missing header

Check warning on line 1 in playwright_test/Pages/apfAuth.page.ts

View workflow job for this annotation

GitHub Actions / lint

'electron' is defined but never used
let electronApp: ElectronApplication

Check warning on line 2 in playwright_test/Pages/apfAuth.page.ts

View workflow job for this annotation

GitHub Actions / lint

'electronApp' is defined but never used

class ApfAuthPage{
page: Page;
pageTitle: Locator;
continueButtonSelector: Locator;
userNameInputSelector: Locator;
writeConfig_greenCheckXpath: Locator;
Expand Down Expand Up @@ -49,6 +50,7 @@

constructor(page: Page) {
this.page = page;
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
this.continueButtonSelector = page.locator('.MuiButton-containedPrimary.MuiButton-sizeMedium')
this.userNameInputSelector = page.locator('label:has-text("User Name") + div input#standard-required')
this.writeConfig_greenCheckXpath = page.locator('#card-download-progress-card svg.MuiSvgIcon-colorSuccess')
Expand Down Expand Up @@ -83,26 +85,25 @@
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.select_SMPE = page.getByLabel('//button[contains(text(),"SMP/E")]')
this.select_SMPE = page.locator('span:has-text("SMP/E")');

}
async returnTitleOfApfAuthPage(){
const ApfAuthTitle = await this.APFAUTH_TITLE.textContent();
return ApfAuthTitle;
return await this.pageTitle.textContent({ timeout: 2000 });
}

async movetoApfAuthPage(){
await this.click_ApfAuth.click({timeout: 9000})
}

async selectInstallationType(){
await this.select_SMPE.waitFor({ state: 'visible', timeout: 9000 }); // Adjust timeout if needed
console.log('SMP/E span is visible.');
await this.select_SMPE.click({timeout: 9000})
}

async movetoInstallationPage(){
await this.licenseAgreement.click({timeout: 9000})
await this.acceptLicense.click({timeout: 9000})
Expand Down
20 changes: 20 additions & 0 deletions playwright_test/Pages/certificates.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Page, Locator } from '@playwright/test';

Check failure on line 1 in playwright_test/Pages/certificates.page.ts

View workflow job for this annotation

GitHub Actions / lint

missing header
import CommonPage from './common.page';

class CertificatesPage {
page: Page;
pageTitle: Locator;

constructor(page: Page) {
this.page = page;
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
}

commonPage = new CommonPage();

async getCertificatesPageTitle() {
await this.commonPage.waitForElement(this.pageTitle)
return await this.pageTitle.textContent({ timeout: 2000 });
}
}
export default CertificatesPage;
38 changes: 38 additions & 0 deletions playwright_test/Pages/common.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Page, Locator, expect } from '@playwright/test';

Check failure on line 1 in playwright_test/Pages/common.page.ts

View workflow job for this annotation

GitHub Actions / lint

missing header

Check warning on line 1 in playwright_test/Pages/common.page.ts

View workflow job for this annotation

GitHub Actions / lint

'expect' is defined but never used

class CommonPage {
page: Page;

async getElementValue(element: Locator) {
const elementValue = await element.getAttribute('value')
return elementValue
}

async isElementHasValue(element: Locator): Promise<boolean> {
const elementValue = await element.getAttribute('value')
if (elementValue !== null && elementValue !== '') {
return true
} else {
return false
}
}

async validateElementValue(textBoxLocator: Locator, expectedValue: string): Promise<boolean> {
const insertedValue = await textBoxLocator.inputValue();
return insertedValue === expectedValue;
}

async waitForElement(locator: Locator) {
try {
await this.page.waitForTimeout(1000);
await locator.waitFor({ state: 'visible', timeout: 10000 });
} catch (error) {
console.error('Error while checking visibility of locator', error);
return false;
}
await this.page.waitForTimeout(2000);
}

}

export default CommonPage;
5 changes: 5 additions & 0 deletions playwright_test/Pages/connection.page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page,Locator } from '@playwright/test';

Check failure on line 1 in playwright_test/Pages/connection.page.ts

View workflow job for this annotation

GitHub Actions / lint

missing header

class ConnectionPage{
page: Page;
Expand Down Expand Up @@ -57,6 +57,11 @@
return await this.connectionPageTitle.textContent();
}

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

async SubmitValidateCredential(){
console.log("Submitting credentials...");
await this.page.waitForTimeout(1000);
Expand Down
7 changes: 4 additions & 3 deletions playwright_test/Pages/launchConfig.page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Page,ElectronApplication, Locator,_electron as electron } from '@playwright/test';

Check failure on line 1 in playwright_test/Pages/launchConfig.page.ts

View workflow job for this annotation

GitHub Actions / lint

missing header

Check warning on line 1 in playwright_test/Pages/launchConfig.page.ts

View workflow job for this annotation

GitHub Actions / lint

'electron' is defined but never used
let electronApp: ElectronApplication

Check warning on line 2 in playwright_test/Pages/launchConfig.page.ts

View workflow job for this annotation

GitHub Actions / lint

'electronApp' is defined but never used

class LaunchConfigPage{
page: Page;
pageTitle: Locator;
fillValidation: Locator;
logLevel: Locator;
fillLogLevel: Locator;
Expand All @@ -26,6 +27,7 @@

constructor(page: Page) {
this.page = page;
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
this.click_launchConfig = page.locator('//span[text()="Launch Config"]')
this.validation = page.getByLabel('Validation');
this.logLevel = page.getByLabel('LogLevel');
Expand Down Expand Up @@ -59,9 +61,8 @@
await this.continueToComponentInstallation.click({timeout: 5000})
await this.click_launchConfig.click({timeout: 5000})
}
async returnTitleOfConfPage(){
const apfAuth_title = await this.CONFPAGE_TITLE.textContent();
return apfAuth_title;
async getLaunchConfigurationPageTitle() {
return await this.pageTitle.textContent({ timeout: 2000 });
}
async fillvalues(validation:string){
await this.page.fill('input[id="#/properties/configmgr/properties/validation"]', validation, { timeout: 10000 });
Expand Down
17 changes: 7 additions & 10 deletions playwright_test/Pages/planning.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class PlanningPage{
return false;
}
}


async clickSaveAndClose(){
await this.saveAndClose.click({timeout: 15000});
Expand All @@ -223,7 +223,7 @@ class PlanningPage{

async clickContinueToInstallation(){
const timeout = 30000;
const interval = 100;
const interval = 100;
const startTime = Date.now();
const isButtonEnabled = async (): Promise<boolean> => {
return await this.isContinueToInstallationEnabled();
Expand Down Expand Up @@ -257,21 +257,18 @@ class PlanningPage{
await this.saveAndValidate.click();
await this.page.waitForTimeout(500);
}
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.enterRbacProfileIdentifier(profileIdentifier);
await this.enterJobName(jobname);
await this.enterJobPrefix(jobPrefix);
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);
}
Expand Down
190 changes: 190 additions & 0 deletions playwright_test/Pages/review.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
import { Page, Locator } from '@playwright/test';
import CommonPage from './common.page';

class ReviewPage {
page: Page;
pageTitle: Locator;
reviewInstallationTab: Locator;
connectionTab: Locator;
planningTab: Locator;
installationTypeTab: Locator;
initializationTab: Locator;
installationTab: Locator;
networkingTab: Locator;
apfAuthTab: Locator;
securityTab: Locator;
stcsTab: Locator;
certificatesTab: Locator;
cachingServiceTab: Locator;
launchConfigTab: Locator;
connectionTabSuccessfulIcon: Locator;
planningTabSuccessfulIcon: Locator;
installationTypeTabSuccessfulIcon: Locator;
initializationTabPendingIcon: Locator;
installationTabPendingIcon: Locator;
networkingTabPendingIcon: Locator;
apfAuthTabPendingIcon: Locator;
securityTabPendingIcon: Locator;
certificatesTabPendingIcon: Locator;
launchConfigTabPendingIcon: Locator;
viewEditYaml: Locator;
viewJobOutput: Locator;
saveAndClose: Locator;
previousStep: Locator;
finishInstallation: Locator;
editorTitleElement: Locator;
closeEditorButton: Locator;

constructor(page: Page) {
this.page = page;
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
this.reviewInstallationTab = page.locator("//span[text()='Review Installation']")
this.connectionTab = page.locator("//p[text()='Connection']")
this.planningTab = page.locator("//p[text()='Planning']")
this.installationTypeTab = page.locator("//p[text()='Installation Type']")
this.initializationTab = page.locator("//p[text()='Initialization']")
this.installationTab = page.locator("//p[text()='Installation']")
this.networkingTab = page.locator("//p[text()='Networking']")
this.apfAuthTab = page.locator("//p[text()='APF Auth']")
this.securityTab = page.locator("//p[text()='Security']")
this.stcsTab = page.locator("//p[text()='Stcs']")
this.certificatesTab = page.locator("//p[text()='Certificates']")
this.cachingServiceTab = page.locator("//p[text()='Caching Service']")
this.launchConfigTab = page.locator("//p[text()='Launch Config']")
this.connectionTabSuccessfulIcon = page.locator("//p[text()='Connection']/following-sibling::*[@data-testid='CheckCircleIcon']")
this.planningTabSuccessfulIcon = page.locator("//p[text()='Planning']/following-sibling::*[@data-testid='CheckCircleIcon']")
this.installationTypeTabSuccessfulIcon = page.locator("//p[text()='Installation Type']/following-sibling::*[@data-testid='CheckCircleIcon']")
this.initializationTabPendingIcon = page.locator("//p[text()='Initialization']/following-sibling::*[@data-testid='WarningIcon']")
this.installationTabPendingIcon = page.locator("//p[text()='Installation']/following-sibling::*[@data-testid='WarningIcon']")
this.networkingTabPendingIcon = page.locator("//p[text()='Networking']/following-sibling::*[@data-testid='WarningIcon']")
this.apfAuthTabPendingIcon = page.locator("//p[text()='APF Auth']/following-sibling::*[@data-testid='WarningIcon']")
this.securityTabPendingIcon = page.locator("//p[text()='Security']/following-sibling::*[@data-testid='WarningIcon']")
this.certificatesTabPendingIcon = page.locator("//p[text()='Certificates']/following-sibling::*[@data-testid='WarningIcon']")
this.launchConfigTabPendingIcon = page.locator("//p[text()='Launch Config']/following-sibling::*[@data-testid='WarningIcon']")
this.viewEditYaml = page.locator("//button[text()='View Yaml']")
this.viewJobOutput = page.locator("//button[text()='View Job Output']")
this.saveAndClose = page.locator("//button[text()='Save & close']")
this.previousStep = page.locator("//button[text()='Previous step']")
this.finishInstallation = page.locator("//button[text()='Finish Installation']")
this.editorTitleElement = page.locator("//h2[text()='Editor']")
this.closeEditorButton = page.locator("//button[text()='Close']")
}

commonPage = new CommonPage();

async getReviewPageTitle() {
await this.commonPage.waitForElement(this.pageTitle)
return await this.pageTitle.textContent({ timeout: 2000 });
}

async clickReviewInstallationTab() {
await this.commonPage.waitForElement(this.reviewInstallationTab)
await this.reviewInstallationTab.click();
}

async clickConnectionTab() {
await this.commonPage.waitForElement(this.connectionTab)
await this.connectionTab.click();
}

async clickPlanningTab() {
await this.commonPage.waitForElement(this.planningTab)
await this.planningTab.click();
}

async clickInstallationTypeTab() {
await this.commonPage.waitForElement(this.installationTypeTab)
await this.installationTypeTab.click();
}

async clickInstallationTab() {
await this.commonPage.waitForElement(this.installationTab)
await this.installationTab.click();
}

async clickNetworkingTab() {
await this.commonPage.waitForElement(this.networkingTab)
await this.networkingTab.click();
}

async clickApfAuthTab() {
await this.commonPage.waitForElement(this.apfAuthTab)
await this.apfAuthTab.click();
}

async clickSecurityTab() {
await this.commonPage.waitForElement(this.securityTab)
await this.securityTab.click();
}

async clickStcsTab() {
await this.commonPage.waitForElement(this.stcsTab)
await this.stcsTab.click();
}

async clickCertificatesTab() {
await this.commonPage.waitForElement(this.certificatesTab)
await this.certificatesTab.click();
}

async clickCachingServiceTab() {
await this.commonPage.waitForElement(this.cachingServiceTab)
await this.cachingServiceTab.click();
}

async clickLaunchConfigTab() {
await this.commonPage.waitForElement(this.launchConfigTab)
await this.launchConfigTab.click();
}

async clickViewEditYaml() {
await this.commonPage.waitForElement(this.viewEditYaml)
await this.viewEditYaml.click();
}

async clickViewJobOutput() {
await this.commonPage.waitForElement(this.viewJobOutput)
await this.viewJobOutput.click();
await this.page.waitForTimeout(2000);
}

async clickSaveAndClose() {
await this.commonPage.waitForElement(this.saveAndClose)
await this.saveAndClose.click({ timeout: 2000 });
}

async clickPreviousStep() {
await this.commonPage.waitForElement(this.previousStep)
await this.previousStep.click();
}

async clickFinishInstallation() {
await this.commonPage.waitForElement(this.finishInstallation)
await this.finishInstallation.click();
}

async isFinishInstallationDisabled() {
await this.commonPage.waitForElement(this.finishInstallation)
return await this.finishInstallation.isDisabled()
}

async isFinishInstallationEnabled() {
await this.commonPage.waitForElement(this.finishInstallation)
return await this.finishInstallation.isEnabled()
}

async open_monacoEditor() {
await this.commonPage.waitForElement(this.viewEditYaml)
this.viewEditYaml.click({ timeout: 2000 })
await this.commonPage.waitForElement(this.editorTitleElement)
const editor_title = await this.editorTitleElement.textContent();
return editor_title;
}

async clickCloseEditor() {
await this.commonPage.waitForElement(this.closeEditorButton)
await this.closeEditorButton.click();
}

}
export default ReviewPage;
Loading
Loading