Skip to content

Deleting long cluster name enteires for DB for correct UI experience #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 56 additions & 33 deletions test/acceptance/test/mccp_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,57 @@ func ClusterStatusFromList(clustersPage *pages.ClustersPage, clusterName string)
return pages.FindClusterInList(clustersPage, clusterName).Status
}

func deleteClusterEntry(webDriver *agouti.Page, clusterNames []string) {
for _, clusterName := range clusterNames {
clustersPage := pages.GetClustersPage(webDriver)
clusterConnectionPage := pages.GetClusterConnectionPage(webDriver)
confirmDisconnectClusterDialog := pages.GetConfirmDisconnectClusterDialog(webDriver)

log.Printf("Deleting cluster entry: %s", clusterName)
Expect(webDriver.Refresh()).ShouldNot(HaveOccurred())

By("And wait for the page to be fully loaded", func() {
Eventually(clustersPage.SupportEmailLink).Should(BeVisible())
Eventually(clustersPage.ClusterCount).Should(MatchText(`[0-9]+`))
Eventually(clustersPage.ClustersListSection).Should(BeFound())
pages.ScrollWindow(webDriver, WINDOW_SIZE_X, WINDOW_SIZE_Y)
})

By("And when I click edit cluster I should see disconnect cluster tab", func() {

if len(clusterName) > 256 {
clusterName = clusterName[0:256]
}
Expect(pages.FindClusterInList(clustersPage, clusterName).EditCluster.Click()).To(Succeed())

Eventually(clusterConnectionPage.ClusterConnectionPopup).Should(BeFound())
Eventually(clusterConnectionPage.DisconnectTab).Should(BeFound())
})

By("And I open Disconnect tab and click Remove cluster from the MCCP button", func() {
Expect(clusterConnectionPage.DisconnectTab.Click()).Should(Succeed())

Eventually(clusterConnectionPage.ButtonRemoveCluster).Should(BeFound())
Expect(clusterConnectionPage.ButtonRemoveCluster.Click()).To(Succeed())
})

By("Then I should see an alert popup with Remove button", func() {
Eventually(confirmDisconnectClusterDialog.AlertPopup, ASSERTION_1MINUTE_TIME_OUT).Should(BeFound())
Eventually(confirmDisconnectClusterDialog.ButtonRemove).Should(BeFound())
})

By("And I click remove button and the alert is closed", func() {
Expect(confirmDisconnectClusterDialog.ButtonRemove.Click()).To(Succeed())
Eventually(confirmDisconnectClusterDialog.AlertPopup).ShouldNot(BeFound())
})

By("Then I should see the cluster removed from the table", func() {
Eventually(pages.FindClusterInList(clustersPage, clusterName).Name, ASSERTION_1MINUTE_TIME_OUT).
ShouldNot(BeFound())
})
}
}

func createClusterEntry(webDriver *agouti.Page, clusterName string) (*pages.ClustersPage, *pages.ClusterConnectionPage) {

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

AfterEach(func() {
TakeNextScreenshot()
//Tear down
//Expect(webDriver.Destroy()).To(Succeed())
})

It("Verify MCCP page structure first time with no cluster configured", func() {
Expand Down Expand Up @@ -327,6 +376,8 @@ func DescribeMCCPClusters(mccpTestRunner MCCPTestRunner) {
By("And I see Save & next button disabled", func() {
Eventually(clusterConnectionPage.ButtonClusterSaveAndNext).ShouldNot(BeEnabled())
})

deleteClusterEntry(webDriver, []string{clusterNameMax})
})

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

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

By("And when I click edit cluster I should see disconnect cluster tab", func() {
Expect(pages.FindClusterInList(clustersPage, clusterName).EditCluster.Click()).To(Succeed())

Eventually(clusterConnectionPage.ClusterConnectionPopup).Should(BeFound())
Eventually(clusterConnectionPage.DisconnectTab).Should(BeFound())
})

By("And I open Disconnect tab and click Remove cluster from the MCCP button", func() {
Expect(clusterConnectionPage.DisconnectTab.Click()).Should(Succeed())

Eventually(clusterConnectionPage.ButtonRemoveCluster).Should(BeFound())
Expect(clusterConnectionPage.ButtonRemoveCluster.Click()).To(Succeed())
})

By("Then I should see an alert popup with Remove button", func() {
Eventually(confirmDisconnectClusterDialog.AlertPopup, ASSERTION_1MINUTE_TIME_OUT).Should(BeFound())
Eventually(confirmDisconnectClusterDialog.ButtonRemove).Should(BeFound())
})

By("And I click remove button and the alert is closed", func() {
Expect(confirmDisconnectClusterDialog.ButtonRemove.Click()).To(Succeed())
Eventually(confirmDisconnectClusterDialog.AlertPopup).ShouldNot(BeFound())
})

By("Then I should see the cluster removed from the table", func() {
Eventually(pages.FindClusterInList(clustersPage, clusterName).Name, ASSERTION_1MINUTE_TIME_OUT).
ShouldNot(BeFound())
})
deleteClusterEntry(webDriver, []string{clusterName})
})

It("@wkp Verify team workspaces variations", func() {
Expand Down
5 changes: 3 additions & 2 deletions test/acceptance/test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ func SetSeleniumServiceUrl(url string) {
var GITHUB_ORG string
var CLUSTER_REPOSITORY string

const WINDOW_SIZE_X int = 1800
const WINDOW_SIZE_Y int = 2500
const ARTEFACTS_BASE_DIR string = "/tmp/workspace/test/"
const SCREENSHOTS_DIR string = ARTEFACTS_BASE_DIR + "screenshots/"
const CLUSTER_INFO_DIR string = ARTEFACTS_BASE_DIR + "cluster-info/"
Expand Down Expand Up @@ -207,8 +209,7 @@ func initializeWebdriver() {
}}}))
Expect(err).NotTo(HaveOccurred())

// Make the page bigger so we can see all the things in the screenshots
err = webDriver.Size(1800, 2500)
err = webDriver.Size(WINDOW_SIZE_X, WINDOW_SIZE_Y)
Expect(err).NotTo(HaveOccurred())
}

Expand Down