1 package org.apache.archiva.web.test;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
23 import org.junit.Test;
26 * Based on LoginTest of Emmanuel Venisse test.
28 * @author José Morales MartÃnez
33 public class LoginTest
34 extends AbstractArchivaTest
38 public void testWithBadUsername()
41 setFieldValue( "user-login-form-username", "badUsername" );
42 clickLinkWithLocator( "modal-login-ok", true );
43 assertTextPresent( "This field is required." );
48 public void testWithBadPassword()
51 setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
52 setFieldValue( "user-login-form-password", "badPassword" );
53 clickLinkWithLocator( "modal-login-ok", true );
54 assertTextPresent( "You have entered an incorrect username and/or password" );
58 public void testWithEmptyUsername()
61 setFieldValue( "user-login-form-password", "password" );
62 clickLinkWithLocator( "modal-login-ok", true );
63 assertTextPresent( "This field is required." );
67 public void testWithEmptyPassword()
70 setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
71 clickLinkWithLocator( "modal-login-ok", true );
72 assertTextPresent( "This field is required." );
76 public void testWithCorrectUsernamePassword()
79 setFieldValue( "user-login-form-username", getProperty( "ADMIN_USERNAME" ) );
80 setFieldValue( "user-login-form-password", getProperty( "ADMIN_PASSWORD" ) );
81 clickLinkWithLocator( "modal-login-ok", true );
83 assertUserLoggedIn( getProperty( "ADMIN_USERNAME" ) );