Skip to content

Commit 2093d3f

Browse files
[espresso] Address review: adopt code-excerpts for XML and Gradle snippets
Adds code-excerpt management for the network_security_config.xml snippet and switches the dependencies snippet from Groovy to build.gradle.kts, pulling current versions from the example app.
1 parent 5ab1a10 commit 2093d3f

4 files changed

Lines changed: 27 additions & 5 deletions

File tree

‎packages/espresso/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
validated against compilable, analyzed source, and updates it to use
55
`integration_test`'s driver instead of the deprecated `flutter_driver`
66
extension.
7+
* Adopts `code-excerpt` for the README's `network_security_config.xml` and
8+
`build.gradle.kts` dependencies snippets.
79

810
## 0.4.0+25
911

‎packages/espresso/README.md‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Add ```android:networkSecurityConfig="@xml/network_security_config"``` in the ``
1919

2020
Then you will need to create a `network_security_config.xml` in the `res/xml/` directory.
2121

22+
<?code-excerpt "android/app/src/debug/res/xml/network_security_config.xml (network_security_config)"?>
2223
```xml
23-
<?xml version="1.0" encoding="utf-8"?>
2424
<network-security-config>
2525
<!-- Cleartext is needed for Espresso testing. -->
2626
<base-config cleartextTrafficPermitted="true">
@@ -33,15 +33,21 @@ For example, the Espresso example app has this file in the location `example/and
3333
It is best to put this in a debug or androidTest
3434
AndroidManifest.xml so that you don't ship it to end users. (See the example app of this package.)
3535

36-
Add the following dependencies in android/app/build.gradle:
36+
Add the following dependencies in android/app/build.gradle.kts:
3737

38-
```groovy
38+
<?code-excerpt "android/app/build.gradle.kts (test_dependencies)"?>
39+
```kotlin
3940
dependencies {
4041
testImplementation("junit:junit:4.13.2")
41-
testImplementation("com.google.truth:truth:1.1.3")
42+
// ···
43+
api("androidx.test:core:1.6.1")
44+
// ···
4245
androidTestImplementation("androidx.test:runner:1.6.1")
46+
// ···
47+
androidTestImplementation("com.google.truth:truth:1.1.3")
48+
// ···
4349
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
44-
api("androidx.test:core:1.2.0")
50+
// ···
4551
}
4652
```
4753

‎packages/espresso/example/android/app/build.gradle.kts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,36 @@ flutter {
4040
source = "../.."
4141
}
4242

43+
// #docregion test_dependencies
4344
dependencies {
4445
testImplementation("junit:junit:4.13.2")
46+
// #enddocregion test_dependencies
4547

4648
// Multidex
4749
implementation("androidx.multidex:multidex:2.0.1")
4850

4951
// Core library
52+
// #docregion test_dependencies
5053
api("androidx.test:core:1.6.1")
54+
// #enddocregion test_dependencies
5155

5256
// AndroidJUnitRunner and JUnit Rules
57+
// #docregion test_dependencies
5358
androidTestImplementation("androidx.test:runner:1.6.1")
59+
// #enddocregion test_dependencies
5460
androidTestImplementation("androidx.test:rules:1.6.1")
5561

5662
// Assertions
5763
androidTestImplementation("androidx.test.ext:junit:1.2.1")
5864
androidTestImplementation("androidx.test.ext:truth:1.6.0")
65+
// #docregion test_dependencies
5966
androidTestImplementation("com.google.truth:truth:1.1.3")
67+
// #enddocregion test_dependencies
6068

6169
// Espresso dependencies
70+
// #docregion test_dependencies
6271
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
72+
// #enddocregion test_dependencies
6373
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.6.1")
6474
androidTestImplementation("androidx.test.espresso:espresso-intents:3.6.1")
6575
androidTestImplementation("androidx.test.espresso:espresso-accessibility:3.6.1")
@@ -71,4 +81,6 @@ dependencies {
7181
// dependency to appear on your APK's compile classpath or the test APK
7282
// classpath.
7383
androidTestImplementation("androidx.test.espresso:espresso-idling-resource:3.6.1")
84+
// #docregion test_dependencies
7485
}
86+
// #enddocregion test_dependencies
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--#docregion network_security_config-->
23
<network-security-config>
34
<!-- Cleartext is needed for Espresso testing. -->
45
<base-config cleartextTrafficPermitted="true">
56
</base-config>
67
</network-security-config>
8+
<!--#enddocregion network_security_config-->

0 commit comments

Comments
 (0)