forked from hashgraph/guardian
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created UI automation cypress scripts for the Policies flow hashgraph…
…#2266 : -Edit -Import (via file) -Return to Edit -Export -Add tags Created UI Automation scripts for import and delete Artifacts hashgraph#2270 Created UI automation scripts for the Module hashgraph#2272 : -edit -export -import Created UI automation scripts for Administration hashgraph#2273 : -Settings -Logs and Status Created UI Automation scripts for Policy Editing hashgraph#2275 : Signed-off-by: lozytskyiintellecteu <[email protected]>
- Loading branch information
1 parent
d4f9fcd
commit 72ef47c
Showing
37 changed files
with
1,423 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
node_modules/ | ||
fixtures/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import ASSERT from "../../../support/CustomHelpers/assertions"; | ||
import TIMEOUTS from "../../../support/CustomHelpers/timeouts"; | ||
import URL from "../../../support/GuardianUrls"; | ||
|
||
const ArtifactsPageLocators = { | ||
modalWindow: 'mat-dialog-container[id*="mat-dialog"]', | ||
uploadFileInput: '[dropzoneclassname="file-drop-zone"] input[type="file"]', | ||
artifactsList: "/api/v1/artifacts?policyId=&pageIndex=0&pageSize=100", | ||
dialogContainer: '.mat-dialog-container', | ||
}; | ||
|
||
export class ArtifactsPage { | ||
|
||
openArtifactsTab() { | ||
cy.visit(URL.Root + URL.Artifacts); | ||
} | ||
|
||
static waitForArtifactsList(){ | ||
cy.intercept(ArtifactsPageLocators.artifactsList).as( | ||
"waitForArtifactsList" | ||
); | ||
cy.wait("@waitForArtifactsList", { timeout: 300000 }) | ||
} | ||
|
||
uploadFile(fileName) { | ||
cy.get(ArtifactsPageLocators.modalWindow, { timeout: 30000 }).should('be.visible'); | ||
cy.fixture(fileName, { encoding: null }).as("myFixture"); | ||
cy.get(ArtifactsPageLocators.uploadFileInput).selectFile("@myFixture", { force: true }); | ||
} | ||
|
||
checkArtifactsTableContains(text) { | ||
cy.contains("td", text).should("be.visible"); | ||
} | ||
|
||
checkArtifactsTableIsNotContains(text) { | ||
cy.contains("td", text).should("not.exist"); | ||
} | ||
|
||
deleteArtifact(name) { | ||
cy.contains("td", name) | ||
.siblings() | ||
.contains("div", "delete") | ||
.click({ force: true }); | ||
cy.get(ArtifactsPageLocators.dialogContainer).contains(new RegExp("^OK$", "g")).click({ force: true }); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import URL from "../../../support/GuardianUrls"; | ||
|
||
const LogsPageLocators = { | ||
LogModal: '.cdk-overlay-pane', | ||
detailsBtn: '.btn-settings', | ||
apllyBtn: 'button[type="submit"]', | ||
messageField: '[formcontrolname="message"]', | ||
messageColumn: '.cdk-column-message .long-message', | ||
typeSelect: '[formcontrolname="type"]', | ||
typeDefaultOption: '[formcontrolname="type"] .mat-select-min-line', | ||
typeOption: '.mat-option-text', | ||
logType: '.log-type', | ||
tableBody: 'tbody tr', | ||
calendarIcon: '[aria-label="Open calendar"]', | ||
todayDate: '.mat-calendar-body-today', | ||
attributesSelect: '[formcontrolname="attributes"]', | ||
attributesInput: '[ng-reflect-placeholder="Attributes"]', | ||
attributesOption: '[role="option"]', | ||
attributeReflect: '[ng-reflect-name="attributes"]', | ||
startDate: '[formcontrolname="startDate"]', | ||
endDate: '[formcontrolname="endDate"]', | ||
}; | ||
|
||
export class LogsPage { | ||
|
||
openLogsTab() { | ||
cy.visit(URL.Root + URL.Logs); | ||
} | ||
|
||
openDetailsModal() { | ||
cy.get(LogsPageLocators.detailsBtn).first().click(); | ||
} | ||
|
||
verifyLogModalIsDisplayed() { | ||
cy.get(LogsPageLocators.LogModal).should('be.visible'); | ||
cy.contains("Log Details").should('be.visible'); | ||
cy.get('[formcontrolname="type"]').should('be.visible'); | ||
cy.get('[formcontrolname="datetime"]').should('be.visible'); | ||
cy.get('[formcontrolname="message"]').should('be.visible'); | ||
cy.get('[formcontrolname="attributes"]').should('be.visible'); | ||
} | ||
|
||
fillMessageField(message) { | ||
cy.get(LogsPageLocators.messageField).type(message); | ||
} | ||
|
||
clickOnApplyButton() { | ||
cy.get(LogsPageLocators.apllyBtn).click(); | ||
cy.wait(500); | ||
} | ||
|
||
verifyIfMessageColumnContains(message) { | ||
cy.get(LogsPageLocators.messageColumn).each(($el) => { | ||
cy.wrap($el).contains(message); | ||
}); | ||
} | ||
|
||
selectMessageType(type) { | ||
cy.get(LogsPageLocators.typeSelect).click(); | ||
cy.get(LogsPageLocators.typeOption).contains(type).click(); | ||
} | ||
|
||
verifyIfTypeColumnContains(type) { | ||
cy.get("tbody").then($tbody => { | ||
if ($tbody.find("tr").length > 0) { | ||
cy.get(LogsPageLocators.logType).each(($el) => { | ||
cy.wrap($el).contains(type); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
openDateRangePicker() { | ||
cy.get(LogsPageLocators.calendarIcon).click(); | ||
} | ||
|
||
selectTodayDate() { | ||
cy.get(LogsPageLocators.todayDate).click(); | ||
cy.get(LogsPageLocators.todayDate).click(); | ||
} | ||
|
||
selectFirstOptionInAttributes() { | ||
cy.get(LogsPageLocators.attributesSelect).click(); | ||
cy.get(LogsPageLocators.attributesOption).first().click(); | ||
} | ||
|
||
verifyThatLogsTableIsNotEmpty() { | ||
cy.get(LogsPageLocators.tableBody).should('not.be.empty'); | ||
} | ||
|
||
clickOnButton(buttonName) { | ||
cy.contains(buttonName).click(); | ||
} | ||
|
||
verifyIfMessageFieldIsEmpty() { | ||
cy.get(LogsPageLocators.messageField).should('have.value', ''); | ||
} | ||
|
||
verifyIfTypeFieldHasDefaultValue() { | ||
cy.get(LogsPageLocators.typeDefaultOption).contains('All').should("be.visible"); | ||
} | ||
|
||
verifyIfDateRangeFieldIsEmpty() { | ||
cy.get(LogsPageLocators.startDate).should('have.value', ''); | ||
cy.get(LogsPageLocators.endDate).should('have.value', ''); | ||
} | ||
|
||
verifyIfAttributeFieldIsEmpty() { | ||
cy.get(LogsPageLocators.attributeReflect).should(($element) => { | ||
expect($element).not.to.have.attr('role', 'listbox'); | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.