Skip to content

Commit 83a4c35

Browse files
authored
Fix diagnostics tests (#1456)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
1 parent 4c0c46f commit 83a4c35

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

portal-ui/tests/permissions/diagnostics.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,15 @@ import * as roles from "../utils/roles";
1818
import * as elements from "../utils/elements";
1919
import { diagnosticsElement, supportElement } from "../utils/elements-menu";
2020

21-
fixture("For user with Diagnostics permissions")
22-
.page("http://localhost:9090")
23-
.beforeEach(async (t) => {
24-
await t.useRole(roles.diagnostics);
25-
});
21+
fixture("For user with Diagnostics permissions").page("http://localhost:9090");
2622

2723
test("Support sidebar item exists", async (t) => {
28-
await t.expect(supportElement.exists).ok();
24+
await t.useRole(roles.diagnostics).expect(supportElement.exists).ok();
2925
});
3026

3127
test("Diagnostics link exists in Tools page", async (t) => {
3228
await t
29+
.useRole(roles.diagnostics)
3330
.expect(supportElement.exists)
3431
.ok()
3532
.click(supportElement)
@@ -38,50 +35,61 @@ test("Diagnostics link exists in Tools page", async (t) => {
3835
});
3936

4037
test("Diagnostics page can be opened", async (t) => {
41-
await t.navigateTo("http://localhost:9090/support/diagnostics");
38+
await t
39+
.useRole(roles.diagnostics)
40+
.navigateTo("http://localhost:9090/support/diagnostics");
4241
});
4342

4443
test("Start Diagnostic button exists", async (t) => {
4544
const startDiagnosticExists = elements.startDiagnosticButton.exists;
4645
await t
46+
.useRole(roles.diagnostics)
4747
.navigateTo("http://localhost:9090/support/diagnostics")
4848
.expect(startDiagnosticExists)
4949
.ok();
5050
});
5151

5252
test("Start Diagnostic button can be clicked", async (t) => {
5353
await t
54+
.useRole(roles.diagnostics)
5455
.navigateTo("http://localhost:9090/support/diagnostics")
5556
.click(elements.startDiagnosticButton);
5657
});
5758

5859
test("Download button exists after Diagnostic is completed", async (t) => {
59-
const downloadExists = elements.downloadButton.exists;
6060
await t
61+
.useRole(roles.diagnostics)
6162
.navigateTo("http://localhost:9090/support/diagnostics")
6263
.click(elements.startDiagnosticButton)
63-
.expect(downloadExists)
64+
.wait(2000)
65+
.expect(elements.downloadButton.exists)
6466
.ok();
6567
});
6668

6769
test("Download button is clickable after Diagnostic is completed", async (t) => {
6870
await t
71+
.useRole(roles.diagnostics)
6972
.navigateTo("http://localhost:9090/support/diagnostics")
7073
.click(elements.startDiagnosticButton)
74+
.wait(2000)
7175
.click(elements.downloadButton);
7276
});
7377

7478
test("Start New Diagnostic button exists after Diagnostic is completed", async (t) => {
7579
await t
80+
.useRole(roles.diagnostics)
7681
.navigateTo("http://localhost:9090/support/diagnostics")
7782
.click(elements.startDiagnosticButton)
83+
.wait(2000)
7884
.expect(elements.startNewDiagnosticButton.exists)
7985
.ok();
8086
});
8187

8288
test("Start New Diagnostic button is clickable after Diagnostic is completed", async (t) => {
8389
await t
90+
.useRole(roles.diagnostics)
8491
.navigateTo("http://localhost:9090/support/diagnostics")
8592
.click(elements.startDiagnosticButton)
93+
.wait(2000)
8694
.click(elements.startNewDiagnosticButton);
8795
});

0 commit comments

Comments
 (0)