I writeen test cases for activation process in my app. Activation process contains 5 steps, each step is a single view/page. When I run my tests 1st and 2nd steps are pass but other tests in case fail.
The reason of fail is:
OpenQA.Selenium.WebDriverTimeoutException : Timed out after 10 seconds
----> OpenQA.Selenium.NoSuchElementException : An element could not be located on the page using the given search parameters.
When I run single test case is working but in group no. Where is the problem?
I use wait for element present/visible.
My idea for testing this app is at first activate app, no rest app and lofin to app in other test cases.
I have to include activationPage = welcomePage.GoToActivatePage(); in each test?
or
Each step makes as a class and return next step? ex in firstStep return secondStep …
this is all up to you.
for example I wrote mine tests to start app from zero. fresh start.
in such way each test is fully independent from another one.
I have to include activationPage = welcomePage.GoToActivatePage(); in each test?
Not working - same problems with find element.
Maby I don’t understand how write a tests for this app :(. Fresh start app on every test is ok and maby the best way. But fresh start it makes activate before tests. It caused that tests will run to much time.
Other way is skip testing activation process and activate app only one time before tests in baseTest.
My app after installed need to activate. Next time app is active and after run app I have to use pin to login to app.
So app activate is only one time, after installed app.
I would in ma tests:
install app
activate app only one time
next tests should login by pin
In BaseTest in setUp I create new driver with caps, and app start again:
driver = new DriverFactory().Create(config.PlatformName, config.IsRemote);
So when ActivateTests check all elements and activate app, every next test will start when app is activate. In other test I will use pin to login to app.
You know… activation is only one time, normal state is when app is activate and user use pin to login to app.
yes. but anything can go wrong. app, network or server. next test should be able to try activate and login. also imagine later you making tests executing on multiple devices simultaneously.
step one is install app on all phones under test. just start appium driver in full reset mode and logout in app if it logged in. normally we do not know what user it is.
that uses logged in users and use mostly PIN to login (let say: suite 1)
that need special users or create new users and start full login in each test (lets say: suite 2)
Now with suite 1 we have login function that able to login from any state:
user logged out (not activated in your case)
user logged in and need only PIN
we just detect what screen we have now and taking decision to continue with full login or only PIN. Using only pin login we save test time and speedup tests.
1 why you install app each time?
2 the idea of topic is that you need to fix your code and make it more stable. Right now in your code in test2 you navigate to some other screen that you expecting to see in next test3.