surfstudio / ReactiveDataDisplayManager

MIT License
34 stars 13 forks source link

SPT-1511 Improve stability of UI tests #238

Closed NullIsOne closed 1 year ago

NullIsOne commented 1 year ago

Что сделано?

Зачем это сделано?

Чтобы повысить качество и стабильность прогона тестов на CI

На что обратить внимание?

Как протестировать?

github-actions[bot] commented 1 year ago
Warnings
:warning: The .yml file has been modified. Keep `changelog.md` up to date.
:warning: Oops! We have found some issues. It's better to fix them to keep code clean

SwiftLint found issues

Severity File Reason
Warning ManualTableManager.swift:37 Line should be 145 characters or less: currently 146 characters (line_length)
Warning ManualTableManager.swift:53 Line should be 145 characters or less: currently 146 characters (line_length)

Generated by :no_entry_sign: Danger Swift against 6021bc92e2a5f22cf494de4197c55f1aef5fac5d

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 13.10% and project coverage change: -24.15 :warning:

Comparison is base (d5a7be2) 60.70% compared to head (d604813) 36.56%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/7.4 #238 +/- ## ================================================ - Coverage 60.70% 36.56% -24.15% ================================================ Files 143 143 Lines 5296 5303 +7 Branches 2447 2437 -10 ================================================ - Hits 3215 1939 -1276 - Misses 1955 3283 +1328 + Partials 126 81 -45 ``` | Flag | Coverage Δ | | |---|---|---| | uitests | `?` | | | unittests | `36.56% <13.10%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio) | Coverage Δ | | |---|---|---| | [Source/Collection/CollectionCell+RDDM.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vQ29sbGVjdGlvbkNlbGwrUkRETS5zd2lmdA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [...llection/DataSource/BaseCollectionDataSource.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vRGF0YVNvdXJjZS9CYXNlQ29sbGVjdGlvbkRhdGFTb3VyY2Uuc3dpZnQ=) | `38.70% <0.00%> (-41.07%)` | :arrow_down: | | [...e/Collection/Delegate/BaseCollectionDelegate.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vRGVsZWdhdGUvQmFzZUNvbGxlY3Rpb25EZWxlZ2F0ZS5zd2lmdA==) | `47.55% <0.00%> (-22.38%)` | :arrow_down: | | [...on/Generators/EmptyCollectionHeaderGenerator.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vR2VuZXJhdG9ycy9FbXB0eUNvbGxlY3Rpb25IZWFkZXJHZW5lcmF0b3Iuc3dpZnQ=) | `13.04% <0.00%> (-26.09%)` | :arrow_down: | | [...ins/PluginAction/CollectionPaginatablePlugin.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vUGx1Z2lucy9QbHVnaW5BY3Rpb24vQ29sbGVjdGlvblBhZ2luYXRhYmxlUGx1Z2luLnN3aWZ0) | `24.28% <0.00%> (-62.86%)` | :arrow_down: | | [.../Collection/Protocols/CollectionFoldableItem.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL0NvbGxlY3Rpb24vUHJvdG9jb2xzL0NvbGxlY3Rpb25Gb2xkYWJsZUl0ZW0uc3dpZnQ=) | `0.00% <0.00%> (ø)` | | | [...Accessibility/AccessibilityItem+Invalidation.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL1Byb3RvY29scy9QbHVnaW5zL0dlbmVyYXRvcnMvQWNjZXNzaWJpbGl0eS9BY2Nlc3NpYmlsaXR5SXRlbStJbnZhbGlkYXRpb24uc3dpZnQ=) | `0.00% <0.00%> (-90.00%)` | :arrow_down: | | [...rs/Accessibility/AccessibilityItem+Providers.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL1Byb3RvY29scy9QbHVnaW5zL0dlbmVyYXRvcnMvQWNjZXNzaWJpbGl0eS9BY2Nlc3NpYmlsaXR5SXRlbStQcm92aWRlcnMuc3dpZnQ=) | `0.00% <0.00%> (-80.00%)` | :arrow_down: | | [...s/Accessibility/AccessibilityItem+Strategies.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL1Byb3RvY29scy9QbHVnaW5zL0dlbmVyYXRvcnMvQWNjZXNzaWJpbGl0eS9BY2Nlc3NpYmlsaXR5SXRlbStTdHJhdGVnaWVzLnN3aWZ0) | `0.00% <0.00%> (-29.42%)` | :arrow_down: | | [...s/Generators/Accessibility/AccessibilityItem.swift](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio#diff-U291cmNlL1Byb3RvY29scy9QbHVnaW5zL0dlbmVyYXRvcnMvQWNjZXNzaWJpbGl0eS9BY2Nlc3NpYmlsaXR5SXRlbS5zd2lmdA==) | `0.00% <0.00%> (-46.67%)` | :arrow_down: | | ... and [30 more](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio) | | ... and [44 files with indirect coverage changes](https://app.codecov.io/gh/surfstudio/ReactiveDataDisplayManager/pull/238/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=surfstudio)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

NullIsOne commented 1 year ago

Снимок экрана 2023-06-21 в 21 12 12 На CI все равно упало. A build check зелененький как всегда..

Ikeret commented 1 year ago

Как я понял, проблема в том, что xcodebuild возвращает 0 код, даже если тесты зафейлились. А если добавить в экшен такой код?

test_output=$( make test_example_iOS )
if [[ echo $test_output | grep "** TEST EXECUTE FAILED **" ]]; then
  echo "::error:: Test execute failed"
fi

Будет фейлить степ если будет такая строчка в конце

image
Ikeret commented 1 year ago

Запускал на 14.3 iOS 16.4 (iPhone 14) и на 15 iOS 17 (iPhone 14) - все тесты ок

NullIsOne commented 1 year ago

Как я понял, проблема в том, что xcodebuild возвращает 0 код, даже если тесты зафейлились. А если добавить в экшен такой код?

test_output=$( make test_example_iOS )
if [[ echo $test_output | grep "** TEST EXECUTE FAILED **" ]]; then
  echo "::error:: Test execute failed"
fi

Будет фейлить степ если будет такая строчка в конце

image

Не очень удобно что при таком способе в реалтайме за тестами не получается наблюдать Снимок экрана 2023-06-22 в 17 45 43

Попробую все-таки читать этот output в следующем шаге slather может - и мы сможем) Но в целом способ работает

Golubeykov commented 1 year ago

На 1-м прогоне ManagerExampleUITests упал testTable_whenFirstCellDragingToDestination_thenDestinationCellBecomesFirst(). При повторном запуске тест прошел.

Другие тесты (TestsiOS и TeststvOS) что-то не могу запустить, в т.ч. выбирая другие схемы и добавляя тесты в схему Example iOS. Получаю ошибку билда "Command PhaseScriptExecution failed with a nonzero exit code". Это как-то связано с предыдущим комментом Сережи?

Ikeret commented 1 year ago

На 1-м прогоне ManagerExampleUITests упал testTable_whenFirstCellDragingToDestination_thenDestinationCellBecomesFirst(). При повторном запуске тест прошел.

Другие тесты (TestsiOS и TeststvOS) что-то не могу запустить, в т.ч. выбирая другие схемы и добавляя тесты в схему Example iOS. Получаю ошибку билда "Command PhaseScriptExecution failed with a nonzero exit code". Это как-то связано с предыдущим комментом Сережи?

Это означает что есть ошибки при билде, очистить билд можно попробовать, чтобы показало ошибку. Скорее всего с тестами на телевизор что то забыли дописать)

NullIsOne commented 1 year ago

Чекер починен Снимок экрана 2023-06-23 в 17 50 43

Тестов для tv нет и не было (пока) - схему лишнюю удалил

Задержки загрузки экранов при прогоне UI тестов обнулены

Ikeret commented 1 year ago

После замены fatalError с Runloop на Void closure время джобы build_iOS уменьшилось с 14 минут до 5 😄

UPD: хоть время и плавает, но кажется стало быстрее для первой джобы. Пример с unreachable со stackoverflow был не очень, так как он плодит кучу ворк итемов, где бесконечно крутится ранлуп. По идее избавление от этого должно было помочь с быстродействием на CI во время тестов

Ikeret commented 1 year ago

UI тесты теперь тоже побеждены) https://github.com/surfstudio/ReactiveDataDisplayManager/pull/238/commits/6021bc92e2a5f22cf494de4197c55f1aef5fac5d Необходимо было добавить такие же 2 параметра, какие указаны в Movable были. Похоже на CI не успевала ячейка встать на место другой и отпускалась раньше)

image