import { Selector } from "testcafe";
import { getSiteRoot } from "./utils";

fixture`Front page renders and functions correctly`.page(`${getSiteRoot()}`);

test("Favicon exists", async (t) => {
  /**
   * Test if there is a favicon element on the page
   */
  const elem = Selector("link[rel=\"icon\"]");
  await t.expect(elem.exists).ok();
});

test("Header contains text \"Aalto-yliopiston Sähköinsinöörikilta\"", async (t) => {
  /**
   * Test if the header contains the text.
   */
  const header = Selector("h1");
  await t.expect(header.textContent)
    .contains("Aalto-yliopiston Sähköinsinöörikilta");
});
