This is a migrated thread and some comments may be shown as answers.

Admin vs regular user tests...

4 Answers 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 11 May 2011, 04:25 PM
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

4 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 11 May 2011, 08:10 PM
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...
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 11 May 2011, 08:26 PM
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
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 11 May 2011, 10:25 PM
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
0
Daniel Djambov
Telerik team
answered on 13 May 2011, 03:17 PM
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 >>

Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Daniel Djambov
Telerik team
Share this question
or