Skip to content

Commit 91b15ef

Browse files
committed
combine tap and type to enter text, assert product name
1 parent 17468c9 commit 91b15ef

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

WooCommerce/UITestsFoundation/Screens/Products/ProductsScreen.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public final class ProductsScreen: ScreenObject {
8383

8484
public func selectProductType(productType: String) throws -> SingleProductScreen {
8585
app.staticTexts[productType].tap()
86-
8786
return try SingleProductScreen()
8887
}
8988
}

WooCommerce/UITestsFoundation/Screens/Products/SingleProductScreen.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public final class SingleProductScreen: ScreenObject {
3232
}
3333

3434
public func addProductTitle(productTitle: String) throws -> Self {
35-
app.cells["product-title"].tap()
36-
app.cells["product-title"].typeText(productTitle)
35+
app.cells["product-title"].enterText(text: productTitle)
3736
return self
3837
}
3938

@@ -42,8 +41,9 @@ public final class SingleProductScreen: ScreenObject {
4241
return self
4342
}
4443

45-
public func verifyNewProductScreenLoaded() {
44+
public func verifyNewProductScreenLoaded(productName: String) {
4645
XCTAssertTrue(app.buttons["save-product-button"].exists)
4746
XCTAssertTrue(app.staticTexts["TIP"].exists)
47+
XCTAssertTrue(app.textViews[productName].exists)
4848
}
4949
}

WooCommerce/UITestsFoundation/XCTest+Extensions.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ extension XCUIElement {
2222
self.tap()
2323
self.typeText(text)
2424
}
25+
26+
func enterText(text: String) -> Void {
27+
self.tap()
28+
self.typeText(text)
29+
}
2530
}
2631

2732
extension XCTestCase {

WooCommerce/WooCommerceUITests/Tests/ProductsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ final class ProductsTests: XCTestCase {
55

66
let productTypes = [
77
"physical": "Simple physical product",
8-
"virtual": "Virtual physical product",
8+
"virtual": "Simple virtual product",
99
"variable": "Variable product",
1010
"grouped": "Grouped product",
1111
"external": "External product"
@@ -40,6 +40,6 @@ final class ProductsTests: XCTestCase {
4040
.selectProductType(productType: productTypes["physical"]!)
4141
.addProductTitle(productTitle: product.name)
4242
.publishProduct()
43-
.verifyNewProductScreenLoaded()
43+
.verifyNewProductScreenLoaded(productName: product.name)
4444
}
4545
}

0 commit comments

Comments
 (0)