Remove jest because it is not needed
Use Testcafé e2e tests for all kinds of frontend testing
This commit is contained in:
@@ -3,23 +3,35 @@
|
||||
* 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 { Selector } from "testcafe";
|
||||
|
||||
fixture`Page renders correctly`.page('http://localhost:3000');
|
||||
fixture`Page renders correctly`.page("http://localhost:3000");
|
||||
|
||||
test('Paragraph exists and is visible', async t => {
|
||||
/**
|
||||
* Test if there is a paragraph on the page.
|
||||
*/
|
||||
const p = Selector('p');
|
||||
await t.expect(await p.exists && await p.visible);
|
||||
test("Paragraph exists and is visible", async t => {
|
||||
/**
|
||||
* Test if there is a paragraph on the page.
|
||||
*/
|
||||
const p = Selector("p");
|
||||
await t.expect(p.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');
|
||||
test("Header contains text \"Aalto-yliopiston sähköinsinöörikilta!\"", async t => {
|
||||
/**
|
||||
* Test if the header contains the text.
|
||||
*/
|
||||
const header = Selector("h1");
|
||||
const text = await header.textContent;
|
||||
await t.expect(text.includes('Aalto-yliopiston sähköinsinöörikilta!'));
|
||||
await t.expect(text).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
|
||||
*/
|
||||
const button = Selector("button");
|
||||
await t.expect(button.textContent).contains("0");
|
||||
await t.click(button);
|
||||
await t.expect(button.textContent).contains("1");
|
||||
});
|
||||
Reference in New Issue
Block a user