Skip to content

Commit 9540994

Browse files
browser: basic config java examples (#1540)
1 parent 882e5f4 commit 9540994

6 files changed

Lines changed: 51 additions & 41 deletions

File tree

webtau-docs/znai/HTTP/configuration.md

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,7 @@ To learn about all configuration capabilities, head over to [Configuration page]
66

77
# Base URL {style: "api"}
88

9-
Use `url` to set base url for your tests.
10-
11-
```tabs
12-
Groovy:
13-
14-
:include-file: scenarios/rest/urlOnly.cfg.groovy {
15-
title: "webtau.cfg.groovy",
16-
includeRegexp: "localhost"
17-
}
18-
19-
Note: WebTau treats groovy config file as code
20-
21-
Java:
22-
23-
When you use JUnit like runners, e.g. [JUnit5](getting-started/installation#junit5), WebTau expects file named
24-
`webtau.properties` to be present in test classpath, e.g. test resources:
25-
26-
:include-file: webtau-junit5-examples/src/test/resources/webtau.properties {
27-
title: "src/test/resources/webtau.properties",
28-
includeRegexp: "localhost"
29-
}
30-
```
31-
32-
To set base url using environment variables use
33-
34-
```
35-
export WEBTAU_URL=http://another-server
36-
```
9+
:include-markdown: configuration/common/base-url.md
3710

3811
# Proxy {style: "api"}
3912

webtau-docs/znai/browser/basic-configuration.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
# Base URL
22

3-
WebTau provides configuration option to set base url for your browser `open` commands.
4-
This way you can run your tests in different environments without modifying code base.
5-
6-
:include-groovy: scenarios/ui/basic.groovy
7-
8-
Define base URL either inside a `webtau.cfg.groovy` file
9-
10-
:include-file: scenarios/ui/webtau.cfg.groovy
11-
12-
or pass as a command line argument `--url=http://...`
3+
:include-markdown: configuration/common/base-url.md
134

145
# Browser Only Base URL
156

@@ -19,10 +10,23 @@ Use `browserUrl` to specify `UI` only base url. This can be handy when your back
1910

2011
# Browser Id
2112

22-
Use `browserId` via command line, or a config file parameter to specify which browser to use.
13+
Use `browserId` via command line, system property, env variable or config file parameter to specify which browser to use.
2314

15+
`````tabs
16+
Groovy:
2417
:include-cli-command: webtau --browserId=firefox
2518
19+
```cli
20+
export WEBTAU_BROWSER_ID=firefox
21+
```
22+
Java:
23+
```cli
24+
... -DbrowserId=firefox
25+
```
26+
```cli
27+
export WEBTAU_BROWSER_ID=firefox
28+
```
29+
`````
2630
Note: Default `browserId` is `chrome`
2731

2832
# Access To Base Url
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
```tabs
2+
Groovy:
3+
4+
:include-file: scenarios/rest/urlOnly.cfg.groovy {
5+
title: "webtau.cfg.groovy",
6+
include: "localhost"
7+
}
8+
9+
Note: WebTau treats groovy config file as code
10+
11+
Alternatively pass `url` as a command line argument `--url=http://...`
12+
13+
Java:
14+
15+
:include-file: webtau-junit5-examples/src/test/resources/webtau.properties {
16+
title: "src/test/resources/webtau.properties",
17+
include: "localhost"
18+
}
19+
20+
When you use JUnit like runners, e.g. [JUnit5](getting-started/installation#junit5), WebTau expects file named
21+
`webtau.properties` to be present in test classpath, e.g. test resources:
22+
23+
Alternatively pass `url` as a system property `-Durl=http://...`
24+
```
25+
26+
To set base url using environment variables use
27+
28+
```
29+
export WEBTAU_URL=http://another-server
30+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Doc: [Browser Basic Config](browser/basic-configuration) Java examples

webtau-docs/znai/release-notes/2023.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: 2023 Releases
33
---
44

5+
# 2.3
6+
7+
:include-markdowns: 2.3
8+
59
# 2.2
610

711
:include-markdowns: 2.2

webtau-junit5-examples/src/test/groovy/com/example/tests/junit5/JUnit5FeatureTestRunner.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ class JUnit5FeatureTestRunner implements StepReporter, TestExecutionListener, Te
6060
cfg.reset()
6161
cfg.triggerConfigHandlers()
6262
cfg.setUrl(baseUrl)
63-
cfg.setUserAgent("Safari/537.36")
64-
cfg.setRemoveWebTauFromUserAgent(true)
6563
cfg.reportPath = cfg.fullPath("webtau-reports/" + testClass.canonicalName + ".html")
6664

6765
if (!browserBaseUrl.isEmpty()) {

0 commit comments

Comments
 (0)