|
| 1 | +import it, {itOnly} from '../helpers/appium'; |
| 2 | +import server from '../helpers/server'; |
| 3 | +import fixtures from '../helpers/fixtures'; |
| 4 | +import bootstrap from '../helpers/bootstrap'; |
| 5 | + |
| 6 | +describe.only("Posts", () => { |
| 7 | + it("should show my posts", function* (driver, done) { |
| 8 | + server.get("/api/posts/tester", fixtures.home()); |
| 9 | + |
| 10 | + yield bootstrap().login().nav("dashboard").launch(driver); |
| 11 | + |
| 12 | + yield driver.elementById('Dashboard'); |
| 13 | + yield driver.elementById('post1'); |
| 14 | + |
| 15 | + done(); |
| 16 | + }); |
| 17 | + |
| 18 | + it("should show an empty list", function* (driver, done) { |
| 19 | + server.get("/api/posts/tester", { username: "tester", posts: [] }); |
| 20 | + |
| 21 | + yield bootstrap().login().nav("dashboard").launch(driver); |
| 22 | + |
| 23 | + yield driver.elementById('Dashboard'); |
| 24 | + yield driver.elementById('No items'); |
| 25 | + |
| 26 | + done(); |
| 27 | + }); |
| 28 | + |
| 29 | + it("should my friends's posts", function* (driver, done) { |
| 30 | + server.get("/api/posts/friend", fixtures.friend()); |
| 31 | + |
| 32 | + yield bootstrap().login().nav("dashboard/follows/friend").launch(driver); |
| 33 | + |
| 34 | + yield driver.elementById('friend'); |
| 35 | + yield driver.elementById('post3'); |
| 36 | + |
| 37 | + done(); |
| 38 | + }); |
| 39 | + |
| 40 | + it("should create a new post", function* (driver, done) { |
| 41 | + var list = fixtures.home(); |
| 42 | + server.get("/api/posts/tester", list); |
| 43 | + server.post("/api/posts", {id: 100, content: 'new post here', username: 'tester' }); |
| 44 | + |
| 45 | + yield bootstrap().login().launch(driver); |
| 46 | + |
| 47 | + yield driver.elementById('+').click(); // new post! |
| 48 | + |
| 49 | + yield driver.elementById('New Post'); |
| 50 | + |
| 51 | + yield driver.execute("target.frontMostApp().keyboard().typeString('new post here')"); |
| 52 | + |
| 53 | + yield driver.elementById('Submit').click(); |
| 54 | + |
| 55 | + yield driver.elementById('Dashboard'); |
| 56 | + |
| 57 | + yield driver.elementById('new post here'); // it's there! |
| 58 | + |
| 59 | + done(); |
| 60 | + }); |
| 61 | + |
| 62 | +}); |
0 commit comments