Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
660 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...