Skip to content

Commit

Permalink
Added test in stcs and vsam tab to read yaml
Browse files Browse the repository at this point in the history
Signed-off-by: hpathak <[email protected]>
  • Loading branch information
hpathak committed Oct 10, 2024
1 parent 10d9ad4 commit e5677b5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 60 deletions.
64 changes: 23 additions & 41 deletions playwright_test/Tests/Stcs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import SecurityPage from '../Pages/security.page.ts'
import StcsPage from '../Pages/stcs.page.ts'
import config from '../utils/config';
import ApfAuthPage from '../Pages/ApfAuth.page';
import { runSSHCommand } from '../utils/sshUtils';
import { connectArgs, Script } from '../setup';


let electronApp: ElectronApplication
const STCS_TITLE = 'Stcs'
const SECURITY_TITLE = 'Security';
const CERTIFICATE_TITLE = 'Certificates'

const script = new Script();

test.describe('StcsTab', () => {
let connectionPage: ConnectionPage;
Expand Down Expand Up @@ -97,13 +98,14 @@ test.describe('StcsTab', () => {
await electronApp.close()
})


test('test title and required fields of page', async ({ page }) => {
const title = await stcsPage.returnTitleOfStcsPage();
expect(title).toBe(STCS_TITLE);
await expect(stcsPage.zis).toBeTruthy()
await expect(stcsPage.zowe).toBeTruthy()
await expect(stcsPage.aux).toBeTruthy()
await expect(stcsPage.dataset_proclib).toBeTruthy()
const title = await stcsPage.returnTitleOfStcsPage();
expect(title).toBe(STCS_TITLE);
await expect(stcsPage.zis).toBeTruthy()
await expect(stcsPage.zowe).toBeTruthy()
await expect(stcsPage.aux).toBeTruthy()
await expect(stcsPage.dataset_proclib).toBeTruthy()
})

test('test values match with previous step', async ({ page }) => {
Expand All @@ -121,22 +123,17 @@ test.describe('StcsTab', () => {
expect(Aux_Value).toBe(aux_value);
})
test('verify yaml updated on zos', async ({ page }) => {
const command = `cat ${process.env.ZOWE_ROOT_DIR}/zowe.yaml`;

try {
const yaml = await runSSHCommand(command);
expect(yaml).toContain(config.SECURITY_AUX);
expect(yaml).toContain(config.SECURITY_STC_ZOWE);
expect(yaml).toContain(config.SECURITY_STC_ZIS);
} catch (error) {
console.error('Error executing command:', error.message);
}
const result = await script.runCommand(`cat ${process.env.ZOWE_ROOT_DIR}/zowe.yaml`);
await expect(result.details).toContain(config.SECURITY_AUX);
await expect(result.details).toContain(config.SECURITY_STC_ZOWE);
await expect(result.details).toContain(config.SECURITY_STC_ZIS);
});


test('Test view yaml button', async ({ page }) => {
await stcsPage.viewYaml()
await expect(stcsPage.editor_title_element).toBeTruthy();
await stcsPage.closeButton()
await stcsPage.viewYaml()
await expect(stcsPage.editor_title_element).toBeTruthy();
await stcsPage.closeButton()
})

test('Test view job', async ({ page }) => {
Expand All @@ -162,19 +159,9 @@ test.describe('StcsTab', () => {

test('Test continue to certificate button is disable', async ({ page }) => {
const is_ContinueButtonDisable = await stcsPage.isContinueButtonDisable();
expect(is_ContinueButtonDisable).toBe(true);
await expect(is_ContinueButtonDisable).toBe(true);
})

test('Test yaml should be updated', async ({ page }) => {
await stcsPage.viewYaml();
await expect(stcsPage.editor_title_element).toBeTruthy();
const yaml = await stcsPage.read_yaml();
expect(yaml).toContain(config.SECURITY_AUX);
expect(yaml).toContain(config.SECURITY_STC_ZOWE);
expect(yaml).toContain(config.SECURITY_STC_ZIS);

})

test('Test Resume Progress', async ({ page }) => {
await stcsPage.click_saveAndClose()
await titlePage.clickOnResumeProgress()
Expand All @@ -194,16 +181,11 @@ test.describe('StcsTab', () => {

test('verify stcs applied successfully on zos after initialization', async ({ page }) => {
await stcsPage.initializeSTC()
const command = `tsocmd "LISTDS '${config.PROC_LIB}' MEMBERS"`;

try {
const yaml = await runSSHCommand(command);
expect(yaml).toContain(config.SECURITY_AUX);
expect(yaml).toContain(config.SECURITY_STC_ZOWE);
expect(yaml).toContain(config.SECURITY_STC_ZIS);
} catch (error) {
console.error('Error executing command:', error.message);
}
const result = await script.runCommand(`tsocmd "LISTDS '${config.PROC_LIB}' MEMBERS"`);
await expect(result.details).toContain(config.SECURITY_AUX);
await expect(result.details).toContain(config.SECURITY_STC_ZOWE);
await expect(result.details).toContain(config.SECURITY_STC_ZIS);

// verify all checks are sucessfully checked
const isWriteConfig_check_visible = await stcsPage.isWriteConfigGreenCheckVisible();
expect(isWriteConfig_check_visible).toBe(true);
Expand Down
29 changes: 11 additions & 18 deletions playwright_test/Tests/Vsam.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import StcsPage from '../Pages/stcs.page.ts'
import config from '../utils/config';
import ApfAuthPage from '../Pages/ApfAuth.page';
import VsamPage from '../Pages/Vsam.page';
import { runSSHCommand } from '../utils/sshUtils';
import { connectArgs, Script } from '../setup';


let electronApp: ElectronApplication
const VSAM_TITLE = 'Vsam'
const CERTIFICATE_TITLE = 'Certificates';
const LAUNCHCONFIG_TITLE = 'Configuration'
const INVALID_ERRORMSG = 'Invalid input. Please enter a valid VSAM dataset name.'
const script = new Script()

test.describe('VsamPage', () => {
let connectionPage: ConnectionPage;
Expand Down Expand Up @@ -153,15 +154,11 @@ test.describe('VsamPage', () => {
test('Test NONRLS YAML Update on z/OS After Init', async ({ page }) => {
await vsamPage.fillVsamDetails('NONRLS',config.VOLUME,'', config.VSAM_DATASET_NAME)
await vsamPage.initializeVSAM();
const command = `cat ${process.env.ZOWE_ROOT_DIR}/zowe.yaml`;
try {
const yaml = await runSSHCommand(command);
expect(yaml).toContain('NONRLS');
expect(yaml).toContain(config.VOLUME);
expect(yaml).toContain(config.VSAM_DATASET_NAME);
} catch (error) {
console.error('Error executing command:', error.message);
}
const result = await script.runCommand(`cat ${process.env.ZOWE_ROOT_DIR}/zowe.yaml`);
await expect(result.details).toContain('NONRLS');
await expect(result.details).toContain(config.VOLUME);
await expect(result.details).toContain(config.VSAM_DATASET_NAME);

const isWriteConfig_check_visible = await vsamPage.isWriteConfigGreenCheckVisible();
expect(isWriteConfig_check_visible).toBe(true);
const isUploadConfig_check_visible = await vsamPage.isUploadConfigGreenCheckVisible();
Expand All @@ -173,14 +170,10 @@ test.describe('VsamPage', () => {
test('Verify VSAM dataset was successfully created on z/OS.', async ({ page }) => {
await vsamPage.fillVsamDetails('RLS',config.VOLUME,'', config.VSAM_DATASET_NAME)
await vsamPage.initializeVSAM();
const command = `tso "LISTCAT"`;

try {
const yaml = await runSSHCommand(command);
expect(yaml).toContain(config.VSAM_DATASET_NAME);
} catch (error) {
console.error('Error executing command:', error.message);
}
const result = await script.runCommand(`tso "LISTCAT"`);

await expect(result.details).toContain(config.VSAM_DATASET_NAME);

});

test('Test save and close and Resume Progress', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright_test/prepare.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Script = require('./setup.js');
import { connectArgs, Script } from './setup';

async function prepareEnvironment(options = {}) {
const { install = false, remove = false } = options;
Expand Down

0 comments on commit e5677b5

Please sign in to comment.