sosedoff / pgweb

Cross-platform client for PostgreSQL databases
https://sosedoff.github.io/pgweb
MIT License
8.64k stars 734 forks source link

Add integration tests #269

Closed sosedoff closed 3 years ago

sosedoff commented 7 years ago

SUBJ. Pgweb needs at least a base line integration test suite to verify that all the frontend code works.

sosedoff commented 7 years ago

@varp this is something you can work on if you'd like :) there are a few options on the table right now:

The complexity of the app has been increasing steadily over the time without any backing of the actual integration tests. I've been testing all the features directly in the browser, which is not much actually, but having an automated suite would definitely make it all piece of cake. Integration suite would also help with the ongoing effort to move Pgweb onto a real web framework, like react.

DylanGriffith commented 7 years ago

I'd like to have a go at this. I'm not super familiar with Go, but generally familiar with integration testing.

I was thinking I'd follow the instructions on Agouti for setup but I imagine that you'll want me to add a make task to get the test running on Travis. I assume that phantomjs is probably the easiest way to get the test running on travis.

I imagine I'll write at least one test that does the following:

  1. Connects to a database
  2. Query the database
  3. Disconnect

When I've got that up I can try to figure out what are the next features to tackle.

Does that seem like a good strategy @sosedoff ? Do you have any recommendations about how to structure the tests and the code? It looks like the agouti docs have a specific format for naming files and setup etc. but I'm not exactly sure where I should put those files. I assume the root directory is not the most appropriate. I could create some directory called integration perhaps.

varp commented 7 years ago

@sosedoff ok. I got it. Just finished reading a book on Golang =)

sosedoff commented 7 years ago

@DylanGriffith Agouti requires a specific setup, so if you follow their readme you should be able to get it figured. I usually group my test files by functionality.

As far as the tests go, we just need coverage for the most functionality like connecting to the database, switching tables, running custom queries, sorting, filtering, pagination, data export and so on.