Get test URL from process.env
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
/**
|
||||
* TestCafé test fixtures.
|
||||
* This file is used by TestCafé to run end-to-end tests with chrome against the site.
|
||||
* Tests are grouped into fixtures and fixtures into files.
|
||||
*/
|
||||
import { Selector } from "testcafe";
|
||||
|
||||
fixture`404 page renders and functions correctly`.page("http://localhost:3000/404");
|
||||
import { Selector } from "testcafe";
|
||||
import { getSiteRoot } from "./utils";
|
||||
|
||||
fixture`404 page renders and functions correctly`.page(`${getSiteRoot}/404`);
|
||||
|
||||
test("Page contains the text 404", async t => {
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/**
|
||||
* TestCafé test fixtures.
|
||||
* This file is used by TestCafé to run end-to-end tests with chrome against the site.
|
||||
* Tests are grouped into fixtures and fixtures into files.
|
||||
*/
|
||||
import { Selector, ClientFunction } from "testcafe";
|
||||
import { getSiteRoot } from "./utils";
|
||||
|
||||
fixture`Admin login page functions correctly`.page("http://localhost:3000/admin/login");
|
||||
fixture`Admin login page functions correctly`.page(`${getSiteRoot}/admin/login`);
|
||||
|
||||
test("Login form exists", async t => {
|
||||
/**
|
||||
@@ -26,7 +22,7 @@ test("User can log in with default credentials", async t => {
|
||||
await t.typeText(Selector("#login-password"), PASSWORD);
|
||||
await t.click(Selector("#login-submit"));
|
||||
|
||||
const frontPage = Selector(`[data-e2e="admin-front-page"]`);
|
||||
const frontPage = Selector("[data-e2e=\"admin-front-page\"]");
|
||||
await t.expect(frontPage.exists).ok();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/**
|
||||
* TestCafé test fixtures.
|
||||
* This file is used by TestCafé to run end-to-end tests with chrome against the site.
|
||||
* Tests are grouped into fixtures and fixtures into files.
|
||||
*/
|
||||
import { Selector } from "testcafe";
|
||||
import { getSiteRoot } from "./utils";
|
||||
|
||||
fixture`Front page renders and functions correctly`.page("http://localhost:3000");
|
||||
fixture`Front page renders and functions correctly`.page(`${getSiteRoot}`);
|
||||
|
||||
test("Favicon exists", async t => {
|
||||
/**
|
||||
@@ -21,5 +17,5 @@ test("Header contains text \"Aalto-yliopiston Sähköinsinöörikilta\"", async
|
||||
*/
|
||||
const header = Selector("h1");
|
||||
await t.expect(header.textContent)
|
||||
.contains("Aalto-yliopiston Sähköinsinöörikilta");
|
||||
.contains("Aalto-yliopiston Sähköinsinöörikilta");
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export const getSiteRoot = () => {
|
||||
return process.env.SITE_URL || "http://localhost:3000";
|
||||
}
|
||||
Reference in New Issue
Block a user