From 3235dad44fe194d6d11a6af7514d0f63e86f4a54 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 17:34:45 -0400 Subject: [PATCH 01/54] try some caching --- .github/workflows/build.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4fcd76554ca..b06421de491 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,12 +17,20 @@ env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + main: name: main runs-on: ubuntu-latest strategy: fail-fast: false steps: + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + key: ${{ runner.os }}-build-${{ env.cache-name }} - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - name: tool/bots.sh From 0ef328cab9e3c6ce94fefa07dea948e61488cd3f Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 17:47:02 -0400 Subject: [PATCH 02/54] use it betweenzies --- .github/workflows/build.yaml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b06421de491..12277437e60 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,15 +24,17 @@ jobs: strategy: fail-fast: false steps: - - name: Cache Gradle packages + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + + - name: Cache Generated Files uses: actions/cache@v3 with: path: | **/build/ **/.dart_tool/ key: ${{ runner.os }}-build-${{ env.cache-name }} - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: tool/bots.sh env: BOT: main @@ -51,6 +53,14 @@ jobs: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + key: ${{ runner.os }}-build-${{ env.cache-name }} + - name: tool/bots.sh env: BOT: ${{ matrix.bot }} @@ -77,6 +87,14 @@ jobs: steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + key: ${{ runner.os }}-build-${{ env.cache-name }} - name: tool/bots.sh env: From 5484e737353bf106205a64fbfe145fbf35add36e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 17:58:11 -0400 Subject: [PATCH 03/54] try clone first --- .github/workflows/build.yaml | 70 ++---------------------------------- tool/bots.sh | 4 +-- 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 12277437e60..2aff6f25892 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,7 +26,8 @@ jobs: steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - + - name: flutter clone + run: git clone https://github.com/flutter/flutter.git ./flutter-sdk - name: Cache Generated Files uses: actions/cache@v3 with: @@ -40,74 +41,7 @@ jobs: BOT: main run: ./tool/bots.sh - test: - name: test ${{ matrix.bot }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - bot: - - test_ddc - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh - - - name: image failures - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 - if: failure() # Only if failure then failures directory exists. - with: - # TODO(terry): matrix.os currently empty. If we run tests on other - # platforms this will be used. - name: test-image-failures-${{ matrix.os }} # Name for the artifact - path: packages/devtools_app/test/failures # Path to upload - - macos-test: - name: macos ${{ matrix.bot }} - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - bot: - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - key: ${{ runner.os }}-build-${{ env.cache-name }} - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh - - - name: Upload Golden Failure Artifacts - uses: actions/upload-artifact@v3 - if: failure() - with: - name: golden_image_failures.${{ matrix.bot }} - path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh diff --git a/tool/bots.sh b/tool/bots.sh index 20bde41b8c6..0ad4bca0112 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -27,8 +27,8 @@ function flutter { } # Get Flutter. -echo "Cloning the Flutter master branch" -git clone https://github.com/flutter/flutter.git ./flutter-sdk +# echo "Cloning the Flutter master branch" +# git clone https://github.com/flutter/flutter.git ./flutter-sdk # Look in the dart bin dir first, then the flutter one, then the one for the # devtools repo. We don't use the dart script from flutter/bin as that script From 4d630f1e12368e99e903a1ded4820e410cd1d0cf Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 18:44:36 -0400 Subject: [PATCH 04/54] this might just do it --- .github/workflows/build.yaml | 6 +++--- tool/bots.sh | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2aff6f25892..6d097816269 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,15 +26,15 @@ jobs: steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: flutter clone - run: git clone https://github.com/flutter/flutter.git ./flutter-sdk - name: Cache Generated Files uses: actions/cache@v3 with: path: | **/build/ **/.dart_tool/ - key: ${{ runner.os }}-build-${{ env.cache-name }} + ./flutter-sdk + key: ${{ runner.os }}-build + #TODO: flutter candidate in env, - name: tool/bots.sh env: diff --git a/tool/bots.sh b/tool/bots.sh index 0ad4bca0112..aa7644979f0 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -27,8 +27,20 @@ function flutter { } # Get Flutter. -# echo "Cloning the Flutter master branch" -# git clone https://github.com/flutter/flutter.git ./flutter-sdk +echo "Cloning the Flutter master branch" +# if ./flutter-sdk exists then fetch master +# otherwise clone it and run it fresh +#NOTES +# - make sure whole test runs on candidate +# - cache entire flutter candidate branch +# - cache build artifacts from devtools +if [ -d "/path/to/dir" ]; then + pushd ./flutter-sdk + git fetch --All + popd +else + git clone https://github.com/flutter/flutter.git ./flutter-sdk +fi # Look in the dart bin dir first, then the flutter one, then the one for the # devtools repo. We don't use the dart script from flutter/bin as that script From 4d33872a34b9357da05a545c9626beff23687fed Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 22:59:55 -0400 Subject: [PATCH 05/54] :facepalm: --- tool/bots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index aa7644979f0..58d03a642b5 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -34,7 +34,7 @@ echo "Cloning the Flutter master branch" # - make sure whole test runs on candidate # - cache entire flutter candidate branch # - cache build artifacts from devtools -if [ -d "/path/to/dir" ]; then +if [ -d "./flutter-sdk" ]; then pushd ./flutter-sdk git fetch --All popd From 31659d976fff3ce30c5c7f8928d0f73b710b6d53 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 23:06:05 -0400 Subject: [PATCH 06/54] all --- tool/bots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index 58d03a642b5..8d8380e05f6 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -36,7 +36,7 @@ echo "Cloning the Flutter master branch" # - cache build artifacts from devtools if [ -d "./flutter-sdk" ]; then pushd ./flutter-sdk - git fetch --All + git fetch --all popd else git clone https://github.com/flutter/flutter.git ./flutter-sdk From 752825b54bbfb86d195c4dd091dae628fe4716c7 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Fri, 4 Nov 2022 23:16:08 -0400 Subject: [PATCH 07/54] invalidate the cache --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6d097816269..352c5775961 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: **/build/ **/.dart_tool/ ./flutter-sdk - key: ${{ runner.os }}-build + key: ${{ runner.os }}-build-2 #TODO: flutter candidate in env, - name: tool/bots.sh From 4124ebfb977859715e74d55c4290e6eb92bb33ca Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Mon, 7 Nov 2022 10:12:50 -0500 Subject: [PATCH 08/54] cache all steps --- .github/workflows/build.yaml | 70 +++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 352c5775961..c7ffb62c805 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,7 +17,6 @@ env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - main: name: main runs-on: ubuntu-latest @@ -33,15 +32,78 @@ jobs: **/build/ **/.dart_tool/ ./flutter-sdk - key: ${{ runner.os }}-build-2 - #TODO: flutter candidate in env, - + key: ${{ runner.os }}-cache - name: tool/bots.sh env: BOT: main run: ./tool/bots.sh + test: + name: test ${{ matrix.bot }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + bot: + - test_ddc + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + ./flutter-sdk + key: ${{ runner.os }}-cache + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh + - name: image failures + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 + if: failure() # Only if failure then failures directory exists. + with: + # TODO(terry): matrix.os currently empty. If we run tests on other + # platforms this will be used. + name: test-image-failures-${{ matrix.os }} # Name for the artifact + path: packages/devtools_app/test/failures # Path to upload + + macos-test: + name: macos ${{ matrix.bot }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + bot: + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + ./flutter-sdk + key: ${{ runner.os }}-cache + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh + + - name: Upload Golden Failure Artifacts + uses: actions/upload-artifact@v3 + if: failure() + with: + name: golden_image_failures.${{ matrix.bot }} + path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh From 112d5f275628bb2afa8d09436fef0bb6b61a34ba Mon Sep 17 00:00:00 2001 From: Daniel Chevalier Date: Mon, 7 Nov 2022 11:01:36 -0500 Subject: [PATCH 09/54] trigger another build --- tool/bots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index 8d8380e05f6..7e4cfb75b52 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -30,7 +30,7 @@ function flutter { echo "Cloning the Flutter master branch" # if ./flutter-sdk exists then fetch master # otherwise clone it and run it fresh -#NOTES +# NOTES # - make sure whole test runs on candidate # - cache entire flutter candidate branch # - cache build artifacts from devtools From 9a1cbe7659e97a9b1eb98329f544361fc3be7280 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Mon, 7 Nov 2022 13:44:26 -0500 Subject: [PATCH 10/54] fix comments --- tool/bots.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tool/bots.sh b/tool/bots.sh index 7e4cfb75b52..240d0db8fe2 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -28,17 +28,13 @@ function flutter { # Get Flutter. echo "Cloning the Flutter master branch" -# if ./flutter-sdk exists then fetch master -# otherwise clone it and run it fresh -# NOTES -# - make sure whole test runs on candidate -# - cache entire flutter candidate branch -# - cache build artifacts from devtools if [ -d "./flutter-sdk" ]; then + # the flutter-sdk dir exists so just make sure it is up to date pushd ./flutter-sdk git fetch --all popd else + # the flutter-sdk dir DOES NOT exists so clone it git clone https://github.com/flutter/flutter.git ./flutter-sdk fi From c7ae1f3510f41ef7733996178876f3a895784e40 Mon Sep 17 00:00:00 2001 From: Daniel Chevalier Date: Mon, 7 Nov 2022 14:07:26 -0500 Subject: [PATCH 11/54] Update tool/bots.sh --- tool/bots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index 240d0db8fe2..0cecece295e 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -34,7 +34,7 @@ if [ -d "./flutter-sdk" ]; then git fetch --all popd else - # the flutter-sdk dir DOES NOT exists so clone it + # the flutter-sdk dir DOES NOT exist so clone it git clone https://github.com/flutter/flutter.git ./flutter-sdk fi From 6de6d9d358636f18012cf8748379c67960920ab4 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 10:54:15 -0500 Subject: [PATCH 12/54] start work on prep --- .github/workflows/build.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c7ffb62c805..6fa49887644 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,6 +17,35 @@ env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + ubuntu-flutter-prep: + name: main + runs-on: ubuntu-latest + steps: + - name: Get Flutter HEAD sha + run: | + RESPONSE=$(gh api /repos/flutter/flutter/branches/master) + echo $RESPONSE + HEAD_SHA=$(echo $RESPONSE | jq '.commit.sha') + echo "HEAD_SHA:$HEAD_SHA" + + # - name: Load Cached Flutter SDK + # uses: actions/cache@v3 + # with: + # path: | + # ./flutter-sdk + # # TODO: cache keybased on HEAD ref of flutter + # key: flutter-sdk-${{ runner.os }} + # - name: Clone Flutter SDK if none cached + # run: | + # if [ ! -d "./flutter-sdk" ]; then + # git clone https://github.com/flutter/flutter.git ./flutter-sdk + # fi + # - name: Setup Flutter SDK + # run: | + # ./flutter-sdk/bin/flutter --version # TODO: is there a proper way to do this? + # ./flutter-sdk/bin/cache/dart-sdk/bin/dart --version #TODO: do i need to do the same for dart? + + main: name: main runs-on: ubuntu-latest From e2936c17c78f5c49af2b4422728fe46471ae6fbf Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:00:29 -0500 Subject: [PATCH 13/54] set GH token --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6fa49887644..c28f189583f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,6 +15,7 @@ permissions: read-all env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: ubuntu-flutter-prep: From 81ae60bbb9000c8f4f2ad6f1b6214a5d11eb5463 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:15:48 -0500 Subject: [PATCH 14/54] proper checkout and cache(hopefully) --- .github/workflows/build.yaml | 205 ++++++++++++++++++----------------- 1 file changed, 105 insertions(+), 100 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c28f189583f..66d3ee9736a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,117 +23,122 @@ jobs: runs-on: ubuntu-latest steps: - name: Get Flutter HEAD sha + id: get-flutter-head run: | RESPONSE=$(gh api /repos/flutter/flutter/branches/master) - echo $RESPONSE HEAD_SHA=$(echo $RESPONSE | jq '.commit.sha') - echo "HEAD_SHA:$HEAD_SHA" + echo "SHA=$HEAD_SHA" >> $GITHUB_OUTPUT - # - name: Load Cached Flutter SDK - # uses: actions/cache@v3 - # with: - # path: | - # ./flutter-sdk - # # TODO: cache keybased on HEAD ref of flutter - # key: flutter-sdk-${{ runner.os }} - # - name: Clone Flutter SDK if none cached - # run: | - # if [ ! -d "./flutter-sdk" ]; then - # git clone https://github.com/flutter/flutter.git ./flutter-sdk - # fi - # - name: Setup Flutter SDK - # run: | - # ./flutter-sdk/bin/flutter --version # TODO: is there a proper way to do this? - # ./flutter-sdk/bin/cache/dart-sdk/bin/dart --version #TODO: do i need to do the same for dart? - - - main: - name: main - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache Generated Files + - name: Load Cached Flutter SDK uses: actions/cache@v3 with: path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - - name: tool/bots.sh - env: - BOT: main - run: ./tool/bots.sh + ./flutter-sdk + # TODO: cache keybased on HEAD ref of flutter + key: flutter-sdk-${{ runner.os }}-${{ steps.get-flutter-head.outputs.SHA }} - test: - name: test ${{ matrix.bot }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - bot: - - test_ddc - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh + - name: Clone Flutter SDK if none cached + run: | + if [ ! -d "./flutter-sdk" ]; then + git clone https://github.com/flutter/flutter.git ./flutter-sdk + git checkout $FLUTTER_HEAD_SHA + fi + env: | + FLUTTER_HEAD_SHA: ${{ steps.get-flutter-head.outputs.SHA }} - - name: image failures - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 - if: failure() # Only if failure then failures directory exists. - with: - # TODO(terry): matrix.os currently empty. If we run tests on other - # platforms this will be used. - name: test-image-failures-${{ matrix.os }} # Name for the artifact - path: packages/devtools_app/test/failures # Path to upload + - name: Setup Flutter SDK + run: | + ./flutter-sdk/bin/flutter --version # TODO: is there a proper way to do this? + ./flutter-sdk/bin/cache/dart-sdk/bin/dart --version #TODO: do i need to do the same for dart? + + + # main: + # name: main + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # steps: + # - name: git clone + # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # - name: Cache Generated Files + # uses: actions/cache@v3 + # with: + # path: | + # **/build/ + # **/.dart_tool/ + # ./flutter-sdk + # key: ${{ runner.os }}-cache + # - name: tool/bots.sh + # env: + # BOT: main + # run: ./tool/bots.sh + + # test: + # name: test ${{ matrix.bot }} + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # bot: + # - test_ddc + # - test_dart2js + # steps: + # - name: git clone + # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # - name: Cache Generated Files + # uses: actions/cache@v3 + # with: + # path: | + # **/build/ + # **/.dart_tool/ + # ./flutter-sdk + # key: ${{ runner.os }}-cache + # - name: tool/bots.sh + # env: + # BOT: ${{ matrix.bot }} + # PLATFORM: vm + # run: ./tool/bots.sh + + # - name: image failures + # uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 + # if: failure() # Only if failure then failures directory exists. + # with: + # # TODO(terry): matrix.os currently empty. If we run tests on other + # # platforms this will be used. + # name: test-image-failures-${{ matrix.os }} # Name for the artifact + # path: packages/devtools_app/test/failures # Path to upload - macos-test: - name: macos ${{ matrix.bot }} - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - bot: - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh + # macos-test: + # name: macos ${{ matrix.bot }} + # runs-on: macos-latest + # strategy: + # fail-fast: false + # matrix: + # bot: + # - test_dart2js + # steps: + # - name: git clone + # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # - name: Cache Generated Files + # uses: actions/cache@v3 + # with: + # path: | + # **/build/ + # **/.dart_tool/ + # ./flutter-sdk + # key: ${{ runner.os }}-cache + # - name: tool/bots.sh + # env: + # BOT: ${{ matrix.bot }} + # PLATFORM: vm + # run: ./tool/bots.sh - - name: Upload Golden Failure Artifacts - uses: actions/upload-artifact@v3 - if: failure() - with: - name: golden_image_failures.${{ matrix.bot }} - path: packages/devtools_app/test/**/failures/*.png + # - name: Upload Golden Failure Artifacts + # uses: actions/upload-artifact@v3 + # if: failure() + # with: + # name: golden_image_failures.${{ matrix.bot }} + # path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh From 87e6e094f6d4982682d68637d34d059640ddf8e0 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:24:28 -0500 Subject: [PATCH 15/54] indent --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 66d3ee9736a..79d020cdce7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: uses: actions/cache@v3 with: path: | - ./flutter-sdk + ./flutter-sdk # TODO: cache keybased on HEAD ref of flutter key: flutter-sdk-${{ runner.os }}-${{ steps.get-flutter-head.outputs.SHA }} From 0f30669fb0eb7b04d2057762b3f78ea8c43fc401 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:27:32 -0500 Subject: [PATCH 16/54] oops another indent --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 79d020cdce7..5a1bb60067e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,7 +35,7 @@ jobs: path: | ./flutter-sdk # TODO: cache keybased on HEAD ref of flutter - key: flutter-sdk-${{ runner.os }}-${{ steps.get-flutter-head.outputs.SHA }} + key: flutter-sdk-${{ runner.os }}-${{ steps.get-flutter-head.outputs.SHA }} - name: Clone Flutter SDK if none cached run: | From 8aebdd26d788c1540709df237f5e9f60e04930e6 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:29:35 -0500 Subject: [PATCH 17/54] improve env --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5a1bb60067e..45521bff22b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -43,7 +43,7 @@ jobs: git clone https://github.com/flutter/flutter.git ./flutter-sdk git checkout $FLUTTER_HEAD_SHA fi - env: | + env: FLUTTER_HEAD_SHA: ${{ steps.get-flutter-head.outputs.SHA }} - name: Setup Flutter SDK From 1ee11125237db486abc428f2d2fcbd19d1d73ed6 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:34:16 -0500 Subject: [PATCH 18/54] cd into fsd --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 45521bff22b..02c03826d4d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -41,6 +41,7 @@ jobs: run: | if [ ! -d "./flutter-sdk" ]; then git clone https://github.com/flutter/flutter.git ./flutter-sdk + cd flutter-sdk git checkout $FLUTTER_HEAD_SHA fi env: From 41edafda1c2c99c103049d385dbdfd3740ec037d Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 11:40:23 -0500 Subject: [PATCH 19/54] get rid of surrounding quotes --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 02c03826d4d..87d08773bda 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -26,7 +26,7 @@ jobs: id: get-flutter-head run: | RESPONSE=$(gh api /repos/flutter/flutter/branches/master) - HEAD_SHA=$(echo $RESPONSE | jq '.commit.sha') + HEAD_SHA=$(echo $RESPONSE | jq -r '.commit.sha') echo "SHA=$HEAD_SHA" >> $GITHUB_OUTPUT - name: Load Cached Flutter SDK From cc99cf39dd783a254697f55aae8076c383e8fab2 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 15:55:43 -0500 Subject: [PATCH 20/54] latest flutter candy --- .github/workflows/build.yaml | 75 +++++++++++++++++++------------- tool/latest_flutter_candidate.sh | 23 ++++++++++ 2 files changed, 68 insertions(+), 30 deletions(-) create mode 100755 tool/latest_flutter_candidate.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 87d08773bda..9131bcf9fe2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,30 +19,38 @@ env: jobs: ubuntu-flutter-prep: - name: main + name: Ubuntu Flutter Prep + id: ubuntu-flutter-prep runs-on: ubuntu-latest + #TODO can this be matrixed on OS. + outputs: + latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} steps: - - name: Get Flutter HEAD sha - id: get-flutter-head + - name: git clone devtools + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Get Latest Flutter Candidate + id: flutter-candidate run: | - RESPONSE=$(gh api /repos/flutter/flutter/branches/master) - HEAD_SHA=$(echo $RESPONSE | jq -r '.commit.sha') - echo "SHA=$HEAD_SHA" >> $GITHUB_OUTPUT + LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) + if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then + echo "::error ::Unable to get Latest flutter candidate" + exit 1 + fi + echo "FLUTTER_CANDIDATE=$LATEST_FLUTTER_CANDIDATE" >> $GITHUB_OUTPUT - name: Load Cached Flutter SDK uses: actions/cache@v3 with: path: | ./flutter-sdk - # TODO: cache keybased on HEAD ref of flutter - key: flutter-sdk-${{ runner.os }}-${{ steps.get-flutter-head.outputs.SHA }} + key: flutter-sdk-${{ runner.os }}-${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} - name: Clone Flutter SDK if none cached run: | if [ ! -d "./flutter-sdk" ]; then git clone https://github.com/flutter/flutter.git ./flutter-sdk cd flutter-sdk - git checkout $FLUTTER_HEAD_SHA + git checkout $LATEST_FLUTTER_CANDIDATE fi env: FLUTTER_HEAD_SHA: ${{ steps.get-flutter-head.outputs.SHA }} @@ -51,28 +59,35 @@ jobs: run: | ./flutter-sdk/bin/flutter --version # TODO: is there a proper way to do this? ./flutter-sdk/bin/cache/dart-sdk/bin/dart --version #TODO: do i need to do the same for dart? - - # main: - # name: main - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # steps: - # - name: git clone - # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # - name: Cache Generated Files - # uses: actions/cache@v3 - # with: - # path: | - # **/build/ - # **/.dart_tool/ - # ./flutter-sdk - # key: ${{ runner.os }}-cache - # - name: tool/bots.sh - # env: - # BOT: main - # run: ./tool/bots.sh + main: + name: main + needs: ubuntu-flutter-prep + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Load Cached Flutter SDK + uses: actions/cache@v3 + with: + path: | + ./flutter-sdk + key: flutter-sdk-${{ runner.os }}-${{ needs.ubuntu-flutter-prep.outputs.latest_flutter_candidate }} + + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + ./flutter-sdk + key: ${{ runner.os }}-cache + - name: tool/bots.sh + env: + BOT: main + run: ./tool/bots.sh # test: # name: test ${{ matrix.bot }} diff --git a/tool/latest_flutter_candidate.sh b/tool/latest_flutter_candidate.sh new file mode 100755 index 00000000000..421aba29625 --- /dev/null +++ b/tool/latest_flutter_candidate.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Copyright 2022 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +RESPONSE=$(gh api --paginate /repos/flutter/flutter/branches) +CANDIDATES=$(echo "$RESPONSE" | jq '.[].name' | grep candidate) + +VERSIONS=$(echo "$CANDIDATES" | egrep -o "\d+\.\d+\-candidate\.\d+" ) + + + +LATEST_VERSION=$(echo "$VERSIONS" | sort --version-sort | tail -n 1 ) + +if [ -z ${LATEST_VERSION+x} ]; then + echo "Unable to get Latest flutter candidate version" + exit 1 +fi + +LATEST_FLUTTER_CANDIDATE="flutter-$LATEST_VERSION" + +echo $LATEST_FLUTTER_CANDIDATE \ No newline at end of file From 301b7445290aca29d4d2a2de5a322b07add62973 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 15:58:50 -0500 Subject: [PATCH 21/54] noid --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9131bcf9fe2..5e27d7d2770 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,6 @@ env: jobs: ubuntu-flutter-prep: name: Ubuntu Flutter Prep - id: ubuntu-flutter-prep runs-on: ubuntu-latest #TODO can this be matrixed on OS. outputs: From fe7ceae118caf0e766eafb30ebfb14af37a9f62a Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 16:05:34 -0500 Subject: [PATCH 22/54] debug outies --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5e27d7d2770..a19d982ced4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,9 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | + ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) + echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then echo "::error ::Unable to get Latest flutter candidate" exit 1 From 727175956d62d4ca7af8ccbbf6a072c5906f5ca8 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 16:09:00 -0500 Subject: [PATCH 23/54] pass the ghtoken --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a19d982ced4..b2ffc2f8a04 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,7 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - ./tool/latest_flutter_candidate.sh + GT_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then From b3265fe9165f31c99f7c906efc2a3faa8c89bbde Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 16:13:14 -0500 Subject: [PATCH 24/54] gotta love tyepos --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b2ffc2f8a04..4a074d6e6c6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,7 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - GT_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh + GH_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then From a8f8ad3c5bee3dabd359e17d7c0250429eaf059b Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Wed, 9 Nov 2022 16:17:27 -0500 Subject: [PATCH 25/54] try export instead? --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a074d6e6c6..b5720e34668 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,8 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - GH_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh + export GH_TOKEN + ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then From 1bfc868dde44ac73e3d3c40320a04ef7ed0a02fa Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 09:39:31 -0500 Subject: [PATCH 26/54] help debugging --- .github/workflows/build.yaml | 3 +-- tool/latest_flutter_candidate.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b5720e34668..00a76798ea5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,8 +30,7 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - export GH_TOKEN - ./tool/latest_flutter_candidate.sh + GH_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then diff --git a/tool/latest_flutter_candidate.sh b/tool/latest_flutter_candidate.sh index 421aba29625..ec6e711b658 100755 --- a/tool/latest_flutter_candidate.sh +++ b/tool/latest_flutter_candidate.sh @@ -1,9 +1,8 @@ -#!/bin/bash +#!/bin/bash -x # Copyright 2022 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. - RESPONSE=$(gh api --paginate /repos/flutter/flutter/branches) CANDIDATES=$(echo "$RESPONSE" | jq '.[].name' | grep candidate) From e5f094c1e1e12ea7521487a381a7789725037c60 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 10:36:22 -0500 Subject: [PATCH 27/54] feeling a bit embarassed at how rusty i am with sed --- .github/workflows/build.yaml | 2 +- tool/latest_flutter_candidate.sh | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 00a76798ea5..cecd6e2f8fc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,7 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - GH_TOKEN=$GH_TOKEN ./tool/latest_flutter_candidate.sh + ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo $LATEST_FLUTTER_CANDIDATE if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then diff --git a/tool/latest_flutter_candidate.sh b/tool/latest_flutter_candidate.sh index ec6e711b658..aa6443f05f6 100755 --- a/tool/latest_flutter_candidate.sh +++ b/tool/latest_flutter_candidate.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash # Copyright 2022 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be @@ -6,9 +6,7 @@ RESPONSE=$(gh api --paginate /repos/flutter/flutter/branches) CANDIDATES=$(echo "$RESPONSE" | jq '.[].name' | grep candidate) -VERSIONS=$(echo "$CANDIDATES" | egrep -o "\d+\.\d+\-candidate\.\d+" ) - - +VERSIONS=$(echo "$CANDIDATES" | sed -E 's/.*([0-9]+\.[0-9]+-candidate\.[0-9]+).*/\1/' ) LATEST_VERSION=$(echo "$VERSIONS" | sort --version-sort | tail -n 1 ) From a00a54f081f77c807cd31818608d100d5efd78f3 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 10:47:21 -0500 Subject: [PATCH 28/54] setup flutter-sdk outside bots.sh --- .github/workflows/build.yaml | 4 ++-- tool/bots.sh | 22 ++++------------------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cecd6e2f8fc..09944f10e29 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -58,8 +58,8 @@ jobs: - name: Setup Flutter SDK run: | - ./flutter-sdk/bin/flutter --version # TODO: is there a proper way to do this? - ./flutter-sdk/bin/cache/dart-sdk/bin/dart --version #TODO: do i need to do the same for dart? + ./flutter-sdk/bin/flutter config --no-analytics + ./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics main: name: main diff --git a/tool/bots.sh b/tool/bots.sh index 0cecece295e..5af85b34107 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -26,16 +26,10 @@ function flutter { fi } -# Get Flutter. -echo "Cloning the Flutter master branch" -if [ -d "./flutter-sdk" ]; then - # the flutter-sdk dir exists so just make sure it is up to date - pushd ./flutter-sdk - git fetch --all - popd -else - # the flutter-sdk dir DOES NOT exist so clone it - git clone https://github.com/flutter/flutter.git ./flutter-sdk +# Make sure Flutter sdk has been provided +if [ ! -d "./flutter-sdk" ]; then + echo "Expected ./flutter-sdk to exist and be checked out to the right commit" + exit 1; fi # Look in the dart bin dir first, then the flutter one, then the one for the @@ -47,14 +41,6 @@ export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd` # Look up the latest flutter candidate (this is the latest flutter version in g3) # TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a # shell script so we won't have to incurr the cost of building flutter tool twice. -echo "Looking up the latest Flutter candidate branch" -pushd packages/devtools_app -LATEST_FLUTTER_CANDIDATE=`repo_tool latest-flutter-candidate --githubToken=$AUTH_TOKEN | tail -n 1` -popd - -pushd flutter-sdk -git checkout $LATEST_FLUTTER_CANDIDATE -popd flutter config --no-analytics flutter doctor From e491260406a93310dc389de5cd896a511ec35011 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 10:52:32 -0500 Subject: [PATCH 29/54] ! --- tool/bots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index 5af85b34107..62f3b067fce 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -27,7 +27,7 @@ function flutter { } # Make sure Flutter sdk has been provided -if [ ! -d "./flutter-sdk" ]; then +if [ -d "./flutter-sdk" ]; then echo "Expected ./flutter-sdk to exist and be checked out to the right commit" exit 1; fi From 5b9b6415a02f82e8debed07453ca0c4b38629dbd Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:01:27 -0500 Subject: [PATCH 30/54] take a peek at that path --- tool/bots.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tool/bots.sh b/tool/bots.sh index 62f3b067fce..3e2e2b8cd2e 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -37,6 +37,7 @@ fi # can and does print 'Waiting for another flutter command...' at inopportune # times. export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`/bin:$PATH +echo "DAKE: PATH: $PATH" # Look up the latest flutter candidate (this is the latest flutter version in g3) # TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a From 548e2d1497595808ea61d272a6459a348a1555ef Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:08:13 -0500 Subject: [PATCH 31/54] lllll --- tool/bots.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/bots.sh b/tool/bots.sh index 3e2e2b8cd2e..f19ae136866 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -37,7 +37,10 @@ fi # can and does print 'Waiting for another flutter command...' at inopportune # times. export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`/bin:$PATH -echo "DAKE: PATH: $PATH" +ll -l `pwd`/flutter-sdk/bin/cache/dart-sdk/bin +ll -l `pwd`/flutter-sdk/bin +ll -l `pwd`/bin + # Look up the latest flutter candidate (this is the latest flutter version in g3) # TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a From 7df252f73e617338b04240cc176d98c205fadb98 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:12:25 -0500 Subject: [PATCH 32/54] ls no ll --- tool/bots.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/bots.sh b/tool/bots.sh index f19ae136866..64352f0c1a2 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -37,9 +37,9 @@ fi # can and does print 'Waiting for another flutter command...' at inopportune # times. export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`/bin:$PATH -ll -l `pwd`/flutter-sdk/bin/cache/dart-sdk/bin -ll -l `pwd`/flutter-sdk/bin -ll -l `pwd`/bin +ls -l `pwd`/flutter-sdk/bin/cache/dart-sdk/bin +ls -l `pwd`/flutter-sdk/bin +ls -l `pwd`/bin # Look up the latest flutter candidate (this is the latest flutter version in g3) From 6f95bff37d38ac8a59ad982a26107c8bab931eeb Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:20:22 -0500 Subject: [PATCH 33/54] almost there --- tool/bots.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tool/bots.sh b/tool/bots.sh index 64352f0c1a2..1d1de7e3ddf 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -27,7 +27,9 @@ function flutter { } # Make sure Flutter sdk has been provided -if [ -d "./flutter-sdk" ]; then +ls -l . +ls -l .. +if [ ! -d "./flutter-sdk" ]; then echo "Expected ./flutter-sdk to exist and be checked out to the right commit" exit 1; fi @@ -37,9 +39,6 @@ fi # can and does print 'Waiting for another flutter command...' at inopportune # times. export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`/bin:$PATH -ls -l `pwd`/flutter-sdk/bin/cache/dart-sdk/bin -ls -l `pwd`/flutter-sdk/bin -ls -l `pwd`/bin # Look up the latest flutter candidate (this is the latest flutter version in g3) From f07039ea8a4a098ca341f3106f69f73465c2184d Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:26:08 -0500 Subject: [PATCH 34/54] try clone first? --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 09944f10e29..fb9934801a4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,6 +68,8 @@ jobs: strategy: fail-fast: false steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - name: Load Cached Flutter SDK uses: actions/cache@v3 with: @@ -75,8 +77,6 @@ jobs: ./flutter-sdk key: flutter-sdk-${{ runner.os }}-${{ needs.ubuntu-flutter-prep.outputs.latest_flutter_candidate }} - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - name: Cache Generated Files uses: actions/cache@v3 with: From 876274aaf2d00f646dad117b3c25c4b5d7f71c5d Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:34:34 -0500 Subject: [PATCH 35/54] uncomment --- .github/workflows/build.yaml | 128 +++++++++++++++++------------------ 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fb9934801a4..48512232773 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -90,72 +90,72 @@ jobs: BOT: main run: ./tool/bots.sh - # test: - # name: test ${{ matrix.bot }} - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # bot: - # - test_ddc - # - test_dart2js - # steps: - # - name: git clone - # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # - name: Cache Generated Files - # uses: actions/cache@v3 - # with: - # path: | - # **/build/ - # **/.dart_tool/ - # ./flutter-sdk - # key: ${{ runner.os }}-cache - # - name: tool/bots.sh - # env: - # BOT: ${{ matrix.bot }} - # PLATFORM: vm - # run: ./tool/bots.sh - - # - name: image failures - # uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 - # if: failure() # Only if failure then failures directory exists. - # with: - # # TODO(terry): matrix.os currently empty. If we run tests on other - # # platforms this will be used. - # name: test-image-failures-${{ matrix.os }} # Name for the artifact - # path: packages/devtools_app/test/failures # Path to upload + test: + name: test ${{ matrix.bot }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + bot: + - test_ddc + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + ./flutter-sdk + key: ${{ runner.os }}-cache + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh + + - name: image failures + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 + if: failure() # Only if failure then failures directory exists. + with: + # TODO(terry): matrix.os currently empty. If we run tests on other + # platforms this will be used. + name: test-image-failures-${{ matrix.os }} # Name for the artifact + path: packages/devtools_app/test/failures # Path to upload - # macos-test: - # name: macos ${{ matrix.bot }} - # runs-on: macos-latest - # strategy: - # fail-fast: false - # matrix: - # bot: - # - test_dart2js - # steps: - # - name: git clone - # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # - name: Cache Generated Files - # uses: actions/cache@v3 - # with: - # path: | - # **/build/ - # **/.dart_tool/ - # ./flutter-sdk - # key: ${{ runner.os }}-cache - # - name: tool/bots.sh - # env: - # BOT: ${{ matrix.bot }} - # PLATFORM: vm - # run: ./tool/bots.sh + macos-test: + name: macos ${{ matrix.bot }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + bot: + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Cache Generated Files + uses: actions/cache@v3 + with: + path: | + **/build/ + **/.dart_tool/ + ./flutter-sdk + key: ${{ runner.os }}-cache + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh - # - name: Upload Golden Failure Artifacts - # uses: actions/upload-artifact@v3 - # if: failure() - # with: - # name: golden_image_failures.${{ matrix.bot }} - # path: packages/devtools_app/test/**/failures/*.png + - name: Upload Golden Failure Artifacts + uses: actions/upload-artifact@v3 + if: failure() + with: + name: golden_image_failures.${{ matrix.bot }} + path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh From e9fdc69fa0f072b40ce775b34d95501049dfa53c Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:36:15 -0500 Subject: [PATCH 36/54] recomment --- .github/workflows/build.yaml | 114 +++++++++++++++++------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f22010ff645..8ea8a5fd9c4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -90,65 +90,65 @@ jobs: BOT: main run: ./tool/bots.sh - test: - name: ${{ matrix.bot }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - bot: - - build_ddc - - build_dart2js - - test_ddc - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh + # test: + # name: ${{ matrix.bot }} + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # bot: + # - build_ddc + # - build_dart2js + # - test_ddc + # - test_dart2js + # steps: + # - name: git clone + # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # - name: Cache Generated Files + # uses: actions/cache@v3 + # with: + # path: | + # **/build/ + # **/.dart_tool/ + # ./flutter-sdk + # key: ${{ runner.os }}-cache + # - name: tool/bots.sh + # env: + # BOT: ${{ matrix.bot }} + # PLATFORM: vm + # run: ./tool/bots.sh - macos-test: - name: macos ${{ matrix.bot }} - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - bot: - - test_dart2js - steps: - - name: git clone - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - - name: tool/bots.sh - env: - BOT: ${{ matrix.bot }} - PLATFORM: vm - run: ./tool/bots.sh + # macos-test: + # name: macos ${{ matrix.bot }} + # runs-on: macos-latest + # strategy: + # fail-fast: false + # matrix: + # bot: + # - test_dart2js + # steps: + # - name: git clone + # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + # - name: Cache Generated Files + # uses: actions/cache@v3 + # with: + # path: | + # **/build/ + # **/.dart_tool/ + # ./flutter-sdk + # key: ${{ runner.os }}-cache + # - name: tool/bots.sh + # env: + # BOT: ${{ matrix.bot }} + # PLATFORM: vm + # run: ./tool/bots.sh - - name: Upload Golden Failure Artifacts - uses: actions/upload-artifact@v3 - if: failure() - with: - name: golden_image_failures.${{ matrix.bot }} - path: packages/devtools_app/test/**/failures/*.png + # - name: Upload Golden Failure Artifacts + # uses: actions/upload-artifact@v3 + # if: failure() + # with: + # name: golden_image_failures.${{ matrix.bot }} + # path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh From 05173c44224493afa355dfce0c887f58382150b8 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 11:54:25 -0500 Subject: [PATCH 37/54] clean up and sha work --- .github/workflows/build.yaml | 14 +++++++------- tool/bots.sh | 5 +---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8ea8a5fd9c4..19553bcf430 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,13 +30,7 @@ jobs: - name: Get Latest Flutter Candidate id: flutter-candidate run: | - ./tool/latest_flutter_candidate.sh LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) - echo $LATEST_FLUTTER_CANDIDATE - if [ -z ${LATEST_FLUTTER_CANDIDATE+x} ]; then - echo "::error ::Unable to get Latest flutter candidate" - exit 1 - fi echo "FLUTTER_CANDIDATE=$LATEST_FLUTTER_CANDIDATE" >> $GITHUB_OUTPUT - name: Load Cached Flutter SDK @@ -53,8 +47,14 @@ jobs: cd flutter-sdk git checkout $LATEST_FLUTTER_CANDIDATE fi + HEAD_SHA=$(git rev-parse HEAD) + LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse $LATEST_FLUTTER_CANDIDATE) + if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then + echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}" + exit 1 + fi env: - FLUTTER_HEAD_SHA: ${{ steps.get-flutter-head.outputs.SHA }} + LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} - name: Setup Flutter SDK run: | diff --git a/tool/bots.sh b/tool/bots.sh index 89f3ed37475..44da0ac5b5e 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -27,10 +27,8 @@ function flutter { } # Make sure Flutter sdk has been provided -ls -l . -ls -l .. if [ ! -d "./flutter-sdk" ]; then - echo "Expected ./flutter-sdk to exist and be checked out to the right commit" + echo "Expected ./flutter-sdk to exist" exit 1; fi @@ -40,7 +38,6 @@ fi # times. export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`/bin:$PATH - # Look up the latest flutter candidate (this is the latest flutter version in g3) # TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a # shell script so we won't have to incurr the cost of building flutter tool twice. From abc246486f47f5906bfe8997d73b9ff0fc85b52c Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 12:00:08 -0500 Subject: [PATCH 38/54] remove old cache --- .github/workflows/build.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 19553bcf430..62ee6b24b64 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,14 +77,6 @@ jobs: ./flutter-sdk key: flutter-sdk-${{ runner.os }}-${{ needs.ubuntu-flutter-prep.outputs.latest_flutter_candidate }} - - name: Cache Generated Files - uses: actions/cache@v3 - with: - path: | - **/build/ - **/.dart_tool/ - ./flutter-sdk - key: ${{ runner.os }}-cache - name: tool/bots.sh env: BOT: main From d07d774d0ebd54c88b72e8440299d3a32bc0cb46 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 12:04:04 -0500 Subject: [PATCH 39/54] much better --- .github/workflows/build.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 62ee6b24b64..3c5313fdcbe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -47,12 +47,15 @@ jobs: cd flutter-sdk git checkout $LATEST_FLUTTER_CANDIDATE fi - HEAD_SHA=$(git rev-parse HEAD) - LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse $LATEST_FLUTTER_CANDIDATE) - if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then - echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}" - exit 1 - fi + - name: Ensure that the Latest Flutter Candidate is checked out + run: | + cd flutter-sdk + HEAD_SHA=$(git rev-parse HEAD) + LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse $LATEST_FLUTTER_CANDIDATE) + if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then + echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}" + exit 1 + fi env: LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} From 50156f103748a90e340f903d705aaa98ec4ad66e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:14:34 -0500 Subject: [PATCH 40/54] use remote to get branch sha --- .github/workflows/build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3c5313fdcbe..3152fe48bda 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -47,11 +47,13 @@ jobs: cd flutter-sdk git checkout $LATEST_FLUTTER_CANDIDATE fi + env: + LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} - name: Ensure that the Latest Flutter Candidate is checked out run: | cd flutter-sdk HEAD_SHA=$(git rev-parse HEAD) - LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse $LATEST_FLUTTER_CANDIDATE) + LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse "upstream/$LATEST_FLUTTER_CANDIDATE") if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}" exit 1 From d20822852e54f8603821b6d237f6cdd03b5c968b Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:15:52 -0500 Subject: [PATCH 41/54] origin instead of upstream --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3152fe48bda..24baed560ee 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,7 +53,7 @@ jobs: run: | cd flutter-sdk HEAD_SHA=$(git rev-parse HEAD) - LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse "upstream/$LATEST_FLUTTER_CANDIDATE") + LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse "origin/$LATEST_FLUTTER_CANDIDATE") if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}" exit 1 From 30bf0a0b79d0cdc6351398a8b2e7ca7883b718f7 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:24:10 -0500 Subject: [PATCH 42/54] see if flutter doctor can be cached --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 24baed560ee..e41abbe64a0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -64,6 +64,7 @@ jobs: - name: Setup Flutter SDK run: | ./flutter-sdk/bin/flutter config --no-analytics + ./flutter-sdk/bin/flutter doctor ./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics main: From 0154a1cfa1ea7b87f008c916ef46271d429567c3 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:30:36 -0500 Subject: [PATCH 43/54] small cleanup --- .github/workflows/build.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e41abbe64a0..47c103a9801 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,29 +27,31 @@ jobs: steps: - name: git clone devtools uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Get Latest Flutter Candidate id: flutter-candidate run: | LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh) echo "FLUTTER_CANDIDATE=$LATEST_FLUTTER_CANDIDATE" >> $GITHUB_OUTPUT - + - name: Load Cached Flutter SDK + id: cache-flutter uses: actions/cache@v3 with: path: | ./flutter-sdk key: flutter-sdk-${{ runner.os }}-${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} - - name: Clone Flutter SDK if none cached + - if: ${{ steps.cache-flutter.outputs.cache-hit != 'true' }} + name: Clone Flutter SDK if none cached run: | - if [ ! -d "./flutter-sdk" ]; then - git clone https://github.com/flutter/flutter.git ./flutter-sdk - cd flutter-sdk - git checkout $LATEST_FLUTTER_CANDIDATE - fi + git clone https://github.com/flutter/flutter.git ./flutter-sdk + cd flutter-sdk + git checkout $LATEST_FLUTTER_CANDIDATE env: LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} - - name: Ensure that the Latest Flutter Candidate is checked out + + - name: Assert that the Latest Flutter Candidate is checked out run: | cd flutter-sdk HEAD_SHA=$(git rev-parse HEAD) From 2bf2abb95933d727c6cabf6033efecb918868b8f Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:41:29 -0500 Subject: [PATCH 44/54] try matrix runs on --- .github/workflows/build.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 47c103a9801..158215fe058 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,12 +18,15 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - ubuntu-flutter-prep: + flutter-prep: name: Ubuntu Flutter Prep - runs-on: ubuntu-latest #TODO can this be matrixed on OS. outputs: latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: git clone devtools uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -71,7 +74,7 @@ jobs: main: name: main - needs: ubuntu-flutter-prep + needs: flutter-prep runs-on: ubuntu-latest strategy: fail-fast: false @@ -83,7 +86,7 @@ jobs: with: path: | ./flutter-sdk - key: flutter-sdk-${{ runner.os }}-${{ needs.ubuntu-flutter-prep.outputs.latest_flutter_candidate }} + key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }} - name: tool/bots.sh env: From 6e3daa9b8bd29a38208d12828156fe792db7a62e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:47:43 -0500 Subject: [PATCH 45/54] better prep naming --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 158215fe058..719ee0e5ec1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ env: jobs: flutter-prep: - name: Ubuntu Flutter Prep + name: ${{ matrix.os }} Flutter Prep #TODO can this be matrixed on OS. outputs: latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} From b065ad7e9b444bd5751b00b7ef36fd444f87b655 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 13:49:22 -0500 Subject: [PATCH 46/54] more caching. here we go --- .github/workflows/build.yaml | 112 +++++++++++++++++------------------ 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 719ee0e5ec1..659991502d7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -93,65 +93,63 @@ jobs: BOT: main run: ./tool/bots.sh - # test: - # name: ${{ matrix.bot }} - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # bot: - # - build_ddc - # - build_dart2js - # - test_ddc - # - test_dart2js - # steps: - # - name: git clone - # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # - name: Cache Generated Files - # uses: actions/cache@v3 - # with: - # path: | - # **/build/ - # **/.dart_tool/ - # ./flutter-sdk - # key: ${{ runner.os }}-cache - # - name: tool/bots.sh - # env: - # BOT: ${{ matrix.bot }} - # PLATFORM: vm - # run: ./tool/bots.sh + test: + name: ${{ matrix.bot }} + needs: flutter-prep + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + bot: + - build_ddc + - build_dart2js + - test_ddc + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Load Cached Flutter SDK + uses: actions/cache@v3 + with: + path: | + ./flutter-sdk + key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }} + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh - # macos-test: - # name: macos ${{ matrix.bot }} - # runs-on: macos-latest - # strategy: - # fail-fast: false - # matrix: - # bot: - # - test_dart2js - # steps: - # - name: git clone - # uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - # - name: Cache Generated Files - # uses: actions/cache@v3 - # with: - # path: | - # **/build/ - # **/.dart_tool/ - # ./flutter-sdk - # key: ${{ runner.os }}-cache - # - name: tool/bots.sh - # env: - # BOT: ${{ matrix.bot }} - # PLATFORM: vm - # run: ./tool/bots.sh + macos-test: + needs: flutter-prep + name: macos ${{ matrix.bot }} + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + bot: + - test_dart2js + steps: + - name: git clone + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - name: Load Cached Flutter SDK + uses: actions/cache@v3 + with: + path: | + ./flutter-sdk + key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }} + - name: tool/bots.sh + env: + BOT: ${{ matrix.bot }} + PLATFORM: vm + run: ./tool/bots.sh - # - name: Upload Golden Failure Artifacts - # uses: actions/upload-artifact@v3 - # if: failure() - # with: - # name: golden_image_failures.${{ matrix.bot }} - # path: packages/devtools_app/test/**/failures/*.png + - name: Upload Golden Failure Artifacts + uses: actions/upload-artifact@v3 + if: failure() + with: + name: golden_image_failures.${{ matrix.bot }} + path: packages/devtools_app/test/**/failures/*.png # TODO(https://github.com/flutter/devtools/issues/1715): add a windows compatible version of tool/bots.sh From ec426c03624d5dd6c13e0440fc70b51c38e8dfc0 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 14:13:12 -0500 Subject: [PATCH 47/54] try diagnostic logging --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 659991502d7..3db5d2340bb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ permissions: read-all env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + ACTIONS_RUNNER_DEBUG: true jobs: flutter-prep: name: ${{ matrix.os }} Flutter Prep From 820622357e3811ef1e5e36e74aa902bf86bdc14e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 14:27:06 -0500 Subject: [PATCH 48/54] another bit of cleanup --- .github/workflows/build.yaml | 1 - tool/latest_flutter_candidate.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3db5d2340bb..4c35d10e833 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,6 @@ env: jobs: flutter-prep: name: ${{ matrix.os }} Flutter Prep - #TODO can this be matrixed on OS. outputs: latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} strategy: diff --git a/tool/latest_flutter_candidate.sh b/tool/latest_flutter_candidate.sh index aa6443f05f6..e2eb3b9c0ad 100755 --- a/tool/latest_flutter_candidate.sh +++ b/tool/latest_flutter_candidate.sh @@ -3,7 +3,9 @@ # Copyright 2022 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + RESPONSE=$(gh api --paginate /repos/flutter/flutter/branches) + CANDIDATES=$(echo "$RESPONSE" | jq '.[].name' | grep candidate) VERSIONS=$(echo "$CANDIDATES" | sed -E 's/.*([0-9]+\.[0-9]+-candidate\.[0-9]+).*/\1/' ) From f3cfa16c5463854777f0b14a4d828f309db00cc1 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 15:14:20 -0500 Subject: [PATCH 49/54] quick try for shard --- .github/workflows/build.yaml | 22 +++++++++++++++++++--- tool/bots.sh | 6 +++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c35d10e833..0d700031977 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -72,11 +72,16 @@ jobs: ./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics main: - name: main + name: main - ${{ matrix.shard_index }} needs: flutter-prep runs-on: ubuntu-latest strategy: fail-fast: false + matrix: + shard_index: + - 0 + - 1 + - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -90,10 +95,11 @@ jobs: - name: tool/bots.sh env: BOT: main + SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh test: - name: ${{ matrix.bot }} + name: ${{ matrix.bot }} - ${{ matrix.shard_index }} needs: flutter-prep runs-on: ubuntu-latest strategy: @@ -104,6 +110,10 @@ jobs: - build_dart2js - test_ddc - test_dart2js + shard_index: + - 0 + - 1 + - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -117,17 +127,22 @@ jobs: env: BOT: ${{ matrix.bot }} PLATFORM: vm + SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh macos-test: needs: flutter-prep - name: macos ${{ matrix.bot }} + name: macos ${{ matrix.bot }} - ${{ matrix.shard_index }} runs-on: macos-latest strategy: fail-fast: false matrix: bot: - test_dart2js + shard_index: + - 0 + - 1 + - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -141,6 +156,7 @@ jobs: env: BOT: ${{ matrix.bot }} PLATFORM: vm + SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh - name: Upload Golden Failure Artifacts diff --git a/tool/bots.sh b/tool/bots.sh index 44da0ac5b5e..dcb14081c60 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -94,7 +94,7 @@ if [ "$BOT" = "main" ]; then pushd packages/devtools_shared echo `pwd` - flutter test test/ + flutter test --total-shards 3 --shard-index $SHARD_INDEX test/ popd # Change the directory back to devtools_app. @@ -128,9 +128,9 @@ elif [[ "$BOT" == "test_ddc" || "$BOT" == "test_dart2js" ]]; then # we may need to explicitly exclude running integration_tests here (this is what we # used to do when integration tests were enabled). if [ "$PLATFORM" = "vm" ]; then - WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test test/ + WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --total-shards 3 --shard-index $SHARD_INDEX test/ elif [ "$PLATFORM" = "chrome" ]; then - WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --platform chrome test/ + WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --total-shards 3 --shard-index $SHARD_INDEX --platform chrome test/ else echo "unknown test platform" exit 1 From 00dfe2d45c4a6d039373a46b1987833cee1f32db Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 16:11:43 -0500 Subject: [PATCH 50/54] Revert "quick try for shard" This reverts commit f3cfa16c5463854777f0b14a4d828f309db00cc1. --- .github/workflows/build.yaml | 22 +++------------------- tool/bots.sh | 6 +++--- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0d700031977..4c35d10e833 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -72,16 +72,11 @@ jobs: ./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics main: - name: main - ${{ matrix.shard_index }} + name: main needs: flutter-prep runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - shard_index: - - 0 - - 1 - - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -95,11 +90,10 @@ jobs: - name: tool/bots.sh env: BOT: main - SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh test: - name: ${{ matrix.bot }} - ${{ matrix.shard_index }} + name: ${{ matrix.bot }} needs: flutter-prep runs-on: ubuntu-latest strategy: @@ -110,10 +104,6 @@ jobs: - build_dart2js - test_ddc - test_dart2js - shard_index: - - 0 - - 1 - - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -127,22 +117,17 @@ jobs: env: BOT: ${{ matrix.bot }} PLATFORM: vm - SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh macos-test: needs: flutter-prep - name: macos ${{ matrix.bot }} - ${{ matrix.shard_index }} + name: macos ${{ matrix.bot }} runs-on: macos-latest strategy: fail-fast: false matrix: bot: - test_dart2js - shard_index: - - 0 - - 1 - - 2 steps: - name: git clone uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -156,7 +141,6 @@ jobs: env: BOT: ${{ matrix.bot }} PLATFORM: vm - SHARD_INDEX: ${{ matrix.shard_index }} run: ./tool/bots.sh - name: Upload Golden Failure Artifacts diff --git a/tool/bots.sh b/tool/bots.sh index dcb14081c60..44da0ac5b5e 100755 --- a/tool/bots.sh +++ b/tool/bots.sh @@ -94,7 +94,7 @@ if [ "$BOT" = "main" ]; then pushd packages/devtools_shared echo `pwd` - flutter test --total-shards 3 --shard-index $SHARD_INDEX test/ + flutter test test/ popd # Change the directory back to devtools_app. @@ -128,9 +128,9 @@ elif [[ "$BOT" == "test_ddc" || "$BOT" == "test_dart2js" ]]; then # we may need to explicitly exclude running integration_tests here (this is what we # used to do when integration tests were enabled). if [ "$PLATFORM" = "vm" ]; then - WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --total-shards 3 --shard-index $SHARD_INDEX test/ + WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test test/ elif [ "$PLATFORM" = "chrome" ]; then - WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --total-shards 3 --shard-index $SHARD_INDEX --platform chrome test/ + WEBDEV_RELEASE=$USE_WEBDEV_RELEASE flutter test --platform chrome test/ else echo "unknown test platform" exit 1 From c025d4644b0eeb2f69ed1edab9418f48c31453bb Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 16:26:40 -0500 Subject: [PATCH 51/54] test commit --- packages/devtools_app/build.yaml | 2 +- packages/devtools_app/mdtg.log | 17 + .../test/debugger/debugger_codeview_test.dart | 59 +- .../inspector/inspector_integration_test.dart | 286 +++++---- .../layout_explorer/flex/arrow_test.dart | 6 + .../layout_explorer/flex/flex_test.dart | 2 + .../test/memory/chart/chart_test.dart | 322 +++++----- .../memory/control/settings_dialog_test.dart | 95 +-- .../diff/widgets/class_filter_test.dart | 96 +-- .../memory/diff/widgets/diff_pane_test.dart | 120 ++-- .../test/memory/memory_screen_test.dart | 327 +++++----- .../frame_analysis/frame_analysis_test.dart | 186 +++--- .../raster_stats/raster_stats_test.dart | 98 +-- .../timeline_flame_chart_test.dart | 1 + .../test/provider/provider_screen_test.dart | 281 ++++---- .../test/shared/instance_viewer_test.dart | 598 +++++++++--------- packages/devtools_test/lib/src/wrappers.dart | 2 + 17 files changed, 1315 insertions(+), 1183 deletions(-) create mode 100644 packages/devtools_app/mdtg.log diff --git a/packages/devtools_app/build.yaml b/packages/devtools_app/build.yaml index de2d04f5885..1428878801b 100644 --- a/packages/devtools_app/build.yaml +++ b/packages/devtools_app/build.yaml @@ -1,4 +1,4 @@ -targets: +targets:: $default: builders: build_web_compilers|entrypoint: diff --git a/packages/devtools_app/mdtg.log b/packages/devtools_app/mdtg.log new file mode 100644 index 00000000000..30bd29476b3 --- /dev/null +++ b/packages/devtools_app/mdtg.log @@ -0,0 +1,17 @@ +test/memory/memory_screen_test.dart +test/memory/chart/chart_test.dart +test/memory/diff/widgets/class_filter_test.dart +test/memory/diff/widgets/diff_pane_test.dart +test/memory/control/settings_dialog_test.dart +test/inspector/inspector_integration_test.dart +test/inspector/layout_explorer/flex/flex_test.dart +test/inspector/layout_explorer/flex/arrow_test.dart +test/provider/provider_screen_test.dart +test/shared/instance_viewer_test.dart +test/shared/ui_utils_test.dart +test/shared/treemap_test.dart +test/debugger/debugger_codeview_test.dart +test/matchers/matchers.dart +test/performance/frame_analysis/frame_analysis_test.dart +test/performance/timeline_events/timeline_flame_chart_test.dart +test/performance/raster_stats/raster_stats_test.dart diff --git a/packages/devtools_app/test/debugger/debugger_codeview_test.dart b/packages/devtools_app/test/debugger/debugger_codeview_test.dart index 7619c9c63b6..35ea4f0ae93 100644 --- a/packages/devtools_app/test/debugger/debugger_codeview_test.dart +++ b/packages/devtools_app/test/debugger/debugger_codeview_test.dart @@ -75,35 +75,38 @@ void main() { } testWidgetsWithWindowSize( - 'has a horizontal and a vertical scrollbar', smallWindowSize, - (WidgetTester tester) async { - await pumpDebuggerScreen(tester, debuggerController); - - // TODO(elliette): https://github.com/flutter/flutter/pull/88152 fixes - // this so that forcing a scroll event is no longer necessary. Remove - // once the change is in the stable release. - codeViewController.showScriptLocation( - ScriptLocation( - mockScriptRef, - location: const SourcePosition(line: 50, column: 50), - ), - ); - await tester.pumpAndSettle(); + 'has a horizontal and a vertical scrollbar', + smallWindowSize, + (WidgetTester tester) async { + await pumpDebuggerScreen(tester, debuggerController); + + // TODO(elliette): https://github.com/flutter/flutter/pull/88152 fixes + // this so that forcing a scroll event is no longer necessary. Remove + // once the change is in the stable release. + codeViewController.showScriptLocation( + ScriptLocation( + mockScriptRef, + location: const SourcePosition(line: 50, column: 50), + ), + ); + await tester.pumpAndSettle(); - expect(find.byType(Scrollbar), findsNWidgets(2)); - expect( - find.byKey(const Key('debuggerCodeViewVerticalScrollbarKey')), - findsOneWidget, - ); - expect( - find.byKey(const Key('debuggerCodeViewHorizontalScrollbarKey')), - findsOneWidget, - ); - await expectLater( - find.byKey(DebuggerScreenBody.codeViewKey), - matchesDevToolsGolden('../goldens/codeview_scrollbars.png'), - ); - }); + expect(find.byType(Scrollbar), findsNWidgets(2)); + expect( + find.byKey(const Key('debuggerCodeViewVerticalScrollbarKey')), + findsOneWidget, + ); + expect( + find.byKey(const Key('debuggerCodeViewHorizontalScrollbarKey')), + findsOneWidget, + ); + await expectLater( + find.byKey(DebuggerScreenBody.codeViewKey), + matchesDevToolsGolden('../goldens/codeview_scrollbars.png'), + ); + }, + tags: ['golden'], + ); testWidgetsWithWindowSize('search in file field is visible', smallWindowSize, (WidgetTester tester) async { diff --git a/packages/devtools_app/test/inspector/inspector_integration_test.dart b/packages/devtools_app/test/inspector/inspector_integration_test.dart index c120a584abc..cd3701858f8 100644 --- a/packages/devtools_app/test/inspector/inspector_integration_test.dart +++ b/packages/devtools_app/test/inspector/inspector_integration_test.dart @@ -57,99 +57,103 @@ void main() async { await env.tearDownEnvironment(force: true); }); - testWidgetsWithWindowSize('navigation', windowSize, - (WidgetTester tester) async { - await env.setupEnvironment(); - expect(serviceManager.service, equals(env.service)); - expect(serviceManager.isolateManager, isNotNull); - - const screen = InspectorScreen(); - await tester.pumpWidget( - wrapWithInspectorControllers(Builder(builder: screen.build)), - ); - await tester.pump(const Duration(seconds: 1)); - final InspectorScreenBodyState state = - tester.state(find.byType(InspectorScreenBody)); - final controller = state.controller; - while (!controller.flutterAppFrameReady) { - await controller.maybeLoadUI(); - await tester.pumpAndSettle(); - } - // Give time for the initial animation to complete. - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_initial_load.png', - ), - ); - - // Click on the Center widget (row index #5) - await tester.tap(find.richText('Center')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_select_center.png', - ), - ); - - // Select the details tree. - await tester.tap(find.text('Widget Details Tree')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_select_center_details_tree.png', - ), - ); - - // Select the RichText row. - await tester.tap(find.richText('RichText')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_richtext_selected.png', - ), - ); - - // Test hovering over the icon shown when a property has its default - // value. - // TODO(jacobr): support tooltips in the Flutter version of the inspector. - // https://github.com/flutter/devtools/issues/2570. - // For example, verify that the tooltip hovering over the default value - // icons is "Default value". - // Test selecting a widget. - - // Two 'Scaffold's: a breadcrumb and an actual tree item - expect(find.richText('Scaffold'), findsNWidgets(2)); - // select Scaffold widget in summary tree. - await tester.tap(find.richText('Scaffold').last); - await tester.pumpAndSettle(inspectorChangeSettleTime); - // This tree is huge. If there is a change to package:flutter it may - // change. If this happens don't panic and rebaseline the golden. - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_scaffold_selected.png', - ), - ); - - // The important thing about this is that the details tree should scroll - // instead of re-rooting as the selected row is already visible in the - // details tree. - await tester.tap(find.richText('AnimatedPhysicalModel')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_animated_physical_model_selected.png', - ), - ); - - await env.tearDownEnvironment(); - }); + testWidgetsWithWindowSize( + 'navigation', + windowSize, + (WidgetTester tester) async { + await env.setupEnvironment(); + expect(serviceManager.service, equals(env.service)); + expect(serviceManager.isolateManager, isNotNull); + + const screen = InspectorScreen(); + await tester.pumpWidget( + wrapWithInspectorControllers(Builder(builder: screen.build)), + ); + await tester.pump(const Duration(seconds: 1)); + final InspectorScreenBodyState state = + tester.state(find.byType(InspectorScreenBody)); + final controller = state.controller; + while (!controller.flutterAppFrameReady) { + await controller.maybeLoadUI(); + await tester.pumpAndSettle(); + } + // Give time for the initial animation to complete. + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_initial_load.png', + ), + ); + + // Click on the Center widget (row index #5) + await tester.tap(find.richText('Center')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_select_center.png', + ), + ); + + // Select the details tree. + await tester.tap(find.text('Widget Details Tree')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_select_center_details_tree.png', + ), + ); + + // Select the RichText row. + await tester.tap(find.richText('RichText')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_richtext_selected.png', + ), + ); + + // Test hovering over the icon shown when a property has its default + // value. + // TODO(jacobr): support tooltips in the Flutter version of the inspector. + // https://github.com/flutter/devtools/issues/2570. + // For example, verify that the tooltip hovering over the default value + // icons is "Default value". + // Test selecting a widget. + + // Two 'Scaffold's: a breadcrumb and an actual tree item + expect(find.richText('Scaffold'), findsNWidgets(2)); + // select Scaffold widget in summary tree. + await tester.tap(find.richText('Scaffold').last); + await tester.pumpAndSettle(inspectorChangeSettleTime); + // This tree is huge. If there is a change to package:flutter it may + // change. If this happens don't panic and rebaseline the golden. + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_scaffold_selected.png', + ), + ); + + // The important thing about this is that the details tree should scroll + // instead of re-rooting as the selected row is already visible in the + // details tree. + await tester.tap(find.richText('AnimatedPhysicalModel')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_animated_physical_model_selected.png', + ), + ); + + await env.tearDownEnvironment(); + }, + tags: ['golden'], + ); // TODO(jacobr): convert these tests to screenshot tests like the initial // state test. @@ -408,52 +412,56 @@ void main() async { await env.tearDownEnvironment(force: true); }); - testWidgetsWithWindowSize('show navigator and error labels', windowSize, - (WidgetTester tester) async { - await env.setupEnvironment( - config: const FlutterRunConfiguration( - withDebugger: true, - entryScript: 'lib/overflow_errors.dart', - ), - ); - expect(serviceManager.service, equals(env.service)); - expect(serviceManager.isolateManager, isNotNull); - - const screen = InspectorScreen(); - await tester.pumpWidget( - wrapWithInspectorControllers(Builder(builder: screen.build)), - ); - await tester.pumpAndSettle(const Duration(seconds: 1)); - final InspectorScreenBodyState state = - tester.state(find.byType(InspectorScreenBody)); - final controller = state.controller; - while (!controller.flutterAppFrameReady) { - await controller.maybeLoadUI(); - await tester.pumpAndSettle(); - } - await env.flutter!.hotReload(); - // Give time for the initial animation to complete. - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_errors_1_initial_load.png', - ), - ); - - // Navigate so one of the errors is selected. - for (var i = 0; i < 2; i++) { - await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); + testWidgetsWithWindowSize( + 'show navigator and error labels', + windowSize, + (WidgetTester tester) async { + await env.setupEnvironment( + config: const FlutterRunConfiguration( + withDebugger: true, + entryScript: 'lib/overflow_errors.dart', + ), + ); + expect(serviceManager.service, equals(env.service)); + expect(serviceManager.isolateManager, isNotNull); + + const screen = InspectorScreen(); + await tester.pumpWidget( + wrapWithInspectorControllers(Builder(builder: screen.build)), + ); + await tester.pumpAndSettle(const Duration(seconds: 1)); + final InspectorScreenBodyState state = + tester.state(find.byType(InspectorScreenBody)); + final controller = state.controller; + while (!controller.flutterAppFrameReady) { + await controller.maybeLoadUI(); + await tester.pumpAndSettle(); + } + await env.flutter!.hotReload(); + // Give time for the initial animation to complete. await tester.pumpAndSettle(inspectorChangeSettleTime); - } - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_errors_2_error_selected.png', - ), - ); - - await env.tearDownEnvironment(); - }); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_errors_1_initial_load.png', + ), + ); + + // Navigate so one of the errors is selected. + for (var i = 0; i < 2; i++) { + await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); + await tester.pumpAndSettle(inspectorChangeSettleTime); + } + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_errors_2_error_selected.png', + ), + ); + + await env.tearDownEnvironment(); + }, + tags: ['golden'], + ); }); } diff --git a/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart b/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart index 347ec1ab9e7..33f18fab3a6 100644 --- a/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart +++ b/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart @@ -40,6 +40,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); testWidgets( 'up', @@ -52,6 +53,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); testWidgets( 'right', @@ -64,6 +66,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); testWidgets( 'down', @@ -76,6 +79,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); }); @@ -108,6 +112,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); testWidgets( 'vertical', @@ -120,6 +125,7 @@ void main() { ); }, skip: kIsWeb, + tags: ['golden'], ); }); }); diff --git a/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart b/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart index 88264c1c1e2..9ae1f9f4396 100644 --- a/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart +++ b/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart @@ -269,6 +269,7 @@ void main() { ); }, skip: true, + tags: ['golden'], ); testWidgetsWithWindowSize( @@ -288,5 +289,6 @@ void main() { ); }, skip: true, + tags: ['golden'], ); } diff --git a/packages/devtools_app/test/memory/chart/chart_test.dart b/packages/devtools_app/test/memory/chart/chart_test.dart index ab0fc710de0..44282f9af8f 100644 --- a/packages/devtools_app/test/memory/chart/chart_test.dart +++ b/packages/devtools_app/test/memory/chart/chart_test.dart @@ -329,6 +329,7 @@ void main() { equals('16:45:30'), ); }, + tags: ['golden'], ); void checkScaledXAxis2Labels(ChartController controller) { @@ -343,85 +344,93 @@ void main() { ); } - testWidgetsWithWindowSize('Scaled Y-axis all', windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize( + 'Scaled Y-axis all', + windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupScaledChart(tester, controller, chartKey); + await setupScaledChart(tester, controller, chartKey); - // Check A=all data view zoom. - controller.zoomDuration = null; - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Check A=all data view zoom. + controller.zoomDuration = null; + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden('../../goldens/memory_chart_scaled_all.png'), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden('../../goldens/memory_chart_scaled_all.png'), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(104)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.0)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2150.0)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(104)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.0)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2150.0)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(719576719.5767195)); - expect(controller.yScale.labelTicks, equals(10.0)); - expect(controller.yScale.labelUnitExponent, 8.0); - expect(controller.yScale.tickSpacing, equals(5291005.291005291)); - expect(controller.yScale.maxPoint, equals(717799424.0)); - expect(controller.yScale.maxTicks, equals(190.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(719576719.5767195)); + expect(controller.yScale.labelTicks, equals(10.0)); + expect(controller.yScale.labelUnitExponent, 8.0); + expect(controller.yScale.tickSpacing, equals(5291005.291005291)); + expect(controller.yScale.maxPoint, equals(717799424.0)); + expect(controller.yScale.maxTicks, equals(190.0)); - validateScaledYLabels(controller); + validateScaledYLabels(controller); - checkScaledXAxis2Labels(controller); - }); + checkScaledXAxis2Labels(controller); + }, + tags: ['golden'], + ); - testWidgetsWithWindowSize('Scaled Y-axis Five Minutes', windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize( + 'Scaled Y-axis Five Minutes', + windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupScaledChart(tester, controller, chartKey); + await setupScaledChart(tester, controller, chartKey); - // Check 5 minute data view zoom. - controller.zoomDuration = const Duration(minutes: 5); - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Check 5 minute data view zoom. + controller.zoomDuration = const Duration(minutes: 5); + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden( - '../../goldens/memory_chart_scaled_five_minute.png', - ), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden( + '../../goldens/memory_chart_scaled_five_minute.png', + ), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(1704)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.6880000000001019)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2149.312)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(1704)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.6880000000001019)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2149.312)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(719576719.5767195)); - expect(controller.yScale.labelTicks, equals(10.0)); - expect(controller.yScale.labelUnitExponent, 8.0); - expect(controller.yScale.tickSpacing, equals(5291005.291005291)); - expect(controller.yScale.maxPoint, equals(717799424.0)); - expect(controller.yScale.maxTicks, equals(190.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(719576719.5767195)); + expect(controller.yScale.labelTicks, equals(10.0)); + expect(controller.yScale.labelUnitExponent, 8.0); + expect(controller.yScale.tickSpacing, equals(5291005.291005291)); + expect(controller.yScale.maxPoint, equals(717799424.0)); + expect(controller.yScale.maxTicks, equals(190.0)); - validateScaledYLabels(controller); + validateScaledYLabels(controller); - checkScaledXAxis2Labels(controller); - }); + checkScaledXAxis2Labels(controller); + }, + tags: ['golden'], + ); /////////////////////////////////////////////////////////////////////////// // Fixed Y-axis chart. // @@ -712,6 +721,7 @@ void main() { equals('16:45:30'), ); }, + tags: ['golden'], ); void checkFixedXAxis2Labels(ChartController controller) { @@ -726,111 +736,119 @@ void main() { ); } - testWidgetsWithWindowSize('Fixed Y-axis all', windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize( + 'Fixed Y-axis all', + windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupFixedChart(tester, controller, chartKey); + await setupFixedChart(tester, controller, chartKey); - // Check all data view zoom. - controller.zoomDuration = null; - await tester.pumpAndSettle(const Duration(seconds: 15)); + // Check all data view zoom. + controller.zoomDuration = null; + await tester.pumpAndSettle(const Duration(seconds: 15)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden('../../goldens/memory_chart_fixed_all.png'), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden('../../goldens/memory_chart_fixed_all.png'), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(104)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.0)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2150.0)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(104)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.0)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2150.0)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(2.426966292134831)); - expect(controller.yScale.labelTicks, equals(3.0)); - expect(controller.yScale.labelUnitExponent, 0.0); - expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); - expect(controller.yScale.maxPoint, equals(2.4)); - expect(controller.yScale.maxTicks, equals(90.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(2.426966292134831)); + expect(controller.yScale.labelTicks, equals(3.0)); + expect(controller.yScale.labelUnitExponent, 0.0); + expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); + expect(controller.yScale.maxPoint, equals(2.4)); + expect(controller.yScale.maxTicks, equals(90.0)); - // Validate the labels displayed on the y-axis. - final yScale = controller.yScale; - expect(yScale.labelTicks, equals(3)); - for (var labelIndex = yScale.labelTicks; - labelIndex >= 0; - labelIndex--) { - final labelName = ChartPainter.constructLabel( - labelIndex.toInt(), - yScale.labelUnitExponent.toInt(), - ); + // Validate the labels displayed on the y-axis. + final yScale = controller.yScale; + expect(yScale.labelTicks, equals(3)); + for (var labelIndex = yScale.labelTicks; + labelIndex >= 0; + labelIndex--) { + final labelName = ChartPainter.constructLabel( + labelIndex.toInt(), + yScale.labelUnitExponent.toInt(), + ); - final expectedLabels = ['0', '1', '2', '3']; - expect(labelName, expectedLabels[labelIndex.toInt()]); - } + final expectedLabels = ['0', '1', '2', '3']; + expect(labelName, expectedLabels[labelIndex.toInt()]); + } - checkFixedXAxis2Labels(controller); - }); + checkFixedXAxis2Labels(controller); + }, + tags: ['golden'], + ); - testWidgetsWithWindowSize('Fixed Y-axis 5 Minutes', windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize( + 'Fixed Y-axis 5 Minutes', + windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupFixedChart(tester, controller, chartKey); + await setupFixedChart(tester, controller, chartKey); - // Check all data view zoom. - controller.zoomDuration = const Duration(minutes: 5); - await tester.pumpAndSettle(const Duration(seconds: 15)); + // Check all data view zoom. + controller.zoomDuration = const Duration(minutes: 5); + await tester.pumpAndSettle(const Duration(seconds: 15)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden( - '../../goldens/memory_chart_fixed_five_minutes.png', - ), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden( + '../../goldens/memory_chart_fixed_five_minutes.png', + ), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(1704)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.6880000000001019)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2149.312)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(1704)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.6880000000001019)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2149.312)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(2.426966292134831)); - expect(controller.yScale.labelTicks, equals(3.0)); - expect(controller.yScale.labelUnitExponent, 0.0); - expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); - expect(controller.yScale.maxPoint, equals(2.4)); - expect(controller.yScale.maxTicks, equals(90.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(2.426966292134831)); + expect(controller.yScale.labelTicks, equals(3.0)); + expect(controller.yScale.labelUnitExponent, 0.0); + expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); + expect(controller.yScale.maxPoint, equals(2.4)); + expect(controller.yScale.maxTicks, equals(90.0)); - // Validate the labels displayed on the y-axis. - final yScale = controller.yScale; - expect(yScale.labelTicks, equals(3)); - for (var labelIndex = yScale.labelTicks; - labelIndex >= 0; - labelIndex--) { - final labelName = ChartPainter.constructLabel( - labelIndex.toInt(), - yScale.labelUnitExponent.toInt(), - ); + // Validate the labels displayed on the y-axis. + final yScale = controller.yScale; + expect(yScale.labelTicks, equals(3)); + for (var labelIndex = yScale.labelTicks; + labelIndex >= 0; + labelIndex--) { + final labelName = ChartPainter.constructLabel( + labelIndex.toInt(), + yScale.labelUnitExponent.toInt(), + ); - final expectedLabels = ['0', '1', '2', '3']; - expect(labelName, expectedLabels[labelIndex.toInt()]); - } + final expectedLabels = ['0', '1', '2', '3']; + expect(labelName, expectedLabels[labelIndex.toInt()]); + } - checkFixedXAxis2Labels(controller); - }); + checkFixedXAxis2Labels(controller); + }, + tags: ['golden'], + ); }, ); } diff --git a/packages/devtools_app/test/memory/control/settings_dialog_test.dart b/packages/devtools_app/test/memory/control/settings_dialog_test.dart index 4fa971a8902..5a26d2ef6d6 100644 --- a/packages/devtools_app/test/memory/control/settings_dialog_test.dart +++ b/packages/devtools_app/test/memory/control/settings_dialog_test.dart @@ -36,52 +36,57 @@ void main() { scene.tearDown(); }); - testWidgetsWithWindowSize('settings update preferences', windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + testWidgetsWithWindowSize( + 'settings update preferences', + windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Open the dialog. - await tester.tap(find.byType(SettingsOutlinedButton)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_default.png'), - ); + // Open the dialog. + await tester.tap(find.byType(SettingsOutlinedButton)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_default.png'), + ); - // Modify settings and check the changes are reflected in the controller. - expect( - preferences.memory.androidCollectionEnabled.value, - isFalse, - ); - expect( - preferences.memory.autoSnapshotEnabled.value, - isFalse, - ); - await tester - .tap(find.byKey(MemorySettingDialogKeys.showAndroidChartCheckBox)); - await tester.tap(find.byKey(MemorySettingDialogKeys.autoSnapshotCheckbox)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), - ); - expect( - preferences.memory.androidCollectionEnabled.value, - isTrue, - ); - expect( - preferences.memory.autoSnapshotEnabled.value, - isTrue, - ); + // Modify settings and check the changes are reflected in the controller. + expect( + preferences.memory.androidCollectionEnabled.value, + isFalse, + ); + expect( + preferences.memory.autoSnapshotEnabled.value, + isFalse, + ); + await tester + .tap(find.byKey(MemorySettingDialogKeys.showAndroidChartCheckBox)); + await tester + .tap(find.byKey(MemorySettingDialogKeys.autoSnapshotCheckbox)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), + ); + expect( + preferences.memory.androidCollectionEnabled.value, + isTrue, + ); + expect( + preferences.memory.autoSnapshotEnabled.value, + isTrue, + ); - // Reopen the dialog and check the settings are not changed. - await tester.tap(find.byType(DialogCloseButton)); - await tester.pumpAndSettle(); - await tester.tap(find.byType(SettingsOutlinedButton)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), - ); - }); + // Reopen the dialog and check the settings are not changed. + await tester.tap(find.byType(DialogCloseButton)); + await tester.pumpAndSettle(); + await tester.tap(find.byType(SettingsOutlinedButton)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), + ); + }, + tags: ['golden'], + ); } diff --git a/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart b/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart index fee88d54952..e0e045c1bed 100644 --- a/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart +++ b/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart @@ -75,55 +75,61 @@ void main() { for (final test in _tests) { testWidgetsWithWindowSize( - '$ClassFilterDialog filters classes, ${test.name}', windowSize, - (WidgetTester tester) async { - await pumpScene(tester, test); - - await _switchFilter( - ClassFilterType.showAll, - ClassFilterType.except, - tester, - test, - ); - - await _switchFilter( - ClassFilterType.except, - ClassFilterType.only, - tester, - test, - ); - - await _switchFilter( - ClassFilterType.only, - ClassFilterType.showAll, - tester, - test, - ); - }); + '$ClassFilterDialog filters classes, ${test.name}', + windowSize, + (WidgetTester tester) async { + await pumpScene(tester, test); + + await _switchFilter( + ClassFilterType.showAll, + ClassFilterType.except, + tester, + test, + ); + + await _switchFilter( + ClassFilterType.except, + ClassFilterType.only, + tester, + test, + ); + + await _switchFilter( + ClassFilterType.only, + ClassFilterType.showAll, + tester, + test, + ); + }, + tags: ['golden'], + ); } for (final test in _tests) { testWidgetsWithWindowSize( - '$ClassFilterDialog customizes and resets to default, ${test.name}', - windowSize, (WidgetTester tester) async { - await pumpScene(tester, test); - - // Customize filter. - scene.diffController.applyFilter(_customFilter); - await _checkDataGolden(null, tester, test); - - // Open dialog. - await tester.tap(find.byType(ClassFilterButton)); - await _checkFilterGolden(null, tester); - - // Reset to default. - await tester.tap(find.text('Reset to default')); - await _checkFilterGolden(ClassFilterType.showAll, tester); - - // Close dialog. - await tester.tap(find.text('APPLY')); - await _checkDataGolden(ClassFilterType.showAll, tester, test); - }); + '$ClassFilterDialog customizes and resets to default, ${test.name}', + windowSize, + (WidgetTester tester) async { + await pumpScene(tester, test); + + // Customize filter. + scene.diffController.applyFilter(_customFilter); + await _checkDataGolden(null, tester, test); + + // Open dialog. + await tester.tap(find.byType(ClassFilterButton)); + await _checkFilterGolden(null, tester); + + // Reset to default. + await tester.tap(find.text('Reset to default')); + await _checkFilterGolden(ClassFilterType.showAll, tester); + + // Close dialog. + await tester.tap(find.text('APPLY')); + await _checkDataGolden(ClassFilterType.showAll, tester, test); + }, + tags: ['golden'], + ); } } diff --git a/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart b/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart index ea94fc211dd..6a2cd59c7ff 100644 --- a/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart +++ b/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart @@ -44,65 +44,69 @@ void main() { scene.tearDown(); }); - testWidgetsWithWindowSize('records and deletes snapshots', windowSize, - (WidgetTester tester) async { - final snapshots = scene.controller.diffPaneController.core.snapshots; - // Check the list contains only documentation item. - expect(snapshots.value.length, equals(1)); - await pumpScene(tester); - - // Check initial golden. - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden('../../../goldens/memory_diff_empty1.png'), - ); - - // Record three snapshots. - for (var i in Iterable.generate(3)) { - await tester.tap(find.byIcon(Icons.fiber_manual_record).first); + testWidgetsWithWindowSize( + 'records and deletes snapshots', + windowSize, + (WidgetTester tester) async { + final snapshots = scene.controller.diffPaneController.core.snapshots; + // Check the list contains only documentation item. + expect(snapshots.value.length, equals(1)); + await pumpScene(tester); + + // Check initial golden. + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden('../../../goldens/memory_diff_empty1.png'), + ); + + // Record three snapshots. + for (var i in Iterable.generate(3)) { + await tester.tap(find.byIcon(Icons.fiber_manual_record).first); + await tester.pumpAndSettle(); + expect(find.text('selected-isolate-${i + 1}'), findsOneWidget); + } + + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_three_snapshots1.png', + ), + ); + expect(snapshots.value.length, equals(1 + 3)); + + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_selected_class.png', + ), + ); + + // Delete a snapshot. + await tester.tap(find.byTooltip('Delete snapshot')); await tester.pumpAndSettle(); - expect(find.text('selected-isolate-${i + 1}'), findsOneWidget); - } - - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_three_snapshots1.png', - ), - ); - expect(snapshots.value.length, equals(1 + 3)); - - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_selected_class.png', - ), - ); - - // Delete a snapshot. - await tester.tap(find.byTooltip('Delete snapshot')); - await tester.pumpAndSettle(); - expect(snapshots.value.length, equals(1 + 3 - 1)); + expect(snapshots.value.length, equals(1 + 3 - 1)); - // Record snapshot - await tester.tap(find.byIcon(Icons.fiber_manual_record)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_three_snapshots2.png', - ), - ); - expect(snapshots.value.length, equals(1 + 3 - 1 + 1)); - - // Clear all - await tester.tap(find.byTooltip('Clear all snapshots')); - await tester.pumpAndSettle(); - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden('../../../goldens/memory_diff_empty2.png'), - ); - expect(snapshots.value.length, equals(1)); - }); + // Record snapshot + await tester.tap(find.byIcon(Icons.fiber_manual_record)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_three_snapshots2.png', + ), + ); + expect(snapshots.value.length, equals(1 + 3 - 1 + 1)); + + // Clear all + await tester.tap(find.byTooltip('Clear all snapshots')); + await tester.pumpAndSettle(); + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden('../../../goldens/memory_diff_empty2.png'), + ); + expect(snapshots.value.length, equals(1)); + }, + tags: ['golden'], + ); }); } diff --git a/packages/devtools_app/test/memory/memory_screen_test.dart b/packages/devtools_app/test/memory/memory_screen_test.dart index 6e5e32073f6..87020cbc426 100644 --- a/packages/devtools_app/test/memory/memory_screen_test.dart +++ b/packages/devtools_app/test/memory/memory_screen_test.dart @@ -143,39 +143,41 @@ void main() { ); }); - testWidgetsWithWindowSize('Chart Select Hover Test', windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); - initControllerState(); + testWidgetsWithWindowSize( + 'Chart Select Hover Test', + windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); + initControllerState(); - await tester.tap(find.text('Analysis')); - await tester.pumpAndSettle(); + await tester.tap(find.text('Analysis')); + await tester.pumpAndSettle(); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Verify default event pane and vm chart exists. - expect(find.byType(MemoryEventsPane), findsOneWidget); - expect(find.byType(MemoryVMChart), findsOneWidget); + // Verify default event pane and vm chart exists. + expect(find.byType(MemoryEventsPane), findsOneWidget); + expect(find.byType(MemoryVMChart), findsOneWidget); - expect(controller.memoryTimeline.liveData.isEmpty, isTrue); - expect(controller.memoryTimeline.offlineData.isEmpty, isFalse); + expect(controller.memoryTimeline.liveData.isEmpty, isTrue); + expect(controller.memoryTimeline.offlineData.isEmpty, isFalse); - controller.refreshAllCharts(); - await tester.pumpAndSettle(); + controller.refreshAllCharts(); + await tester.pumpAndSettle(); - expect(controller.memoryTimeline.data.isEmpty, isFalse); + expect(controller.memoryTimeline.data.isEmpty, isFalse); - final data = controller.memoryTimeline.data; + final data = controller.memoryTimeline.data; - // Total number of collected HeapSamples. - expect(data.length, 104); + // Total number of collected HeapSamples. + expect(data.length, 104); - for (var _ in Iterable.generate(6)) { - await tester.pumpAndSettle(); - } + for (var _ in Iterable.generate(6)) { + await tester.pumpAndSettle(); + } - // TODO(terry): Need to fix hover not appearing. - /* + // TODO(terry): Need to fix hover not appearing. + /* final vmChartFinder = find.byKey(MemoryScreen.vmChartKey); final vmChart = tester.firstWidget(vmChartFinder) as MemoryVMChart; final rect = tester.getRect(vmChartFinder); @@ -193,185 +195,196 @@ void main() { await pumpAndSettleTwoSeconds(); */ - await expectLater( - find.byType(MemoryVMChart), - matchesDevToolsGolden('../goldens/memory_hover_card.png'), - ); - }); + await expectLater( + find.byType(MemoryVMChart), + matchesDevToolsGolden('../goldens/memory_hover_card.png'), + ); + }, + tags: ['golden'], + ); - testWidgetsWithWindowSize('export current memory profile', windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + testWidgetsWithWindowSize( + 'export current memory profile', + windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Verify initial state - collecting live feed. - expect(controller.offline.value, isFalse); + // Verify initial state - collecting live feed. + expect(controller.offline.value, isFalse); - final previousMemoryLogs = controller.memoryLog.offlineFiles(); + final previousMemoryLogs = controller.memoryLog.offlineFiles(); - // Export memory to a memory log file. - await tester.tap(find.byType(ExportButton)); - await tester.pump(); + // Export memory to a memory log file. + await tester.tap(find.byType(ExportButton)); + await tester.pump(); - expect(controller.offline.value, isFalse); + expect(controller.offline.value, isFalse); - expect(controller.memoryTimeline.liveData, isEmpty); - expect(controller.memoryTimeline.offlineData, isEmpty); + expect(controller.memoryTimeline.liveData, isEmpty); + expect(controller.memoryTimeline.offlineData, isEmpty); - final currentMemoryLogs = controller.memoryLog.offlineFiles(); - expect(currentMemoryLogs.length, previousMemoryLogs.length + 1); + final currentMemoryLogs = controller.memoryLog.offlineFiles(); + expect(currentMemoryLogs.length, previousMemoryLogs.length + 1); - // Verify that memory source is still live feed. - expect(controller.offline.value, isFalse); - }); + // Verify that memory source is still live feed. + expect(controller.offline.value, isFalse); + }, + tags: ['golden'], + ); testWidgetsWithWindowSize( - 'switch from live feed and load exported file', windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + 'switch from live feed and load exported file', + windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Live feed should be default selected. - expect(controller.memorySource, MemoryController.liveFeed); + // Live feed should be default selected. + expect(controller.memorySource, MemoryController.liveFeed); - // Expand the memory sources. - await tester.tap(find.byKey(sourcesDropdownKey)); - await tester.pumpAndSettle(); + // Expand the memory sources. + await tester.tap(find.byKey(sourcesDropdownKey)); + await tester.pumpAndSettle(); - // Last item in dropdown list of memory source should be memory log file. - await tester - .tap(find.byType(typeOf>()).last); - await tester.pump(); + // Last item in dropdown list of memory source should be memory log file. + await tester + .tap(find.byType(typeOf>()).last); + await tester.pump(); - expect( - controller.memorySource, - startsWith(MemoryController.logFilenamePrefix), - ); + expect( + controller.memorySource, + startsWith(MemoryController.logFilenamePrefix), + ); - final filenames = controller.memoryLog.offlineFiles(); - final filename = filenames.first; + final filenames = controller.memoryLog.offlineFiles(); + final filename = filenames.first; - expect(filename, startsWith(MemoryController.logFilenamePrefix)); + expect(filename, startsWith(MemoryController.logFilenamePrefix)); - await controller.memoryLog.loadOffline(filename); + await controller.memoryLog.loadOffline(filename); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Remove the memory log, in desktop only version. Don't want to polute - // our temp directory when this test runs locally. - expect(controller.memoryLog.removeOfflineFile(filename), isTrue); - }); + // Remove the memory log, in desktop only version. Don't want to polute + // our temp directory when this test runs locally. + expect(controller.memoryLog.removeOfflineFile(filename), isTrue); + }, + tags: ['golden'], + ); - testWidgetsWithWindowSize('heap tree view', windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); - initControllerState(); - await tester.tap(find.text('Analysis')); - await tester.pumpAndSettle(); + testWidgetsWithWindowSize( + 'heap tree view', + windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); + initControllerState(); + await tester.tap(find.text('Analysis')); + await tester.pumpAndSettle(); - final heapSnapShotFinder = find.text('Take Heap Snapshot'); + final heapSnapShotFinder = find.text('Take Heap Snapshot'); - expect(heapSnapShotFinder, findsOneWidget); + expect(heapSnapShotFinder, findsOneWidget); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Verify default event pane and vm chart exists. - expect(find.byType(MemoryEventsPane), findsOneWidget); - expect(find.byType(MemoryVMChart), findsOneWidget); + // Verify default event pane and vm chart exists. + expect(find.byType(MemoryEventsPane), findsOneWidget); + expect(find.byType(MemoryVMChart), findsOneWidget); - expect(controller.memoryTimeline.liveData.isEmpty, isTrue); - expect(controller.memoryTimeline.offlineData.isNotEmpty, isTrue); + expect(controller.memoryTimeline.liveData.isEmpty, isTrue); + expect(controller.memoryTimeline.offlineData.isNotEmpty, isTrue); - controller.refreshAllCharts(); - expect(controller.isAndroidChartVisibleNotifier.value, true); + controller.refreshAllCharts(); + expect(controller.isAndroidChartVisibleNotifier.value, true); - // Await charts to update. - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Await charts to update. + await tester.pumpAndSettle(const Duration(seconds: 2)); - expect(controller.memoryTimeline.data.isEmpty, isFalse); + expect(controller.memoryTimeline.data.isEmpty, isFalse); - final data = controller.memoryTimeline.data; + final data = controller.memoryTimeline.data; - // Total number of collected HeapSamples. - expect(data.length, 104); + // Total number of collected HeapSamples. + expect(data.length, 104); - // Number of VM GCs - final totalGCEvents = data.where((element) => element.isGC); - expect(totalGCEvents.length, 46); + // Number of VM GCs + final totalGCEvents = data.where((element) => element.isGC); + expect(totalGCEvents.length, 46); - // User initiated GCs - final totalUserGCEvents = - data.where((element) => element.memoryEventInfo.isEventGC); - expect(totalUserGCEvents.length, 3); + // User initiated GCs + final totalUserGCEvents = + data.where((element) => element.memoryEventInfo.isEventGC); + expect(totalUserGCEvents.length, 3); - // User initiated Snapshots - final totalSnapshotEvents = - data.where((element) => element.memoryEventInfo.isEventSnapshot); - expect(totalSnapshotEvents.length, 1); + // User initiated Snapshots + final totalSnapshotEvents = + data.where((element) => element.memoryEventInfo.isEventSnapshot); + expect(totalSnapshotEvents.length, 1); - // Number of auto-Snapshots - final totalSnapshotAutoEvents = - data.where((element) => element.memoryEventInfo.isEventSnapshotAuto); - expect(totalSnapshotAutoEvents.length, 2); + // Number of auto-Snapshots + final totalSnapshotAutoEvents = data + .where((element) => element.memoryEventInfo.isEventSnapshotAuto); + expect(totalSnapshotAutoEvents.length, 2); - // Total Allocation Monitor events (many are empty). - final totalAllocationMonitorEvents = data.where( - (element) => element.memoryEventInfo.isEventAllocationAccumulator, - ); - expect(totalAllocationMonitorEvents.length, 81); + // Total Allocation Monitor events (many are empty). + final totalAllocationMonitorEvents = data.where( + (element) => element.memoryEventInfo.isEventAllocationAccumulator, + ); + expect(totalAllocationMonitorEvents.length, 81); - // Number of user initiated allocation monitors - final startMonitors = totalAllocationMonitorEvents.where( - (element) => element.memoryEventInfo.allocationAccumulator!.isStart, - ); - expect(startMonitors.length, 2); + // Number of user initiated allocation monitors + final startMonitors = totalAllocationMonitorEvents.where( + (element) => element.memoryEventInfo.allocationAccumulator!.isStart, + ); + expect(startMonitors.length, 2); - // Number of accumulator resets - final resetMonitors = totalAllocationMonitorEvents.where( - (element) => element.memoryEventInfo.allocationAccumulator!.isReset, - ); - expect(resetMonitors.length, 1); + // Number of accumulator resets + final resetMonitors = totalAllocationMonitorEvents.where( + (element) => element.memoryEventInfo.allocationAccumulator!.isReset, + ); + expect(resetMonitors.length, 1); - final interval1Min = - MemoryController.displayIntervalToIntervalDurationInMs( - ChartInterval.OneMinute, - ); - expect(interval1Min, 60000); - final interval5Min = - MemoryController.displayIntervalToIntervalDurationInMs( - ChartInterval.FiveMinutes, - ); - expect(interval5Min, 300000); + final interval1Min = + MemoryController.displayIntervalToIntervalDurationInMs( + ChartInterval.OneMinute, + ); + expect(interval1Min, 60000); + final interval5Min = + MemoryController.displayIntervalToIntervalDurationInMs( + ChartInterval.FiveMinutes, + ); + expect(interval5Min, 300000); - // TODO(terry): Check intervals and autosnapshot does it snapshot same points? - // TODO(terry): Simulate sample run of liveData filling up? + // TODO(terry): Check intervals and autosnapshot does it snapshot same points? + // TODO(terry): Simulate sample run of liveData filling up? - // Take a snapshot - await tester.tap(heapSnapShotFinder); - await tester.pump(); + // Take a snapshot + await tester.tap(heapSnapShotFinder); + await tester.pump(); - final snapshotIconLabel = tester.element(heapSnapShotFinder); - final snapshotButton = - snapshotIconLabel.findAncestorWidgetOfExactType()!; + final snapshotIconLabel = tester.element(heapSnapShotFinder); + final snapshotButton = + snapshotIconLabel.findAncestorWidgetOfExactType()!; - expect(snapshotButton.enabled, isFalse); - await tester.pumpAndSettle(const Duration(seconds: 3)); + expect(snapshotButton.enabled, isFalse); + await tester.pumpAndSettle(const Duration(seconds: 3)); - expect( - controller.selectedSnapshotTimestamp!.millisecondsSinceEpoch, - lessThan(DateTime.now().millisecondsSinceEpoch), - ); + expect( + controller.selectedSnapshotTimestamp!.millisecondsSinceEpoch, + lessThan(DateTime.now().millisecondsSinceEpoch), + ); - await tester.pumpAndSettle(const Duration(seconds: 2)); + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byType(MemoryVMChart), - matchesDevToolsGolden('../goldens/memory_heap_android.png'), - ); + await expectLater( + find.byType(MemoryVMChart), + matchesDevToolsGolden('../goldens/memory_heap_android.png'), + ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // TODO(terry): Need to test legend. - /* + // TODO(terry): Need to test legend. + /* // Bring up the full legend with Android chart visible. expect(find.byKey(legendKey), findsOneWidget); // Bring up the legend. @@ -402,6 +415,8 @@ void main() { // Await delay for golden comparison. await tester.pumpAndSettle(const Duration(seconds: 2)); */ - }); + }, + tags: ['golden'], + ); }); } diff --git a/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart b/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart index e0c990ba761..14354c14b93 100644 --- a/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart +++ b/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart @@ -92,98 +92,108 @@ void main() { expect(find.byType(FrameTimeVisualizer), findsOneWidget); } - testWidgetsWithWindowSize('builds successfully', windowSize, - (WidgetTester tester) async { - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsOneWidget); - expect(find.textContaining('Layout - '), findsOneWidget); - expect(find.textContaining('Paint - '), findsOneWidget); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsOneWidget); - expect(find.textContaining('Raster - '), findsOneWidget); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsNothing); - expect(find.textContaining('Shader compilation'), findsNothing); - expect(find.textContaining('Other raster'), findsNothing); - expect(find.byIcon(Icons.image_outlined), findsNothing); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer.png', - ), - ); - }); + testWidgetsWithWindowSize( + 'builds successfully', + windowSize, + (WidgetTester tester) async { + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsOneWidget); + expect(find.textContaining('Layout - '), findsOneWidget); + expect(find.textContaining('Paint - '), findsOneWidget); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsOneWidget); + expect(find.textContaining('Raster - '), findsOneWidget); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsNothing); + expect(find.textContaining('Shader compilation'), findsNothing); + expect(find.textContaining('Other raster'), findsNothing); + expect(find.byIcon(Icons.image_outlined), findsNothing); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer.png', + ), + ); + }, + tags: ['golden'], + ); testWidgetsWithWindowSize( - 'builds with icons only for narrow screen', const Size(200.0, 1000.0), - (WidgetTester tester) async { - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsNothing); - expect(find.textContaining('Layout - '), findsNothing); - expect(find.textContaining('Paint - '), findsNothing); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsOneWidget); - expect(find.textContaining('Raster - '), findsNothing); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsNothing); - expect(find.textContaining('Shader compilation'), findsNothing); - expect(find.textContaining('Other raster'), findsNothing); - expect(find.byIcon(Icons.image_outlined), findsNothing); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer_icons_only.png', - ), - ); - }); + 'builds with icons only for narrow screen', + const Size(200.0, 1000.0), + (WidgetTester tester) async { + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsNothing); + expect(find.textContaining('Layout - '), findsNothing); + expect(find.textContaining('Paint - '), findsNothing); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsOneWidget); + expect(find.textContaining('Raster - '), findsNothing); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsNothing); + expect(find.textContaining('Shader compilation'), findsNothing); + expect(find.textContaining('Other raster'), findsNothing); + expect(find.byIcon(Icons.image_outlined), findsNothing); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer_icons_only.png', + ), + ); + }, + tags: ['golden'], + ); testWidgetsWithWindowSize( - 'builds for frame with shader compilation', windowSize, - (WidgetTester tester) async { - frame = testFrame0.shallowCopy() - ..setEventFlow(goldenUiTimelineEvent) - ..setEventFlow(rasterTimelineEventWithSubtleShaderJank); - frameAnalysis = FrameAnalysis(frame); - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsOneWidget); - expect(find.textContaining('Layout - '), findsOneWidget); - expect(find.textContaining('Paint - '), findsOneWidget); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsNothing); - expect(find.textContaining('Raster - '), findsNothing); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsOneWidget); - expect(find.textContaining('Shader compilation - '), findsOneWidget); - expect(find.textContaining('Other raster - '), findsOneWidget); - expect(find.byIcon(Icons.image_outlined), findsOneWidget); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer_with_shader_compilation.png', - ), - ); - }); + 'builds for frame with shader compilation', + windowSize, + (WidgetTester tester) async { + frame = testFrame0.shallowCopy() + ..setEventFlow(goldenUiTimelineEvent) + ..setEventFlow(rasterTimelineEventWithSubtleShaderJank); + frameAnalysis = FrameAnalysis(frame); + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsOneWidget); + expect(find.textContaining('Layout - '), findsOneWidget); + expect(find.textContaining('Paint - '), findsOneWidget); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsNothing); + expect(find.textContaining('Raster - '), findsNothing); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsOneWidget); + expect(find.textContaining('Shader compilation - '), findsOneWidget); + expect(find.textContaining('Other raster - '), findsOneWidget); + expect(find.byIcon(Icons.image_outlined), findsOneWidget); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer_with_shader_compilation.png', + ), + ); + }, + tags: ['golden'], + ); }); }); } diff --git a/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart b/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart index e5e81d430f4..a5b4e7d1e19 100644 --- a/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart +++ b/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart @@ -54,50 +54,58 @@ void main() { ); }); - testWidgets('renders with data', (tester) async { - await pumpRenderingLayerVisualizer(tester); - - expect(find.byType(LayerSnapshotTable), findsOneWidget); - expect(find.richText('Layer'), findsOneWidget); - expect(find.richText('Rendering time'), findsOneWidget); - expect(find.richText('Percent rendering time'), findsOneWidget); - expect(find.richText('Layer 12731'), findsOneWidget); - expect(find.richText('0.4 ms'), findsOneWidget); - expect(find.richText('78.74%'), findsOneWidget); - expect(find.richText('Layer 12734'), findsOneWidget); - expect(find.richText('0.1 ms'), findsOneWidget); - expect(find.richText('21.26%'), findsOneWidget); - - expect(find.byType(LayerImage), findsOneWidget); - - await expectLater( - find.byType(RenderingLayerVisualizer), - matchesDevToolsGolden('goldens/raster_stats_with_data.png'), - ); - }); - - testWidgets('can change layer selection', (tester) async { - await pumpRenderingLayerVisualizer(tester); - - final layers = controller.rasterStats.value.layerSnapshots; - final firstLayer = layers.first; - final secondLayer = layers.last; - expect(firstLayer.displayName, equals('Layer 12731')); - expect(secondLayer.displayName, equals('Layer 12734')); - - expect( - controller.rasterStats.value.selectedSnapshot, - equals(firstLayer), - ); - - await tester.tap(find.richText('Layer 12734')); - await tester.pumpAndSettle(); - - expect(controller.selectedSnapshot.value, equals(secondLayer)); - await expectLater( - find.byType(RenderingLayerVisualizer), - matchesDevToolsGolden('goldens/raster_stats_changed_selection.png'), - ); - }); + testWidgets( + 'renders with data', + (tester) async { + await pumpRenderingLayerVisualizer(tester); + + expect(find.byType(LayerSnapshotTable), findsOneWidget); + expect(find.richText('Layer'), findsOneWidget); + expect(find.richText('Rendering time'), findsOneWidget); + expect(find.richText('Percent rendering time'), findsOneWidget); + expect(find.richText('Layer 12731'), findsOneWidget); + expect(find.richText('0.4 ms'), findsOneWidget); + expect(find.richText('78.74%'), findsOneWidget); + expect(find.richText('Layer 12734'), findsOneWidget); + expect(find.richText('0.1 ms'), findsOneWidget); + expect(find.richText('21.26%'), findsOneWidget); + + expect(find.byType(LayerImage), findsOneWidget); + + await expectLater( + find.byType(RenderingLayerVisualizer), + matchesDevToolsGolden('goldens/raster_stats_with_data.png'), + ); + }, + tags: ['golden'], + ); + + testWidgets( + 'can change layer selection', + (tester) async { + await pumpRenderingLayerVisualizer(tester); + + final layers = controller.rasterStats.value.layerSnapshots; + final firstLayer = layers.first; + final secondLayer = layers.last; + expect(firstLayer.displayName, equals('Layer 12731')); + expect(secondLayer.displayName, equals('Layer 12734')); + + expect( + controller.rasterStats.value.selectedSnapshot, + equals(firstLayer), + ); + + await tester.tap(find.richText('Layer 12734')); + await tester.pumpAndSettle(); + + expect(controller.selectedSnapshot.value, equals(secondLayer)); + await expectLater( + find.byType(RenderingLayerVisualizer), + matchesDevToolsGolden('goldens/raster_stats_changed_selection.png'), + ); + }, + tags: ['golden'], + ); }); } diff --git a/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart b/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart index 0d229165d63..20a394fc112 100644 --- a/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart +++ b/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart @@ -180,6 +180,7 @@ void main() { }, // ignore: avoid_redundant_argument_values skip: kIsWeb, + tags: ['golden'], ); }); } diff --git a/packages/devtools_app/test/provider/provider_screen_test.dart b/packages/devtools_app/test/provider/provider_screen_test.dart index 9b81bc08c6e..b5409ff9839 100644 --- a/packages/devtools_app/test/provider/provider_screen_test.dart +++ b/packages/devtools_app/test/provider/provider_screen_test.dart @@ -52,40 +52,43 @@ void main() { group('ProviderScreen', () { testWidgetsWithWindowSize( - 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the list of providers', - windowSize, (tester) async { - await tester.pumpWidget( - ProviderScope( - overrides: [ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.loading(), - ), - ], - child: providerScreen, - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - sortedProviderNodesProvider.overrideWithValue( - AsyncValue.error(StateError('')), - ), - ], - child: providerScreen, - ), - ); + 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the list of providers', + windowSize, + (tester) async { + await tester.pumpWidget( + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.loading(), + ), + ], + child: providerScreen, + ), + ); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + AsyncValue.error(StateError('')), + ), + ], + child: providerScreen, + ), + ); - // wait for the Banner to appear as it is mounted asynchronously - await tester.pump(); + // wait for the Banner to appear as it is mounted asynchronously + await tester.pump(); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/list_error_banner.png', - ), - ); - }); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/list_error_banner.png', + ), + ); + }, + tags: ['golden'], + ); }); group('selectedProviderIdProvider', () { @@ -288,121 +291,127 @@ void main() { } testWidgetsWithWindowSize( - 'selects the first provider the first time a provider is received', - windowSize, (tester) async { - final container = ProviderContainer( - overrides: [ - sortedProviderNodesProvider - .overrideWithValue(const AsyncValue.loading()), - ...getOverrides(), - ], - ); + 'selects the first provider the first time a provider is received', + windowSize, + (tester) async { + final container = ProviderContainer( + overrides: [ + sortedProviderNodesProvider + .overrideWithValue(const AsyncValue.loading()), + ...getOverrides(), + ], + ); - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: providerScreen, - ), - ); + await tester.pumpWidget( + UncontrolledProviderScope( + container: container, + child: providerScreen, + ), + ); - expect(container.read(selectedProviderIdProvider), isNull); - expect(find.byType(ProviderNodeItem), findsNothing); + expect(container.read(selectedProviderIdProvider), isNull); + expect(find.byType(ProviderNodeItem), findsNothing); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/no_selected_provider.png', - ), - ); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/no_selected_provider.png', + ), + ); - container.updateOverrides([ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.data([ - ProviderNode(id: '0', type: 'Provider'), - ProviderNode(id: '1', type: 'Provider'), - ]), - ), - ...getOverrides(), - ]); + container.updateOverrides([ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.data([ + ProviderNode(id: '0', type: 'Provider'), + ProviderNode(id: '1', type: 'Provider'), + ]), + ), + ...getOverrides(), + ]); - await tester.pump(); + await tester.pump(); - expect(container.read(selectedProviderIdProvider), '0'); - expect(find.byType(ProviderNodeItem), findsNWidgets(2)); - expect( - find.descendant( - of: find.byKey(const Key('provider-0')), - matching: find.text('Provider()'), - ), - findsOneWidget, - ); - expect( - find.descendant( - of: find.byKey(const Key('provider-1')), - matching: find.text('Provider()'), - ), - findsOneWidget, - ); + expect(container.read(selectedProviderIdProvider), '0'); + expect(find.byType(ProviderNodeItem), findsNWidgets(2)); + expect( + find.descendant( + of: find.byKey(const Key('provider-0')), + matching: find.text('Provider()'), + ), + findsOneWidget, + ); + expect( + find.descendant( + of: find.byKey(const Key('provider-1')), + matching: find.text('Provider()'), + ), + findsOneWidget, + ); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/selected_provider.png', - ), - ); - }); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/selected_provider.png', + ), + ); + }, + tags: ['golden'], + ); testWidgetsWithWindowSize( - 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the selected provider', - windowSize, (tester) async { - final overrides = [ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.data([ - ProviderNode(id: '0', type: 'Provider'), - ProviderNode(id: '1', type: 'Provider'), - ]), - ), - ...getOverrides(), - ]; - - await tester.pumpWidget( - ProviderScope( - overrides: [ - ...overrides, - instanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: providerScreen, - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - ...overrides, - instanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(AsyncValue.error(Error())), - ], - child: providerScreen, - ), - ); + 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the selected provider', + windowSize, + (tester) async { + final overrides = [ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.data([ + ProviderNode(id: '0', type: 'Provider'), + ProviderNode(id: '1', type: 'Provider'), + ]), + ), + ...getOverrides(), + ]; + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: providerScreen, + ), + ); + + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(AsyncValue.error(Error())), + ], + child: providerScreen, + ), + ); - // await for the modal to be mounted as it is rendered asynchronously - await tester.pump(); + // await for the modal to be mounted as it is rendered asynchronously + await tester.pump(); - expect( - find.byKey( - const Key('ProviderUnknownErrorBanner - ${ProviderScreen.id}'), - ), - findsOneWidget, - ); + expect( + find.byKey( + const Key('ProviderUnknownErrorBanner - ${ProviderScreen.id}'), + ), + findsOneWidget, + ); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/selected_provider_error_banner.png', - ), - ); - }); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/selected_provider_error_banner.png', + ), + ); + }, + tags: ['golden'], + ); }); } diff --git a/packages/devtools_app/test/shared/instance_viewer_test.dart b/packages/devtools_app/test/shared/instance_viewer_test.dart index e27bee6d261..88cfaada2c0 100644 --- a/packages/devtools_app/test/shared/instance_viewer_test.dart +++ b/packages/devtools_app/test/shared/instance_viewer_test.dart @@ -130,348 +130,366 @@ void main() { group('InstanceViewer', () { testWidgets( - 'showInternalProperties: false hides private properties from dependencies', - (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - - InstancePath pathForProperty(String name) { - return objPath.pathForChild( - PathToProperty.objectProperty( - name: name, - ownerUri: '', - ownerName: '', - ), - ); - } - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: '_second', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: 'third', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ObjectField( - name: '_forth', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', + 'showInternalProperties: false hides private properties from dependencies', + (tester) async { + const objPath = InstancePath.fromInstanceId('obj'); + + InstancePath pathForProperty(String name) { + return objPath.pathForChild( + PathToProperty.objectProperty( + name: name, + ownerUri: '', + ownerName: '', + ), + ); + } + + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(objPath).overrideWithValue( + AsyncValue.data( + ObjectInstance( + [ + ObjectField( + name: 'first', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: true, + ), + ObjectField( + name: '_second', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: true, + ), + ObjectField( + name: 'third', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ObjectField( + name: '_forth', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ], + hash: 0, + instanceRefId: 'object', + setter: null, + evalForInstance: FakeEvalOnDartLibrary(), + type: 'MyClass', + ), ), ), - ), - instanceProvider(pathForProperty('first')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_second')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('third')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_forth')) - .overrideWithValue(int42Instance), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: false, - rootPath: objPath, + instanceProvider(pathForProperty('first')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('_second')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('third')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('_forth')) + .overrideWithValue(int42Instance), + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: false, + rootPath: objPath, + ), ), ), ), - ), - ); + ); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../goldens/instance_viewer/show_internal_properties.png', - ), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden( + '../goldens/instance_viewer/show_internal_properties.png', + ), + ); + }, + tags: ['golden'], + ); - testWidgets('field editing flow', (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - final propertyPath = objPath.pathForChild( - const PathToProperty.objectProperty( - name: 'first', - ownerUri: '', - ownerName: '', - ), - ); + testWidgets( + 'field editing flow', + (tester) async { + const objPath = InstancePath.fromInstanceId('obj'); + final propertyPath = objPath.pathForChild( + const PathToProperty.objectProperty( + name: 'first', + ownerUri: '', + ownerName: '', + ), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(objPath).overrideWithValue( + AsyncValue.data( + ObjectInstance( + [ + ObjectField( + name: 'first', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ], + hash: 0, + instanceRefId: 'object', + setter: null, + evalForInstance: FakeEvalOnDartLibrary(), + type: 'MyClass', + ), ), ), - ), - instanceProvider(propertyPath).overrideWithValue( - AsyncValue.data( - InstanceDetails.number( - '0', - instanceRefId: '0', - setter: (value) async {}, + instanceProvider(propertyPath).overrideWithValue( + AsyncValue.data( + InstanceDetails.number( + '0', + instanceRefId: '0', + setter: (value) async {}, + ), ), ), - ), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: objPath, + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: objPath, + ), ), ), ), - ), - ); + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await tester.tap(find.byKey(ValueKey(propertyPath))); + await tester.tap(find.byKey(ValueKey(propertyPath))); - await tester.pump(); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/edit.png'), - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/edit.png'), + ); - // can press esc to unfocus active node - await tester.sendKeyEvent(LogicalKeyboardKey.escape); + // can press esc to unfocus active node + await tester.sendKeyEvent(LogicalKeyboardKey.escape); - await tester.pump(); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/edit_esc.png'), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/edit_esc.png'), + ); + }, + tags: ['golden'], + ); - testWidgets('renders while an instance is fetched', - (tester) async { - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()) - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), + testWidgets( + 'renders while an instance is fetched', + (tester) async { + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()) + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), + ), ), ), ), - ), - ); + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/loading.png'), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/loading.png'), + ); + }, + tags: ['golden'], + ); // TODO(rrousselGit) find a way to test "data then loading then wait then loading then wait shows "loading" after a total of one second" // This is tricky because tester.pump(duration) completes the Timer even if the duration is < 1 second testWidgets( - 'once valid data was fetched, going back to loading and emiting an error immediately updates the UI', - (tester) async { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), + 'once valid data was fetched, going back to loading and emiting an error immediately updates the UI', + (tester) async { + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), + ), ), - ), - ); + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, - ), - ); - await tester.pump(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/null.png'), - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/null.png'), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(AsyncValue.error(StateError('test error'))), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue( + AsyncValue.error(StateError('test error'))), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/error.png'), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/error.png'), + ); + }, + tags: ['golden'], + ); testWidgets( - 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', - (tester) async { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), + 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', + (tester) async { + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), + ), ), - ), - ); + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, - ), - ); - await tester.pump(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/null.png'), - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/null.png'), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(int42Instance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(int42Instance), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/num.png'), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/num.png'), + ); + }, + tags: ['golden'], + ); - testWidgets('renders enums', (tester) async { - final container = ProviderContainer( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('enum')) - .overrideWithValue(enumValueInstance), - ], - ); - addTearDown(container.dispose); + testWidgets( + 'renders enums', + (tester) async { + final container = ProviderContainer( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('enum')) + .overrideWithValue(enumValueInstance), + ], + ); + addTearDown(container.dispose); - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('enum'), + await tester.pumpWidget( + UncontrolledProviderScope( + container: container, + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('enum'), + ), ), ), ), - ), - ); + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/enum.png'), - ); - }); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/enum.png'), + ); + }, + tags: ['golden'], + ); testWidgets('renders null', (tester) async { final container = ProviderContainer( diff --git a/packages/devtools_test/lib/src/wrappers.dart b/packages/devtools_test/lib/src/wrappers.dart index 7f66215fb76..e2e64049f12 100644 --- a/packages/devtools_test/lib/src/wrappers.dart +++ b/packages/devtools_test/lib/src/wrappers.dart @@ -146,6 +146,7 @@ void testWidgetsWithWindowSize( Size windowSize, WidgetTesterCallback test, { bool skip = false, + List tags = const [], }) { testWidgets( name, @@ -155,6 +156,7 @@ void testWidgetsWithWindowSize( await _resetWindowSize(); }, skip: skip, + tags: tags, ); } From 44fe623194ddd64cc2dfee3788cab68f7705a6b1 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 16:40:56 -0500 Subject: [PATCH 52/54] Revert "test commit" This reverts commit c025d4644b0eeb2f69ed1edab9418f48c31453bb. --- packages/devtools_app/build.yaml | 2 +- packages/devtools_app/mdtg.log | 17 - .../test/debugger/debugger_codeview_test.dart | 59 +- .../inspector/inspector_integration_test.dart | 286 ++++----- .../layout_explorer/flex/arrow_test.dart | 6 - .../layout_explorer/flex/flex_test.dart | 2 - .../test/memory/chart/chart_test.dart | 322 +++++----- .../memory/control/settings_dialog_test.dart | 95 ++- .../diff/widgets/class_filter_test.dart | 96 ++- .../memory/diff/widgets/diff_pane_test.dart | 120 ++-- .../test/memory/memory_screen_test.dart | 327 +++++----- .../frame_analysis/frame_analysis_test.dart | 186 +++--- .../raster_stats/raster_stats_test.dart | 98 ++- .../timeline_flame_chart_test.dart | 1 - .../test/provider/provider_screen_test.dart | 281 ++++---- .../test/shared/instance_viewer_test.dart | 598 +++++++++--------- packages/devtools_test/lib/src/wrappers.dart | 2 - 17 files changed, 1183 insertions(+), 1315 deletions(-) delete mode 100644 packages/devtools_app/mdtg.log diff --git a/packages/devtools_app/build.yaml b/packages/devtools_app/build.yaml index 1428878801b..de2d04f5885 100644 --- a/packages/devtools_app/build.yaml +++ b/packages/devtools_app/build.yaml @@ -1,4 +1,4 @@ -targets:: +targets: $default: builders: build_web_compilers|entrypoint: diff --git a/packages/devtools_app/mdtg.log b/packages/devtools_app/mdtg.log deleted file mode 100644 index 30bd29476b3..00000000000 --- a/packages/devtools_app/mdtg.log +++ /dev/null @@ -1,17 +0,0 @@ -test/memory/memory_screen_test.dart -test/memory/chart/chart_test.dart -test/memory/diff/widgets/class_filter_test.dart -test/memory/diff/widgets/diff_pane_test.dart -test/memory/control/settings_dialog_test.dart -test/inspector/inspector_integration_test.dart -test/inspector/layout_explorer/flex/flex_test.dart -test/inspector/layout_explorer/flex/arrow_test.dart -test/provider/provider_screen_test.dart -test/shared/instance_viewer_test.dart -test/shared/ui_utils_test.dart -test/shared/treemap_test.dart -test/debugger/debugger_codeview_test.dart -test/matchers/matchers.dart -test/performance/frame_analysis/frame_analysis_test.dart -test/performance/timeline_events/timeline_flame_chart_test.dart -test/performance/raster_stats/raster_stats_test.dart diff --git a/packages/devtools_app/test/debugger/debugger_codeview_test.dart b/packages/devtools_app/test/debugger/debugger_codeview_test.dart index 35ea4f0ae93..7619c9c63b6 100644 --- a/packages/devtools_app/test/debugger/debugger_codeview_test.dart +++ b/packages/devtools_app/test/debugger/debugger_codeview_test.dart @@ -75,38 +75,35 @@ void main() { } testWidgetsWithWindowSize( - 'has a horizontal and a vertical scrollbar', - smallWindowSize, - (WidgetTester tester) async { - await pumpDebuggerScreen(tester, debuggerController); - - // TODO(elliette): https://github.com/flutter/flutter/pull/88152 fixes - // this so that forcing a scroll event is no longer necessary. Remove - // once the change is in the stable release. - codeViewController.showScriptLocation( - ScriptLocation( - mockScriptRef, - location: const SourcePosition(line: 50, column: 50), - ), - ); - await tester.pumpAndSettle(); + 'has a horizontal and a vertical scrollbar', smallWindowSize, + (WidgetTester tester) async { + await pumpDebuggerScreen(tester, debuggerController); - expect(find.byType(Scrollbar), findsNWidgets(2)); - expect( - find.byKey(const Key('debuggerCodeViewVerticalScrollbarKey')), - findsOneWidget, - ); - expect( - find.byKey(const Key('debuggerCodeViewHorizontalScrollbarKey')), - findsOneWidget, - ); - await expectLater( - find.byKey(DebuggerScreenBody.codeViewKey), - matchesDevToolsGolden('../goldens/codeview_scrollbars.png'), - ); - }, - tags: ['golden'], - ); + // TODO(elliette): https://github.com/flutter/flutter/pull/88152 fixes + // this so that forcing a scroll event is no longer necessary. Remove + // once the change is in the stable release. + codeViewController.showScriptLocation( + ScriptLocation( + mockScriptRef, + location: const SourcePosition(line: 50, column: 50), + ), + ); + await tester.pumpAndSettle(); + + expect(find.byType(Scrollbar), findsNWidgets(2)); + expect( + find.byKey(const Key('debuggerCodeViewVerticalScrollbarKey')), + findsOneWidget, + ); + expect( + find.byKey(const Key('debuggerCodeViewHorizontalScrollbarKey')), + findsOneWidget, + ); + await expectLater( + find.byKey(DebuggerScreenBody.codeViewKey), + matchesDevToolsGolden('../goldens/codeview_scrollbars.png'), + ); + }); testWidgetsWithWindowSize('search in file field is visible', smallWindowSize, (WidgetTester tester) async { diff --git a/packages/devtools_app/test/inspector/inspector_integration_test.dart b/packages/devtools_app/test/inspector/inspector_integration_test.dart index cd3701858f8..c120a584abc 100644 --- a/packages/devtools_app/test/inspector/inspector_integration_test.dart +++ b/packages/devtools_app/test/inspector/inspector_integration_test.dart @@ -57,103 +57,99 @@ void main() async { await env.tearDownEnvironment(force: true); }); - testWidgetsWithWindowSize( - 'navigation', - windowSize, - (WidgetTester tester) async { - await env.setupEnvironment(); - expect(serviceManager.service, equals(env.service)); - expect(serviceManager.isolateManager, isNotNull); - - const screen = InspectorScreen(); - await tester.pumpWidget( - wrapWithInspectorControllers(Builder(builder: screen.build)), - ); - await tester.pump(const Duration(seconds: 1)); - final InspectorScreenBodyState state = - tester.state(find.byType(InspectorScreenBody)); - final controller = state.controller; - while (!controller.flutterAppFrameReady) { - await controller.maybeLoadUI(); - await tester.pumpAndSettle(); - } - // Give time for the initial animation to complete. - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_initial_load.png', - ), - ); - - // Click on the Center widget (row index #5) - await tester.tap(find.richText('Center')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_select_center.png', - ), - ); - - // Select the details tree. - await tester.tap(find.text('Widget Details Tree')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_select_center_details_tree.png', - ), - ); - - // Select the RichText row. - await tester.tap(find.richText('RichText')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_richtext_selected.png', - ), - ); - - // Test hovering over the icon shown when a property has its default - // value. - // TODO(jacobr): support tooltips in the Flutter version of the inspector. - // https://github.com/flutter/devtools/issues/2570. - // For example, verify that the tooltip hovering over the default value - // icons is "Default value". - // Test selecting a widget. - - // Two 'Scaffold's: a breadcrumb and an actual tree item - expect(find.richText('Scaffold'), findsNWidgets(2)); - // select Scaffold widget in summary tree. - await tester.tap(find.richText('Scaffold').last); - await tester.pumpAndSettle(inspectorChangeSettleTime); - // This tree is huge. If there is a change to package:flutter it may - // change. If this happens don't panic and rebaseline the golden. - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_scaffold_selected.png', - ), - ); - - // The important thing about this is that the details tree should scroll - // instead of re-rooting as the selected row is already visible in the - // details tree. - await tester.tap(find.richText('AnimatedPhysicalModel')); - await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_animated_physical_model_selected.png', - ), - ); - - await env.tearDownEnvironment(); - }, - tags: ['golden'], - ); + testWidgetsWithWindowSize('navigation', windowSize, + (WidgetTester tester) async { + await env.setupEnvironment(); + expect(serviceManager.service, equals(env.service)); + expect(serviceManager.isolateManager, isNotNull); + + const screen = InspectorScreen(); + await tester.pumpWidget( + wrapWithInspectorControllers(Builder(builder: screen.build)), + ); + await tester.pump(const Duration(seconds: 1)); + final InspectorScreenBodyState state = + tester.state(find.byType(InspectorScreenBody)); + final controller = state.controller; + while (!controller.flutterAppFrameReady) { + await controller.maybeLoadUI(); + await tester.pumpAndSettle(); + } + // Give time for the initial animation to complete. + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_initial_load.png', + ), + ); + + // Click on the Center widget (row index #5) + await tester.tap(find.richText('Center')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_select_center.png', + ), + ); + + // Select the details tree. + await tester.tap(find.text('Widget Details Tree')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_select_center_details_tree.png', + ), + ); + + // Select the RichText row. + await tester.tap(find.richText('RichText')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_richtext_selected.png', + ), + ); + + // Test hovering over the icon shown when a property has its default + // value. + // TODO(jacobr): support tooltips in the Flutter version of the inspector. + // https://github.com/flutter/devtools/issues/2570. + // For example, verify that the tooltip hovering over the default value + // icons is "Default value". + // Test selecting a widget. + + // Two 'Scaffold's: a breadcrumb and an actual tree item + expect(find.richText('Scaffold'), findsNWidgets(2)); + // select Scaffold widget in summary tree. + await tester.tap(find.richText('Scaffold').last); + await tester.pumpAndSettle(inspectorChangeSettleTime); + // This tree is huge. If there is a change to package:flutter it may + // change. If this happens don't panic and rebaseline the golden. + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_scaffold_selected.png', + ), + ); + + // The important thing about this is that the details tree should scroll + // instead of re-rooting as the selected row is already visible in the + // details tree. + await tester.tap(find.richText('AnimatedPhysicalModel')); + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_animated_physical_model_selected.png', + ), + ); + + await env.tearDownEnvironment(); + }); // TODO(jacobr): convert these tests to screenshot tests like the initial // state test. @@ -412,56 +408,52 @@ void main() async { await env.tearDownEnvironment(force: true); }); - testWidgetsWithWindowSize( - 'show navigator and error labels', - windowSize, - (WidgetTester tester) async { - await env.setupEnvironment( - config: const FlutterRunConfiguration( - withDebugger: true, - entryScript: 'lib/overflow_errors.dart', - ), - ); - expect(serviceManager.service, equals(env.service)); - expect(serviceManager.isolateManager, isNotNull); - - const screen = InspectorScreen(); - await tester.pumpWidget( - wrapWithInspectorControllers(Builder(builder: screen.build)), - ); - await tester.pumpAndSettle(const Duration(seconds: 1)); - final InspectorScreenBodyState state = - tester.state(find.byType(InspectorScreenBody)); - final controller = state.controller; - while (!controller.flutterAppFrameReady) { - await controller.maybeLoadUI(); - await tester.pumpAndSettle(); - } - await env.flutter!.hotReload(); - // Give time for the initial animation to complete. + testWidgetsWithWindowSize('show navigator and error labels', windowSize, + (WidgetTester tester) async { + await env.setupEnvironment( + config: const FlutterRunConfiguration( + withDebugger: true, + entryScript: 'lib/overflow_errors.dart', + ), + ); + expect(serviceManager.service, equals(env.service)); + expect(serviceManager.isolateManager, isNotNull); + + const screen = InspectorScreen(); + await tester.pumpWidget( + wrapWithInspectorControllers(Builder(builder: screen.build)), + ); + await tester.pumpAndSettle(const Duration(seconds: 1)); + final InspectorScreenBodyState state = + tester.state(find.byType(InspectorScreenBody)); + final controller = state.controller; + while (!controller.flutterAppFrameReady) { + await controller.maybeLoadUI(); + await tester.pumpAndSettle(); + } + await env.flutter!.hotReload(); + // Give time for the initial animation to complete. + await tester.pumpAndSettle(inspectorChangeSettleTime); + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_errors_1_initial_load.png', + ), + ); + + // Navigate so one of the errors is selected. + for (var i = 0; i < 2; i++) { + await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); await tester.pumpAndSettle(inspectorChangeSettleTime); - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_errors_1_initial_load.png', - ), - ); - - // Navigate so one of the errors is selected. - for (var i = 0; i < 2; i++) { - await tester.tap(find.byIcon(Icons.keyboard_arrow_down)); - await tester.pumpAndSettle(inspectorChangeSettleTime); - } - await expectLater( - find.byType(InspectorScreenBody), - matchesDevToolsGolden( - '../goldens/integration_inspector_errors_2_error_selected.png', - ), - ); - - await env.tearDownEnvironment(); - }, - tags: ['golden'], - ); + } + await expectLater( + find.byType(InspectorScreenBody), + matchesDevToolsGolden( + '../goldens/integration_inspector_errors_2_error_selected.png', + ), + ); + + await env.tearDownEnvironment(); + }); }); } diff --git a/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart b/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart index 33f18fab3a6..347ec1ab9e7 100644 --- a/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart +++ b/packages/devtools_app/test/inspector/layout_explorer/flex/arrow_test.dart @@ -40,7 +40,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); testWidgets( 'up', @@ -53,7 +52,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); testWidgets( 'right', @@ -66,7 +64,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); testWidgets( 'down', @@ -79,7 +76,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); }); @@ -112,7 +108,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); testWidgets( 'vertical', @@ -125,7 +120,6 @@ void main() { ); }, skip: kIsWeb, - tags: ['golden'], ); }); }); diff --git a/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart b/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart index 9ae1f9f4396..88264c1c1e2 100644 --- a/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart +++ b/packages/devtools_app/test/inspector/layout_explorer/flex/flex_test.dart @@ -269,7 +269,6 @@ void main() { ); }, skip: true, - tags: ['golden'], ); testWidgetsWithWindowSize( @@ -289,6 +288,5 @@ void main() { ); }, skip: true, - tags: ['golden'], ); } diff --git a/packages/devtools_app/test/memory/chart/chart_test.dart b/packages/devtools_app/test/memory/chart/chart_test.dart index 44282f9af8f..ab0fc710de0 100644 --- a/packages/devtools_app/test/memory/chart/chart_test.dart +++ b/packages/devtools_app/test/memory/chart/chart_test.dart @@ -329,7 +329,6 @@ void main() { equals('16:45:30'), ); }, - tags: ['golden'], ); void checkScaledXAxis2Labels(ChartController controller) { @@ -344,93 +343,85 @@ void main() { ); } - testWidgetsWithWindowSize( - 'Scaled Y-axis all', - windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize('Scaled Y-axis all', windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupScaledChart(tester, controller, chartKey); + await setupScaledChart(tester, controller, chartKey); - // Check A=all data view zoom. - controller.zoomDuration = null; - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Check A=all data view zoom. + controller.zoomDuration = null; + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden('../../goldens/memory_chart_scaled_all.png'), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden('../../goldens/memory_chart_scaled_all.png'), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(104)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.0)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2150.0)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(104)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.0)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2150.0)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(719576719.5767195)); - expect(controller.yScale.labelTicks, equals(10.0)); - expect(controller.yScale.labelUnitExponent, 8.0); - expect(controller.yScale.tickSpacing, equals(5291005.291005291)); - expect(controller.yScale.maxPoint, equals(717799424.0)); - expect(controller.yScale.maxTicks, equals(190.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(719576719.5767195)); + expect(controller.yScale.labelTicks, equals(10.0)); + expect(controller.yScale.labelUnitExponent, 8.0); + expect(controller.yScale.tickSpacing, equals(5291005.291005291)); + expect(controller.yScale.maxPoint, equals(717799424.0)); + expect(controller.yScale.maxTicks, equals(190.0)); - validateScaledYLabels(controller); + validateScaledYLabels(controller); - checkScaledXAxis2Labels(controller); - }, - tags: ['golden'], - ); + checkScaledXAxis2Labels(controller); + }); - testWidgetsWithWindowSize( - 'Scaled Y-axis Five Minutes', - windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize('Scaled Y-axis Five Minutes', windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupScaledChart(tester, controller, chartKey); + await setupScaledChart(tester, controller, chartKey); - // Check 5 minute data view zoom. - controller.zoomDuration = const Duration(minutes: 5); - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Check 5 minute data view zoom. + controller.zoomDuration = const Duration(minutes: 5); + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden( - '../../goldens/memory_chart_scaled_five_minute.png', - ), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden( + '../../goldens/memory_chart_scaled_five_minute.png', + ), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(1704)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.6880000000001019)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2149.312)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(1704)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.6880000000001019)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2149.312)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(719576719.5767195)); - expect(controller.yScale.labelTicks, equals(10.0)); - expect(controller.yScale.labelUnitExponent, 8.0); - expect(controller.yScale.tickSpacing, equals(5291005.291005291)); - expect(controller.yScale.maxPoint, equals(717799424.0)); - expect(controller.yScale.maxTicks, equals(190.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(719576719.5767195)); + expect(controller.yScale.labelTicks, equals(10.0)); + expect(controller.yScale.labelUnitExponent, 8.0); + expect(controller.yScale.tickSpacing, equals(5291005.291005291)); + expect(controller.yScale.maxPoint, equals(717799424.0)); + expect(controller.yScale.maxTicks, equals(190.0)); - validateScaledYLabels(controller); + validateScaledYLabels(controller); - checkScaledXAxis2Labels(controller); - }, - tags: ['golden'], - ); + checkScaledXAxis2Labels(controller); + }); /////////////////////////////////////////////////////////////////////////// // Fixed Y-axis chart. // @@ -721,7 +712,6 @@ void main() { equals('16:45:30'), ); }, - tags: ['golden'], ); void checkFixedXAxis2Labels(ChartController controller) { @@ -736,119 +726,111 @@ void main() { ); } - testWidgetsWithWindowSize( - 'Fixed Y-axis all', - windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize('Fixed Y-axis all', windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupFixedChart(tester, controller, chartKey); + await setupFixedChart(tester, controller, chartKey); - // Check all data view zoom. - controller.zoomDuration = null; - await tester.pumpAndSettle(const Duration(seconds: 15)); + // Check all data view zoom. + controller.zoomDuration = null; + await tester.pumpAndSettle(const Duration(seconds: 15)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden('../../goldens/memory_chart_fixed_all.png'), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden('../../goldens/memory_chart_fixed_all.png'), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(104)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.0)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2150.0)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(104)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.0)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2150.0)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(2.426966292134831)); - expect(controller.yScale.labelTicks, equals(3.0)); - expect(controller.yScale.labelUnitExponent, 0.0); - expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); - expect(controller.yScale.maxPoint, equals(2.4)); - expect(controller.yScale.maxTicks, equals(90.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(2.426966292134831)); + expect(controller.yScale.labelTicks, equals(3.0)); + expect(controller.yScale.labelUnitExponent, 0.0); + expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); + expect(controller.yScale.maxPoint, equals(2.4)); + expect(controller.yScale.maxTicks, equals(90.0)); - // Validate the labels displayed on the y-axis. - final yScale = controller.yScale; - expect(yScale.labelTicks, equals(3)); - for (var labelIndex = yScale.labelTicks; - labelIndex >= 0; - labelIndex--) { - final labelName = ChartPainter.constructLabel( - labelIndex.toInt(), - yScale.labelUnitExponent.toInt(), - ); + // Validate the labels displayed on the y-axis. + final yScale = controller.yScale; + expect(yScale.labelTicks, equals(3)); + for (var labelIndex = yScale.labelTicks; + labelIndex >= 0; + labelIndex--) { + final labelName = ChartPainter.constructLabel( + labelIndex.toInt(), + yScale.labelUnitExponent.toInt(), + ); - final expectedLabels = ['0', '1', '2', '3']; - expect(labelName, expectedLabels[labelIndex.toInt()]); - } + final expectedLabels = ['0', '1', '2', '3']; + expect(labelName, expectedLabels[labelIndex.toInt()]); + } - checkFixedXAxis2Labels(controller); - }, - tags: ['golden'], - ); + checkFixedXAxis2Labels(controller); + }); - testWidgetsWithWindowSize( - 'Fixed Y-axis 5 Minutes', - windowSize, - (WidgetTester tester) async { - const chartKey = Key('Chart'); - final controller = ChartController(); + testWidgetsWithWindowSize('Fixed Y-axis 5 Minutes', windowSize, + (WidgetTester tester) async { + const chartKey = Key('Chart'); + final controller = ChartController(); - await setupFixedChart(tester, controller, chartKey); + await setupFixedChart(tester, controller, chartKey); - // Check all data view zoom. - controller.zoomDuration = const Duration(minutes: 5); - await tester.pumpAndSettle(const Duration(seconds: 15)); + // Check all data view zoom. + controller.zoomDuration = const Duration(minutes: 5); + await tester.pumpAndSettle(const Duration(seconds: 15)); - await expectLater( - find.byKey(chartKey), - matchesDevToolsGolden( - '../../goldens/memory_chart_fixed_five_minutes.png', - ), - ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + await expectLater( + find.byKey(chartKey), + matchesDevToolsGolden( + '../../goldens/memory_chart_fixed_five_minutes.png', + ), + ); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // Validate the X axis after data added to all traces. - expect(controller.visibleXAxisTicks, equals(1704)); - expect(controller.xCanvasChart, equals(50.0)); - expect(controller.xPaddingRight, equals(0.6880000000001019)); - expect(controller.displayXLabels, true); - expect(controller.canvasChartWidth, equals(2149.312)); + // Validate the X axis after data added to all traces. + expect(controller.visibleXAxisTicks, equals(1704)); + expect(controller.xCanvasChart, equals(50.0)); + expect(controller.xPaddingRight, equals(0.6880000000001019)); + expect(controller.displayXLabels, true); + expect(controller.canvasChartWidth, equals(2149.312)); - // Validate the Y axis after data added to all traces. - expect(controller.yScale.computedMin, equals(0.0)); - expect(controller.yScale.computedMax, equals(2.426966292134831)); - expect(controller.yScale.labelTicks, equals(3.0)); - expect(controller.yScale.labelUnitExponent, 0.0); - expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); - expect(controller.yScale.maxPoint, equals(2.4)); - expect(controller.yScale.maxTicks, equals(90.0)); + // Validate the Y axis after data added to all traces. + expect(controller.yScale.computedMin, equals(0.0)); + expect(controller.yScale.computedMax, equals(2.426966292134831)); + expect(controller.yScale.labelTicks, equals(3.0)); + expect(controller.yScale.labelUnitExponent, 0.0); + expect(controller.yScale.tickSpacing, equals(0.033707865168539325)); + expect(controller.yScale.maxPoint, equals(2.4)); + expect(controller.yScale.maxTicks, equals(90.0)); - // Validate the labels displayed on the y-axis. - final yScale = controller.yScale; - expect(yScale.labelTicks, equals(3)); - for (var labelIndex = yScale.labelTicks; - labelIndex >= 0; - labelIndex--) { - final labelName = ChartPainter.constructLabel( - labelIndex.toInt(), - yScale.labelUnitExponent.toInt(), - ); + // Validate the labels displayed on the y-axis. + final yScale = controller.yScale; + expect(yScale.labelTicks, equals(3)); + for (var labelIndex = yScale.labelTicks; + labelIndex >= 0; + labelIndex--) { + final labelName = ChartPainter.constructLabel( + labelIndex.toInt(), + yScale.labelUnitExponent.toInt(), + ); - final expectedLabels = ['0', '1', '2', '3']; - expect(labelName, expectedLabels[labelIndex.toInt()]); - } + final expectedLabels = ['0', '1', '2', '3']; + expect(labelName, expectedLabels[labelIndex.toInt()]); + } - checkFixedXAxis2Labels(controller); - }, - tags: ['golden'], - ); + checkFixedXAxis2Labels(controller); + }); }, ); } diff --git a/packages/devtools_app/test/memory/control/settings_dialog_test.dart b/packages/devtools_app/test/memory/control/settings_dialog_test.dart index 5a26d2ef6d6..4fa971a8902 100644 --- a/packages/devtools_app/test/memory/control/settings_dialog_test.dart +++ b/packages/devtools_app/test/memory/control/settings_dialog_test.dart @@ -36,57 +36,52 @@ void main() { scene.tearDown(); }); - testWidgetsWithWindowSize( - 'settings update preferences', - windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + testWidgetsWithWindowSize('settings update preferences', windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Open the dialog. - await tester.tap(find.byType(SettingsOutlinedButton)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_default.png'), - ); + // Open the dialog. + await tester.tap(find.byType(SettingsOutlinedButton)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_default.png'), + ); - // Modify settings and check the changes are reflected in the controller. - expect( - preferences.memory.androidCollectionEnabled.value, - isFalse, - ); - expect( - preferences.memory.autoSnapshotEnabled.value, - isFalse, - ); - await tester - .tap(find.byKey(MemorySettingDialogKeys.showAndroidChartCheckBox)); - await tester - .tap(find.byKey(MemorySettingDialogKeys.autoSnapshotCheckbox)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), - ); - expect( - preferences.memory.androidCollectionEnabled.value, - isTrue, - ); - expect( - preferences.memory.autoSnapshotEnabled.value, - isTrue, - ); + // Modify settings and check the changes are reflected in the controller. + expect( + preferences.memory.androidCollectionEnabled.value, + isFalse, + ); + expect( + preferences.memory.autoSnapshotEnabled.value, + isFalse, + ); + await tester + .tap(find.byKey(MemorySettingDialogKeys.showAndroidChartCheckBox)); + await tester.tap(find.byKey(MemorySettingDialogKeys.autoSnapshotCheckbox)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), + ); + expect( + preferences.memory.androidCollectionEnabled.value, + isTrue, + ); + expect( + preferences.memory.autoSnapshotEnabled.value, + isTrue, + ); - // Reopen the dialog and check the settings are not changed. - await tester.tap(find.byType(DialogCloseButton)); - await tester.pumpAndSettle(); - await tester.tap(find.byType(SettingsOutlinedButton)); - await tester.pumpAndSettle(); - await expectLater( - find.byType(MemorySettingsDialog), - matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), - ); - }, - tags: ['golden'], - ); + // Reopen the dialog and check the settings are not changed. + await tester.tap(find.byType(DialogCloseButton)); + await tester.pumpAndSettle(); + await tester.tap(find.byType(SettingsOutlinedButton)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(MemorySettingsDialog), + matchesDevToolsGolden('../../goldens/settings_dialog_modified.png'), + ); + }); } diff --git a/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart b/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart index e0e045c1bed..fee88d54952 100644 --- a/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart +++ b/packages/devtools_app/test/memory/diff/widgets/class_filter_test.dart @@ -75,61 +75,55 @@ void main() { for (final test in _tests) { testWidgetsWithWindowSize( - '$ClassFilterDialog filters classes, ${test.name}', - windowSize, - (WidgetTester tester) async { - await pumpScene(tester, test); - - await _switchFilter( - ClassFilterType.showAll, - ClassFilterType.except, - tester, - test, - ); - - await _switchFilter( - ClassFilterType.except, - ClassFilterType.only, - tester, - test, - ); - - await _switchFilter( - ClassFilterType.only, - ClassFilterType.showAll, - tester, - test, - ); - }, - tags: ['golden'], - ); + '$ClassFilterDialog filters classes, ${test.name}', windowSize, + (WidgetTester tester) async { + await pumpScene(tester, test); + + await _switchFilter( + ClassFilterType.showAll, + ClassFilterType.except, + tester, + test, + ); + + await _switchFilter( + ClassFilterType.except, + ClassFilterType.only, + tester, + test, + ); + + await _switchFilter( + ClassFilterType.only, + ClassFilterType.showAll, + tester, + test, + ); + }); } for (final test in _tests) { testWidgetsWithWindowSize( - '$ClassFilterDialog customizes and resets to default, ${test.name}', - windowSize, - (WidgetTester tester) async { - await pumpScene(tester, test); - - // Customize filter. - scene.diffController.applyFilter(_customFilter); - await _checkDataGolden(null, tester, test); - - // Open dialog. - await tester.tap(find.byType(ClassFilterButton)); - await _checkFilterGolden(null, tester); - - // Reset to default. - await tester.tap(find.text('Reset to default')); - await _checkFilterGolden(ClassFilterType.showAll, tester); - - // Close dialog. - await tester.tap(find.text('APPLY')); - await _checkDataGolden(ClassFilterType.showAll, tester, test); - }, - tags: ['golden'], - ); + '$ClassFilterDialog customizes and resets to default, ${test.name}', + windowSize, (WidgetTester tester) async { + await pumpScene(tester, test); + + // Customize filter. + scene.diffController.applyFilter(_customFilter); + await _checkDataGolden(null, tester, test); + + // Open dialog. + await tester.tap(find.byType(ClassFilterButton)); + await _checkFilterGolden(null, tester); + + // Reset to default. + await tester.tap(find.text('Reset to default')); + await _checkFilterGolden(ClassFilterType.showAll, tester); + + // Close dialog. + await tester.tap(find.text('APPLY')); + await _checkDataGolden(ClassFilterType.showAll, tester, test); + }); } } diff --git a/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart b/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart index 6a2cd59c7ff..ea94fc211dd 100644 --- a/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart +++ b/packages/devtools_app/test/memory/diff/widgets/diff_pane_test.dart @@ -44,69 +44,65 @@ void main() { scene.tearDown(); }); - testWidgetsWithWindowSize( - 'records and deletes snapshots', - windowSize, - (WidgetTester tester) async { - final snapshots = scene.controller.diffPaneController.core.snapshots; - // Check the list contains only documentation item. - expect(snapshots.value.length, equals(1)); - await pumpScene(tester); - - // Check initial golden. - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden('../../../goldens/memory_diff_empty1.png'), - ); - - // Record three snapshots. - for (var i in Iterable.generate(3)) { - await tester.tap(find.byIcon(Icons.fiber_manual_record).first); - await tester.pumpAndSettle(); - expect(find.text('selected-isolate-${i + 1}'), findsOneWidget); - } - - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_three_snapshots1.png', - ), - ); - expect(snapshots.value.length, equals(1 + 3)); - - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_selected_class.png', - ), - ); - - // Delete a snapshot. - await tester.tap(find.byTooltip('Delete snapshot')); - await tester.pumpAndSettle(); - expect(snapshots.value.length, equals(1 + 3 - 1)); + testWidgetsWithWindowSize('records and deletes snapshots', windowSize, + (WidgetTester tester) async { + final snapshots = scene.controller.diffPaneController.core.snapshots; + // Check the list contains only documentation item. + expect(snapshots.value.length, equals(1)); + await pumpScene(tester); + + // Check initial golden. + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden('../../../goldens/memory_diff_empty1.png'), + ); - // Record snapshot - await tester.tap(find.byIcon(Icons.fiber_manual_record)); + // Record three snapshots. + for (var i in Iterable.generate(3)) { + await tester.tap(find.byIcon(Icons.fiber_manual_record).first); await tester.pumpAndSettle(); - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden( - '../../../goldens/memory_diff_three_snapshots2.png', - ), - ); - expect(snapshots.value.length, equals(1 + 3 - 1 + 1)); - - // Clear all - await tester.tap(find.byTooltip('Clear all snapshots')); - await tester.pumpAndSettle(); - await expectLater( - find.byType(DiffPane), - matchesDevToolsGolden('../../../goldens/memory_diff_empty2.png'), - ); - expect(snapshots.value.length, equals(1)); - }, - tags: ['golden'], - ); + expect(find.text('selected-isolate-${i + 1}'), findsOneWidget); + } + + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_three_snapshots1.png', + ), + ); + expect(snapshots.value.length, equals(1 + 3)); + + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_selected_class.png', + ), + ); + + // Delete a snapshot. + await tester.tap(find.byTooltip('Delete snapshot')); + await tester.pumpAndSettle(); + expect(snapshots.value.length, equals(1 + 3 - 1)); + + // Record snapshot + await tester.tap(find.byIcon(Icons.fiber_manual_record)); + await tester.pumpAndSettle(); + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden( + '../../../goldens/memory_diff_three_snapshots2.png', + ), + ); + expect(snapshots.value.length, equals(1 + 3 - 1 + 1)); + + // Clear all + await tester.tap(find.byTooltip('Clear all snapshots')); + await tester.pumpAndSettle(); + await expectLater( + find.byType(DiffPane), + matchesDevToolsGolden('../../../goldens/memory_diff_empty2.png'), + ); + expect(snapshots.value.length, equals(1)); + }); }); } diff --git a/packages/devtools_app/test/memory/memory_screen_test.dart b/packages/devtools_app/test/memory/memory_screen_test.dart index 87020cbc426..6e5e32073f6 100644 --- a/packages/devtools_app/test/memory/memory_screen_test.dart +++ b/packages/devtools_app/test/memory/memory_screen_test.dart @@ -143,41 +143,39 @@ void main() { ); }); - testWidgetsWithWindowSize( - 'Chart Select Hover Test', - windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); - initControllerState(); + testWidgetsWithWindowSize('Chart Select Hover Test', windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); + initControllerState(); - await tester.tap(find.text('Analysis')); - await tester.pumpAndSettle(); + await tester.tap(find.text('Analysis')); + await tester.pumpAndSettle(); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Verify default event pane and vm chart exists. - expect(find.byType(MemoryEventsPane), findsOneWidget); - expect(find.byType(MemoryVMChart), findsOneWidget); + // Verify default event pane and vm chart exists. + expect(find.byType(MemoryEventsPane), findsOneWidget); + expect(find.byType(MemoryVMChart), findsOneWidget); - expect(controller.memoryTimeline.liveData.isEmpty, isTrue); - expect(controller.memoryTimeline.offlineData.isEmpty, isFalse); + expect(controller.memoryTimeline.liveData.isEmpty, isTrue); + expect(controller.memoryTimeline.offlineData.isEmpty, isFalse); - controller.refreshAllCharts(); - await tester.pumpAndSettle(); + controller.refreshAllCharts(); + await tester.pumpAndSettle(); - expect(controller.memoryTimeline.data.isEmpty, isFalse); + expect(controller.memoryTimeline.data.isEmpty, isFalse); - final data = controller.memoryTimeline.data; + final data = controller.memoryTimeline.data; - // Total number of collected HeapSamples. - expect(data.length, 104); + // Total number of collected HeapSamples. + expect(data.length, 104); - for (var _ in Iterable.generate(6)) { - await tester.pumpAndSettle(); - } + for (var _ in Iterable.generate(6)) { + await tester.pumpAndSettle(); + } - // TODO(terry): Need to fix hover not appearing. - /* + // TODO(terry): Need to fix hover not appearing. + /* final vmChartFinder = find.byKey(MemoryScreen.vmChartKey); final vmChart = tester.firstWidget(vmChartFinder) as MemoryVMChart; final rect = tester.getRect(vmChartFinder); @@ -195,196 +193,185 @@ void main() { await pumpAndSettleTwoSeconds(); */ - await expectLater( - find.byType(MemoryVMChart), - matchesDevToolsGolden('../goldens/memory_hover_card.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MemoryVMChart), + matchesDevToolsGolden('../goldens/memory_hover_card.png'), + ); + }); - testWidgetsWithWindowSize( - 'export current memory profile', - windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + testWidgetsWithWindowSize('export current memory profile', windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Verify initial state - collecting live feed. - expect(controller.offline.value, isFalse); + // Verify initial state - collecting live feed. + expect(controller.offline.value, isFalse); - final previousMemoryLogs = controller.memoryLog.offlineFiles(); + final previousMemoryLogs = controller.memoryLog.offlineFiles(); - // Export memory to a memory log file. - await tester.tap(find.byType(ExportButton)); - await tester.pump(); + // Export memory to a memory log file. + await tester.tap(find.byType(ExportButton)); + await tester.pump(); - expect(controller.offline.value, isFalse); + expect(controller.offline.value, isFalse); - expect(controller.memoryTimeline.liveData, isEmpty); - expect(controller.memoryTimeline.offlineData, isEmpty); + expect(controller.memoryTimeline.liveData, isEmpty); + expect(controller.memoryTimeline.offlineData, isEmpty); - final currentMemoryLogs = controller.memoryLog.offlineFiles(); - expect(currentMemoryLogs.length, previousMemoryLogs.length + 1); + final currentMemoryLogs = controller.memoryLog.offlineFiles(); + expect(currentMemoryLogs.length, previousMemoryLogs.length + 1); - // Verify that memory source is still live feed. - expect(controller.offline.value, isFalse); - }, - tags: ['golden'], - ); + // Verify that memory source is still live feed. + expect(controller.offline.value, isFalse); + }); testWidgetsWithWindowSize( - 'switch from live feed and load exported file', - windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); + 'switch from live feed and load exported file', windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); - // Live feed should be default selected. - expect(controller.memorySource, MemoryController.liveFeed); + // Live feed should be default selected. + expect(controller.memorySource, MemoryController.liveFeed); - // Expand the memory sources. - await tester.tap(find.byKey(sourcesDropdownKey)); - await tester.pumpAndSettle(); + // Expand the memory sources. + await tester.tap(find.byKey(sourcesDropdownKey)); + await tester.pumpAndSettle(); - // Last item in dropdown list of memory source should be memory log file. - await tester - .tap(find.byType(typeOf>()).last); - await tester.pump(); + // Last item in dropdown list of memory source should be memory log file. + await tester + .tap(find.byType(typeOf>()).last); + await tester.pump(); - expect( - controller.memorySource, - startsWith(MemoryController.logFilenamePrefix), - ); + expect( + controller.memorySource, + startsWith(MemoryController.logFilenamePrefix), + ); - final filenames = controller.memoryLog.offlineFiles(); - final filename = filenames.first; + final filenames = controller.memoryLog.offlineFiles(); + final filename = filenames.first; - expect(filename, startsWith(MemoryController.logFilenamePrefix)); + expect(filename, startsWith(MemoryController.logFilenamePrefix)); - await controller.memoryLog.loadOffline(filename); + await controller.memoryLog.loadOffline(filename); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Remove the memory log, in desktop only version. Don't want to polute - // our temp directory when this test runs locally. - expect(controller.memoryLog.removeOfflineFile(filename), isTrue); - }, - tags: ['golden'], - ); + // Remove the memory log, in desktop only version. Don't want to polute + // our temp directory when this test runs locally. + expect(controller.memoryLog.removeOfflineFile(filename), isTrue); + }); - testWidgetsWithWindowSize( - 'heap tree view', - windowSize, - (WidgetTester tester) async { - await pumpMemoryScreen(tester); - initControllerState(); - await tester.tap(find.text('Analysis')); - await tester.pumpAndSettle(); + testWidgetsWithWindowSize('heap tree view', windowSize, + (WidgetTester tester) async { + await pumpMemoryScreen(tester); + initControllerState(); + await tester.tap(find.text('Analysis')); + await tester.pumpAndSettle(); - final heapSnapShotFinder = find.text('Take Heap Snapshot'); + final heapSnapShotFinder = find.text('Take Heap Snapshot'); - expect(heapSnapShotFinder, findsOneWidget); + expect(heapSnapShotFinder, findsOneWidget); - expect(controller.offline.value, isTrue); + expect(controller.offline.value, isTrue); - // Verify default event pane and vm chart exists. - expect(find.byType(MemoryEventsPane), findsOneWidget); - expect(find.byType(MemoryVMChart), findsOneWidget); + // Verify default event pane and vm chart exists. + expect(find.byType(MemoryEventsPane), findsOneWidget); + expect(find.byType(MemoryVMChart), findsOneWidget); - expect(controller.memoryTimeline.liveData.isEmpty, isTrue); - expect(controller.memoryTimeline.offlineData.isNotEmpty, isTrue); + expect(controller.memoryTimeline.liveData.isEmpty, isTrue); + expect(controller.memoryTimeline.offlineData.isNotEmpty, isTrue); - controller.refreshAllCharts(); - expect(controller.isAndroidChartVisibleNotifier.value, true); + controller.refreshAllCharts(); + expect(controller.isAndroidChartVisibleNotifier.value, true); - // Await charts to update. - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Await charts to update. + await tester.pumpAndSettle(const Duration(seconds: 2)); - expect(controller.memoryTimeline.data.isEmpty, isFalse); + expect(controller.memoryTimeline.data.isEmpty, isFalse); - final data = controller.memoryTimeline.data; + final data = controller.memoryTimeline.data; - // Total number of collected HeapSamples. - expect(data.length, 104); + // Total number of collected HeapSamples. + expect(data.length, 104); - // Number of VM GCs - final totalGCEvents = data.where((element) => element.isGC); - expect(totalGCEvents.length, 46); + // Number of VM GCs + final totalGCEvents = data.where((element) => element.isGC); + expect(totalGCEvents.length, 46); - // User initiated GCs - final totalUserGCEvents = - data.where((element) => element.memoryEventInfo.isEventGC); - expect(totalUserGCEvents.length, 3); + // User initiated GCs + final totalUserGCEvents = + data.where((element) => element.memoryEventInfo.isEventGC); + expect(totalUserGCEvents.length, 3); - // User initiated Snapshots - final totalSnapshotEvents = - data.where((element) => element.memoryEventInfo.isEventSnapshot); - expect(totalSnapshotEvents.length, 1); + // User initiated Snapshots + final totalSnapshotEvents = + data.where((element) => element.memoryEventInfo.isEventSnapshot); + expect(totalSnapshotEvents.length, 1); - // Number of auto-Snapshots - final totalSnapshotAutoEvents = data - .where((element) => element.memoryEventInfo.isEventSnapshotAuto); - expect(totalSnapshotAutoEvents.length, 2); + // Number of auto-Snapshots + final totalSnapshotAutoEvents = + data.where((element) => element.memoryEventInfo.isEventSnapshotAuto); + expect(totalSnapshotAutoEvents.length, 2); - // Total Allocation Monitor events (many are empty). - final totalAllocationMonitorEvents = data.where( - (element) => element.memoryEventInfo.isEventAllocationAccumulator, - ); - expect(totalAllocationMonitorEvents.length, 81); + // Total Allocation Monitor events (many are empty). + final totalAllocationMonitorEvents = data.where( + (element) => element.memoryEventInfo.isEventAllocationAccumulator, + ); + expect(totalAllocationMonitorEvents.length, 81); - // Number of user initiated allocation monitors - final startMonitors = totalAllocationMonitorEvents.where( - (element) => element.memoryEventInfo.allocationAccumulator!.isStart, - ); - expect(startMonitors.length, 2); + // Number of user initiated allocation monitors + final startMonitors = totalAllocationMonitorEvents.where( + (element) => element.memoryEventInfo.allocationAccumulator!.isStart, + ); + expect(startMonitors.length, 2); - // Number of accumulator resets - final resetMonitors = totalAllocationMonitorEvents.where( - (element) => element.memoryEventInfo.allocationAccumulator!.isReset, - ); - expect(resetMonitors.length, 1); + // Number of accumulator resets + final resetMonitors = totalAllocationMonitorEvents.where( + (element) => element.memoryEventInfo.allocationAccumulator!.isReset, + ); + expect(resetMonitors.length, 1); - final interval1Min = - MemoryController.displayIntervalToIntervalDurationInMs( - ChartInterval.OneMinute, - ); - expect(interval1Min, 60000); - final interval5Min = - MemoryController.displayIntervalToIntervalDurationInMs( - ChartInterval.FiveMinutes, - ); - expect(interval5Min, 300000); + final interval1Min = + MemoryController.displayIntervalToIntervalDurationInMs( + ChartInterval.OneMinute, + ); + expect(interval1Min, 60000); + final interval5Min = + MemoryController.displayIntervalToIntervalDurationInMs( + ChartInterval.FiveMinutes, + ); + expect(interval5Min, 300000); - // TODO(terry): Check intervals and autosnapshot does it snapshot same points? - // TODO(terry): Simulate sample run of liveData filling up? + // TODO(terry): Check intervals and autosnapshot does it snapshot same points? + // TODO(terry): Simulate sample run of liveData filling up? - // Take a snapshot - await tester.tap(heapSnapShotFinder); - await tester.pump(); + // Take a snapshot + await tester.tap(heapSnapShotFinder); + await tester.pump(); - final snapshotIconLabel = tester.element(heapSnapShotFinder); - final snapshotButton = - snapshotIconLabel.findAncestorWidgetOfExactType()!; + final snapshotIconLabel = tester.element(heapSnapShotFinder); + final snapshotButton = + snapshotIconLabel.findAncestorWidgetOfExactType()!; - expect(snapshotButton.enabled, isFalse); - await tester.pumpAndSettle(const Duration(seconds: 3)); + expect(snapshotButton.enabled, isFalse); + await tester.pumpAndSettle(const Duration(seconds: 3)); - expect( - controller.selectedSnapshotTimestamp!.millisecondsSinceEpoch, - lessThan(DateTime.now().millisecondsSinceEpoch), - ); + expect( + controller.selectedSnapshotTimestamp!.millisecondsSinceEpoch, + lessThan(DateTime.now().millisecondsSinceEpoch), + ); - await tester.pumpAndSettle(const Duration(seconds: 2)); + await tester.pumpAndSettle(const Duration(seconds: 2)); - await expectLater( - find.byType(MemoryVMChart), - matchesDevToolsGolden('../goldens/memory_heap_android.png'), - ); + await expectLater( + find.byType(MemoryVMChart), + matchesDevToolsGolden('../goldens/memory_heap_android.png'), + ); - // Await delay for golden comparison. - await tester.pumpAndSettle(const Duration(seconds: 2)); + // Await delay for golden comparison. + await tester.pumpAndSettle(const Duration(seconds: 2)); - // TODO(terry): Need to test legend. - /* + // TODO(terry): Need to test legend. + /* // Bring up the full legend with Android chart visible. expect(find.byKey(legendKey), findsOneWidget); // Bring up the legend. @@ -415,8 +402,6 @@ void main() { // Await delay for golden comparison. await tester.pumpAndSettle(const Duration(seconds: 2)); */ - }, - tags: ['golden'], - ); + }); }); } diff --git a/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart b/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart index 14354c14b93..e0c990ba761 100644 --- a/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart +++ b/packages/devtools_app/test/performance/frame_analysis/frame_analysis_test.dart @@ -92,108 +92,98 @@ void main() { expect(find.byType(FrameTimeVisualizer), findsOneWidget); } - testWidgetsWithWindowSize( - 'builds successfully', - windowSize, - (WidgetTester tester) async { - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsOneWidget); - expect(find.textContaining('Layout - '), findsOneWidget); - expect(find.textContaining('Paint - '), findsOneWidget); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsOneWidget); - expect(find.textContaining('Raster - '), findsOneWidget); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsNothing); - expect(find.textContaining('Shader compilation'), findsNothing); - expect(find.textContaining('Other raster'), findsNothing); - expect(find.byIcon(Icons.image_outlined), findsNothing); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer.png', - ), - ); - }, - tags: ['golden'], - ); + testWidgetsWithWindowSize('builds successfully', windowSize, + (WidgetTester tester) async { + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsOneWidget); + expect(find.textContaining('Layout - '), findsOneWidget); + expect(find.textContaining('Paint - '), findsOneWidget); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsOneWidget); + expect(find.textContaining('Raster - '), findsOneWidget); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsNothing); + expect(find.textContaining('Shader compilation'), findsNothing); + expect(find.textContaining('Other raster'), findsNothing); + expect(find.byIcon(Icons.image_outlined), findsNothing); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer.png', + ), + ); + }); testWidgetsWithWindowSize( - 'builds with icons only for narrow screen', - const Size(200.0, 1000.0), - (WidgetTester tester) async { - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsNothing); - expect(find.textContaining('Layout - '), findsNothing); - expect(find.textContaining('Paint - '), findsNothing); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsOneWidget); - expect(find.textContaining('Raster - '), findsNothing); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsNothing); - expect(find.textContaining('Shader compilation'), findsNothing); - expect(find.textContaining('Other raster'), findsNothing); - expect(find.byIcon(Icons.image_outlined), findsNothing); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer_icons_only.png', - ), - ); - }, - tags: ['golden'], - ); + 'builds with icons only for narrow screen', const Size(200.0, 1000.0), + (WidgetTester tester) async { + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsNothing); + expect(find.textContaining('Layout - '), findsNothing); + expect(find.textContaining('Paint - '), findsNothing); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsOneWidget); + expect(find.textContaining('Raster - '), findsNothing); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsNothing); + expect(find.textContaining('Shader compilation'), findsNothing); + expect(find.textContaining('Other raster'), findsNothing); + expect(find.byIcon(Icons.image_outlined), findsNothing); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer_icons_only.png', + ), + ); + }); testWidgetsWithWindowSize( - 'builds for frame with shader compilation', - windowSize, - (WidgetTester tester) async { - frame = testFrame0.shallowCopy() - ..setEventFlow(goldenUiTimelineEvent) - ..setEventFlow(rasterTimelineEventWithSubtleShaderJank); - frameAnalysis = FrameAnalysis(frame); - await pumpVisualizer(tester, frameAnalysis); - - expect(find.text('UI phases:'), findsOneWidget); - expect(find.textContaining('Build - '), findsOneWidget); - expect(find.textContaining('Layout - '), findsOneWidget); - expect(find.textContaining('Paint - '), findsOneWidget); - expect(find.byIcon(Icons.build), findsOneWidget); - expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); - expect(find.byIcon(Icons.format_paint), findsOneWidget); - - expect(find.text('Raster phase:'), findsNothing); - expect(find.textContaining('Raster - '), findsNothing); - expect(find.byIcon(Icons.grid_on), findsOneWidget); - - expect(find.text('Raster phases:'), findsOneWidget); - expect(find.textContaining('Shader compilation - '), findsOneWidget); - expect(find.textContaining('Other raster - '), findsOneWidget); - expect(find.byIcon(Icons.image_outlined), findsOneWidget); - - await expectLater( - find.byType(FrameTimeVisualizer), - matchesDevToolsGolden( - 'goldens/performance/frame_time_visualizer_with_shader_compilation.png', - ), - ); - }, - tags: ['golden'], - ); + 'builds for frame with shader compilation', windowSize, + (WidgetTester tester) async { + frame = testFrame0.shallowCopy() + ..setEventFlow(goldenUiTimelineEvent) + ..setEventFlow(rasterTimelineEventWithSubtleShaderJank); + frameAnalysis = FrameAnalysis(frame); + await pumpVisualizer(tester, frameAnalysis); + + expect(find.text('UI phases:'), findsOneWidget); + expect(find.textContaining('Build - '), findsOneWidget); + expect(find.textContaining('Layout - '), findsOneWidget); + expect(find.textContaining('Paint - '), findsOneWidget); + expect(find.byIcon(Icons.build), findsOneWidget); + expect(find.byIcon(Icons.auto_awesome_mosaic), findsOneWidget); + expect(find.byIcon(Icons.format_paint), findsOneWidget); + + expect(find.text('Raster phase:'), findsNothing); + expect(find.textContaining('Raster - '), findsNothing); + expect(find.byIcon(Icons.grid_on), findsOneWidget); + + expect(find.text('Raster phases:'), findsOneWidget); + expect(find.textContaining('Shader compilation - '), findsOneWidget); + expect(find.textContaining('Other raster - '), findsOneWidget); + expect(find.byIcon(Icons.image_outlined), findsOneWidget); + + await expectLater( + find.byType(FrameTimeVisualizer), + matchesDevToolsGolden( + 'goldens/performance/frame_time_visualizer_with_shader_compilation.png', + ), + ); + }); }); }); } diff --git a/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart b/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart index a5b4e7d1e19..e5e81d430f4 100644 --- a/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart +++ b/packages/devtools_app/test/performance/raster_stats/raster_stats_test.dart @@ -54,58 +54,50 @@ void main() { ); }); - testWidgets( - 'renders with data', - (tester) async { - await pumpRenderingLayerVisualizer(tester); - - expect(find.byType(LayerSnapshotTable), findsOneWidget); - expect(find.richText('Layer'), findsOneWidget); - expect(find.richText('Rendering time'), findsOneWidget); - expect(find.richText('Percent rendering time'), findsOneWidget); - expect(find.richText('Layer 12731'), findsOneWidget); - expect(find.richText('0.4 ms'), findsOneWidget); - expect(find.richText('78.74%'), findsOneWidget); - expect(find.richText('Layer 12734'), findsOneWidget); - expect(find.richText('0.1 ms'), findsOneWidget); - expect(find.richText('21.26%'), findsOneWidget); - - expect(find.byType(LayerImage), findsOneWidget); - - await expectLater( - find.byType(RenderingLayerVisualizer), - matchesDevToolsGolden('goldens/raster_stats_with_data.png'), - ); - }, - tags: ['golden'], - ); - - testWidgets( - 'can change layer selection', - (tester) async { - await pumpRenderingLayerVisualizer(tester); - - final layers = controller.rasterStats.value.layerSnapshots; - final firstLayer = layers.first; - final secondLayer = layers.last; - expect(firstLayer.displayName, equals('Layer 12731')); - expect(secondLayer.displayName, equals('Layer 12734')); - - expect( - controller.rasterStats.value.selectedSnapshot, - equals(firstLayer), - ); - - await tester.tap(find.richText('Layer 12734')); - await tester.pumpAndSettle(); - - expect(controller.selectedSnapshot.value, equals(secondLayer)); - await expectLater( - find.byType(RenderingLayerVisualizer), - matchesDevToolsGolden('goldens/raster_stats_changed_selection.png'), - ); - }, - tags: ['golden'], - ); + testWidgets('renders with data', (tester) async { + await pumpRenderingLayerVisualizer(tester); + + expect(find.byType(LayerSnapshotTable), findsOneWidget); + expect(find.richText('Layer'), findsOneWidget); + expect(find.richText('Rendering time'), findsOneWidget); + expect(find.richText('Percent rendering time'), findsOneWidget); + expect(find.richText('Layer 12731'), findsOneWidget); + expect(find.richText('0.4 ms'), findsOneWidget); + expect(find.richText('78.74%'), findsOneWidget); + expect(find.richText('Layer 12734'), findsOneWidget); + expect(find.richText('0.1 ms'), findsOneWidget); + expect(find.richText('21.26%'), findsOneWidget); + + expect(find.byType(LayerImage), findsOneWidget); + + await expectLater( + find.byType(RenderingLayerVisualizer), + matchesDevToolsGolden('goldens/raster_stats_with_data.png'), + ); + }); + + testWidgets('can change layer selection', (tester) async { + await pumpRenderingLayerVisualizer(tester); + + final layers = controller.rasterStats.value.layerSnapshots; + final firstLayer = layers.first; + final secondLayer = layers.last; + expect(firstLayer.displayName, equals('Layer 12731')); + expect(secondLayer.displayName, equals('Layer 12734')); + + expect( + controller.rasterStats.value.selectedSnapshot, + equals(firstLayer), + ); + + await tester.tap(find.richText('Layer 12734')); + await tester.pumpAndSettle(); + + expect(controller.selectedSnapshot.value, equals(secondLayer)); + await expectLater( + find.byType(RenderingLayerVisualizer), + matchesDevToolsGolden('goldens/raster_stats_changed_selection.png'), + ); + }); }); } diff --git a/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart b/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart index 20a394fc112..0d229165d63 100644 --- a/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart +++ b/packages/devtools_app/test/performance/timeline_events/timeline_flame_chart_test.dart @@ -180,7 +180,6 @@ void main() { }, // ignore: avoid_redundant_argument_values skip: kIsWeb, - tags: ['golden'], ); }); } diff --git a/packages/devtools_app/test/provider/provider_screen_test.dart b/packages/devtools_app/test/provider/provider_screen_test.dart index b5409ff9839..9b81bc08c6e 100644 --- a/packages/devtools_app/test/provider/provider_screen_test.dart +++ b/packages/devtools_app/test/provider/provider_screen_test.dart @@ -52,43 +52,40 @@ void main() { group('ProviderScreen', () { testWidgetsWithWindowSize( - 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the list of providers', - windowSize, - (tester) async { - await tester.pumpWidget( - ProviderScope( - overrides: [ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.loading(), - ), - ], - child: providerScreen, - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - sortedProviderNodesProvider.overrideWithValue( - AsyncValue.error(StateError('')), - ), - ], - child: providerScreen, - ), - ); + 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the list of providers', + windowSize, (tester) async { + await tester.pumpWidget( + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.loading(), + ), + ], + child: providerScreen, + ), + ); - // wait for the Banner to appear as it is mounted asynchronously - await tester.pump(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + sortedProviderNodesProvider.overrideWithValue( + AsyncValue.error(StateError('')), + ), + ], + child: providerScreen, + ), + ); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/list_error_banner.png', - ), - ); - }, - tags: ['golden'], - ); + // wait for the Banner to appear as it is mounted asynchronously + await tester.pump(); + + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/list_error_banner.png', + ), + ); + }); }); group('selectedProviderIdProvider', () { @@ -291,127 +288,121 @@ void main() { } testWidgetsWithWindowSize( - 'selects the first provider the first time a provider is received', - windowSize, - (tester) async { - final container = ProviderContainer( - overrides: [ - sortedProviderNodesProvider - .overrideWithValue(const AsyncValue.loading()), - ...getOverrides(), - ], - ); + 'selects the first provider the first time a provider is received', + windowSize, (tester) async { + final container = ProviderContainer( + overrides: [ + sortedProviderNodesProvider + .overrideWithValue(const AsyncValue.loading()), + ...getOverrides(), + ], + ); - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: providerScreen, - ), - ); + await tester.pumpWidget( + UncontrolledProviderScope( + container: container, + child: providerScreen, + ), + ); - expect(container.read(selectedProviderIdProvider), isNull); - expect(find.byType(ProviderNodeItem), findsNothing); + expect(container.read(selectedProviderIdProvider), isNull); + expect(find.byType(ProviderNodeItem), findsNothing); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/no_selected_provider.png', - ), - ); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/no_selected_provider.png', + ), + ); - container.updateOverrides([ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.data([ - ProviderNode(id: '0', type: 'Provider'), - ProviderNode(id: '1', type: 'Provider'), - ]), - ), - ...getOverrides(), - ]); + container.updateOverrides([ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.data([ + ProviderNode(id: '0', type: 'Provider'), + ProviderNode(id: '1', type: 'Provider'), + ]), + ), + ...getOverrides(), + ]); - await tester.pump(); + await tester.pump(); - expect(container.read(selectedProviderIdProvider), '0'); - expect(find.byType(ProviderNodeItem), findsNWidgets(2)); - expect( - find.descendant( - of: find.byKey(const Key('provider-0')), - matching: find.text('Provider()'), - ), - findsOneWidget, - ); - expect( - find.descendant( - of: find.byKey(const Key('provider-1')), - matching: find.text('Provider()'), - ), - findsOneWidget, - ); + expect(container.read(selectedProviderIdProvider), '0'); + expect(find.byType(ProviderNodeItem), findsNWidgets(2)); + expect( + find.descendant( + of: find.byKey(const Key('provider-0')), + matching: find.text('Provider()'), + ), + findsOneWidget, + ); + expect( + find.descendant( + of: find.byKey(const Key('provider-1')), + matching: find.text('Provider()'), + ), + findsOneWidget, + ); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/selected_provider.png', - ), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/selected_provider.png', + ), + ); + }); testWidgetsWithWindowSize( - 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the selected provider', - windowSize, - (tester) async { - final overrides = [ - sortedProviderNodesProvider.overrideWithValue( - const AsyncValue.data([ - ProviderNode(id: '0', type: 'Provider'), - ProviderNode(id: '1', type: 'Provider'), - ]), - ), - ...getOverrides(), - ]; - - await tester.pumpWidget( - ProviderScope( - overrides: [ - ...overrides, - instanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: providerScreen, - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - ...overrides, - instanceProvider(const InstancePath.fromProviderId('0')) - .overrideWithValue(AsyncValue.error(Error())), - ], - child: providerScreen, - ), - ); + 'shows ProviderUnknownErrorBanner if the devtool failed to fetch the selected provider', + windowSize, (tester) async { + final overrides = [ + sortedProviderNodesProvider.overrideWithValue( + const AsyncValue.data([ + ProviderNode(id: '0', type: 'Provider'), + ProviderNode(id: '1', type: 'Provider'), + ]), + ), + ...getOverrides(), + ]; - // await for the modal to be mounted as it is rendered asynchronously - await tester.pump(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: providerScreen, + ), + ); - expect( - find.byKey( - const Key('ProviderUnknownErrorBanner - ${ProviderScreen.id}'), - ), - findsOneWidget, - ); + await tester.pumpWidget( + ProviderScope( + overrides: [ + ...overrides, + instanceProvider(const InstancePath.fromProviderId('0')) + .overrideWithValue(AsyncValue.error(Error())), + ], + child: providerScreen, + ), + ); - await expectLater( - find.byType(ProviderScreenBody), - matchesDevToolsGolden( - '../goldens/provider_screen/selected_provider_error_banner.png', - ), - ); - }, - tags: ['golden'], - ); + // await for the modal to be mounted as it is rendered asynchronously + await tester.pump(); + + expect( + find.byKey( + const Key('ProviderUnknownErrorBanner - ${ProviderScreen.id}'), + ), + findsOneWidget, + ); + + await expectLater( + find.byType(ProviderScreenBody), + matchesDevToolsGolden( + '../goldens/provider_screen/selected_provider_error_banner.png', + ), + ); + }); }); } diff --git a/packages/devtools_app/test/shared/instance_viewer_test.dart b/packages/devtools_app/test/shared/instance_viewer_test.dart index 88cfaada2c0..e27bee6d261 100644 --- a/packages/devtools_app/test/shared/instance_viewer_test.dart +++ b/packages/devtools_app/test/shared/instance_viewer_test.dart @@ -130,366 +130,348 @@ void main() { group('InstanceViewer', () { testWidgets( - 'showInternalProperties: false hides private properties from dependencies', - (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - - InstancePath pathForProperty(String name) { - return objPath.pathForChild( - PathToProperty.objectProperty( - name: name, - ownerUri: '', - ownerName: '', - ), - ); - } - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: '_second', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: true, - ), - ObjectField( - name: 'third', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ObjectField( - name: '_forth', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), + 'showInternalProperties: false hides private properties from dependencies', + (tester) async { + const objPath = InstancePath.fromInstanceId('obj'); + + InstancePath pathForProperty(String name) { + return objPath.pathForChild( + PathToProperty.objectProperty( + name: name, + ownerUri: '', + ownerName: '', + ), + ); + } + + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(objPath).overrideWithValue( + AsyncValue.data( + ObjectInstance( + [ + ObjectField( + name: 'first', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: true, + ), + ObjectField( + name: '_second', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: true, + ), + ObjectField( + name: 'third', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ObjectField( + name: '_forth', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ], + hash: 0, + instanceRefId: 'object', + setter: null, + evalForInstance: FakeEvalOnDartLibrary(), + type: 'MyClass', ), ), - instanceProvider(pathForProperty('first')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_second')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('third')) - .overrideWithValue(int42Instance), - instanceProvider(pathForProperty('_forth')) - .overrideWithValue(int42Instance), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: false, - rootPath: objPath, - ), + ), + instanceProvider(pathForProperty('first')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('_second')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('third')) + .overrideWithValue(int42Instance), + instanceProvider(pathForProperty('_forth')) + .overrideWithValue(int42Instance), + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: false, + rootPath: objPath, ), ), ), - ); + ), + ); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden( - '../goldens/instance_viewer/show_internal_properties.png', - ), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden( + '../goldens/instance_viewer/show_internal_properties.png', + ), + ); + }); - testWidgets( - 'field editing flow', - (tester) async { - const objPath = InstancePath.fromInstanceId('obj'); - final propertyPath = objPath.pathForChild( - const PathToProperty.objectProperty( - name: 'first', - ownerUri: '', - ownerName: '', - ), - ); + testWidgets('field editing flow', (tester) async { + const objPath = InstancePath.fromInstanceId('obj'); + final propertyPath = objPath.pathForChild( + const PathToProperty.objectProperty( + name: 'first', + ownerUri: '', + ownerName: '', + ), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(objPath).overrideWithValue( - AsyncValue.data( - ObjectInstance( - [ - ObjectField( - name: 'first', - isFinal: false, - ownerName: '', - ownerUri: '', - eval: FakeEvalOnDartLibrary(), - ref: Result.error(Error(), StackTrace.empty), - isDefinedByDependency: false, - ), - ], - hash: 0, - instanceRefId: 'object', - setter: null, - evalForInstance: FakeEvalOnDartLibrary(), - type: 'MyClass', - ), + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(objPath).overrideWithValue( + AsyncValue.data( + ObjectInstance( + [ + ObjectField( + name: 'first', + isFinal: false, + ownerName: '', + ownerUri: '', + eval: FakeEvalOnDartLibrary(), + ref: Result.error(Error(), StackTrace.empty), + isDefinedByDependency: false, + ), + ], + hash: 0, + instanceRefId: 'object', + setter: null, + evalForInstance: FakeEvalOnDartLibrary(), + type: 'MyClass', ), ), - instanceProvider(propertyPath).overrideWithValue( - AsyncValue.data( - InstanceDetails.number( - '0', - instanceRefId: '0', - setter: (value) async {}, - ), + ), + instanceProvider(propertyPath).overrideWithValue( + AsyncValue.data( + InstanceDetails.number( + '0', + instanceRefId: '0', + setter: (value) async {}, ), ), - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: objPath, - ), + ), + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: objPath, ), ), ), - ); + ), + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await tester.tap(find.byKey(ValueKey(propertyPath))); + await tester.tap(find.byKey(ValueKey(propertyPath))); - await tester.pump(); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/edit.png'), - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/edit.png'), + ); - // can press esc to unfocus active node - await tester.sendKeyEvent(LogicalKeyboardKey.escape); + // can press esc to unfocus active node + await tester.sendKeyEvent(LogicalKeyboardKey.escape); - await tester.pump(); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/edit_esc.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/edit_esc.png'), + ); + }); - testWidgets( - 'renders while an instance is fetched', - (tester) async { - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()) - ], - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), + testWidgets('renders while an instance is fetched', + (tester) async { + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()) + ], + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), ), ), ), - ); + ), + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/loading.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/loading.png'), + ); + }); // TODO(rrousselGit) find a way to test "data then loading then wait then loading then wait shows "loading" after a total of one second" // This is tricky because tester.pump(duration) completes the Timer even if the duration is < 1 second testWidgets( - 'once valid data was fetched, going back to loading and emiting an error immediately updates the UI', - (tester) async { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), + 'once valid data was fetched, going back to loading and emiting an error immediately updates the UI', + (tester) async { + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), ), - ); + ), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, - ), - ); - await tester.pump(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/null.png'), - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/null.png'), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue( - AsyncValue.error(StateError('test error'))), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(AsyncValue.error(StateError('test error'))), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/error.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/error.png'), + ); + }); testWidgets( - 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', - (tester) async { - const app = MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('0'), - ), - ), - ); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(nullInstance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(const AsyncValue.loading()), - ], - child: app, + 'once valid data was fetched, going back to loading and emiting a new value immediately updates the UI', + (tester) async { + const app = MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('0'), ), - ); - await tester.pump(); - - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/null.png'), - ); + ), + ); - await tester.pumpWidget( - ProviderScope( - overrides: [ - instanceProvider(const InstancePath.fromInstanceId('0')) - .overrideWithValue(int42Instance), - ], - child: app, - ), - ); - await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(nullInstance), + ], + child: app, + ), + ); + await tester.pumpAndSettle(); + await tester.pumpWidget( + ProviderScope( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(const AsyncValue.loading()), + ], + child: app, + ), + ); + await tester.pump(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/num.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/null.png'), + ); - testWidgets( - 'renders enums', - (tester) async { - final container = ProviderContainer( + await tester.pumpWidget( + ProviderScope( overrides: [ - instanceProvider(const InstancePath.fromInstanceId('enum')) - .overrideWithValue(enumValueInstance), + instanceProvider(const InstancePath.fromInstanceId('0')) + .overrideWithValue(int42Instance), ], - ); - addTearDown(container.dispose); + child: app, + ), + ); + await tester.pumpAndSettle(); - await tester.pumpWidget( - UncontrolledProviderScope( - container: container, - child: const MaterialApp( - home: Scaffold( - body: InstanceViewer( - showInternalProperties: true, - rootPath: InstancePath.fromInstanceId('enum'), - ), + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/num.png'), + ); + }); + + testWidgets('renders enums', (tester) async { + final container = ProviderContainer( + overrides: [ + instanceProvider(const InstancePath.fromInstanceId('enum')) + .overrideWithValue(enumValueInstance), + ], + ); + addTearDown(container.dispose); + + await tester.pumpWidget( + UncontrolledProviderScope( + container: container, + child: const MaterialApp( + home: Scaffold( + body: InstanceViewer( + showInternalProperties: true, + rootPath: InstancePath.fromInstanceId('enum'), ), ), ), - ); + ), + ); - await tester.pumpAndSettle(); + await tester.pumpAndSettle(); - await expectLater( - find.byType(MaterialApp), - matchesDevToolsGolden('../goldens/instance_viewer/enum.png'), - ); - }, - tags: ['golden'], - ); + await expectLater( + find.byType(MaterialApp), + matchesDevToolsGolden('../goldens/instance_viewer/enum.png'), + ); + }); testWidgets('renders null', (tester) async { final container = ProviderContainer( diff --git a/packages/devtools_test/lib/src/wrappers.dart b/packages/devtools_test/lib/src/wrappers.dart index e2e64049f12..7f66215fb76 100644 --- a/packages/devtools_test/lib/src/wrappers.dart +++ b/packages/devtools_test/lib/src/wrappers.dart @@ -146,7 +146,6 @@ void testWidgetsWithWindowSize( Size windowSize, WidgetTesterCallback test, { bool skip = false, - List tags = const [], }) { testWidgets( name, @@ -156,7 +155,6 @@ void testWidgetsWithWindowSize( await _resetWindowSize(); }, skip: skip, - tags: tags, ); } From 63bbcf36396214b13291e354e02944082db9091e Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 17:30:39 -0500 Subject: [PATCH 53/54] remove extras --- .github/workflows/build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c35d10e833..4fbb8269e3c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,9 +14,7 @@ on: permissions: read-all env: - AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ACTIONS_RUNNER_DEBUG: true jobs: flutter-prep: name: ${{ matrix.os }} Flutter Prep From 787daa347a54983b18007633ac30bc27683070d5 Mon Sep 17 00:00:00 2001 From: Dan Chevalier Date: Thu, 10 Nov 2022 17:37:47 -0500 Subject: [PATCH 54/54] new world latest flut can --- .../commands/latest_flutter_candidate.dart | 121 ------------------ tool/lib/repo_tool.dart | 2 - tool/update_flutter_sdk.sh | 2 +- 3 files changed, 1 insertion(+), 124 deletions(-) delete mode 100644 tool/lib/commands/latest_flutter_candidate.dart diff --git a/tool/lib/commands/latest_flutter_candidate.dart b/tool/lib/commands/latest_flutter_candidate.dart deleted file mode 100644 index b878c56b111..00000000000 --- a/tool/lib/commands/latest_flutter_candidate.dart +++ /dev/null @@ -1,121 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:args/command_runner.dart'; -import 'package:devtools_shared/devtools_shared.dart'; -import 'package:http/http.dart' as http; - -const githubToken = 'githubToken'; - -/// Outputs the latest flutter candidate branch name. -/// -/// The latest candidate branch will be the branch that matches the Flutter SDK -/// inside g3. -/// -/// Sample usage: -/// ```shell -/// $dart tool/bin/repo_tool.dart latest-flutter-candidate -/// ``` -class LatestFlutterCandidateCommand extends Command { - LatestFlutterCandidateCommand() { - argParser.addOption( - githubToken, - help: 'Specify the github auth token to be used for API requests.' - ' If unspecified, this may lead to rate limit errors from the' - ' GitHub API.', - defaultsTo: '', - ); - } - - @override - String get name => 'latest-flutter-candidate'; - - @override - String get description => - 'Outputs the most recent flutter release candidate banch'; - - @override - Future run() async { - final authToken = (argResults?[githubToken] ?? '') as String; - - SemanticVersion latest = SemanticVersion(); - String? latestBranchName; - - final allBranchNames = []; - - // TODO(kenz): consider traversing pages properly instead of using a while - // loop. - // See https://docs.github.com/en/rest/guides/traversing-with-pagination - const maxPerPage = 100; - var requestPage = 0; - bool lastPageReceived = false; - while (!lastPageReceived) { - final uri = Uri.https( - 'api.github.com', - '/repos/flutter/flutter/branches', - { - 'per_page': '$maxPerPage', - 'page': '$requestPage', - }, - ); - - final response = await http.get( - uri, - headers: - authToken.isEmpty ? null : {'authorization': 'Bearer $authToken'}, - ); - - if (response.statusCode != HttpStatus.ok) { - print('HttpStatus ${response.statusCode}: ${response.reasonPhrase}'); - return; - } - - final List> branches = - (jsonDecode(response.body) as List).cast>(); - - final branchNames = - branches.map((branch) => branch['name']).cast(); - allBranchNames.addAll(branchNames); - - final candidateBranchesNames = - branchNames.where((name) => name.contains('candidate')); - - for (final branchName in candidateBranchesNames) { - final semVer = semVerFromCandidateBranch(branchName); - if (semVer != null && semVer > latest) { - latest = semVer; - latestBranchName = branchName; - } - } - - requestPage++; - if (branches.length < maxPerPage) { - lastPageReceived = true; - } - } - - if (latestBranchName == null) { - throw Exception( - 'Something went wrong. Could not find the latest candidate branch:' - '${allBranchNames.join('\n')}'); - } else { - print(latestBranchName); - } - } -} - -SemanticVersion? semVerFromCandidateBranch(String branch) { - final candidateBranchPattern = - RegExp(r'^flutter-([0-9]+).([0-9]+)-candidate.([0-9]+)$'); - - final match = candidateBranchPattern.firstMatch(branch); - if (match == null) { - return null; - } - - final x = int.parse(match.group(1)!); - final y = int.parse(match.group(2)!); - final z = int.parse(match.group(3)!); - - return SemanticVersion(major: x, minor: y, patch: z); -} diff --git a/tool/lib/repo_tool.dart b/tool/lib/repo_tool.dart index 7c7150bcbe1..407f733be9b 100644 --- a/tool/lib/repo_tool.dart +++ b/tool/lib/repo_tool.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'package:args/command_runner.dart'; -import 'package:devtools_repo/commands/latest_flutter_candidate.dart'; import 'commands/analyze.dart'; import 'commands/generate_changelog.dart'; @@ -21,6 +20,5 @@ class DevToolsCommandRunner extends CommandRunner { addCommand(PackagesGetCommand()); addCommand(GenerateChangelogCommand()); addCommand(RollbackCommand()); - addCommand(LatestFlutterCandidateCommand()); } } diff --git a/tool/update_flutter_sdk.sh b/tool/update_flutter_sdk.sh index 9df3b2c87b8..7e392112ce0 100755 --- a/tool/update_flutter_sdk.sh +++ b/tool/update_flutter_sdk.sh @@ -17,7 +17,7 @@ TOOL_DIR=`dirname "${RELATIVE_PATH_TO_SCRIPT}"` pushd "$TOOL_DIR" dart pub get -REQUIRED_FLUTTER_BRANCH=`dart bin/repo_tool.dart latest-flutter-candidate | tail -n 1` +REQUIRED_FLUTTER_BRANCH=`./latest_flutter_candidate.sh` echo "REQUIRED_FLUTTER_BRANCH: $REQUIRED_FLUTTER_BRANCH"