-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
selenium.groovy
75 lines (72 loc) · 2.25 KB
/
selenium.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* This pipeline executes Selenium tests against Chrome and Firefox, all running in the same Pod but in separate containers
* and in parallel
*/
podTemplate(yaml: '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven-firefox
image: maven:3.8.1-jdk-8
command:
- sleep
args:
- 99d
- name: maven-chrome
image: maven:3.8.1-jdk-8
command:
- sleep
args:
- 99d
- name: selenium-hub
image: selenium/hub:3.141.59
- name: selenium-chrome
image: selenium/node-chrome:3.141.59
env:
- name: HUB_PORT_4444_TCP_ADDR
value: localhost
- name: HUB_PORT_4444_TCP_PORT
value: 4444
- name: DISPLAY
value: :99.0
- name: SE_OPTS
value: -port 5556
- name: selenium-firefox
image: selenium/node-firefox:3.141.59
env:
- name: HUB_PORT_4444_TCP_ADDR
value: localhost
- name: HUB_PORT_4444_TCP_PORT
value: 4444
- name: DISPLAY
value: :98.0
- name: SE_OPTS
value: -port 5557
''') {
node(POD_LABEL) {
stage('Checkout') {
git 'https://github.com/carlossg/selenium-example.git'
parallel (
firefox: {
container('maven-firefox') {
stage('Test firefox') {
sh 'mvn -B clean test -Dselenium.browser=firefox -Dsurefire.rerunFailingTestsCount=5 -Dsleep=0'
}
}
},
chrome: {
container('maven-chrome') {
stage('Test chrome') {
sh 'mvn -B clean test -Dselenium.browser=chrome -Dsurefire.rerunFailingTestsCount=5 -Dsleep=0'
}
}
}
)
}
stage('Logs') {
containerLog('selenium-chrome')
containerLog('selenium-firefox')
}
}
}