-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexternal-employee-test.js
64 lines (49 loc) · 1.92 KB
/
external-employee-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { visit } from "@ember/test-helpers";
import { setupMirage } from "ember-cli-mirage/test-support";
import { setupApplicationTest } from "ember-qunit";
import { setBreakpoint } from "ember-responsive/test-support";
import { authenticateSession } from "ember-simple-auth/test-support";
import { module, test } from "qunit";
module("Acceptance | external employee", function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
hooks.beforeEach(async function () {
const user = this.server.create("user");
this.user = user;
await authenticateSession({ user_id: user.id });
// get active employment and set it to isExternal
const activeEmployment = this.user.employments.filter(
(e) => e.end === null,
);
activeEmployment.update({ isExternal: true });
});
test("cant view statistics", async function (assert) {
await visit("/statistics");
assert.dom("h1").includesText("Access forbidden");
assert
.dom("h4")
.includesText("You do not have the permission to access this page");
});
test("cant view analysis", async function (assert) {
setBreakpoint("md");
await visit("/analysis");
assert.dom("h1").includesText("Access forbidden");
assert
.dom("h4")
.includesText("You do not have the permission to access this page");
});
test("cant add absence", async function (assert) {
await visit("/");
assert.dom("[data-test-add-absence]").isDisabled();
});
test("can only view tracking in top navigation", async function (assert) {
await visit("/");
assert.dom("section > ul > li").exists({ count: 4 });
assert.dom("section > ul > li").includesText("Tracking");
});
test("cant view balances", async function (assert) {
await visit(`/users/${this.user.id}`);
assert.dom("[user-header-worktime-balance-container]").doesNotExist();
assert.dom("[user-header-absence-balance-container]").doesNotExist();
});
});