Skip to content

Commit 3b896c7

Browse files
sam0r040timonback
andcommitted
chore(springwolf-ui): re-add smoke-test for complete app
Co-authored-by: Timon Back <timonback@users.noreply.github.com>
1 parent af366bb commit 3b896c7

File tree

4 files changed

+57
-10
lines changed

4 files changed

+57
-10
lines changed

springwolf-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build_pages": "ng build",
99
"watch": "ng build --watch",
1010
"test": "jest --no-cache",
11-
"update": "ng update | awk -v re='@[[:alnum:]]' '$0 ~ re {printf $1 \" \"}' | xargs ng update --force=true"
11+
"update": "ng update | awk -v re='@[[:alnum:]]' '$0 ~ re {printf $1 \" \"}' | xargs ng update --force=true && npm update"
1212
},
1313
"private": true,
1414
"dependencies": {

springwolf-ui/src/app/app.component.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ main {
1111
padding: 0;
1212
}
1313

14-
section {
14+
article {
1515
margin: 2em 1em;
1616
}

springwolf-ui/src/app/app.component.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
<app-header></app-header>
33
<main class="mat-typography">
44
<app-sidenav>
5-
<section appNavigationTarget id="info">
5+
<article appNavigationTarget id="info">
66
<app-info></app-info>
7-
</section>
7+
</article>
88

9-
<section appNavigationTarget id="servers">
9+
<article appNavigationTarget id="servers">
1010
<app-servers></app-servers>
11-
</section>
11+
</article>
1212

13-
<section appNavigationTarget id="channels">
13+
<article appNavigationTarget id="channels">
1414
<app-channels> </app-channels>
15-
</section>
15+
</article>
1616

17-
<section appNavigationTarget id="schemas">
17+
<article appNavigationTarget id="schemas">
1818
<app-schemas></app-schemas>
19-
</section>
19+
</article>
2020
</app-sidenav>
2121
</main>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
import { AppComponent } from "./app.component";
3+
import { render, screen, waitFor, within } from "@testing-library/angular";
4+
import { appConfig } from "./app.config";
5+
import { MatIconTestingModule } from "@angular/material/icon/testing";
6+
7+
describe("AppComponent", () => {
8+
test("should render", async () => {
9+
await render(AppComponent, {
10+
providers: appConfig.providers,
11+
imports: [MatIconTestingModule],
12+
});
13+
14+
await waitFor(() => {
15+
expect(
16+
screen.getAllByText("Springwolf example project", { exact: false })
17+
.length
18+
).toBeGreaterThan(0);
19+
});
20+
21+
// get menu items
22+
const articles = screen.getAllByRole("article");
23+
24+
// server menu
25+
const servers = articles.find(
26+
(article) => within(article).queryByText("Servers") !== null
27+
);
28+
expect(servers).not.toBeNull();
29+
expect(within(servers!!).getAllByRole("article").length).toBeGreaterThan(0);
30+
31+
// channel menu
32+
const channels = articles.find(
33+
(article) => within(article).queryByText("Channels") !== null
34+
);
35+
expect(channels).not.toBeNull();
36+
expect(within(channels!!).getAllByRole("article").length).toBeGreaterThan(
37+
0
38+
);
39+
40+
// schema menu
41+
const schemas = articles.find(
42+
(article) => within(article).queryByText("Schemas") !== null
43+
);
44+
expect(schemas).not.toBeNull();
45+
expect(within(schemas!!).getAllByRole("article").length).toBeGreaterThan(0);
46+
});
47+
});

0 commit comments

Comments
 (0)