Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. hsc.begin("Verify that we can enter a mobile web facebook stream and all functionality works", [
  2. "Login and verify that streams have loaded",
  3. "Click on Facebook Stream and verify that we've entered it",
  4. "Verify tap-to-update works and that messages have loaded",
  5. "Click on a message and verify that that it has an attachment and comments",
  6. "Verify like and unlike functionality",
  7. "Add a comment to the message and verify that it was added",
  8. ], function suite(test) {
  9.  
  10. //Login and verify that streams have loaded
  11. hsc.step(function() {
  12. hsc.routine.mweb_login(username, password);
  13. casper.waitForText('Streams', function() {
  14. this.test.assertTitle('Hootsuite - Streams',
  15. 'Successfully logged in and loaded Streams view');
  16. });
  17. });
  18.  
  19. //Click on Facebook Stream and verify that we've entered it
  20. hsc.step(function() {
  21. hsc.routine.clickSelector(x ('//div[@class="box _box" and contains(.,"Timeline")]'),
  22. 'Entering Hootsuite\'s Wall Posts');
  23. // hsc.util.screenshot('feed_enter');
  24.  
  25. casper.waitForSelector('._messages', function() {
  26. this.test.assertTitle('Timeline',
  27. 'Successfully entered Hootsuite\'s Wall Posts' );
  28. // hsc.util.screenshot('inFacebookSentMessages');
  29. });
  30. });
  31.  
  32. //Verify tap-to-update works and that messages have loaded
  33. hsc.step(function() {
  34. casper.waitForSelector('div.facebook', function() {
  35. hsc.routine.clickSelector(x ('//div[contains(@class, "_tapToRefresh")]'), false);
  36.  
  37. var messages = [];
  38. messages = messages.concat(this.evaluate(function () {
  39. var messages = document.querySelectorAll('div.facebook');
  40. return Array.prototype.map.call(messages, function (e) {
  41. return e.getAttribute ('data-id');
  42. });
  43. }));
  44.  
  45. casper.test.assertTruthy(messages.length >= 1 && messages.length <= 30,
  46. 'Loaded ' + messages.length + ' messages');
  47. });
  48. });
  49.  
  50. //Click on a message and verify that that it has an attachment and comments
  51. hsc.step(function() {
  52. hsc.routine.clickSelector('.message ._messageInner',
  53. 'Clicked on message');
  54. // hsc.util.screenshot('clickedLink');
  55.  
  56. casper.waitForSelector('div.attachment', function() {
  57. this.test.assertUrlMatch(/\/#message\?m\=/,
  58. 'url shows single message view' );
  59.  
  60. this.test.assertExists('.content .messageContent',
  61. 'Message visible in detailed view');
  62.  
  63. this.test.assertExists('.statCount ._likeCount',
  64. 'Message like count exists');
  65.  
  66. this.test.assertExists('.statCount ._commentCount',
  67. 'Message comment count exists');
  68. // hsc.util.screenshot('googlePlusDetailedMsgLoading');
  69. });
  70.  
  71. casper.waitForSelector('.statCount ._commentCount', function() {
  72. var comments = this.evaluate(function() {
  73. return $(".statCount ._commentCount").text().slice(0, 1);
  74. });
  75.  
  76. if (comments > 0) {
  77. this.waitForSelector('.comment-list', function() {
  78. this.test.assertExists('.comment-list .comment',
  79. 'Loaded comments');
  80. });
  81. }
  82. // hsc.util.screenshot('facebookDetailedMsgLoaded');
  83. });
  84. });
  85. // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement