Skip to content

Commit 194acb5

Browse files
committed
SAK-51196 webcomponents Run tests on maven build
https://sakaiproject.atlassian.net/browse/SAK-51196
1 parent 441efb2 commit 194acb5

File tree

114 files changed

+1196
-1735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1196
-1735
lines changed

Diff for: rubrics/api/src/main/bundle/rubrics.properties

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ existing student rubric scores to the default point value for selected ratings.
9090
public_rubrics_title=Publicly Shared Rubrics
9191
public_rubrics_info=Rubrics in this section were created by instructors and shared publicly with all users. You can share a rubric publicly by clicking on the "Globe" icon next to the rubric you would like to share. To use one of these rubrics in your course site, expand the "Public Rubrics" section and click on the "Copy" icon located in the "Actions" column.
9292
93-
# Rubrics in pdf
9493
export_title=Export {}
9594
export_rubric_title=Exported Rubric Title: {0}
9695
export_rubric_student=Student Name: {0}

Diff for: webcomponents/bundle/src/main/bundle/tasks.properties

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
filter_label=Filter your tasks
12
filter_current=All Current
23
filter_priority_5=Priority: 5
34
filter_priority_4=Priority: 4
@@ -10,6 +11,7 @@ priority_2_tooltip=Quite low (2) priority
1011
priority_3_tooltip=Medium (3) priority
1112
priority_4_tooltip=Quite high (4) priority
1213
priority_5_tooltip=High (5) priority
14+
sort_label=Sort your tasks
1315
sort_none=Sort
1416
sort_due_latest_first=Due: Latest First
1517
sort_due_earliest_first=Due: Earliest First

Diff for: webcomponents/tool/pom.xml

+9-35
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,6 @@
1313
<artifactId>webcomponents</artifactId>
1414
<packaging>war</packaging>
1515

16-
<dependencies>
17-
<!--dependency>
18-
<groupId>org.sakaiproject.kernel</groupId>
19-
<artifactId>sakai-kernel-api</artifactId>
20-
</dependency>
21-
<dependency>
22-
<groupId>org.sakaiproject.kernel</groupId>
23-
<artifactId>sakai-component-manager</artifactId>
24-
</dependency>
25-
<dependency>
26-
<groupId>org.sakaiproject.kernel</groupId>
27-
<artifactId>sakai-kernel-util</artifactId>
28-
</dependency>
29-
<dependency>
30-
<groupId>org.sakaiproject.entitybroker</groupId>
31-
<artifactId>entitybroker-api</artifactId>
32-
</dependency>
33-
<dependency>
34-
<groupId>org.sakaiproject.entitybroker</groupId>
35-
<artifactId>entitybroker-utils</artifactId>
36-
</dependency>
37-
<dependency>
38-
<groupId>org.springframework</groupId>
39-
<artifactId>spring-beans</artifactId>
40-
</dependency>
41-
<dependency>
42-
<groupId>javax.servlet</groupId>
43-
<artifactId>javax.servlet-api</artifactId>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.apache.commons</groupId>
47-
<artifactId>commons-lang3</artifactId>
48-
</dependency-->
49-
</dependencies>
50-
5116
<build>
5217
<plugins>
5318
<plugin>
@@ -141,6 +106,15 @@
141106
<arguments>ci --no-fund</arguments>
142107
</configuration>
143108
</execution>
109+
<execution>
110+
<id>test</id>
111+
<goals>
112+
<goal>npm</goal>
113+
</goals>
114+
<configuration>
115+
<arguments>run test</arguments>
116+
</configuration>
117+
</execution>
144118
<execution>
145119
<id>lint</id>
146120
<goals>

Diff for: webcomponents/tool/src/main/frontend/package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"lint": "eslint \"packages/**/src/*.js\" --max-warnings=0",
1111
"bundle": "esbuild \"bundle-entry-points/*.js\" --sourcemap --preserve-symlinks --bundle --splitting --format=esm --outdir=bundles --minify",
1212
"analyze-bundle": "esbuild \"bundle-entry-points/*.js\" --preserve-symlinks --splitting --bundle --metafile=meta.json --format=esm --outdir=bundles --minify",
13-
"analyze": "lit-analyzer --strict --quiet --rules.no-complex-attribute-binding=warning --rules.no-incompatible-type-binding=off \"packages/**/src/*.js\""
13+
"analyze": "lit-analyzer --strict --quiet --rules.no-complex-attribute-binding=warning --rules.no-incompatible-type-binding=off \"packages/**/src/*.js\"",
14+
"test": "lerna run test --concurrency 1 --since origin/master --stream",
15+
"test-diff": "lerna run test --concurrency 1 --since HEAD --stream"
1416
},
1517
"keywords": [],
1618
"author": "",
@@ -28,7 +30,7 @@
2830
"@sakai-ui/sakai-dialog-content": "file:packages/sakai-dialog-content",
2931
"@sakai-ui/sakai-document-viewer": "file:packages/sakai-document-viewer",
3032
"@sakai-ui/sakai-editor": "file:packages/sakai-editor",
31-
"@sakai-ui/sakai-file-list": "file:packages/sakai-file-list",
33+
"@sakai-ui/sakai-element": "file:packages/sakai-element",
3234
"@sakai-ui/sakai-grader": "file:packages/sakai-grader",
3335
"@sakai-ui/sakai-grades": "file:packages/sakai-grades",
3436
"@sakai-ui/sakai-group-picker": "file:packages/sakai-group-picker",
@@ -58,15 +60,12 @@
5860
"fetch-mock": "^9.11.0",
5961
"globals": "^15.11.0",
6062
"imagesloaded": "^5.0.0",
63+
"lerna": "^8.1.9",
6164
"lint-staged": "^15.2.10",
65+
"lit": "^3.2.1",
6266
"lit-analyzer": "^2.0.3",
6367
"sinon": "^19.0.2",
6468
"sortablejs": "^1.15.3",
6569
"temporal-polyfill": "0.2.5"
66-
},
67-
"dependencies": {
68-
"@sakai-ui/sakai-element": "^3.0.6",
69-
"lerna": "^8.1.9",
70-
"lit": "^3.2.1"
7170
}
7271
}

Diff for: webcomponents/tool/src/main/frontend/packages/sakai-announcements/test/sakai-announcements.test.js

+9-19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
INSTRUCTOR_ORDER,
1212
} from "../src/sakai-announcements-constants.js";
1313
import * as sitePickerData from "../../sakai-site-picker/test/data.js";
14-
import { elementUpdated, expect, fixture, waitUntil, aTimeout } from "@open-wc/testing";
14+
import { elementUpdated, expect, fixture } from "@open-wc/testing";
1515
import fetchMock from "fetch-mock/esm/client";
1616

1717
describe("sakai-announcements tests", () => {
@@ -28,14 +28,14 @@ describe("sakai-announcements tests", () => {
2828
it ("renders in user mode correctly", async () => {
2929

3030
// In user mode, we'd expect to get announcements from multiple sites.
31-
let el = await fixture(html`
31+
const el = await fixture(html`
3232
<sakai-announcements user-id="${data.userId}"></sakai-announcements>
3333
`);
3434

35-
await waitUntil(() => el.dataPage);
36-
3735
await elementUpdated(el);
3836

37+
await expect(el).to.be.accessible();
38+
3939
expect(el.shadowRoot.querySelectorAll("div.title").length).to.equal(3);
4040

4141
expect(el.shadowRoot.querySelectorAll(".header").length).to.equal(3);
@@ -83,31 +83,21 @@ describe("sakai-announcements tests", () => {
8383
siteSelect.dispatchEvent(new CustomEvent("sites-selected", { detail: { value: data.vavavoom }, bubbles: true }));
8484
await elementUpdated(el);
8585
expect(el.shadowRoot.querySelectorAll("div.title").length).to.equal(1);
86+
87+
await expect(el).to.be.accessible();
8688
});
8789

8890
it ("renders in site mode correctly", async () => {
8991

90-
let el = await fixture(html`
92+
const el = await fixture(html`
9193
<sakai-announcements site-id="${data.siteId}"></sakai-announcements>
9294
`);
9395

94-
await waitUntil(() => el.dataPage);
9596
await elementUpdated(el);
9697

97-
expect(el.shadowRoot.querySelectorAll(".title").length).to.equal(2);
98+
await expect(el).to.be.accessible();
9899

100+
expect(el.shadowRoot.querySelectorAll(".title").length).to.equal(2);
99101
expect(el.shadowRoot.querySelectorAll(".header").length).to.equal(2);
100102
});
101-
102-
it ("is accessible", async () => {
103-
104-
let el = await fixture(html`
105-
<sakai-announcements user-id="${data.userId}"></sakai-announcements>
106-
`);
107-
108-
await waitUntil(() => el.dataPage);
109-
await elementUpdated(el);
110-
111-
expect(el.shadowRoot).to.be.accessible();
112-
});
113103
});
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// import { playwrightLauncher } from '@web/test-runner-playwright';
1+
const filteredLogs = ['Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.'];
22

3-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
3+
export default ({
44

5-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6-
/** Test files to run */
75
files: 'test/**/*.test.js',
86

97
rootDir: '../../',
108

11-
/** Resolve bare module imports */
12-
nodeResolve: {
13-
exportConditions: ['browser', 'development'],
14-
},
9+
nodeResolve: true,
1510

1611
/** Filter out lit dev mode logs */
1712
filterBrowserLogs(log) {
@@ -22,22 +17,4 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
2217
}
2318
return true;
2419
},
25-
26-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
27-
// esbuildTarget: 'auto',
28-
29-
/** Amount of browsers to run concurrently */
30-
// concurrentBrowsers: 2,
31-
32-
/** Amount of test files per browser to test concurrently */
33-
// concurrency: 1,
34-
35-
/** Browsers to run tests on */
36-
// browsers: [
37-
// playwrightLauncher({ product: 'chromium' }),
38-
// playwrightLauncher({ product: 'firefox' }),
39-
// playwrightLauncher({ product: 'webkit' }),
40-
// ],
41-
42-
// See documentation for all available options
4320
});

Diff for: webcomponents/tool/src/main/frontend/packages/sakai-button/src/SakaiButton.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { SakaiShadowElement } from "@sakai-ui/sakai-element";
22
import { css, html } from "lit";
3+
import { ifDefined } from "lit/directives/if-defined.js";
34

45
export class SakaiButton extends SakaiShadowElement {
56

@@ -27,6 +28,7 @@ export class SakaiButton extends SakaiShadowElement {
2728
<button
2829
class="${this.primary ? "primary" : ""} ${this.type ? this.type : ""}"
2930
@click=${this.clicked}
31+
title="${ifDefined(this.title)}"
3032
>
3133
<slot>
3234
</slot>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
import "../sakai-button.js";
2-
import { expect, fixture, waitUntil } from "@open-wc/testing";
2+
import { elementUpdated, expect, fixture, waitUntil } from "@open-wc/testing";
33
import { html } from "lit";
44

55
describe("sakai-button tests", () => {
66

7-
it ("renders correctly", async () => {
7+
it ("renders correctly with text content", async () => {
88

9-
const el = await fixture(html`<sakai-button primary>Eggs</sakai-button>`);
9+
const el = await fixture(html`<sakai-button title="eggs button" primary>Eggs</sakai-button>`);
10+
11+
await elementUpdated(el);
12+
13+
await expect(el).to.be.accessible();
1014

1115
expect(el.shadowRoot.querySelector("button").classList.contains("primary")).to.be.true;
1216
});
1317

14-
it ("is accessible", async () => {
18+
it ("renders correctly with no text", async () => {
19+
20+
const title = "No text button";
21+
const el = await fixture(html`<sakai-button title="${title}"></sakai-button>`);
1522

16-
const el = await fixture(html`<sakai-button>Eggs</sakai-button>`);
23+
await elementUpdated(el);
1724

1825
await expect(el).to.be.accessible();
26+
27+
expect(el.shadowRoot.querySelector("button").getAttribute("title")).to.equal(title);
1928
});
2029
});
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// import { playwrightLauncher } from '@web/test-runner-playwright';
1+
const filteredLogs = ['Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.'];
22

3-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
3+
export default ({
44

5-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6-
/** Test files to run */
75
files: 'test/**/*.test.js',
86

97
rootDir: '../../',
108

11-
/** Resolve bare module imports */
12-
nodeResolve: {
13-
exportConditions: ['browser', 'development'],
14-
},
9+
nodeResolve: true,
1510

1611
/** Filter out lit dev mode logs */
1712
filterBrowserLogs(log) {
@@ -22,22 +17,4 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
2217
}
2318
return true;
2419
},
25-
26-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
27-
// esbuildTarget: 'auto',
28-
29-
/** Amount of browsers to run concurrently */
30-
// concurrentBrowsers: 2,
31-
32-
/** Amount of test files per browser to test concurrently */
33-
// concurrency: 1,
34-
35-
/** Browsers to run tests on */
36-
// browsers: [
37-
// playwrightLauncher({ product: 'chromium' }),
38-
// playwrightLauncher({ product: 'firefox' }),
39-
// playwrightLauncher({ product: 'webkit' }),
40-
// ],
41-
42-
// See documentation for all available options
4320
});

Diff for: webcomponents/tool/src/main/frontend/packages/sakai-calendar/test/sakai-calendar.test.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "../sakai-calendar.js";
22
import { html } from "lit";
33
import * as data from "./data.js";
44
import * as sitePickerData from "../../sakai-site-picker/test/data.js";
5-
import { expect, fixture, waitUntil, aTimeout } from "@open-wc/testing";
5+
import { elementUpdated, expect, fixture, waitUntil } from "@open-wc/testing";
66
import fetchMock from "fetch-mock/esm/client";
77

88
describe("sakai-calendar tests", () => {
@@ -26,21 +26,16 @@ describe("sakai-calendar tests", () => {
2626

2727
waitUntil(() => el.events);
2828

29+
await elementUpdated(el);
30+
await expect(el).to.be.accessible();
31+
2932
el.dispatchEvent(new CustomEvent("user-selected-date-changed", { detail: { selectedDate: data.selectedDate } }));
3033

31-
await el.updateComplete;
34+
await elementUpdated(el);
35+
await expect(el).to.be.accessible();
3236

3337
expect(el.shadowRoot.querySelector("#days-events a")).to.exist;
3438
expect(el.shadowRoot.querySelectorAll("#days-events a span").item(0).innerHTML).to.contain(data.userCalendarEvents.events[0].title);
3539
expect(el.shadowRoot.querySelectorAll("#days-events a span").item(1).innerHTML).to.contain(data.userCalendarEvents.events[0].siteTitle);
3640
});
37-
38-
it ("is accessible", async () => {
39-
40-
let el = await fixture(html`
41-
<sakai-calendar user-id="${data.userId}"></sakai-calendar>
42-
`);
43-
44-
expect(el.shadowRoot).to.be.accessible();
45-
});
4641
});
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
// import { playwrightLauncher } from '@web/test-runner-playwright';
1+
const filteredLogs = ['Lit is in dev mode. Not recommended for production! See https://lit.dev/msg/dev-mode for more information.'];
22

3-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
3+
export default ({
44

5-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6-
/** Test files to run */
75
files: 'test/**/*.test.js',
86

97
rootDir: '../../',
108

11-
/** Resolve bare module imports */
12-
nodeResolve: {
13-
exportConditions: ['browser', 'development'],
14-
},
9+
nodeResolve: true,
1510

1611
/** Filter out lit dev mode logs */
1712
filterBrowserLogs(log) {
@@ -22,22 +17,4 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
2217
}
2318
return true;
2419
},
25-
26-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
27-
// esbuildTarget: 'auto',
28-
29-
/** Amount of browsers to run concurrently */
30-
// concurrentBrowsers: 2,
31-
32-
/** Amount of test files per browser to test concurrently */
33-
// concurrency: 1,
34-
35-
/** Browsers to run tests on */
36-
// browsers: [
37-
// playwrightLauncher({ product: 'chromium' }),
38-
// playwrightLauncher({ product: 'firefox' }),
39-
// playwrightLauncher({ product: 'webkit' }),
40-
// ],
41-
42-
// See documentation for all available options
4320
});

0 commit comments

Comments
 (0)