AAYBS / GIC

:construction_worker: :bookmark_tabs: Automate creation of GitHub issues with selenium :bookmark_tabs: :construction_worker:
MIT License
3 stars 9 forks source link

Chrome or Firefox #19

Closed ZoranPandovski closed 5 years ago

ZoranPandovski commented 5 years ago

Add configuration option, so the user can choose which browser to use chrome or firefox. Currently, we have Firefox hardcoded.

pbeart commented 5 years ago

I can start to work on this now

ZoranPandovski commented 5 years ago

Perfect @pbeart . If you have any questions let me know.

pbeart commented 5 years ago

Unfortunately I'm getting KeyError: 'DEFAULT_URL', from this line: return self.config['URL']['DEFAULT_URL']. This can easily be fixed by making DEFAULT_URL the same as START_PAGE_URL, but this suggests that the default configuration and the configuration in the README.MD are both not quite complete.

You also have to remove the single quotes from config values, as it appears configparser does not automatically dequote values.

I also had to comment out lines 38 and 39 of base.py:

self.find_element(*self.locators.ISSUE).click()
self.wait_for_clickable(self.locators.CLOSE_ISSUE).click()

as these appear to be hardcoded to reference issues on your GitHub repo, while I was using a different repo for testing.

I also had to change lines 42 and 43 in base.py from:

self.wait_for_visible(self.locators.DESCRIPTION)\
    .clear().send_keys(self.description_text)

to

self.wait_for_visible(self.locators.DESCRIPTION)\
    .send_keys(self.description_text)

as it seems .clear() returns None

I had to remove

self.find_element(*self.locators.LABELS).click()
labels_list = self.wait_for_clickable(self.locators.LABELS_LIST)
self.driver.execute_script("arguments[0].click();", labels_list)

from create_issue in base.py, firstly because it happens before the issue is submitted which means those controls are not yet visible, and secondly because no labels are actually added.

I also had to add the SUBMIT selector to locators.py:

SUBMIT = (By.XPATH, "//button[@type='submit' and contains(., 'Submit new issue')]")

and add self.wait_for_visible(self.locators.SUBMIT).click() to create_issue in base.py in order to actually make it submit an issue.

Most of these can be fixed easily but I feel I'm possibly not understanding the reasons why some of them are written the way they are and that I might be accidentally removing functionality

ZoranPandovski commented 5 years ago

Can you create PR so I can review all of them? Just make sure that all the changes are working. Thanks

pbeart commented 5 years ago

The main issue is that I don't know what to fix exactly, for some stuff it's clear it should be written differently but the presence of the labels clicker implies that you were planning for the script to be able to add labels to the created issue. What I would suggest is that I create a PR which removes repo-specific code and makes it usable by anyone who downloads, then work on adding those features which were partly present back in and testing them.

pbeart commented 5 years ago

I'll start working on the browser option and possibly other functionality that was hinted at in the original code.