Skip to content

Commit

Permalink
Fixes acceptance tests -- Message has been removed from violations pa…
Browse files Browse the repository at this point in the history
…ge (#1322)

* Fixes acceptance tests -- Message has been removed from violations page

* actually fix selectors

Co-authored-by: Saeed Fazal <[email protected]>
  • Loading branch information
foot and saeedfazal authored Aug 19, 2022
1 parent c714054 commit c63dd91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
12 changes: 5 additions & 7 deletions test/acceptance/test/pages/violations_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type ViolationsPage struct {

type ViolationInformation struct {
NameMgmtUI *agouti.Selection
Message *agouti.Selection
Severity *agouti.Selection
ValidatedPolicy *agouti.Selection
Cluster *agouti.Selection
Expand Down Expand Up @@ -42,12 +41,11 @@ func (v ViolationsPage) FindViolationInList(violationMsg string) *ViolationInfor
violation := v.ViolationList.FirstByXPath(fmt.Sprintf(`//tr[.//a[contains(text(), "%s")]]`, violationMsg))
return &ViolationInformation{
NameMgmtUI: violation.FindByXPath(`td[1]//a`),
Message: violation.FindByXPath(`td[2]`),
Severity: violation.FindByXPath(`td[3]`),
ValidatedPolicy: violation.FindByXPath(`td[4]`),
Cluster: violation.FindByXPath(`td[5]`),
Time: violation.FindByXPath(`td[6]`),
Application: violation.FindByXPath(`td[7]`),
Severity: violation.FindByXPath(`td[2]`),
ValidatedPolicy: violation.FindByXPath(`td[3]`),
Cluster: violation.FindByXPath(`td[4]`),
Time: violation.FindByXPath(`td[5]`),
Application: violation.FindByXPath(`td[6]`),
}
}

Expand Down
10 changes: 1 addition & 9 deletions test/acceptance/test/ui_violations.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ func DescribeViolations(gitopsTestRunner GitopsTestRunner) {
})

violationInfo := violationsPage.FindViolationInList(policyName)
By(fmt.Sprintf("And verify '%s' violation Message", policyName), func() {
Eventually(violationInfo.Message.Text).Should(MatchRegexp(violationMsg), fmt.Sprintf("Failed to list '%s' violation in vioilations table", violationMsg))
})

By(fmt.Sprintf("And verify '%s' violation Severity", policyName), func() {
Eventually(violationInfo.Severity).Should(MatchText(violationSeverity), fmt.Sprintf("Failed to have expected vioilation Severity: %s", violationSeverity))
})
Expand All @@ -91,7 +87,7 @@ func DescribeViolations(gitopsTestRunner GitopsTestRunner) {
})

By(fmt.Sprintf("And navigate to '%s' Violation page", policyName), func() {
Eventually(violationInfo.Message.Click).Should(Succeed(), fmt.Sprintf("Failed to navigate to %s violation detail page", violationMsg))
Eventually(violationInfo.NameMgmtUI.Click).Should(Succeed(), fmt.Sprintf("Failed to navigate to %s violation detail page", violationMsg))
})

violationDetailPage := pages.GetViolationDetailPage(webDriver)
Expand Down Expand Up @@ -224,10 +220,6 @@ func DescribeViolations(gitopsTestRunner GitopsTestRunner) {
})

violationInfo := violationsPage.FindViolationInList(policyName)
By(fmt.Sprintf("And verify '%s' violation Message", policyName), func() {
Eventually(violationInfo.Message.Text).Should(MatchRegexp(violationMsg), fmt.Sprintf("Failed to list '%s' violation in vioilations table", violationMsg))
})

By(fmt.Sprintf("And verify '%s' violation Severity", policyName), func() {
Eventually(violationInfo.Severity).Should(MatchText(violationSeverity), fmt.Sprintf("Failed to have expected vioilation Severity: %s", violationSeverity))
})
Expand Down

0 comments on commit c63dd91

Please sign in to comment.