Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing a Facebook Connect application using Selenium?

Does anyone have experience using Selenium to automate testing of a webapp that uses Facebook Connect for user login? Any tips or methods that you recommend?

like image 720
Zack Burt Avatar asked Nov 14 '22 11:11

Zack Burt


1 Answers

Depends what you want to do?

  1. Will you be using a real-real Facebook User (which is phone verified by Facebook)?

    Safest and most reliable ,but very difficult (impossible) to gather "real" users (phone verified by FB).

    In terms of defining aspects of the user/connections details, like education history, work history, name, age etc(specially if you do not have access to all the "real" facebook accounts).

  2. Fake facebook users created for testing the app (not verified by Fb)?

    Probably the easiest to setup, as all are fake users, no Phone verification(with FB) required. But email ids for all users would need to be created.

    Even though the connection info can be tailored to your liking. One of the main drawbacks(and it has happened to me), is if Fb detects the user is not legit, FB would freeze all accounts. Which would make all your Fb user specific automated tests all useless in the blink of an eye. And there is not much you can do(Unless you plan to get a brand new phone connection to verify those accounts, no google number, no skype, no ip based phones allowed. FB is very strict with that). Also one number can authorize only 1 account.

  3. Will you be using the Facebook APIs to create Fb test users?

    Probably the ideal way (according to FB)to use Facebook connect to test your app. click here for documentation on how to use it.

    It may seem straight forward, but it has its downfalls(major ones). Very un-relaible, the API returns an error 10-20% of the time, and extremly slow the other times. No way to retrieve the password of a FB test user if misplaced once. Connection info cannot be easily customized. A fair amount of effort required to set it up something without being sure it work each time.

I have personally opted for the second option. Facebook detects the legitimacy of the user (I guess) based on parallel logins across multiple ips. I have selenium RCs running across various servers, which run these tests in parallel, which could have possibly raised a red flag. So i just schedule these scripts in a more organized manner, so as to avoid login overlaps.

I hope in this long explanation you find your answer. :)


For the perl implementation -

$sel->start();
$sel->open_ok("$URL");
$sel->set_speed("500");
$sel->click_ok("//img[\@alt='Facebook']",'User clicks on Facebook Login');
$sel->wait_for_pop_up_ok("", "30000",'Facebook Login Popup Loading');
$sel->select_pop_up("null");    
$sel->type_ok("email", "email\@email.com",'User enters Facebook credentials - Username');
$sel->type_ok("pass", "password",'User enters Facebook credentials - Password');
$sel->key_press("pass", "\\13",'User returns Facebook Login credentials');
$sel->select_window("null");
like image 134
Amey Avatar answered Dec 30 '22 01:12

Amey