User.random_detailed = function(id){ return { id : id, first_name : chance.name(), last_name: chance.last(), age: chance.age({type: 'adult'}), address: chance.address(), phone: chance.phone(), ssn: chance.ssn(), country: chance.country({ full: true }) }; }
it('consumes any value', async () => { const output = await createPromiseFromStreams([ createListStream([ chance.integer(), /test/, { birthday: chance.birthday(), ssn: chance.ssn(), }, chance.bool() ]), createFilterRecordsStream('type'), createConcatStream([]), ]); expect(output).to.eql([]); });
function insertNewUserRecord(callback,user) { var chance = new Chance(); var user_id = chance.ssn(); createCrypto(user.password, function(err,pass) { var query = "INSERT INTO user (user_id,user_type,first_name,last_name,address,city,state,zip_code,phone_number,password,salt,email) values " + "( "+ "'" + user_id + "'," + "'" + user.user_type + "'" + "," + "'" + user.first_name + "'" + "," + "'" + user.last_name + "'" + "," + "'" + user.address + "'" + "," + "'" + user.city + "'" + "," + "'" + user.state + "'" + "," + "'" + user.zip_code + "'" + "," + "'" + user.phone_number + "'" + "," + pass.key + "," + pass.salt + "," + "'" + user.email + "'" + " )"; console.log(query); if (CONNECTION_POOL) { getPooledConnection(function(error, connection) { connection.query(query,function(err,result) { if(err) { throw err; } else { result.user_id = user_id; callback(err,result); } }); connection.release(); }); } else { var connection = getConnection(); connection.query(query, function(err,result) { if(err) { throw err; } else { result.user_id = user_id; callback(err,result); } }); connection.end(); } }); }
describe('Testing Parcel Pending - Add and Delete a Client Server', function() { this.timeout(40000); var driver = {}; before( function (done) { if(typeof browser === "undefined") { driver = webdiverio.remote({ desiredCapabilities: {browserName: 'chrome'} }); driver.init(done); } else { driver = browser; done(); } }); //Load Parcel Pending Login Page it('should load the Parcel Pending Login Screen', function () { return driver .url('http://staging.parcelpending.com/') .windowHandleSize({width: 1400, height:900}) .getTitle().then( function (title) { (title).should.be.equal("Parcel Pending"); console.log('Current Page Title: ' + title); }); }); //Fill in User Name it('Should Type in Admin User Name', function () { return driver.setValue("//input[@name='identity']", "Admin") .getValue("//input[@name='identity']").then ( function (e) { (e).should.be.equal("Admin"); console.log("Admin User Name: " + e); }); }); //Fill in password it('Should Type in Admin Password', function () { return driver.setValue("//input[@name='credential']", "ppending") .getValue("//input[@name='credential']").then ( function (e) { (e).should.be.equal("ppending"); console.log("Enter Admin Password"); }); }); //Submit Username and Password and confirm page loads it('Should Load Admin Homepage', function () { return driver.submitForm("//button[@name='submit']").then( function(e) { console.log('Logging In...'); }) .waitForVisible ("//div[@class='navbar-header adminview']" , 10000).then(function (e) { console.log('Admin Successfully Logged In'); }); }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(3000); }); //Go to Client Server Page it('Should Go to Client Servers Page', function(){ return driver.click("//a[contains(text(),'Client Servers')]") }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Click Go to Add New Client Server Page it('Should Go to New Client Server Page', function(){ return driver.click("//button[contains(text(),'add new')]") }); //Create Chance Variables var sname = String; var accesscode = String; var chance = new Chance(); //Get Chance var sname = chance.word({syllables: 3}); var accesscode = chance.ssn({ dashes: false }); //Log to view Chance selections before page loads console.log('Client Server Name:' + sname); console.log('Access Code is: ' + accesscode); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Type in Server Name field it('Should Type Server Name', function(){ return driver.setValue("//input[@name='oauth_client_id']", sname) }); //Type in Server Access Code field it('Should Type Server Access Code Name', function(){ return driver.setValue("//input[@name='oauth_client_secret']", accesscode); }); //Select Active to Yes it('Should Select Active to Yes', function(){ return driver.selectByVisibleText("//select[@name='active']", "Yes"); }); //Select Live it('Should Change Live to Yes', function(){ return driver.selectByVisibleText("//select[@name='live']", 'Yes'); }); //Select California it('Should Select California', function(){ return driver.selectByValue("//select[@name='state']", 'CA'); }); //Select Anaheim it('Should Select Anaheim', function(){ return driver.selectByVisibleText("//select[@name='id_city']", 'Anaheim'); }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Select Katella Grand it('Should Select Katella Grand', function(){ return driver.selectByVisibleText("//select[@name='id_property']", 'Katella Grand'); }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Click Confirm it('Should Click Confirm', function(){ return driver.submitForm("//button[@id='submitbutton']") }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Go to Client Server Page it('Should Go to Client Servers Page', function(){ return driver.click("//a[contains(text(),'Client Servers')]") }); //Go and Search for Client Server it('Should Search for Client Server', function(){ return driver.setValue("//input[@id='s_clientserver']", ""+sname+"") }); //Submit Search it('Should Submit Search', function (){ return driver.click("(//button[@type='button'])[3]") }); //Go to Server Edit Page it('Should Go to Server Edit Page', function(){ return driver.waitForExist("//a[contains(text(),'"+sname+"')]", 10000).then( function(){ driver.click("//a[contains(text(),'"+sname+"')]") }); }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(2000); }); //Go to Delete Server it('Should Click Delete', function(){ return driver.waitForExist("(//button[@type='button'])[2]", 10000).then( function (){ driver.click("(//button[@type='button'])[2]") }); }); //Go to Delete Server it('Should Click Delete', function(){ return driver.waitForExist("//button[@name='del']", 10000).then( function (){ driver.click("//button[@name='del']") }); }); //Pause it('Should Wait for Page to Load', function(){ return driver.pause(5000); }); after(function(done) { if(typeof browser === "undefined") { driver.end(done); } else { done(); } }); });