fnproject / ui

User interface for fn project.
Apache License 2.0
89 stars 21 forks source link

Add Selenium Integration Tests #72

Closed vzDevelopment closed 5 years ago

vzDevelopment commented 5 years ago

I've added Selenium integration tests for the Fn UI meaning that we can automatically test basic Fn UI functionality. This should help with cases like #71 where we need to test the entire system.

I'm not sure if I've used async/await correctly - I've basically made the entire thing synchronous (apart from where I fill in form input fields). However, as I need Selenium to do things in order and the Selenium webdriver functions return promises, I'm being forced to do this. I either need to do this or use promise chaining and I feel promise chaining is a lot less maintainable. If you have any other suggestions, please let me know.

Testing

Apart from adding a few IDs/Name tags to HTML elements, the changes should be self contained and won't affect the Fn UI so testing should be straight forward.

To test, follow the instructions under Automated Testing on the readme test_integration/etc/config.yaml

Results

Here's a little gif of it working with headless set to false in the config

Selenium

vzDevelopment commented 5 years ago

Hi Chad,

I haven't looked at getting it working in CircleCI yet - my aim was to get something up and running first which I could use to automate the tests that I run manually before pushing code.

However, I believe it can be incorporated into CircleCI. I would expect all we'd need to do is install Chrome and the Chrome Driver. However, I see there are also docs on CircleCI's website specifically for it which might be better to follow: https://circleci.com/docs/2.0/browser-testing/.

One concern I had about incorporating them into CircleCI is how long it can take to run - each test currently takes about half a second to run. As we add more tests this could add up (especially if we started testing multiple browsers too). Would this cause issues with CircleCI costs?

The other concern is that it might end up being a pain to maintain. I'm hoping the benefit they provide will outweigh the maintenance costs but I'm not sure - time will tell with this one.

vzDevelopment commented 5 years ago

Ah I forgot, we'd also need to run a local fn server and UI in the CircleCI container/machine too