From 07e55a8c9fce9cfb5aa4ee504f56c929d35c007d Mon Sep 17 00:00:00 2001 From: Neelam Sharma Date: Wed, 5 Feb 2025 11:58:04 +0100 Subject: [PATCH] Added UI tests --- .../PayTo/PayToComponentTests.swift | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/Tests/IntegrationTests/Components Tests/PayTo/PayToComponentTests.swift b/Tests/IntegrationTests/Components Tests/PayTo/PayToComponentTests.swift index c0107d0248..4594288530 100644 --- a/Tests/IntegrationTests/Components Tests/PayTo/PayToComponentTests.swift +++ b/Tests/IntegrationTests/Components Tests/PayTo/PayToComponentTests.swift @@ -27,4 +27,54 @@ class PayToComponentTests: XCTestCase { XCTAssertEqual(sut.paymentMethod.type, .payto) } + + func test_flowSelection_titleLabel_exists() throws { + // Given + let sut = try PayToComponent( + paymentMethod: AdyenCoder.decode(payto), + context: Dummy.context + ) + + setupRootViewController(sut.viewController) + + // Check by accessibility identifier + let flowSelectionTitleLabelItem = sut.viewController.view.findView(with: "AdyenComponents.PayToComponent.flowSelectionTitleLabel") as? UILabel + + // Then + XCTAssertNotNil(flowSelectionTitleLabelItem, "Flow selection title label should exist") + } + + func test_flowSelectionItem_exists() throws { + // Given + let sut = try PayToComponent( + paymentMethod: AdyenCoder.decode(payto), + context: Dummy.context + ) + + setupRootViewController(sut.viewController) + + // Check by accessibility identifier + let flowSelectionItem = sut.viewController.view.findView(with: "AdyenComponents.PayToComponent.flowSelectionSegmentedControl") as? UISegmentedControl + flowSelectionItem?.selectedSegmentIndex = 1 + + // Then + XCTAssertNotNil(flowSelectionItem, "Flow selection item should exist") + } + + func test_continueButton_exists() throws { + // Given + let sut = try PayToComponent( + paymentMethod: AdyenCoder.decode(payto), + context: Dummy.context + ) + + setupRootViewController(sut.viewController) + + // Check by accessibility identifier + let continueButton: FormButtonItemView = try XCTUnwrap(sut.viewController.view.findView(with: "AdyenComponents.PayToComponent.continueButton")) + + // Then + XCTAssertNotNil(continueButton, "ContinueButton should exist") + } + }