Results 1 to 4 of 4

Thread: Running concurrent tests with different users

  1. #1
    Sencha User
    Join Date
    Mar 2020
    Posts
    16
    Answers
    1

    Default Answered: Running concurrent tests with different users

    The application I am testing doesn't have a logout button, but when you first load the application a login screen appears. When the correct login details are entered the application is loaded and tests can be carried out in Sencha Test. Different options are available to the user depending upon whether they are an Administrator, Power User or just a User logging in.

    I have written a suite of tests that I run as an Administrator, then run through slightly adapted tests as a Power User and then a User. When I run all the Administrator tests they pass, if I then run the Power User tests they pass and similarly for the User tests, but when tests are run concurrently and there isn't any way of logging out of the application I am not able to login as a different user and the Power User and User tests fail. It seems that the tests are run with one browser instance and that browser session will continue to use the first credentials it used to log in. I thought Sencha Test would use a different browser session so that it wouldn't remember the login details, especially as I have taken the options of 'Disable browser cache'.

    Does anyone know how to force a new browser session so that new login credentials are required if running my tests concurrently?

    Thanks.

  2. One possible option would be to split your tests up in to different Scenarios in Sencha Test - a different scenario for a different user level.

    Each scenario can either store tests in its own separate folder, where you have tests that are unique for each user type, or alternatively you can have separate scenarios that point to the same folder on disk, so you can share the same tests but change the URL used for each scenario. In order for a scenario to share its folder with another scenario, you first need to enable the "Allow scenarios to use the same directory" checkbox under Preferences.

    If your scenarios shared the same tests, you could then tag on a querystring parameter to the URL on each scenario, e.g. "?usertype=admin", which your test could then check for (by using the "ST.getUrl()" function) and would therefore know which user to login as based on the specified user type.

  3. #2
    Sencha User
    Join Date
    Mar 2020
    Posts
    16
    Answers
    1

    Default

    I have now found out that navigating to the base url with a '/logout' suffixed onto the end logs out of the current Sencha app, which solves my initial problem, but now the problem is it is not using the appended url in the scenario. Sencha Test is navigating to the base url in the mail project settings. I guess this is because I have run the following and forced it to navigate to the logout url:

    Code:
    var currentURL=url;
                var indexStart = currentURL.indexOf(".com");
                var logoutURL = currentURL.slice(0,indexStart+4)+"/logout";
                ST.navigate(logoutURL);
    How do I access and navigate to the url setup in the Senario currently being tested rather than the main url in the main project settings after the above code has been run?

  4. #3
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    London, England
    Posts
    396
    Answers
    75

    Default

    One possible option would be to split your tests up in to different Scenarios in Sencha Test - a different scenario for a different user level.

    Each scenario can either store tests in its own separate folder, where you have tests that are unique for each user type, or alternatively you can have separate scenarios that point to the same folder on disk, so you can share the same tests but change the URL used for each scenario. In order for a scenario to share its folder with another scenario, you first need to enable the "Allow scenarios to use the same directory" checkbox under Preferences.

    If your scenarios shared the same tests, you could then tag on a querystring parameter to the URL on each scenario, e.g. "?usertype=admin", which your test could then check for (by using the "ST.getUrl()" function) and would therefore know which user to login as based on the specified user type.
    Daniel Gallo

  5. #4
    Sencha User
    Join Date
    Mar 2020
    Posts
    16
    Answers
    1

    Default

    Thanks Daniel.

    I can see that your your solution will work, and it won't be too difficult to change the directory structure of my tests.

    Many thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •