Skip to content

Commit

Permalink
fixed system schema tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Celiant committed Feb 14, 2025
1 parent c94495d commit 016cf63
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 90 deletions.
35 changes: 10 additions & 25 deletions e2e-tests/cypress/e2e/ui-tests/pages/schemaPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const SchemaPageLocators = {
closeWindowButton: "[ng-reflect-label='Close']",
createButton: "[ng-reflect-label='Create']",
createTagButton: ' Create a Tag ',
activateButton: 'div.btn-approve',

//Inputs
schemaNameInput: "input[formcontrolname='name']",
Expand All @@ -47,19 +48,18 @@ const SchemaPageLocators = {
entityList: '[formcontrolname="entity"]',
entityOption: (entityType) => `li[aria-label=${entityType}]`,
compareSchemaName: 'div.schema-info-field-value',
activeStatus: "Active",




activateButton: 'div.btn-approve',

policyChooseInput: "mat-select[role='combobox']",
entityChoosing: 'mat-select[formcontrolname="entity"]',


policyComboboxItem: "span.mat-option-text",
dialogContainer: "mat-dialog-container",
activeStatus: "Active",
userEntity: 'mat-option[value="USER"]',
dialogActions: 'mat-dialog-actions',
};
Expand All @@ -83,7 +83,8 @@ export class SchemaPage {
})
Checks.waitForLoading();
}
createPolicySchema(schemaName) {

createSchema(schemaName) {
cy.get(SchemaPageLocators.schemaCreateButton).click();
cy.get(SchemaPageLocators.schemaNameInput).type(schemaName);
cy.get(SchemaPageLocators.dialogSaveButton).click();
Expand Down Expand Up @@ -125,7 +126,7 @@ export class SchemaPage {
cy.contains(name).first().parent().contains("Published").should("exist");
}

deletePolicySchema(name) {
deleteSchema(name) {
cy.contains(name).parent().find(SchemaPageLocators.menuSchemaButton).click();
cy.get(SchemaPageLocators.deleteSchemaButton).click();
cy.get(SchemaPageLocators.confirmDeleteButton).click();
Expand Down Expand Up @@ -207,6 +208,11 @@ export class SchemaPage {
cy.contains(tagName).should("not.exist");
}

activateSystemSchema(schemaNameForActivate) {
cy.contains(schemaNameForActivate).parent().find(SchemaPageLocators.activateButton).click();
cy.contains(schemaNameForActivate).parent().contains(SchemaPageLocators.activeStatus).should("exist");
}




Expand Down Expand Up @@ -250,27 +256,6 @@ export class SchemaPage {
cy.contains(schemaNameForDeletion).should("not.exist");
}

createSystemSchema(schemaName) {
cy.intercept(SchemaPageLocators.systemSchemasList).as(
"waitForSchemaList"
);
cy.contains('mat-label', 'Type').parent().parent().parent().click()
cy.contains(SchemaPageLocators.systemSchemaTabButton).click();
cy.get(SchemaPageLocators.schemaCreateButton).click();
cy.get(SchemaPageLocators.schemaNameInput).click().type(schemaName);
cy.get(SchemaPageLocators.entityChoosing).click();
cy.get(SchemaPageLocators.userEntity).click();
cy.get(SchemaPageLocators.dialogSaveButton).click();
cy.wait("@waitForSchemaList", { timeout: 10000 });
cy.contains(schemaName).should("exist");
}

activateSystemSchema(schemaNameForActivate) {
cy.contains(SchemaPageLocators.systemSchemaTabButton).click();
cy.contains(schemaNameForActivate).parent().find(SchemaPageLocators.activateButton).click();
cy.contains(schemaNameForActivate).parent().contains(SchemaPageLocators.activeStatus).should("exist");
}

activateOtherSystemSchema(schemaNameForActivate) {
cy.intercept(SchemaPageLocators.systemSchemasList).as(
"waitForSchemaList"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ context("Policy Schema Creation", { tags: ['ui'] }, () => {
})

it("create policy schema", () => {
schemaPage.createPolicySchema(schemaName);
schemaPage.createSchema(schemaName);
});

it("import policy schema IPFS", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ context("Policy Schema Operations", { tags: ['ui'] }, () => {

it("delete policy schema", () => {
schemaPage.filterByLastPolicy();
schemaPage.deletePolicySchema(schemaName);
schemaPage.deleteSchema(schemaName);
});

it("publish policy schema", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { SchemaPage } from "../../pages/schemaPage";
const schemaPage = new SchemaPage();

import { HomePage } from "../../pages/homePage";
const homePage = new HomePage();


context("System Schema Creation", { tags: ['ui'] }, () => {

const SRUsername = Cypress.env('SRUser');
const schemaName = "UISystemSchema";
const schemaName2 = "UISystemSchema2";

beforeEach(() => {
cy.viewport(1920, 1080);
homePage.visit();
homePage.login(SRUsername);
schemaPage.openSchemasTab();
schemaPage.openSchemasSubtab("System");
});

it("create system schema", () => {
schemaPage.createSchema(schemaName);
});

it("create system schema", () => {
schemaPage.createSchema(schemaName);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { SchemaPage } from "../../pages/schemaPage";
const schemaPage = new SchemaPage();

import { HomePage } from "../../pages/homePage";
const homePage = new HomePage();


context("System Schema Operations", { tags: ['ui'] }, () => {

const SRUsername = Cypress.env('SRUser');
const schemaName = "UISystemSchema";
const schemaName2 = "UISystemSchema2";

beforeEach(() => {
cy.viewport(1920, 1080);
homePage.visit();
homePage.login(SRUsername);
schemaPage.openSchemasTab();
schemaPage.openSchemasSubtab("System");
});

it("policy schema document view", () => {
schemaPage.documentView(schemaName);
});

it("delete system schema", () => {
schemaPage.deleteSchema(schemaName);
});

it("activate system schema", () => {
schemaPage.createSchema(schemaName2);
schemaPage.activateSystemSchema(schemaName2);
});
});

This file was deleted.

This file was deleted.

0 comments on commit 016cf63

Please sign in to comment.