1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.common;
17
18 import org.junit.Assert;
19 import org.junit.runner.RunWith;
20
21
22
23
24
25
26
27
28 @RunWith(SmokeTestRunner.class)
29 public abstract class SmokeTestBase extends WebDriverLegacyITBase {
30
31 protected String testUrl = ITUtil.KRAD_PORTAL;
32
33 protected boolean shouldNavigate = false;
34
35 protected abstract String getBookmarkUrl();
36
37 protected abstract void navigate() throws Exception;
38
39 @Override
40 public String getTestUrl() {
41
42
43 return testUrl;
44
45
46
47 }
48
49 protected void enableBookmarkMode() {
50 this.testUrl = getBookmarkUrl();
51 }
52
53 protected void enableNavigationMode() {
54 this.shouldNavigate = true;
55 String classString = this.getClass().toString();
56 if (classString.contains("krad.demo") || classString.contains("library")) {
57 this.testUrl = ITUtil.KRAD_PORTAL;
58 } else if (classString.contains("krad.library")) {
59 this.testUrl = ITUtil.KRAD_PORTAL;
60 } else if (classString.contains("krad.labs")) {
61 this.testUrl = ITUtil.LABS;
62 } else {
63 this.testUrl = ITUtil.PORTAL;
64 }
65 }
66
67 @Override
68 public void fail(String message) {
69 passed = false;
70 Assert.fail(message);
71 }
72
73 @Override
74 protected void navigateInternal() throws Exception {
75 if (this.shouldNavigate) {
76 navigate();
77 }
78 }
79 }