Commit Graph

6 Commits

Author SHA1 Message Date
Dinesh c8268865dc puppeteer_tests: Extract a common function to fill forms.
Co-authored-by: Priyank Patel <priyankp390@gmail.com>
2020-06-03 17:38:03 -07:00
Dinesh d9cc081b2d puppeteer_tests: Move `log_in` and `log_out` functions to `common.js`.
Since `log_in` and `log_out` functions will also be used
in other tests, these are moved to `common.js`.
2020-06-03 17:38:02 -07:00
Priyank Patel 0b698d1173 puppeteer: Take screenshot on failure.
To take a screenshot on failure where we have our common error
handling code in common.run_test method we need to have access to
the Page instance. Currently, we create a new Page in the test method
we pass into run_test, so we pass in a new Page instance to that method
so the test and the run_test method have access to the same Page. And,
then we take a screenshot on failure. It will be saved as `failure-${num}`
in var/puppeteer directory.
2020-05-27 12:50:22 -07:00
Priyank Patel b2f566f53e puppeteer: Add screenshot method to common module.
This will be useful for debugging purposes and we'll use it to take
a screenshot on failure.
2020-05-19 15:58:04 -07:00
Priyank Patel d0a7540534 puppeteer: Add run_test method to common.
This method does all error handling and removes ~5-6 lines of try/catch
block across each test file.
2020-05-19 15:58:04 -07:00
Priyank Patel 41447a0d5c puppeteer: Add a common module for resuable code.
In common.js, we now have a single browser instance for the whole
test. When we update the test-js-with-puppetter to spawn a single
node process, like we do for node tests, we will save time on having
to open an new browser for every test + puppetter start up cost.

We will also add some more helpers here like a method for
filling out a form easily etc.
2020-05-19 15:58:04 -07:00