Skip to content
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

Expand UI test #1027

Merged
merged 50 commits into from Nov 20, 2021
Merged

Expand UI test #1027

merged 50 commits into from Nov 20, 2021

Conversation

rokshana-b
Copy link
Contributor

Closes: #903

What changed?

  • Added a couple of UI test flows
  • Small refactor on CLI tests to verify git repo cloning using https

Why?
To add test coverage for UI

How did you test it?
Tested locally and on CI

Release notes
N/A

Documentation Changes
N/A

@rokshana-b rokshana-b added the type/enhancement New feature or request label Nov 4, 2021
Copy link
Contributor

@jpellizzari jpellizzari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't be able to approve any PRs that expand on this type of testing. It is too early to be tightly coupling these tests to individual DOM elements on the page. These tests will need to be fixed very often as we iterate on the UI. In addition, they don't seem to validate that the UI is working correctly end-to-end.

Let's schedule some time to talk about how we want to do this type of testing as a team.

test/acceptance/test/add_tests.go Show resolved Hide resolved
AddAppHeader: webDriver.FindByXPath(`//*[@id="app"]//nav//h2`),
AppName: webDriver.FindByID("name"),
AppNamespace: webDriver.FindByID("namespace"),
AppRepoURL: webDriver.FindByID("url"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be very brittle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to change the ID placement a lot? Or will the overall UI outlook change too much?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the xpaths to be as unique as possible

test/acceptance/test/ui_tests.go Outdated Show resolved Hide resolved
})

By("Then I should see Authentication Button pop up", func() {
_ = Expect(addAppPage.AuthenticationButton.Visible()).To(BeTrue())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does .Visible() check for? The presence of the element in the DOM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if the element is visible to the user. As soon as you hit Add Application Button, the Github Authentication button pops up. The point of this function is to verify the button actually pops up in the UI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visibility can take lots of forms. I can change it with css via display: none, visibility: none, opacity: 0, or remove it from the DOM entirely.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the use of visible matcher can make condition more understandable.
Expect(addAppPage.AuthenticationButton).Should(BeVisible())

The matcher passes if the selection refers to element is displayed on the page.
Incase the element is not present in the DOM the webdriver throws an error straightaway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing this for now since it requires a whole workaround and is causing weird failures. Although, @saeedfazal, I'll use your suggestion when we have a workaround for the gh auth flow.

test/acceptance/test/ui_tests.go Show resolved Hide resolved
Copy link
Contributor

@jpellizzari jpellizzari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't hold up merging for now, but @rokshana-b @iahmad9 @JamWils let's set up some time to discuss this as a team.

test/acceptance/test/pages/add_application_page.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jrryjcksn jrryjcksn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of minor comments

.github/actions/run-acceptance-test/action.yml Outdated Show resolved Hide resolved
@@ -127,6 +127,7 @@ jobs:
github-token: ${{ secrets.WEAVE_GITOPS_TEST_WEAVEWORKS_WEAVE_GITOPS_BOT_TOKEN }}
gitlab-key: ${{ secrets.GITLAB_KEY }}
gitlab-token: ${{ secrets.GITLAB_TOKEN }}
artifacts-base-dir: "/tmp/gitops-test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is used in a whole bunch of jobs. I think it should be moved to the environment for the workflow:

name: run tests
env:
  ARTIFACTS_BASE_DIR: "/tmp/gitops-test"
jobs:
...
       artifacts-base-dir: ${{ env.ARTIFACTS_BASE_DIR }}
...

@rokshana-b rokshana-b merged commit 3ae9201 into main Nov 20, 2021
@rokshana-b rokshana-b deleted the expand-ui-tests branch November 20, 2021 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more tests for GItOps UI
4 participants