Lint test files, clean TS settings
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Selector } from "testcafe";
|
||||
import { getSiteRoot, getPageUrl, generateTestForm, deleteEvent, deleteForm, doLogin, generateToken, getPostRequestLogger } from "../utils";
|
||||
import {
|
||||
getSiteRoot, getPageUrl, generateTestForm, deleteEvent, deleteForm, doLogin, generateToken, getPostRequestLogger,
|
||||
} from "../utils";
|
||||
|
||||
const LOGGER = getPostRequestLogger("events/");
|
||||
|
||||
@@ -12,11 +14,11 @@ fixture`Admin events`.page(`${getSiteRoot()}/admin/events`)
|
||||
})
|
||||
.after(async (ctx) => {
|
||||
const token = await generateToken();
|
||||
const eResp = await deleteEvent(ctx.eventId, token);
|
||||
await deleteEvent(ctx.eventId, token);
|
||||
await deleteForm(ctx.formId, token);
|
||||
});
|
||||
|
||||
test("Logged in user can create event", async t => {
|
||||
test("Logged in user can create event", async (t) => {
|
||||
const loginForm = Selector("form.admin-login-form");
|
||||
await t.expect(loginForm.exists).ok();
|
||||
await doLogin(t);
|
||||
@@ -37,7 +39,6 @@ test("Logged in user can create event", async t => {
|
||||
const locationFi = Selector("#rjsf_location_fi");
|
||||
const locationEn = Selector("#rjsf_location_en");
|
||||
|
||||
|
||||
const tagSelect = Selector("#rjsf_tags");
|
||||
const signupSelect = Selector("#rjsf_signupForm");
|
||||
// const tagOption = tagSelect.find("option").withExactText("Testi");
|
||||
@@ -50,19 +51,18 @@ test("Logged in user can create event", async t => {
|
||||
.click(tagSelect)
|
||||
.pressKey("down")
|
||||
.pressKey("down")
|
||||
.pressKey("space")
|
||||
// .pressKey("tab");
|
||||
.pressKey("space");
|
||||
// .pressKey("tab");
|
||||
|
||||
// .click(tagOption, { modifiers: { ctrl: true } });
|
||||
await t
|
||||
.click(signupSelect)
|
||||
.pressKey("down")
|
||||
.pressKey("down")
|
||||
.pressKey("space")
|
||||
// .pressKey("tab");
|
||||
.pressKey("space");
|
||||
// .pressKey("tab");
|
||||
// .click(signupOption, { modifiers: { ctrl: true } });
|
||||
|
||||
|
||||
await t
|
||||
.typeText(titleFi, "title_fi")
|
||||
.typeText(descFi, "desc_fi")
|
||||
@@ -78,12 +78,13 @@ test("Logged in user can create event", async t => {
|
||||
await t.click(submit);
|
||||
|
||||
const parsed = JSON.parse(LOGGER.requests[0].response.body);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
t.fixtureCtx.eventId = parsed.id;
|
||||
|
||||
const statusMessage = Selector("[data-e2e=\"admin-form-status-message\"]");
|
||||
await t
|
||||
.hover(statusMessage)
|
||||
.expect(
|
||||
statusMessage.innerText
|
||||
statusMessage.innerText,
|
||||
).eql("Event created successfully");
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Selector } from "testcafe";
|
||||
import { getSiteRoot, getPageUrl, deleteForm, doLogin, generateToken, getPostRequestLogger } from "../utils";
|
||||
import {
|
||||
getSiteRoot, getPageUrl, deleteForm, doLogin, generateToken, getPostRequestLogger,
|
||||
} from "../utils";
|
||||
|
||||
const LOGGER = getPostRequestLogger("signupForm/");
|
||||
|
||||
@@ -10,7 +12,7 @@ fixture`Admin signup form`.page(`${getSiteRoot()}/admin/signups`)
|
||||
await deleteForm(ctx.formId, token);
|
||||
});
|
||||
|
||||
test("Logged in user can create signup", async t => {
|
||||
test("Logged in user can create signup", async (t) => {
|
||||
const loginForm = Selector("form.admin-login-form");
|
||||
await t.expect(loginForm.exists).ok();
|
||||
await doLogin(t);
|
||||
@@ -38,7 +40,7 @@ test("Logged in user can create signup", async t => {
|
||||
let question = lastQuestion();
|
||||
let questionName = question.child("input");
|
||||
let questionTypeSelect = question.child("select");
|
||||
let requiredBox = question.child("label")
|
||||
let requiredBox = question.child("label");
|
||||
|
||||
await t
|
||||
.selectText(questionName)
|
||||
@@ -81,12 +83,13 @@ test("Logged in user can create signup", async t => {
|
||||
await t.click(submit);
|
||||
|
||||
const parsed = JSON.parse(LOGGER.requests[0].response.body);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
t.fixtureCtx.formId = parsed.id;
|
||||
|
||||
const statusMessage = Selector("[data-e2e=\"admin-form-status-message\"]");
|
||||
await t
|
||||
.hover(statusMessage)
|
||||
.expect(
|
||||
statusMessage.innerText
|
||||
statusMessage.innerText,
|
||||
).eql("Sign-up created successfully");
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getSiteRoot, doLogin } from "../utils";
|
||||
|
||||
fixture`Admin login page functions correctly`.page(`${getSiteRoot()}/admin/login`);
|
||||
|
||||
test("Login form exists", async t => {
|
||||
test("Login form exists", async (t) => {
|
||||
/**
|
||||
* Test if the page contains a form.
|
||||
*/
|
||||
@@ -11,7 +11,7 @@ test("Login form exists", async t => {
|
||||
await t.expect(form.exists).ok();
|
||||
});
|
||||
|
||||
test("User can log in with default credentials", async t => {
|
||||
test("User can log in with default credentials", async (t) => {
|
||||
/**
|
||||
* Test if the user can log in with default credentials.
|
||||
*/
|
||||
@@ -21,7 +21,7 @@ test("User can log in with default credentials", async t => {
|
||||
await t.expect(frontPage.exists).ok();
|
||||
});
|
||||
|
||||
test("User can log out and is redirected to login", async t => {
|
||||
test("User can log out and is redirected to login", async (t) => {
|
||||
/**
|
||||
* Test if the user can log out.
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ test("User can log out and is redirected to login", async t => {
|
||||
await t.expect(loginForm.exists).ok();
|
||||
});
|
||||
|
||||
test("User is redirected to login when JWT token is invalid", async t => {
|
||||
test("User is redirected to login when JWT token is invalid", async (t) => {
|
||||
/**
|
||||
* Test if the user is redirected to login when JWT token is invalid.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user