Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hsc.begin("Verify that we can enter a mobile web facebook stream and all functionality works", [
- "Login and verify that streams have loaded",
- "Click on Facebook Stream and verify that we've entered it",
- "Verify tap-to-update works and that messages have loaded",
- "Click on a message and verify that that it has an attachment and comments",
- "Verify like and unlike functionality",
- "Add a comment to the message and verify that it was added",
- ], function suite(test) {
- //Login and verify that streams have loaded
- hsc.step(function() {
- hsc.routine.mweb_login(username, password);
- casper.waitForText('Streams', function() {
- this.test.assertTitle('Hootsuite - Streams',
- 'Successfully logged in and loaded Streams view');
- });
- });
- //Click on Facebook Stream and verify that we've entered it
- hsc.step(function() {
- hsc.routine.clickSelector(x ('//div[@class="box _box" and contains(.,"Timeline")]'),
- 'Entering Hootsuite\'s Wall Posts');
- // hsc.util.screenshot('feed_enter');
- casper.waitForSelector('._messages', function() {
- this.test.assertTitle('Timeline',
- 'Successfully entered Hootsuite\'s Wall Posts' );
- // hsc.util.screenshot('inFacebookSentMessages');
- });
- });
- //Verify tap-to-update works and that messages have loaded
- hsc.step(function() {
- casper.waitForSelector('div.facebook', function() {
- hsc.routine.clickSelector(x ('//div[contains(@class, "_tapToRefresh")]'), false);
- var messages = [];
- messages = messages.concat(this.evaluate(function () {
- var messages = document.querySelectorAll('div.facebook');
- return Array.prototype.map.call(messages, function (e) {
- return e.getAttribute ('data-id');
- });
- }));
- casper.test.assertTruthy(messages.length >= 1 && messages.length <= 30,
- 'Loaded ' + messages.length + ' messages');
- });
- });
- //Click on a message and verify that that it has an attachment and comments
- hsc.step(function() {
- hsc.routine.clickSelector('.message ._messageInner',
- 'Clicked on message');
- // hsc.util.screenshot('clickedLink');
- casper.waitForSelector('div.attachment', function() {
- this.test.assertUrlMatch(/\/#message\?m\=/,
- 'url shows single message view' );
- this.test.assertExists('.content .messageContent',
- 'Message visible in detailed view');
- this.test.assertExists('.statCount ._likeCount',
- 'Message like count exists');
- this.test.assertExists('.statCount ._commentCount',
- 'Message comment count exists');
- // hsc.util.screenshot('googlePlusDetailedMsgLoading');
- });
- casper.waitForSelector('.statCount ._commentCount', function() {
- var comments = this.evaluate(function() {
- return $(".statCount ._commentCount").text().slice(0, 1);
- });
- if (comments > 0) {
- this.waitForSelector('.comment-list', function() {
- this.test.assertExists('.comment-list .comment',
- 'Loaded comments');
- });
- }
- // hsc.util.screenshot('facebookDetailedMsgLoaded');
- });
- });
- // ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement