2017-11-22 13 views
1

동일한 테스트를 두 번 실행하면 두 번째 오류가 발생합니다.iOS : 동일한 테스트를 두 번 실행 한 후 Earlgrey/Detox 오류가 발생했습니다.

단계 재현하기 :

이 테스트를 통과 :

describe('Login',() => { 
    beforeEach(async() => { 
    await device.reloadReactNative(); 
    }); 

    it('should not login', async() => { 
    await waitFor(element(by.id('welcome'))) 
     .toBeVisible() 
     .withTimeout(5000); 

    await element(by.id('EmailField')).clearText(); 
    await element(by.id('EmailField')).typeText('wronggmail.com'); 
    await element(by.id('PasswordField')).clearText(); 
    await element(by.id('PasswordField')).typeText('wrongpass'); 

    await element(by.id('LoginButton')).tap(); 

    await waitFor(element(by.id('Home'))) 
     .toBeNotVisible() 
     .withTimeout(10000); 
    }); 
}); 

이 실패

describe('Login',() => { 
    beforeEach(async() => { 
    await device.reloadReactNative(); 
    }); 

    it('should not login', async() => { 
    await waitFor(element(by.id('welcome'))) 
     .toBeVisible() 
     .withTimeout(5000); 

    await element(by.id('EmailField')).typeText('wronggmail.com'); 
    await element(by.id('PasswordField')).typeText('wrongpass'); 

    await element(by.id('LoginButton')).tap(); 

    await waitFor(element(by.id('Home'))) 
     .toBeNotVisible() 
     .withTimeout(10000); 
    }); 

    it('should not login', async() => { 
    await waitFor(element(by.id('welcome'))) 
     .toBeVisible() 
     .withTimeout(5000); 

    await element(by.id('EmailField')).typeText('wronggmail.com'); 
    await element(by.id('PasswordField')).typeText('wrongpass'); 

    await element(by.id('LoginButton')).tap(); 

    await waitFor(element(by.id('Home'))) 
     .toBeNotVisible() 
     .withTimeout(10000); 
    }); 
}); 

해독, 노드, 장치, 엑스 코드와 맥 OS 버전

,134,
  • 장치 : 아이폰 6 아이폰 OS 11.1 (시뮬레이터)

장치 및 자세한 해독 로그

$ npm run test-e2e 

> [email protected] test-e2e /Users/gianfranco/temp/myRN 
> jest e2e --setupTestFrameworkScriptFile=./e2e/init.js --bail 

server listening on localhost:51830... 
: Searching for device matching iPhone 6... 
: Uninstalling com.onova.app... 
: com.onova.app uninstalled 
: Installing /Users/gianfranco/temp/myRN/ios/build/Build/Products/Debug-iphonesimulator/myRN.app... 
: /Users/gianfranco/temp/myRN/ios/build/Build/Products/Debug-iphonesimulator/myRN.app installed 
: Terminating com.onova.app... 
: com.onova.app terminated 
: Launching com.onova.app... 
6: com.onova.app launched. The stdout and stderr logs were recreated, you can watch them with: 
     tail -F $HOME/Library/Developer/CoreSimulator/Devices/C8A0B6F9-5751-4C97-8069-0288C7F928B8/data/tmp/detox.last_launch_app_log.{out,err} 
FAIL e2e/Login.spec.js (15.641s) 
    Login 
    ✓ should not login (7616ms) 
    ✕ should not login (1639ms) 

    ● Login › should not login 

    Error: An action failed. Please refer to the error trace below. 
    Exception with Action: { 
     "Action Name" : "Clear text", 
     "Element Matcher" : "(((respondsToSelector(accessibilityIdentifier) && accessibilityID('EmailField')) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((respondsToSelector(accessibilityIdentifier) && accessibilityID('EmailField')) && kindOfClass('RCTScrollView'))))))" 
    } 

    Error Trace: [ 
     { 
     "Description" : "First responder [F] of element [E] does not conform to UITextInput protocol.", 
     "Description Glossary" :  { 
      "F" : "<RCTRootView: 0x7fd5b7c13d90; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x60800003da40>>", 
      "E" : "<RCTUITextField: 0x7fd5b8876000; baseClass = UITextField; frame = (0 0; 375 36); text = '[email protected]'; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x600000241bf0>; layer = <CALayer: 0x608000238080>>" 
     }, 
     "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain", 
     "Error Code" : "2", 
     "File Name" : "GREYActions.m", 
     "Function Name" : "+[GREYActions grey_actionForTypeText:atUITextPosition:]_block_invoke", 
     "Line" : "547" 
     } 
    ] 

     at Client._callee8$ (node_modules/detox/lib/client/Client.js:58:19) 
     at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40) 
     at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:337:22) 
     at Generator.prototype.(anonymous function) [as throw] (node_modules/regenerator-runtime/runtime.js:96:21) 
     at step (node_modules/detox/lib/client/Client.js:1:836) 
     at node_modules/detox/lib/client/Client.js:1:1035 
     at tryCallOne (node_modules/promise/lib/core.js:37:12) 
     at node_modules/promise/lib/core.js:123:15 
     at flush (node_modules/asap/raw.js:50:29) 
     at _combinedTickCallback (internal/process/next_tick.js:131:7) 
     at process._tickCallback (internal/process/next_tick.js:180:9) 

Test Suites: 1 failed, 1 total 
Tests:  1 failed, 1 passed, 2 total 
Snapshots: 0 total 
Time:  15.713s 
Ran all test suites matching /e2e/i. 

문제가 될 수 있는지에 어떤 아이디어?

+2

너무 확실하지하지만 어떻게 필드가 실패하는 테스트에서 볼 수 기다리고에 대해 :. 기대 기다리고 있습니다 (요소 (by.id ('을 emailField'))) toBeVisible(); .typeText()를 사용하기 전에 .tap()을 시도해보십시오. – Nemoverflow

+0

@Nemoverflow 그게 다야! 키보드는 이상한 일을하고있었습니다. '.tap()'을하기 전에'typeText()'가 작동했습니다! 고마워요. :) –

+2

@Nemoverflow이 질문을 해결할 수 있도록 답변으로 게시 하시겠습니까? – Antoni4

답변

0

답변 양식에 질문을 게시하십시오. 지연 돼서 죄송합니다.

.typeText()를 시작하기 전에 .tap()을 사용해보십시오. 이것에 대한

[...] 
await expect(element(by.id('EmailField'))).toBeVisible(); 
await element(by.id('EmailField')).tap(); 
[...]