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")) {
57 this.testUrl = ITUtil.KRAD_PORTAL;
58 } else if (classString.contains("krad.labs")) {
59 this.testUrl = ITUtil.LABS;
60 } else {
61 this.testUrl = ITUtil.PORTAL;
62 }
63 }
64
65 @Override
66 public void fail(String message) {
67 passed = false;
68 Assert.fail(message);
69 }
70
71 @Override
72 protected void navigateInternal() throws Exception {
73 if (this.shouldNavigate) {
74 navigate();
75 }
76 }
77 }