From 94afcbb5044068f544c9cf91bebbd6708d4049ad Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 02:26:17 +0800 Subject: [PATCH 1/6] Update DarockBili_Watch_App_UI_Tests.swift --- .../DarockBili_Watch_App_UI_Tests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift index 1aeccd6f3..a9dace813 100644 --- a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift +++ b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift @@ -60,11 +60,11 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase { takeScreenshot(of: app, named: "NetworkFix1") sleep(5) takeScreenshot(of: app, named: "NetworkFix2") + } func testLaunchPerformance() throws { if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { - // This measures how long it takes to launch your application. measure(metrics: [XCTApplicationLaunchMetric()]) { XCUIApplication().launch() } From 9bd1339c13e3626102caaa556e2333b3073d8075 Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 02:57:40 +0800 Subject: [PATCH 2/6] Update ui-test.yml --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index b89d899d3..36c84e994 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -47,7 +47,7 @@ jobs: - name: Run DarockBili Watch App UI Test run: | - xcodebuild test -scheme 'DarockBili Watch App' -configuration Release -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (41mm),OS=10.0' -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.0' -testPlan WatchAppUITestPlan -testProductsPath ./Caches/TestProducts.xctestproducts -derivedDataPath ./Caches/DerivedData + xcodebuild test -scheme 'DarockBili Watch App' -configuration Release -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (41mm),OS=10.0' -testPlan WatchAppUITestPlan -testProductsPath ./Caches/TestProducts.xctestproducts -derivedDataPath ./Caches/DerivedData echo "FIN_STATUS=success" >> $GITHUB_ENV - name: Process Test Result From ba01c4cc20bdc88b6f198a5e0b3de3b125647432 Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 03:25:00 +0800 Subject: [PATCH 3/6] Update ui-test.yml --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 36c84e994..ec4174253 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -72,5 +72,5 @@ jobs: /repos/${{ github.repository }}/statuses/$GITHUB_SHA \ -f state='${{ env.FIN_STATUS }}' \ -f target_url='https://github.com/Darock-Studio/Darock-Bili/actions/runs/${{ github.run_id }}' \ - -f context='Unit Test' + -f context='UI Test' From ff149ba91c176d01fdde386cc79950ac8ea182ba Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 03:27:33 +0800 Subject: [PATCH 4/6] Update DarockBili_Watch_App_UI_Tests.swift --- .../DarockBili_Watch_App_UI_Tests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift index a9dace813..4a3bd8bbd 100644 --- a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift +++ b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift @@ -44,6 +44,9 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase { app.swipeUp() sleep(1) takeScreenshot(of: app, named: "RMVideoP2") + app.swipeLeft() + sleep(5) + takeScreenshot(of: app, named: "RMVideoComments") app.navigationBars.buttons.element(boundBy: 0).tap() sleep(1) app.otherElements["MainTabView"].swipeLeft() From 32c0eb196508d73896f25ddac09b3de602377e1d Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 03:36:51 +0800 Subject: [PATCH 5/6] Update status-check.yml --- .github/workflows/status-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/status-check.yml b/.github/workflows/status-check.yml index 482b147f2..bb0a05d3f 100644 --- a/.github/workflows/status-check.yml +++ b/.github/workflows/status-check.yml @@ -55,7 +55,7 @@ jobs: - name: Build DarockBili App run: | - xcodebuild -scheme 'DarockBili Watch App' -configuration Release build CODE_SIGN_IDENTITY="" + xcodebuild -scheme 'DarockBili Watch App' -configuration Release build CODE_SIGN_IDENTITY="" -quiet echo "FIN_STATUS=success" >> $GITHUB_ENV - name: Update Check Status From 171ef0dc3e03358d96d5aa51190b4053e4ca0239 Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Mon, 11 Dec 2023 22:31:17 +0800 Subject: [PATCH 6/6] Update DarockBili_Watch_App_UI_Tests.swift --- .../DarockBili_Watch_App_UI_Tests.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift index 4a3bd8bbd..92aabff9a 100644 --- a/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift +++ b/DarockBili Watch App UI Tests/DarockBili_Watch_App_UI_Tests.swift @@ -38,6 +38,7 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase { app.launch() sleep(2) takeScreenshot(of: app, named: "Launch") + // In main tabview first page (suggestions) app.buttons["SuggestVideo"].firstMatch.tap() sleep(1) takeScreenshot(of: app, named: "RMVideo") @@ -49,6 +50,7 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase { takeScreenshot(of: app, named: "RMVideoComments") app.navigationBars.buttons.element(boundBy: 0).tap() sleep(1) + // Backed to suggestions view app.otherElements["MainTabView"].swipeLeft() sleep(1) takeScreenshot(of: app, named: "PersonalCenter") @@ -75,6 +77,8 @@ final class DarockBili_Watch_App_UI_Tests: XCTestCase { } } +var screenshotCount = 1 + extension XCTestCase { /// Take a screenshot of a given app and add it to the test attachements. /// - Parameters: @@ -84,12 +88,13 @@ extension XCTestCase { let screenshot = app.windows.firstMatch.screenshot() let attachment = XCTAttachment(screenshot: screenshot) #if os(iOS) - let name = "Screenshot-\(name)-\(UIDevice.current.name).png" + let name = "Screenshot-\(screenshotCount)-\(name)-\(UIDevice.current.name).png" #else - let name = "Screenshot-\(name)-watchOS.png" + let name = "Screenshot-\(screenshotCount)-\(name)-watchOS.png" #endif attachment.name = name attachment.lifetime = .keepAlways add(attachment) + screenshotCount += 1 } }