Skip to content

Commit

Permalink
Updated tests as per the suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: sagar-1310 <[email protected]>
  • Loading branch information
sagaryadavs committed Nov 6, 2024
1 parent d1b4d64 commit 1a31019
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 101 deletions.
5 changes: 1 addition & 4 deletions playwright_test/Pages/certificates.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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;
Expand All @@ -10,10 +9,8 @@ class CertificatesPage {
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
}

commonPage = new CommonPage();

async getCertificatesPageTitle() {
await this.commonPage.waitForElement(this.pageTitle)
await this.page.waitForTimeout(500);
return await this.pageTitle.textContent({ timeout: 2000 });
}
}
Expand Down
38 changes: 0 additions & 38 deletions playwright_test/Pages/common.page.ts

This file was deleted.

60 changes: 29 additions & 31 deletions playwright_test/Pages/review.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Page, Locator } from '@playwright/test';
import CommonPage from './common.page';

class ReviewPage {
page: Page;
Expand All @@ -18,8 +17,8 @@ class ReviewPage {
cachingServiceTab: Locator;
launchConfigTab: Locator;
connectionTabSuccessfulIcon: Locator;
planningTabSuccessfulIcon: Locator;
installationTypeTabSuccessfulIcon: Locator;
planningTabPendingIcon: Locator;
installationTypeTabPendingIcon: Locator;
initializationTabPendingIcon: Locator;
installationTabPendingIcon: Locator;
networkingTabPendingIcon: Locator;
Expand All @@ -34,6 +33,7 @@ class ReviewPage {
finishInstallation: Locator;
editorTitleElement: Locator;
closeEditorButton: Locator;
readOnlyEditor: Locator

constructor(page: Page) {
this.page = page;
Expand All @@ -52,8 +52,8 @@ class ReviewPage {
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.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']")
Expand All @@ -68,123 +68,121 @@ class ReviewPage {
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]")
}

commonPage = new CommonPage();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

class StcsPage {
page: Page;
Expand All @@ -10,10 +9,9 @@ class StcsPage {
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
}

commonPage = new CommonPage();

async getStcsPageTitle() {
await this.commonPage.waitForElement(this.pageTitle)
await this.page.waitForTimeout(500);
return await this.pageTitle.textContent({ timeout: 2000 });
}
}
Expand Down
6 changes: 1 addition & 5 deletions playwright_test/Pages/vsam.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Page, Locator } from '@playwright/test';
import CommonPage from './common.page';

class VsamPage {
page: Page;
Expand All @@ -9,11 +8,8 @@ class VsamPage {
this.page = page;
this.pageTitle = page.locator("//div[@class='MuiBox-root css-la96ob']/div")
}

commonPage = new CommonPage();

async getVsamPageTitle() {
await this.commonPage.waitForElement(this.pageTitle)
await this.page.waitForTimeout(500);
return await this.pageTitle.textContent({ timeout: 2000 });
}
}
Expand Down
37 changes: 17 additions & 20 deletions playwright_test/Tests/Review.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test.describe('ReviewTab', () => {
}
});

test.beforeEach(async ({ page }) => {
test.beforeEach(async ({ page }) => {
test.setTimeout(900000);
electronApp = await electron.launch({ args: ['.webpack/main/index.js'] })
page = await electronApp.firstWindow()
Expand All @@ -71,25 +71,10 @@ test.describe('ReviewTab', () => {
launchConfigPage = new LaunchConfigPage(page);
reviewPage = new ReviewPage(page);
titlePage.navigateToConnectionTab()
await connectionPage.fillConnectionDetails(config.SSH_HOST, config.SSH_PORT, config.SSH_USER, config.SSH_PASSWD);
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()
await installationTypePage.downloadZowePaxAndNavigateToInstallationPage()
await installationTypePage.continueToUnpax()
await installationTypePage.skipUnpax()
await page.waitForTimeout(5000);
await page.waitForTimeout(2000);
reviewPage.clickReviewInstallationTab();
await page.waitForTimeout(5000);
})
Expand Down Expand Up @@ -197,8 +182,8 @@ test.describe('ReviewTab', () => {

test('Test Successful and Pending Operations Tabs', async ({ page }) => {
expect(reviewPage.connectionTabSuccessfulIcon).toBeTruthy()
expect(reviewPage.planningTabSuccessfulIcon).toBeTruthy()
expect(reviewPage.installationTypeTabSuccessfulIcon).toBeTruthy()
expect(reviewPage.planningTabPendingIcon).toBeTruthy()
expect(reviewPage.installationTypeTabPendingIcon).toBeTruthy()
expect(reviewPage.installationTabPendingIcon).toBeTruthy()
expect(reviewPage.networkingTabPendingIcon).toBeTruthy()
expect(reviewPage.apfAuthTabPendingIcon).toBeTruthy()
Expand All @@ -224,6 +209,18 @@ test.describe('ReviewTab', () => {
await page.waitForTimeout(2000);
})

test('Test If you can edit the Yaml', async ({ page }) => {
reviewPage.clickViewEditYaml()
await page.waitForTimeout(2000);
expect(reviewPage.editorTitleElement).toBeTruthy();
try {
await reviewPage.readOnlyEditor.fill('Trying to update content');
} catch (error) {
expect(error.message).toContain('Element is not an <input>, <textarea> or [contenteditable] element')
}
await page.waitForTimeout(2000);
})

test('Test View Job Output', async ({ page }) => {
reviewPage.clickViewJobOutput()
await page.waitForTimeout(2000);
Expand Down

0 comments on commit 1a31019

Please sign in to comment.