Last active
August 29, 2015 14:05
-
-
Save Widdershin/6264cd59f230bc48f44b to your computer and use it in GitHub Desktop.
Citrix Auto Time Entry App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
credentials.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'watir' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
childprocess (0.5.3) | |
ffi (~> 1.0, >= 1.0.11) | |
commonwatir (4.0.0) | |
ffi (1.9.3) | |
multi_json (1.10.1) | |
rubyzip (1.1.6) | |
selenium-webdriver (2.42.0) | |
childprocess (>= 0.5.0) | |
multi_json (~> 1.0) | |
rubyzip (~> 1.0) | |
websocket (~> 1.0.4) | |
watir (5.0.0) | |
commonwatir (~> 4) | |
watir-webdriver | |
watir-webdriver (0.6.10) | |
selenium-webdriver (>= 2.18.0) | |
websocket (1.0.7) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
watir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'watir' | |
class TimeEntryApp | |
TIMECODE = 'B#48183' | |
HOURS = 8 | |
attr_reader :browser | |
def initialize | |
@browser = Watir::Browser.new :phantomjs | |
end | |
def login | |
browser.goto "https://desk.gotoassist.com/timesheets/" | |
browser.text_field(:name => 'emailAddress').set email | |
browser.text_field(:name => 'password').set password | |
browser.button(:name => 'submit').click | |
self | |
end | |
def enter_time | |
browser.goto "https://desk.gotoassist.com/timesheets/" | |
browser.link(id: 'addTaskLink').click | |
browser.text_field(id: 'custom_time_entry_autocomplete_entry').set TIMECODE | |
browser.text_field(id: 'custom_time_entry_hours').set HOURS | |
browser.link(id: 'save-timesheet').click | |
self | |
end | |
def email | |
ENV['TIME_EMAIL'] | |
end | |
def password | |
ENV['TIME_PASSWORD'] | |
end | |
end | |
if __FILE__ == $0 | |
TimeEntryApp.new.login.enter_time | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment