001/* 002 * (C) Copyright 2017 Nuxeo (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Funsho David 018 * 019 */ 020 021package org.nuxeo.functionaltests.pages.shibboleth; 022 023import org.nuxeo.functionaltests.JavaScriptErrorCollector; 024import org.nuxeo.functionaltests.Required; 025import org.nuxeo.functionaltests.pages.LoginPage; 026import org.openqa.selenium.WebDriver; 027import org.openqa.selenium.WebElement; 028import org.openqa.selenium.support.FindBy; 029 030/** 031 * @since 9.10 032 */ 033public class ShibbolethLoginPage extends LoginPage { 034 035 @Required 036 @FindBy(name = "j_username") 037 protected WebElement shibUsernameInputTextBox; 038 039 @Required 040 @FindBy(name = "j_password") 041 protected WebElement shibPasswordInputTextBox; 042 043 @Required 044 @FindBy(className = "form-button") 045 protected WebElement submitButton; 046 047 public ShibbolethLoginPage(WebDriver driver) { 048 super(driver); 049 } 050 051 @Override 052 public void login(String username, String password) { 053 JavaScriptErrorCollector.from(driver) 054 .ignore(JavaScriptErrorCollector.JavaScriptErrorIgnoreRule.startsWith( 055 "SyntaxError: expected expression")) 056 .checkForErrors(); 057 shibUsernameInputTextBox.sendKeys(username); 058 shibPasswordInputTextBox.sendKeys(password); 059 submitButton.click(); 060 } 061 062}