Skip to content

Commit

Permalink
add feature to use it for any project
Browse files Browse the repository at this point in the history
  • Loading branch information
crashuniverse committed Nov 23, 2017
1 parent 43d10d9 commit 233c73a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ This project makes the entire effort updating process automated. The way it
works is you provide Travis CI with credentials in form of 2 environment
variables - `USERNAME` and `PASSWORD` with your actual values for these
credentials. Travis CI uses these credentials to login on your behalf and fills
your timesheets.
your timesheets. Advanced usage involves an optional 3rd env variable `PROJECT`,
for which the value is `id` of the [project on Monday in DOM](https://developers.google.com/web/tools/chrome-devtools/inspect-styles/edit-dom#inspect-an-element).
Typical values are `0_0_0_0` & `projectA_0_0_0`.

## Setup Travis CI for scheduled jobs in 5 steps
1. Make a free account or login with an existing account at
Expand All @@ -24,6 +26,7 @@ in Travis CI:
```
USERNAME: xa123456
PASSWORD: password
PROJECT: 0_7_nonproj (optional)
```
5. At 5pm on one of these days, [add a cron job](https://docs.travis-ci.com/user/cron-jobs/#Adding-Cron-Jobs)
in Travis CI so that it runs a build everyday.
Expand Down
4 changes: 3 additions & 1 deletion tests/efforts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
this.efforts = (browser) => {
const username = process.env.USERNAME;
const password = process.env.PASSWORD;
const project = process.env.PROJECT || '0_0_4_0';

const SHORT_INTERVAL = 5000;
const LONG_INTERVAL = 10000;
Expand All @@ -26,7 +27,8 @@ this.efforts = (browser) => {
browser.pause(LONG_INTERVAL);

if (isAnAllowedDay) {
const nodeSelector = `input[id="${yesterday - 1}_0_4_0"]`;
const projectCodeSuffix = project && project.slice(1);
const nodeSelector = `input[id="${yesterday - 1}${projectCodeSuffix}"]`;
browser.waitForElementVisible(nodeSelector, SHORT_INTERVAL);
browser.setValue(nodeSelector, '8');
browser.click('#submitdata');
Expand Down

0 comments on commit 233c73a

Please sign in to comment.