1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.test.ui.administration

File RegisterFromAdministrationTest.java

 

Code metrics

0
7
3
1
68
36
3
0.43
2.33
3
1

Classes

Class Line # Actions
RegisterFromAdministrationTest 35 7 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.test.ui.administration;
21   
22    import org.openqa.selenium.By;
23    import org.xwiki.administration.test.po.LightBoxRegistrationPage;
24    import org.xwiki.test.ui.po.AbstractRegistrationPage;
25    import org.xwiki.test.ui.RegisterTest;
26    import org.xwiki.test.ui.TestUtils;
27   
28    /**
29    * Test the Admin->Users->AddNewUser feature by executing the same tests as in RegisterTest but from
30    * the lightbox from Admin->Users->AddNewUser.
31    *
32    * @version $Id: 0043b203e52e7ea3cedd887217777008062c3d37 $
33    * @since 2.4M2
34    */
 
35    public class RegisterFromAdministrationTest extends RegisterTest
36    {
 
37  7 toggle @Override
38    protected void switchUser()
39    {
40  7 getDriver().get(getUtil().getURLToLoginAsAdmin());
41  7 getUtil().recacheSecretToken();
42  7 getUtil().setDefaultCredentials(TestUtils.ADMIN_CREDENTIALS);
43    }
44   
 
45  8 toggle @Override
46    protected AbstractRegistrationPage getRegistrationPage()
47    {
48  8 return LightBoxRegistrationPage.gotoPage();
49    }
50   
 
51  2 toggle @Override
52    protected boolean tryToRegister()
53    {
54  2 registrationPage.clickRegister();
55   
56  2 getDriver().waitUntilElementsAreVisible(
57    new By[] {By.xpath("//td[@class='username']/a[@href='/xwiki/bin/view/XWiki/JohnSmith']"),
58    By.xpath("//dd/span[@class='LV_validation_message LV_invalid']")
59    },
60    false
61    );
62   
63  2 return !getDriver()
64    .findElements(
65    By.xpath("//td[@class='username']/a[@href='/xwiki/bin/view/XWiki/JohnSmith']"))
66    .isEmpty();
67    }
68    }