Skip to content

Commit 02dd676

Browse files
committed
Project changes
1 parent 82841d9 commit 02dd676

22 files changed

+804
-227
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ target/
1717

1818
screenshot/
1919

20-
logs/
20+
logs/

conf/config.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ url.base = https://codepen.io/eliasnogueira/full/zaYajV/
44

55
test.screenshot.path = screenshot
66

7-
grid.url = 127.0.0.1
7+
grid.url = 172.20.10.7
88
grid.port = 4444
99

1010
log.directory = logs

grid/openshift/README.MD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to use Selenium Grid on OpenShift
2+
3+
The .yaml files on this directory can be found at [https://github.com/ddavison/selenium-openshift-templates](https://github.com/ddavison/selenium-openshift-templates) and additional information can be found at [http://www.assertselenium.com/continuous-delivery/setting-up-selenium-grid-on-kubernetes/](http://www.assertselenium.com/continuous-delivery/setting-up-selenium-grid-on-kubernetes/)
4+
5+
## Create the grid enviroment on OpenShift
6+
7+
Follow the steps:
8+
9+
1. Login into your Openshift account using `oc` command line
10+
2. Navigato to this directory
11+
3. Create the Selenium Hub template running `oc create -f selenium-hub.yaml`
12+
4. Create the Selenium Google Chrome template running `oc create -f selenium-node-chrome.yaml`
13+
4. Create the Selenium Firefox template running `oc create -f selenium-node-firefox.yaml`
14+

grid/openshift/selenium-hub.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
apiVersion: v1
2+
kind: Template
3+
metadata:
4+
name: selenium-hub
5+
annotations:
6+
description: "A Selenium Grid"
7+
iconClass: "icon-selenium"
8+
tags: "selenium,hub"
9+
objects:
10+
- apiVersion: v1
11+
kind: Service
12+
metadata:
13+
name: selenium-hub
14+
spec:
15+
selector:
16+
type: hub
17+
type: ClusterIP
18+
ports:
19+
- name: web
20+
port: 4444
21+
targetPort: 4444
22+
protocol: TCP
23+
- name: node
24+
port: 5555
25+
targetPort: 5555
26+
protocol: TCP
27+
- apiVersion: v1
28+
kind: Pod
29+
metadata:
30+
name: selenium-hub
31+
labels:
32+
type: hub
33+
spec:
34+
containers:
35+
- env:
36+
- name: JAVA_OPTS
37+
value: ${JAVA_OPTS}
38+
- name: POOL_MAX
39+
value: ${POOL_MAX}
40+
- name: GRID_NEW_SESSION_WAIT_TIMEOUT
41+
value: ${GRID_NEW_SESSION_WAIT_TIMEOUT}
42+
- name: GRID_JETTY_MAX_THREADS
43+
value: ${GRID_JETTY_MAX_THREADS}
44+
- name: GRID_NODE_POLLING
45+
value: ${GRID_NODE_POLLING}
46+
- name: GRID_CLEAN_UP_CYCLE
47+
value: ${GRID_CLEAN_UP_CYCLE}
48+
- name: GRID_TIMEOUT
49+
value: ${GRID_TIMEOUT}
50+
- name: GRID_BROWSER_TIMEOUT
51+
value: ${GRID_BROWSER_TIMEOUT}
52+
- name: GRID_MAX_SESSION
53+
value: ${GRID_MAX_SESSION}
54+
- name: GRID_UNREGISTER_IF_STILL_DOWN_AFTER
55+
value: ${GRID_UNREGISTER_IF_STILL_DOWN_AFTER}
56+
image: selenium/hub
57+
name: master
58+
ports:
59+
- containerPort: 4444
60+
protocol: TCP
61+
parameters:
62+
- name: JAVA_OPTS
63+
description: Options to pass to the java command
64+
value: "-Xmx512m"
65+
- name: POOL_MAX
66+
description: Max thread count for incoming and outgoing connections
67+
value: "30000"
68+
- name: GRID_NEW_SESSION_WAIT_TIMEOUT
69+
description: The timeout to wait for new sessions
70+
value: "30"
71+
- name: GRID_JETTY_MAX_THREADS
72+
description: Max Threads for Jetty server
73+
value: "100"
74+
- name: GRID_NODE_POLLING
75+
description: Node Polling setting
76+
value: "150"
77+
- name: GRID_CLEAN_UP_CYCLE
78+
description: How long to wait until cleanup on nodes
79+
value: "300"
80+
- name: GRID_TIMEOUT
81+
description: The timeout for the grid
82+
value: "300"
83+
- name: GRID_BROWSER_TIMEOUT
84+
description: The timeout for the browser
85+
value: "30"
86+
- name: GRID_MAX_SESSION
87+
description: How many sessions max
88+
value: "3"
89+
- name: GRID_UNREGISTER_IF_STILL_DOWN_AFTER
90+
description: Time to wait before unregistering nodes
91+
value: "500"
92+
labels:
93+
selenium-hub: master
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
apiVersion: v1
2+
kind: Template
3+
metadata:
4+
name: selenium-node-chrome
5+
annotations:
6+
description: "Selenium Node with Google Chrome browser"
7+
iconClass: "icon-selenium"
8+
tags: "selenium,node,chrome"
9+
objects:
10+
- kind: BuildConfig
11+
apiVersion: v1
12+
metadata:
13+
name: selenium-node-chrome
14+
spec:
15+
triggers:
16+
- type: ConfigChange
17+
configChange: {}
18+
source:
19+
contextDir: selenium-node-chrome
20+
type: Git
21+
git:
22+
uri: https://github.com/ddavison/selenium-openshift-templates
23+
ref: master
24+
strategy:
25+
type: Docker
26+
DockerStrategy: {}
27+
output:
28+
to:
29+
kind: ImageStreamTag
30+
name: selenium-node-chrome:latest
31+
- kind: ImageStream
32+
apiVersion: v1
33+
metadata:
34+
name: selenium-node-chrome
35+
spec:
36+
dockerImageRepository: ''
37+
tags:
38+
- name: latest
39+
- apiVersion: v1
40+
kind: DeploymentConfig
41+
metadata:
42+
name: selenium-node-chrome
43+
spec:
44+
strategy:
45+
type: Recreate
46+
triggers:
47+
- type: ImageChange
48+
imageChangeParams:
49+
automatic: true
50+
containerNames:
51+
- master
52+
from:
53+
kind: ImageStreamTag
54+
name: selenium-node-chrome:latest
55+
- type: ConfigChange
56+
replicas: 1
57+
selector:
58+
browser: chrome
59+
template:
60+
metadata:
61+
name: selenium-node-chrome-master
62+
labels:
63+
browser: chrome
64+
spec:
65+
containers:
66+
- env:
67+
- name: JAVA_OPTS
68+
value: ${JAVA_OPTS}
69+
- name: SE_OPTS
70+
value: ${SE_OPTS}
71+
- name: HUB_PORT_4444_TCP_ADDR
72+
value: ${HUB_PORT_4444_TCP_ADDR}
73+
- name: HUB_PORT_4444_TCP_PORT
74+
value: ${HUB_PORT_4444_TCP_PORT}
75+
- name: REMOTE_HOST
76+
value: ${REMOTE_HOST}
77+
image: selenium-node-chrome
78+
name: master
79+
ports:
80+
- containerPort: 4444
81+
protocol: TCP
82+
- containerPort: 5555
83+
protocol: TCP
84+
- apiVersion: v1
85+
kind: Service
86+
metadata:
87+
name: selenium-node-chrome
88+
spec:
89+
selector:
90+
browser: chrome
91+
type: ClusterIP
92+
ports:
93+
- name: node-port
94+
port: 5555
95+
targetPort: 5555
96+
protocol: TCP
97+
- name: node-port-grid
98+
port: 4444
99+
targetPort: 4444
100+
protocol: TCP
101+
parameters:
102+
- name: JAVA_OPTS
103+
description: Options for the Java command
104+
value: "-Xmx512m -Dselenium.LOGGER.level=WARNING"
105+
- name: SE_OPTS
106+
description: Options for the Node
107+
value: ""
108+
- name: HUB_PORT_4444_TCP_ADDR
109+
description: The Hub to connect to
110+
value: "selenium-hub"
111+
- name: HUB_PORT_4444_TCP_PORT
112+
description: The Hub port to connect to
113+
value: "4444"
114+
- name: REMOTE_HOST
115+
description: The remote host
116+
value: ""
117+
- name: NODE_ID
118+
description: Unique ID assigned to the node
119+
generate: expression
120+
from: '[a-z]{4}'
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
apiVersion: v1
2+
kind: Template
3+
metadata:
4+
name: selenium-node-firefox
5+
annotations:
6+
description: "Selenium Node with Google firefox browser"
7+
iconClass: "icon-selenium"
8+
tags: "selenium,node,firefox"
9+
objects:
10+
- kind: BuildConfig
11+
apiVersion: v1
12+
metadata:
13+
name: selenium-node-firefox
14+
spec:
15+
triggers:
16+
- type: ConfigChange
17+
configChange: {}
18+
source:
19+
contextDir: selenium-node-firefox
20+
type: Git
21+
git:
22+
uri: https://github.com/ddavison/selenium-openshift-templates
23+
ref: master
24+
strategy:
25+
type: Docker
26+
DockerStrategy: {}
27+
output:
28+
to:
29+
kind: ImageStreamTag
30+
name: selenium-node-firefox:latest
31+
- kind: ImageStream
32+
apiVersion: v1
33+
metadata:
34+
name: selenium-node-firefox
35+
spec:
36+
dockerImageRepository: ''
37+
tags:
38+
- name: latest
39+
- apiVersion: v1
40+
kind: DeploymentConfig
41+
metadata:
42+
name: selenium-node-firefox
43+
spec:
44+
strategy:
45+
type: Recreate
46+
triggers:
47+
- type: ImageChange
48+
imageChangeParams:
49+
automatic: true
50+
containerNames:
51+
- master
52+
from:
53+
kind: ImageStreamTag
54+
name: selenium-node-firefox:latest
55+
- type: ConfigChange
56+
replicas: 1
57+
selector:
58+
browser: firefox
59+
template:
60+
metadata:
61+
name: selenium-node-firefox-master
62+
labels:
63+
browser: firefox
64+
spec:
65+
containers:
66+
- env:
67+
- name: JAVA_OPTS
68+
value: ${JAVA_OPTS}
69+
- name: SE_OPTS
70+
value: ${SE_OPTS}
71+
- name: HUB_PORT_4444_TCP_ADDR
72+
value: ${HUB_PORT_4444_TCP_ADDR}
73+
- name: HUB_PORT_4444_TCP_PORT
74+
value: ${HUB_PORT_4444_TCP_PORT}
75+
- name: REMOTE_HOST
76+
value: ${REMOTE_HOST}
77+
image: selenium-node-firefox
78+
name: master
79+
ports:
80+
- containerPort: 4444
81+
protocol: TCP
82+
- containerPort: 5555
83+
protocol: TCP
84+
- apiVersion: v1
85+
kind: Service
86+
metadata:
87+
name: selenium-node-firefox
88+
spec:
89+
selector:
90+
browser: firefox
91+
type: ClusterIP
92+
ports:
93+
- name: node-port
94+
port: 5555
95+
targetPort: 5555
96+
protocol: TCP
97+
- name: node-port-grid
98+
port: 4444
99+
targetPort: 4444
100+
protocol: TCP
101+
parameters:
102+
- name: JAVA_OPTS
103+
description: Options for the Java command
104+
value: "-Xmx512m -Dselenium.LOGGER.level=WARNING"
105+
- name: SE_OPTS
106+
description: Options for the Node
107+
value: ""
108+
- name: HUB_PORT_4444_TCP_ADDR
109+
description: The Hub to connect to
110+
value: "selenium-hub"
111+
- name: HUB_PORT_4444_TCP_PORT
112+
description: The Hub port to connect to
113+
value: "4444"
114+
- name: REMOTE_HOST
115+
description: The remote host
116+
value: ""
117+
- name: NODE_ID
118+
description: Unique ID assigned to the node
119+
generate: expression
120+
from: '[a-z]{4}'

src/main/java/exception/BrowserNotSupportedException.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/*
2+
* Copyright (c) 2018 Elias Nogueira
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
122
package exception;
223

324
public class BrowserNotSupportedException extends Exception {

0 commit comments

Comments
 (0)