From 32c9b02e24acfab59dff9d2d91f880b06ff0390c Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 4 Oct 2022 12:10:43 +1100 Subject: [PATCH 1/2] Expect failure instead of skipping in `UIPasteBoard` test See discussion at https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696 --- .../Authenticator/PasteboardTests.swift | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/WordPressAuthenticatorTests/Authenticator/PasteboardTests.swift b/WordPressAuthenticatorTests/Authenticator/PasteboardTests.swift index 246cba095..d65df1b76 100644 --- a/WordPressAuthenticatorTests/Authenticator/PasteboardTests.swift +++ b/WordPressAuthenticatorTests/Authenticator/PasteboardTests.swift @@ -10,52 +10,62 @@ class PasteboardTests: XCTestCase { } func testNominalAuthCode() throws { - if #available(iOS 16.0, *) { - throw XCTSkip("UIPasteboard doesn't work in iOS 16.0.") // Check https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696 - } - guard #available(iOS 14.0, *) else { throw XCTSkip("Unsupported iOS version") } + // FIXME: We'll need to find a way to make the test work the new pasteboard rules + // + // See: + // - https://developer.apple.com/forums/thread/713770 + // - https://sarunw.com/posts/uipasteboard-privacy-change-ios16/ + // - https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696 + XCTExpectFailure("Paste board access has changed in iOS 16 and this test is now failing") + let expect = expectation(description: "Could read nominal auth code from pasteboard") let pasteboard = UIPasteboard.general pasteboard.string = "123456" UIPasteboard.general.detectAuthenticatorCode { result in switch result { - case .success(let authenticationCode): - XCTAssertEqual(authenticationCode, "123456") - case .failure: - XCTAssert(false) + case .success(let authenticationCode): + XCTAssertEqual(authenticationCode, "123456") + expect.fulfill() + case .failure: + // Do nothing, by not fulfilling the expectation, the test will fail. + return } - expect.fulfill() } waitForExpectations(timeout: timeout, handler: nil) } func testLeadingZeroInAuthCodePreserved() throws { - if #available(iOS 16.0, *) { - throw XCTSkip("UIPasteboard doesn't work in iOS 16.0.") // Check https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696 - } - guard #available(iOS 14.0, *) else { throw XCTSkip("Unsupported iOS version") } + // FIXME: We'll need to find a way to make the test work the new pasteboard rules + // + // See: + // - https://developer.apple.com/forums/thread/713770 + // - https://sarunw.com/posts/uipasteboard-privacy-change-ios16/ + // - https://github.com/wordpress-mobile/WordPressAuthenticator-iOS/issues/696 + XCTExpectFailure("Paste board access has changed in iOS 16 and this test is now failing") + let expect = expectation(description: "Could read leading zero auth code from pasteboard") let pasteboard = UIPasteboard.general pasteboard.string = "012345" UIPasteboard.general.detectAuthenticatorCode { result in switch result { - case .success(let authenticationCode): - XCTAssertEqual(authenticationCode, "012345") - case .failure: - XCTAssert(false) + case .success(let authenticationCode): + XCTAssertEqual(authenticationCode, "012345") + expect.fulfill() + case .failure: + // Do nothing, by not fulfilling the expectation, the test will fail. + return } - expect.fulfill() } waitForExpectations(timeout: timeout, handler: nil) From 0bb055dc198bff03d357df08367154897c1d313f Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 1 Nov 2022 20:42:04 +1100 Subject: [PATCH 2/2] Update `bash-cache` from version 2.8.0 to 2.9.0 This new version has an improved Ruby Bundler management. --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index bcdab5e85..2cd021608 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,7 +1,7 @@ # Nodes with values to reuse in the pipeline. common_params: plugins: &common_plugins - - automattic/bash-cache#2.8.0 + - automattic/bash-cache#2.9.0 env: &common_env IMAGE_ID: xcode-14