Refactor tests

This commit is contained in:
Jan Tuomi
2018-06-22 11:52:58 +03:00
parent f7059eefbe
commit c34664f556
2 changed files with 6 additions and 8 deletions
+2 -6
View File
@@ -5,7 +5,7 @@
*/
import { Selector } from "testcafe";
fixture`Page renders correctly`.page("http://localhost:3000");
fixture`Front page renders and functions correctly`.page("http://localhost:3000");
test("Favicon exists", async t => {
/**
@@ -32,8 +32,6 @@ test("Header contains text \"Aalto-yliopiston sähköinsinöörikilta!\"", async
.contains("Aalto-yliopiston sähköinsinöörikilta!");
});
fixture`Increment button`.page("http://localhost:3000");
test("Increment button functions correctly", async t => {
/**
* Test if the increment button works and increments the number inside the button
@@ -44,12 +42,10 @@ test("Increment button functions correctly", async t => {
await t.expect(button.textContent).contains("1");
});
fixture`Posts from API`.page("http://localhost:3000");
test("At least one post exists", async t => {
/**
* Test if the API responds with at least one post and it is rendered to the page
*/
const post = Selector(".post");
await t.expect(post.exists).ok();
await t.expect(post.count).gte(1);
});