Skip to content

Commit 6d3eb46

Browse files
authored
Deleting long cluster name enteires for DB for correct UI experience (#157)
Co-authored-by: Saeed Fazal <[email protected]>
1 parent 4637438 commit 6d3eb46

File tree

2 files changed

+59
-35
lines changed

2 files changed

+59
-35
lines changed

test/acceptance/test/mccp_clusters.go

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,57 @@ func ClusterStatusFromList(clustersPage *pages.ClustersPage, clusterName string)
5454
return pages.FindClusterInList(clustersPage, clusterName).Status
5555
}
5656

57+
func deleteClusterEntry(webDriver *agouti.Page, clusterNames []string) {
58+
for _, clusterName := range clusterNames {
59+
clustersPage := pages.GetClustersPage(webDriver)
60+
clusterConnectionPage := pages.GetClusterConnectionPage(webDriver)
61+
confirmDisconnectClusterDialog := pages.GetConfirmDisconnectClusterDialog(webDriver)
62+
63+
log.Printf("Deleting cluster entry: %s", clusterName)
64+
Expect(webDriver.Refresh()).ShouldNot(HaveOccurred())
65+
66+
By("And wait for the page to be fully loaded", func() {
67+
Eventually(clustersPage.SupportEmailLink).Should(BeVisible())
68+
Eventually(clustersPage.ClusterCount).Should(MatchText(`[0-9]+`))
69+
Eventually(clustersPage.ClustersListSection).Should(BeFound())
70+
pages.ScrollWindow(webDriver, WINDOW_SIZE_X, WINDOW_SIZE_Y)
71+
})
72+
73+
By("And when I click edit cluster I should see disconnect cluster tab", func() {
74+
75+
if len(clusterName) > 256 {
76+
clusterName = clusterName[0:256]
77+
}
78+
Expect(pages.FindClusterInList(clustersPage, clusterName).EditCluster.Click()).To(Succeed())
79+
80+
Eventually(clusterConnectionPage.ClusterConnectionPopup).Should(BeFound())
81+
Eventually(clusterConnectionPage.DisconnectTab).Should(BeFound())
82+
})
83+
84+
By("And I open Disconnect tab and click Remove cluster from the MCCP button", func() {
85+
Expect(clusterConnectionPage.DisconnectTab.Click()).Should(Succeed())
86+
87+
Eventually(clusterConnectionPage.ButtonRemoveCluster).Should(BeFound())
88+
Expect(clusterConnectionPage.ButtonRemoveCluster.Click()).To(Succeed())
89+
})
90+
91+
By("Then I should see an alert popup with Remove button", func() {
92+
Eventually(confirmDisconnectClusterDialog.AlertPopup, ASSERTION_1MINUTE_TIME_OUT).Should(BeFound())
93+
Eventually(confirmDisconnectClusterDialog.ButtonRemove).Should(BeFound())
94+
})
95+
96+
By("And I click remove button and the alert is closed", func() {
97+
Expect(confirmDisconnectClusterDialog.ButtonRemove.Click()).To(Succeed())
98+
Eventually(confirmDisconnectClusterDialog.AlertPopup).ShouldNot(BeFound())
99+
})
100+
101+
By("Then I should see the cluster removed from the table", func() {
102+
Eventually(pages.FindClusterInList(clustersPage, clusterName).Name, ASSERTION_1MINUTE_TIME_OUT).
103+
ShouldNot(BeFound())
104+
})
105+
}
106+
}
107+
57108
func createClusterEntry(webDriver *agouti.Page, clusterName string) (*pages.ClustersPage, *pages.ClusterConnectionPage) {
58109

59110
//To check if page is loaded in its entirety
@@ -66,7 +117,7 @@ func createClusterEntry(webDriver *agouti.Page, clusterName string) (*pages.Clus
66117
By("And wait for the page to be fully loaded", func() {
67118
Eventually(clustersPage.SupportEmailLink).Should(BeVisible())
68119
Eventually(clustersPage.ClusterCount).Should(MatchText(`[0-9]+`))
69-
time.Sleep(UI_POLL_INTERVAL)
120+
Eventually(clustersPage.ClustersListSection).Should(BeFound())
70121
count, _ = clustersPage.ClusterCount.Text()
71122
tmpCount, _ := strconv.Atoi(count)
72123
expectedCount = strconv.Itoa(tmpCount + 1)
@@ -216,8 +267,6 @@ func DescribeMCCPClusters(mccpTestRunner MCCPTestRunner) {
216267

217268
AfterEach(func() {
218269
TakeNextScreenshot()
219-
//Tear down
220-
//Expect(webDriver.Destroy()).To(Succeed())
221270
})
222271

223272
It("Verify MCCP page structure first time with no cluster configured", func() {
@@ -327,6 +376,8 @@ func DescribeMCCPClusters(mccpTestRunner MCCPTestRunner) {
327376
By("And I see Save & next button disabled", func() {
328377
Eventually(clusterConnectionPage.ButtonClusterSaveAndNext).ShouldNot(BeEnabled())
329378
})
379+
380+
deleteClusterEntry(webDriver, []string{clusterNameMax})
330381
})
331382

332383
It("Verify that clusters table have correct column headers ", func() {
@@ -545,42 +596,14 @@ func DescribeMCCPClusters(mccpTestRunner MCCPTestRunner) {
545596
It("Verify disconnect cluster", func() {
546597
clusterName := RandString(32)
547598
fmt.Printf("Generated a new cluster name! %s\n", clusterName)
548-
clustersPage, clusterConnectionPage := createClusterEntry(webDriver, clusterName)
549-
confirmDisconnectClusterDialog := pages.GetConfirmDisconnectClusterDialog(webDriver)
599+
_, clusterConnectionPage := createClusterEntry(webDriver, clusterName)
550600

551601
By("And the cluster connection popup is closed", func() {
552602
Expect(clusterConnectionPage.ButtonClose.Click()).To(Succeed())
553603
Eventually(clusterConnectionPage.ClusterConnectionPopup).ShouldNot(BeFound())
554604
})
555605

556-
By("And when I click edit cluster I should see disconnect cluster tab", func() {
557-
Expect(pages.FindClusterInList(clustersPage, clusterName).EditCluster.Click()).To(Succeed())
558-
559-
Eventually(clusterConnectionPage.ClusterConnectionPopup).Should(BeFound())
560-
Eventually(clusterConnectionPage.DisconnectTab).Should(BeFound())
561-
})
562-
563-
By("And I open Disconnect tab and click Remove cluster from the MCCP button", func() {
564-
Expect(clusterConnectionPage.DisconnectTab.Click()).Should(Succeed())
565-
566-
Eventually(clusterConnectionPage.ButtonRemoveCluster).Should(BeFound())
567-
Expect(clusterConnectionPage.ButtonRemoveCluster.Click()).To(Succeed())
568-
})
569-
570-
By("Then I should see an alert popup with Remove button", func() {
571-
Eventually(confirmDisconnectClusterDialog.AlertPopup, ASSERTION_1MINUTE_TIME_OUT).Should(BeFound())
572-
Eventually(confirmDisconnectClusterDialog.ButtonRemove).Should(BeFound())
573-
})
574-
575-
By("And I click remove button and the alert is closed", func() {
576-
Expect(confirmDisconnectClusterDialog.ButtonRemove.Click()).To(Succeed())
577-
Eventually(confirmDisconnectClusterDialog.AlertPopup).ShouldNot(BeFound())
578-
})
579-
580-
By("Then I should see the cluster removed from the table", func() {
581-
Eventually(pages.FindClusterInList(clustersPage, clusterName).Name, ASSERTION_1MINUTE_TIME_OUT).
582-
ShouldNot(BeFound())
583-
})
606+
deleteClusterEntry(webDriver, []string{clusterName})
584607
})
585608

586609
It("@wkp Verify team workspaces variations", func() {

test/acceptance/test/utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ func SetSeleniumServiceUrl(url string) {
8787
var GITHUB_ORG string
8888
var CLUSTER_REPOSITORY string
8989

90+
const WINDOW_SIZE_X int = 1800
91+
const WINDOW_SIZE_Y int = 2500
9092
const ARTEFACTS_BASE_DIR string = "/tmp/workspace/test/"
9193
const SCREENSHOTS_DIR string = ARTEFACTS_BASE_DIR + "screenshots/"
9294
const CLUSTER_INFO_DIR string = ARTEFACTS_BASE_DIR + "cluster-info/"
@@ -207,8 +209,7 @@ func initializeWebdriver() {
207209
}}}))
208210
Expect(err).NotTo(HaveOccurred())
209211

210-
// Make the page bigger so we can see all the things in the screenshots
211-
err = webDriver.Size(1800, 2500)
212+
err = webDriver.Size(WINDOW_SIZE_X, WINDOW_SIZE_Y)
212213
Expect(err).NotTo(HaveOccurred())
213214
}
214215

0 commit comments

Comments
 (0)