aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-10-21Merge pull request #1 from teddywing/dependabot/pip/requests-2.20.0HEADmasterteddywing
Bump requests from 2.18.4 to 2.20.0
2019-10-18Bump requests from 2.18.4 to 2.20.0dependabot[bot]
Bumps [requests](https://github.com/requests/requests) from 2.18.4 to 2.20.0. - [Release notes](https://github.com/requests/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/requests/requests/compare/v2.18.4...v2.20.0) Signed-off-by: dependabot[bot] <support@github.com>
2018-02-04Include app URL in Harvest API request User-Agentv0.0.1Teddy Wing
Harvest requires either a link to the application or an email address to be included in the 'User-Agent' header with requests to their API (https://help.getharvest.com/api-v2/introduction/overview/general/#api-requests).
2018-02-04README: Fix indentationTeddy Wing
GitHub's parser didn't like my indentation, which was held over from before the Markdown conversion. * The code blocks don't need to be double-indented. * Change the list indentation so that the bullets appear at the start of the text of the previous bullet. Otherwise GitHub turns them into blockquotes.
2018-02-04Convert README from Markdown to reStructuredTextTeddy Wing
Markdown apparently doesn't support letter lists (what?), so use a markup language that actually does.
2018-02-04Add READMETeddy Wing
Give some background, along with installation instructions and license information.
2018-02-04Add license (GNU GPLv3+)Teddy Wing
2018-02-04Set path for `geckodriver` logTeddy Wing
Otherwise it gets created in the current directory, and this fails when run from Launchd because that runs at the root of the filesystem.
2018-02-04Add launchd plistTeddy Wing
This will run the program every Monday and Friday evening. The plist needs to be modified to work in your environment and with your configuration.
2018-02-04Print error message when week was already submittedTeddy Wing
2018-02-04Print error to STDERRTeddy Wing
2018-02-04Add command line arguments for Harvest account ID and API tokenTeddy Wing
These are required for the `WeekIsComplete` checker.
2018-02-04Check that there are time entries for every day in the weekTeddy Wing
Before submitting the time sheet for approval (and before doing anything with Selenium), ensure that there's at least one time entry logged for each day in the week. To do this, we query the Harvest API with newly-required account ID and API token values. This gives us a bunch of time entries. We check them to see if they fell in the last week. If all weekdays from the last week have at least one time entry, then the rest of the program executes and we run Selenium to submit the time sheet. If any day had missing entries, an exception is raised and the program exits.
2018-02-04Pipfile: Add 'requests'Teddy Wing
2018-02-04Add PipfileTeddy Wing
Hey, this is new. First time not using `requirements.txt` for dependencies in a Python project. Need to add 'requests', so figured we should be tracking our dependencies. Add 'selenium' to the package list since we're already using and need it.
2018-02-04submit_week_for_approval: Don't submit if already submittedTeddy Wing
Check that the timesheet hasn't already been submitted before trying to submit it. Otherwise we'd resubmit the timesheet which is not what we want. We only want a single submission across successive runs of the program.
2018-02-04submit_week_for_approval: Use most recent FridayTeddy Wing
Remove our test date and use the most recent Friday instead.
2018-02-04submit_week_for_approval: Fix date page load checkTeddy Wing
This time the test for page load using the `friday` date didn't work. Not sure why, it should be the same and the text and element looks right. The only thing I can think of is that Selenium isn't smart enough to know there are multiple elements with the same class name and so it was comparing the wrong one, and last time when it worked it was just a fluke that happened to work the first time. Replace the CSS selector with an XPath selector that will get a "unique" element for us and still check that the correct date appears (here, formatted as "Wednesday, 24 January").
2018-02-04Pass command line arguments to WebDriver functionsTeddy Wing
Get rid of our header variables as these are now replaced with our command line arguments. Add function arguments to `login` and `submit_week_for_approval` to take the values they need from the command line arguments.
2018-02-04Add `get_password`Teddy Wing
Make a function that will get a password string given a shell command. This allows us to pass a command to the program instead of a clear text password.
2018-02-04Add command-line option parsingTeddy Wing
Doesn't do anything but parse the arguments yet. Really liking Python's built-in argument parser, really simple to use.
2018-02-04Add `-headless` option to FirefoxTeddy Wing
Don't launch the GUI.
2018-02-04Remove page source printing and sleep callTeddy Wing
These debug helpers are no longer needed now that we have a working program.
2018-02-04submit_week_for_approval: Fix page load waiter; Click confirm buttonTeddy Wing
Instead of waiting on an "invisible" `<script>` tag that Selenium doesn't know how to do, check that the "week" page is loaded a different way: by checking that the year appears in the header and the day appears in a column header. Uncomment the rest of the function. We weren't clicking the confirmation button (`.approval-confirmation`). Added a `click()` call there.
2018-02-04submit_week_for_approval: Figured out how to get text from `<script>`Teddy Wing
Just saving this because it works, which is neat. Unfortunately, I can't use it in a Selenium wait expectation because it doesn't allow me to compare arbitrary strings. I have to speak its language, with elements and contents etc. This answer showed me how to do this: https://stackoverflow.com/questions/20497607/how-to-get-the-contents-of-a-script-tag-in-selenium/20498102#20498102
2018-02-04Draft of submitting week for approvalTeddy Wing
First pass, doesn't work yet. This will determine last Friday's date and visit the page corresponding to that week. It will then try to submit that week's timesheet. The `wait` on the `script` tag contents waiting for the "week" page to load isn't working. Looks like you can't wait on the contents of a `<script>` tag. Moved the `wait` variable outside of `login` so it can be used in `submit_week_for_approval`.
2018-02-04Replace the sleep with a `wait`Teddy Wing
Wait until an element from the logged-in page is found before finishing or moving on from login.
2018-02-04Add .gitignoreTeddy Wing
Ignore the Python virtualenv/venv directory.
2018-02-04Add harvester_submit_week_for_approval.pyTeddy Wing
The start of a script that will log into Harvest via the normal web interface and submit the most recent full week's time sheet for approval. It uses Selenium and the Firefox WebDriver. It works with the `-headless` option, but I've commented that out for testing. Right now, it can open the Harvest sign-in page and log in.