From cb45b4f9e2e4fd38ebc39b1b6e4e30385c1df164 Mon Sep 17 00:00:00 2001 From: Canhua Li Date: Sun, 15 Nov 2020 14:24:58 -0800 Subject: [PATCH] Fix the test error when connect with YWinAppDriver --- example/Pages/CalculatorPage.ts | 4 ++-- example/__tests__/Calculator.test.ts | 2 +- example/__tests__/CalculatorWithPageObject.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/Pages/CalculatorPage.ts b/example/Pages/CalculatorPage.ts index 321cb42..431f093 100644 --- a/example/Pages/CalculatorPage.ts +++ b/example/Pages/CalculatorPage.ts @@ -15,8 +15,8 @@ class CalculatorPage extends PageObject { get clearButton() { return By2.nativeName('Clear'); } get plusButton() { return By2.nativeName('Plus'); } get divideButton() { return By2.nativeAccessibilityId('divideButton'); } - get multiplyButton() { return By2.nativeXpath("//Button[@Name='Multiply by']") } - get minusButton() { return By2.nativeXpath("//Button[@AutomationId=\"minusButton\"]"); } + get multiplyButton() { return By2.nativeAccessibilityId("multiplyButton") } + get minusButton() { return By2.nativeAccessibilityId("minusButton"); } get button0() { return By2.nativeAccessibilityId('num0Button'); } get button1() { return By2.nativeAccessibilityId('num1Button'); } get button2() { return By2.nativeAccessibilityId('num2Button'); } diff --git a/example/__tests__/Calculator.test.ts b/example/__tests__/Calculator.test.ts index b87e0f2..3cf5a70 100644 --- a/example/__tests__/Calculator.test.ts +++ b/example/__tests__/Calculator.test.ts @@ -26,7 +26,7 @@ async function getCalculatorResultText() { describe('Addition', () => { // Applies only to tests in this describe block beforeEach(() => { - return By2.nativeName('Clear').clear(); + return By2.nativeName('Clear').click(); }); test('Addition', async () => { // Find the buttons by their names and click them in sequence to perform 1 + 7 = 8 diff --git a/example/__tests__/CalculatorWithPageObject.test.ts b/example/__tests__/CalculatorWithPageObject.test.ts index aad663a..0c25047 100644 --- a/example/__tests__/CalculatorWithPageObject.test.ts +++ b/example/__tests__/CalculatorWithPageObject.test.ts @@ -24,7 +24,7 @@ describe('Calulator Test', () => { // Applies only to tests in this describe block beforeEach(async () => { await CalculatorPage.waitForPageLoaded(); - await CalculatorPage.clearButton.clear(); + await CalculatorPage.clearButton.click(); }); test('Addition', async () => { // Find the buttons by their names and click them in sequence to perform 1 + 7 = 8