Problem with run all tetst in case - cant find element


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. obraz

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.

add your code. without it we only gambling …

I attached files with tests, page, basePage
ActivationPage.txt (4.7 KB) ActivationTests.txt (5.5 KB) BasePage.txt (952 Bytes)

cause on step2 you execute FillFirstStep which goes away from ActivationPage

while SetUp() executed ONLY one time before start tests.

You need return to ActivationPage on step3 to continue

I have to include activationPage = welcomePage.GoToActivatePage(); in each test?
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.

you have test and you can see what not correct. We do not know what happen with your app on phone to help you.

yes it takes few seconds. But what it step before fails? How to proceed with next test while having app in unknown state?

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.

In your opinion what I schould do:

  • install and activate app in manual way? - the tests will start from login page
  • each test have to start from activate app

Maby other idea… ?

I do it in following way with any suite:

  • 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.
  • now run tests with open driver setting just start app
    more to read -> Different capabilities for different scenarios

Logically we have suites:

  • 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.

I imaine that I will… in BaseTest-> setUp use if statement and recognize that is activatePage or loginPage.
In test setUp use user/login/pin.

Any idea about main problem of this topic? I also would like testing activation screens. So the plan will be something like that:

  1. install app
  2. run 1st step test
  3. uninstall app
  4. install app
  5. run 2nd step test
  6. uninstall app
  7. install app
  8. run 3th step test

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.

No, I don’t do that. App is installed only one time - manually.

I also get error

OpenQA.Selenium.StaleElementReferenceException : Cached elements 'By.xpath: //android.widget.EditText' do not exist in DOM anymore

In debug mode all working good :confused: