Admin vs regular user tests...

5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 May 2011 Link to this post

    Ok so I have the databound logins working

    So now on certain pages Admins can see things other users cant (like a RadButton)

    How do I go about writing the test so that the step passes (looking for the button) in both cases?...like admin=visible, regular=invisible
  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 May 2011 Link to this post

    I guess what I'd like to do is right-click on the element in the explorer which i found as admin...then create a new validation step off of that to say element is not visible...

    If possible I'd like to do it without a coded step, but I guess I could convert it to one...
  3. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 May 2011 Link to this post

    Should I not be able to do this?

    Assert.IsTrue(!Pages.CTPortfolio_defaultaspx.CreateNewButton.IsVisible());

    The test fails, and I don;t to duplicate the code from the selector for the CreateNewButton if possible
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 11 May 2011 Link to this post

    So this is what I came up with...grab the current data bound index and validate

    var item = ActiveBrowser.Find.ById("~adminAllUsersComboBox");
     
    if (this.Data["Username"].ToString() == "steve@medportal.ca") {
        Assert.IsTrue(item != null);               
    }
    else {
        Assert.IsTrue(item == null);
    }

    Easier way?...or coded steps are the only way
  5. Daniel Djambov
    Admin
    Daniel Djambov avatar
    62 posts

    Posted 13 May 2011 Link to this post

    Hello Steve,

    We also provide ability to use logical steps without using code - you can find more about it here:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/logical-steps/if-else.aspx

    Basically you can do verification if an element, that is specific for admin only and if this is visible to execute some specific steps, if not to execute other steps, specific for the other users.

    Hopefully it will be what you are looking for.

    All the best,
    Daniel Djambov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!