Created
January 9, 2017 12:43
-
-
Save wlsf82/ceb3bc8cda5ab46d75dfea2a43270e67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const AppearInRoom = require("../page-objects/appearInRoom"); | |
const Helper = require("../helper"); | |
const RoomActivity = require("../page-objects/roomActivity"); | |
const shortid = require("shortid"); | |
describe("Activity list", () => { | |
const appearInRoom = new AppearInRoom(); | |
const helper = new Helper(); | |
const roomActivity = new RoomActivity(); | |
let randomRoomName; | |
beforeEach(() => { | |
randomRoomName = shortid.generate(); | |
appearInRoom.visit(randomRoomName); | |
helper.clickWhenClickable(roomActivity.refreshButton); | |
helper.sleepForNSeconds(3); | |
}); | |
it("should arrive with opened activity list and closes it", () => { | |
const attribute = "class"; | |
const value = "ng-scope ng-isolate-scope open"; | |
expect(roomActivity.activityList.getAttribute(attribute)).toEqual(value); | |
roomActivity.roomActivityButton.click(); | |
helper.waitForElementWithAttributeNotToHaveValue(roomActivity.activityList, attribute, value); | |
expect(roomActivity.activityList.getAttribute(attribute)).not.toContain(value); | |
}); | |
it("should access a room from the activity list", () => { | |
browser.getCurrentUrl().then((url) => { | |
const secondRandomRoomName = shortid.generate(); | |
const lowerCasedUrl = url.toLowerCase(); | |
appearInRoom.visit(secondRandomRoomName); | |
helper.clickWhenClickable(roomActivity.refreshButton); | |
helper.sleepForNSeconds(3); | |
roomActivity.listItems.filter((elem) => { | |
return elem.getText().then((text) => { | |
return text === randomRoomName.toLowerCase(); | |
}); | |
}).click(); | |
helper.waitForUrlToBeEqualTo(lowerCasedUrl); | |
const currentUrl = browser.getCurrentUrl(); | |
expect(currentUrl).toEqual(lowerCasedUrl); | |
}); | |
}); | |
it("should remove item from the activity list", () => { | |
roomActivity.listItems.count().then((numberOfItemsBeforeRemoval) => { | |
roomActivity.removeFirstItem(); | |
roomActivity.waitForActivityListToHaveSpecificNumberOfItems(roomActivity.listItems, numberOfItemsBeforeRemoval - 1); | |
roomActivity.listItems.count().then((numberOfItemsAfterRemoval) => { | |
roomActivity.waitForActivityListToHaveSpecificNumberOfItems(numberOfItemsBeforeRemoval - 1); | |
expect(numberOfItemsAfterRemoval).toEqual(numberOfItemsBeforeRemoval - 1); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment