DRT gets stuck on "Already impersonating; click here to change back to brian.pratt@insilicos.com."

LabKey Support Forum (Inactive)
DRT gets stuck on "Already impersonating; click here to change back to brian.pratt@insilicos.com." Brian Pratt  2009-09-30 15:17
Status: Closed
 
Feels like I've gotten myself into some halfway state - any ideas on how to reset so DRT succeeds?

When I hit this state I then have to go in and get rid of all the users created during the security test, should I also be getting rid of myself? Neither scenario seems to lead to success, maybe there's something more fundamental that needs hosing out?

Thanks,

Brian
 
 
adam responded:  2009-09-30 17:55
Which test is this... SecurityTest?

Nothing obvious comes to mind -- it doesn't seem to be a problem on TeamCity. Easiest is probably for you to debug it to find out exactly what line is causing the problem. Create a new IntelliJ remote Run/Debug configuration for localhost:5005; call it "drt". Invoke the test in debug mode:

    ant drt-debug -Dtest=security

After starting up, the test will wait for you to connect to port 5005. In IntelliJ, set a breakpoint before the problematic statement, select your "drt" configuration, and debug. The test will continue and you can step through the statements. Adding log statements might be helpful as well.

BTW, you shouldn't have to manually clean anything up -- you can clean up after a single test using -Dcleanonly=true, so:

    ant drt -Dtest=security -Dcleanonly=true

In addition, every test should clean up before running.
 
Brian Pratt responded:  2009-09-30 18:02
Correct, it's the security test. Somehow it's getting to a state where it's trying to impersonate while already impersonating. This is so not what I'm interested in that I'd happily just nuke something to move past this, but I can debug if need be.

I also have that "hangs on replace" problem with the Build target in ant (but not on commandline), makes me wonder if my (WinXP) system isn't hosed somehow.
 
adam responded:  2009-09-30 18:12
The test intentionally attempts to impersonate while impersonating -- it's checking to make sure the right thing happens in this case (the message in your subject is supposed to appear). It's likely that something immediately after this check is failing, perhaps delete user.

Several of us have seen the "hang on replace" problem when invoking ant from within IntelliJ -- no ideas there either, but I doubt it has anything to do with this issue.
 
Brian Pratt responded:  2009-10-01 13:14
Sure enough I was misunderstanding the problem - it's actually failing because it can't find the Delete button - although it's right there. Maybe I'll try switching browsers, although I imagine Firefox (I have 3.5.3) is the one that's actually preferred.
 
Brian Pratt responded:  2009-10-01 15:57
OK, absolutely stumped. I thought maybe it's a race condition, as the Delete button is greyed out until the username is checked (and it does get checked), but even a sleep(10000) and a log call don't seem to fix that. Any selenium jockeys sensing anything familiar here?

...
    [junit] 15:51:31,250 Checking for link with exact text 'Projects'
    [junit] 15:51:31,265 Checking for link with exact text 'Site Users'
    [junit] 15:51:31,265 Clicking link with text 'Site Users'
    [junit] 15:51:31,281 selenium - Clicking on element: link=Site Users
    [junit] 15:51:31,796 Checking checkbox //a[text()="details"]/../../td[text()="delete_me@security.test"]/../td[1]/input
    [junit] 15:51:31,796 selenium - Clicking on element: //a[text()="details"]/.
./../td[text()="delete_me@security.test"]/../td[1]/input
    [junit] 15:51:31,828 trying to delete user [bpratt added log message]...
    [junit] 15:51:43,187 =============== Completed SecurityTest (1 of 1) =================
    [junit]
    [junit] testSteps(org.labkey.test.drt.SecurityTest)
    [junit] junit.framework.AssertionFailedError: No button found with text "Delete"
    [junit] at org.labkey.test.BaseSeleniumWebTest.clickButton(BaseSeleniumWebTest.java:2069)
    [junit] at org.labkey.test.BaseSeleniumWebTest.clickNavButton(BaseSeleniumWebTest.java:2093)
...
 
Matthew Bellew responded:  2009-10-01 17:35
I gave up on trying the DRTs with Firefox 3.5. I uninstalled it and went back to the previous version (which I can't recall right now). In theory, you can have both installed, you just need to specify the path. Something like this

ant drt -Dselenium.browser=*firefox3 c:\Program Files\Mozilla Firefox3\firefox.exe
 
Brian Pratt responded:  2009-10-01 17:37
OK, good to know, thanks. This has been making me crazy.
 
Brian Pratt responded:  2009-10-02 09:38
Title: DRT does not work with Firefox 3.5
Yeah, that was the entire issue. Rolled firefox back to 3.0 and DRT security test completes without issue.

This needs to go into the developer notes in BIG RED LETTERS, I burned a boatload of time on this.
 
eknelson responded:  2009-10-02 11:27
Indeed, this definitely needs to go in the docs -- thanks for letting me know. I've updated the relevant doc page (https://www.labkey.org/wiki/home/Documentation/page.view?name=checkin) as follows:

-------------------
**Note:** As of October 2009, you must be running **Firefox 3.0,** ~~not 3.5,~~ to successfully run the DRTs. If you are running Firefox 3.5, the DRT will fail when it cannot find certain buttons. A typical error message you might see is 'No button found with text "Delete"'. In theory, you are can have both versions of Firefox installed, as long as you specify the path to Firefox 3.0 when you run the DRT. You can use something along the lines of:

ant drt -Dselenium.browser=*firefox3 c:Program FilesMozilla Firefox3firefox.exe
-------------------

Thanks,

Elizabeth
 
adam responded:  2009-10-02 12:13
That page hadn't been touched in a few years; I just did a rewrite to bring it up-to-date again.
 
adam responded:  2010-01-23 10:05
Update: Tests now support Firefox 3.5, thanks to Kevin. See https://www.labkey.org/announcements/home/Developer/Forum/thread.view?rowId=3690
 
Brian Pratt responded:  2010-01-24 20:54
Yeah, I went ahead and tried 3.5 when I saw that post, and can confirm that it works great.