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 all 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
23 changes: 11 additions & 12 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('//*[@id="box-download-progress-card"][1]')
Expand Down Expand Up @@ -85,34 +87,31 @@
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.page.waitForTimeout(500)
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.');
await this.select_SMPE.click({timeout: 9000})
}


async movetoInstallationPage(){
await this.licenseAgreement.click({timeout: 9000})
await this.acceptLicense.click({timeout: 9000})
await this.continueToComponentInstallation.click({timeout: 5000})
}

async fillApfDetails(datasetPrefix:string, authLoadLib:string,authpluginLib:string){
await this.page.waitForTimeout(500)
Expand All @@ -120,8 +119,8 @@
await this.page.waitForTimeout(500)
await this.authLoadLib.fill(authLoadLib);
await this.authpluginLib.fill(authpluginLib);
await this.page.waitForTimeout(5000)

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

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs

}
async initializeApfauth(){
await this.initApfauth.click()
Expand Down
17 changes: 17 additions & 0 deletions playwright_test/Pages/certificates.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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

class CertificatesPage {
page: Page;
pageTitle: Locator;

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

async getCertificatesPageTitle() {
await this.page.waitForTimeout(500);
return await this.pageTitle.textContent({ timeout: 2000 });
}
}
export default CertificatesPage;
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.validateCredential.click();
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 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.reviewPage_title = page.locator('//span[text()="Review Installation"]')
this.validation = page.getByLabel('Validation');
Expand Down Expand Up @@ -57,9 +59,8 @@
async movetoLaunchConfigPage(){
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){
const inputLocator = this.page.locator('//html/body/div/div[2]/div/div[4]/div/form/div/div[2]/div/div[1]/div/div[2]/div/div/div/div/div/div/div/div/div/input');
Expand Down
38 changes: 17 additions & 21 deletions playwright_test/Pages/planning.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Locator, Page } from '@playwright/test';
let page: Page;

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

View workflow job for this annotation

GitHub Actions / lint

'page' is defined but never used

class PlanningPage{
page: Page;
Expand Down Expand Up @@ -222,32 +222,28 @@
await this.page.waitForTimeout(500);
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

async clickContinueToInstallation(){
const timeout = 30000;
const interval = 100;
const startTime = Date.now();
const isButtonEnabled = async (): Promise<boolean> => {
return await this.isContinueToInstallationEnabled();
};
while (!(await isButtonEnabled())) {
if (Date.now() - startTime > timeout) {
throw new Error('Timed out waiting for the button to be enabled.');
}
await this.page.waitForTimeout(interval);
await new Promise(resolve => setTimeout(resolve, interval));
}

console.log("Continue button did not enabled ");
return false; // Button did not become enabled
}

async clickContinueToInstallation(): Promise<void> {
await this.continueInstallationOptions.click();
}

async isContinueToInstallationDisabled(){
await this.page.waitForTimeout(500);
return await this.continueInstallationOptions.isDisabled()
}

async isContinueToInstallationEnabled(){
await this.page.waitForTimeout(500);
return await this.continueInstallationOptions.isEnabled()
Expand All @@ -267,8 +263,8 @@
await this.saveAndValidate.click();
await this.page.waitForTimeout(500);
}


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);
Expand All @@ -277,8 +273,8 @@
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);
}
Expand Down
188 changes: 188 additions & 0 deletions playwright_test/Pages/review.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
import { Page, Locator } from '@playwright/test';

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;
planningTabPendingIcon: Locator;
installationTypeTabPendingIcon: 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;
readOnlyEditor: 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.planningTabPendingIcon = page.locator("//p[text()='Planning']/following-sibling::*[@data-testid='WarningIcon']")
this.installationTypeTabPendingIcon = page.locator("//p[text()='Installation Type']/following-sibling::*[@data-testid='WarningIcon']")
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']")
this.readOnlyEditor = page.locator("//h2[text()='Editor']/following-sibling::div[1]//div[@class='view-lines monaco-mouse-cursor-text']/div[1]")
}

async getReviewPageTitle() {
await this.page.waitForTimeout(500);
return await this.pageTitle.textContent({ timeout: 2000 });
}

async clickReviewInstallationTab() {
await this.page.waitForTimeout(500);
await this.reviewInstallationTab.click();
}

async clickConnectionTab() {
await this.page.waitForTimeout(500);
await this.connectionTab.click();
}

async clickPlanningTab() {
await this.page.waitForTimeout(500);
await this.planningTab.click();
}

async clickInstallationTypeTab() {
await this.page.waitForTimeout(500);
await this.installationTypeTab.click();
}

async clickInstallationTab() {
await this.page.waitForTimeout(500);
await this.installationTab.click();
}

async clickNetworkingTab() {
await this.page.waitForTimeout(500);
await this.networkingTab.click();
}

async clickApfAuthTab() {
await this.page.waitForTimeout(500);
await this.apfAuthTab.click();
}

async clickSecurityTab() {
await this.page.waitForTimeout(500);
await this.securityTab.click();
}

async clickStcsTab() {
await this.page.waitForTimeout(500);
await this.stcsTab.click();
}

async clickCertificatesTab() {
await this.page.waitForTimeout(500);
await this.certificatesTab.click();
}

async clickCachingServiceTab() {
await this.page.waitForTimeout(500);
await this.cachingServiceTab.click();
}

async clickLaunchConfigTab() {
await this.page.waitForTimeout(500);
await this.launchConfigTab.click();
}

async clickViewEditYaml() {
await this.page.waitForTimeout(500);
await this.viewEditYaml.click();
}

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

async clickSaveAndClose() {
await this.page.waitForTimeout(500);
await this.saveAndClose.click({ timeout: 2000 });
}

async clickPreviousStep() {
await this.page.waitForTimeout(500);
await this.previousStep.click();
}

async clickFinishInstallation() {
await this.page.waitForTimeout(500);
await this.finishInstallation.click();
}

async isFinishInstallationDisabled() {
await this.page.waitForTimeout(500);
return await this.finishInstallation.isDisabled()
}

async isFinishInstallationEnabled() {
await this.page.waitForTimeout(500);
return await this.finishInstallation.isEnabled()
}

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

async clickCloseEditor() {
await this.page.waitForTimeout(500);
await this.closeEditorButton.click();
}
}
export default ReviewPage;
Loading
Loading