-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
133 lines (110 loc) · 3.75 KB
/
build.gradle
File metadata and controls
133 lines (110 loc) · 3.75 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
plugins {
id 'idea'
id 'java'
id 'io.qameta.allure' version '2.12.0'
id 'io.freefair.lombok' version '8.4'
}
group 'com.playwright.cucumber.project'
version '1.0-SNAPSHOT'
def cucumberVersion = '7.14.0'
def testNgVersion = '7.8.0'
def allureVersion = '2.29.0'
def playwrightVersion = '1.48.0'
def allureCucumberVersion = '2.29.0'
def logbackVersion = '1.4.14'
def cucumberThreadsOption = ['--threads', '3']
def setParallel = "false"
def cucumberOptions = [
'--plugin', 'pretty',
'--plugin', 'io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm',
'--plugin', 'json:target/allure-results/cucumber.json',
'--plugin', "rerun:target/failed_scenarios.txt",
'--glue', 'com.playwright.cucumber.step_definitions',
'src/test/resources/features'
]
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
testCompile
}
dependencies {
testImplementation "org.testng:testng:${testNgVersion}"
testImplementation "ch.qos.logback:logback-classic:${logbackVersion}"
implementation "com.microsoft.playwright:playwright:${playwrightVersion}"
implementation "io.cucumber:cucumber-java:${cucumberVersion}"
implementation "io.cucumber:cucumber-testng:${cucumberVersion}"
implementation "io.cucumber:cucumber-picocontainer:${cucumberVersion}"
implementation platform("io.qameta.allure:allure-bom:$allureVersion")
implementation "io.qameta.allure:allure-cucumber7-jvm:${allureCucumberVersion}"
implementation "io.qameta.allure:allure-testng:${allureVersion}"
}
tasks.register('initPlaywright', JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = "com.microsoft.playwright.CLI"
args 'install'
}
test {
useTestNG() {
useDefaultListeners = true
suites 'src/test/resources/testng.xml'
}
scanForTestClasses = false
testLogging.showStandardStreams = true
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.register('cucumber', JavaExec) {
group = 'cucumber'
description = 'Running UI tests'
dependsOn assemble, compileTestJava
mainClass = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
def isParallel = System.properties.getProperty("parallel", setParallel)
if (isParallel == "true") cucumberOptions.addAll(cucumberThreadsOption)
args = cucumberOptions
}
tasks.register('cucumberRerun', JavaExec) {
group = 'cucumber'
description = 'Execute rerun UI tests'
onlyIf { tasks.cucumber.state.failure }
def options = [
'--plugin', 'pretty',
'--plugin', 'io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm',
'@target/failed_scenarios.txt'
]
mainClass = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
def isParallel = System.properties.getProperty("parallel", setParallel)
if (isParallel == "true") options.addAll(cucumberThreadsOption)
args = options
}
tasks.register('pwServeTraces', JavaExec) {
mainClass = 'com.microsoft.playwright.CLI'
classpath = sourceSets.main.runtimeClasspath
args 'show-trace', 'build/pw/' + System.getProperty("trace") + '.zip'
systemProperties = System.getProperties() as Map<String, ?>
}
allure {
version = allureVersion
}
cucumber.finalizedBy cucumberRerun
cucumber.finalizedBy('allureReport')
test.finalizedBy('allureReport')