Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
643 views
in Technique[技术] by (71.8m points)

e2e testing - start at certain point in e2e test using Detox in react native

I am writing a e2e test to a react native app(-v : 0.63.4) using Detox (-v : 18.2.2) the app contains several screens and I want to start at certain point in the test while I am writing it just to spare time by writing the test and not start every time from the beginning because I run the test while I am writing it to check if everything like I want it to be I know it is called e2e test but is there a way to do that ?

question from:https://stackoverflow.com/questions/66047053/start-at-certain-point-in-e2e-test-using-detox-in-react-native

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Edit: I should mention I'm using Jest as a test-runner, I don't know if you're using Jest, but I'll leave this here for now anyway.

The way I'm doing it in my project now is to use the .only function on my tests. https://jestjs.io/docs/en/api#testonlyname-fn-timeout

test.only('the user can continue to account creation', async () => {
  await element(by.id('continueButton')).tap()
  await expect(element(by.id('accountCreationScreen'))).toBeVisible()
})

Notice though, that in my case I have to keep the tests that logs a user in to the app. But that's fine for me, I still skip all the other tests. Hope that works out for you, or helps in some way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...