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

Add Selenium UI tests to GitHub Actions CI #183

Open
MBARIMike opened this issue Jun 13, 2022 · 6 comments
Open

Add Selenium UI tests to GitHub Actions CI #183

MBARIMike opened this issue Jun 13, 2022 · 6 comments

Comments

@MBARIMike
Copy link
Contributor

To test basic User Interface functionality add Selenium tests. There appears to be docker containers for Selenium that can simplify adding it to this project. See:

https://marcgibbons.com/post/selenium-in-docker/

@MBARIMike
Copy link
Contributor Author

@MBARIMike
Copy link
Contributor Author

@MBARIMike
Copy link
Contributor Author

Implementing Selenium testing scheme that works equally well in development and in GitHub Actions has been challenging!

GitHub provides binaries for chrome & firefox that can be used in Actions. The equivalent setup for development requires those driver binaries to be installed in the local docker image. The test code needs to be customized for this scheme.

A more attractive option is selenium-hub which uses Docker containers that contain browser instances. This works well in development, but fails in GitHub Actions. The problem seems to be the way the docker network is configured in Actions. Here's a SO post describing the problem.

I think I proceed with the selenium-hub solution and then tag the UI tests so that they don't run in Actions. At least this way we have a good testing scheme in development.

@MBARIMike
Copy link
Contributor Author

MBARIMike commented Jun 22, 2022

Had to revert some of the recent UI "Dash" changes as the page was not rendering in my development browser. This made it easier to develop the Selenium tests which now get executed on a development system, but not in GitHub Actions.

Perhaps a minimal set of those changes can be pulled into this branch before merging with main. A set of UI tests (also to be added to this branch) will help assure that those changes don't break anything.

@MBARIMike
Copy link
Contributor Author

The Selenium tests work fairly reliably on a local debug.yml development system. Here's a screen shot from VS Code of the tests following a merge from this PR:
Screen Shot 2022-06-24 at 3 52 10 PM
The test found an error where "searchBar" in the html template mismatched the case of "searchbar" in the javascript. This commit fixes the problem.

@MBARIMike
Copy link
Contributor Author

MBARIMike commented Jun 24, 2022

Many more tests still need to be written, but the Selenium framework is in place – at least for a local development server.

This is the error reported in GitHub Actions:

    def test_visit_site_with_chrome(self):
        print(f"Lauching chrome browser at: {self.server_url}")
>       self.chrome.get(self.server_url)
smdb/tests/func_tests/test_ui.py:40: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py:442: in get
    self.execute(Command.GET, {'url': url})
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py:430: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x7fefec57a2e0>
response = {'status': 500, 'value': '{"value":{"error":"unknown error","message":"unknown error: net::ERR_NAME_NOT_RESOLVED\\n  (...\\n#22 0x55c230a2d788 \\u003Cunknown>\\n#23 0x55c230a47f1d \\u003Cunknown>\\n#24 0x7f2937a6f609 \\u003Cunknown>\\n"}}'}

Selenium tests are currently turned off for GitHub Actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant