Skip to content

Instantly share code, notes, and snippets.

@chicks
Created December 31, 2014 22:01
Show Gist options
  • Save chicks/6e4bc74461baf08725c9 to your computer and use it in GitHub Desktop.
Save chicks/6e4bc74461baf08725c9 to your computer and use it in GitHub Desktop.
Create RLI Using Selenium Webdriver.js in Sugar 7
client.init();
client.url('http://localhost:8888/s721');
client.waitUntilVisible('a[name="login_button"]', function(err, res) {});
client.setValue('input[name="username"]', 'admin');
client.setValue('input[name="password"]', 'letmein');
client.click('a[name="login_button"]');
client.waitUntilVisible('#tutorial-controls');
client.click('a[title=Done]');
client.waitUntilVisible('button.close')
client.click('button.close');
// Navigate to Revenue Line Items on More Menu
client.waitUntilVisible('li.more');
client.click('li.more');
client.waitUntilVisible('li.dropdown:not(.hidden)[data-module="RevenueLineItems"]');
client.click('li.dropdown:not(.hidden)[data-module="RevenueLineItems"]');
// Click the Create button on List View
client.waitUntilVisible('=Create');
client.click('=Create');
// Populate the RLI Name
client.waitUntilVisible('input[name="name"]');
client.setValue('input[name="name"]', "Bucket of Weasels");
// Set the close date
client.waitUntilVisible('input[aria-label="Expected Close Date"]');
client.click('input[aria-label="Expected Close Date"]');
client.waitUntilVisible('div.datepicker-days');
client.click('div.datepicker-days > table > tbody > tr:nth-child(2) > td:nth-child(3)');
// Select an Opportunity
client.waitUntilVisible('span[data-fieldname="opportunity_name"] > span > div.select2-container');
client.click('span[data-fieldname="opportunity_name"] > span > div.select2-container');
$opp_search_field_id = '';
$opp_name = 'Start Over Trust - 114 Units';
// Set the opportunity Name
client.getAttribute('span[data-fieldname="opportunity_name"] > span > div.select2-container > input', 'id', function(err, res) {
$opp_search_field_id = "#" + res + "_search";
client.waitUntilVisible($opp_search_field_id);
client.setValue($opp_search_field_id, $opp_name);
client.waitUntilVisible('span.select2-match');
client.click('span.select2-match');
}).call();
// SAve
client.click('=Save');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment