001/*
002 * (C) Copyright 2016 Nuxeo SA (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 *     Thomas Roger
018 *
019 */
020
021package org.nuxeo.functionaltests.pages.profile;
022
023import org.nuxeo.functionaltests.Required;
024import org.nuxeo.functionaltests.pages.AbstractPage;
025import org.nuxeo.functionaltests.pages.UserHomePage;
026import org.openqa.selenium.WebDriver;
027import org.openqa.selenium.WebElement;
028import org.openqa.selenium.support.FindBy;
029
030/**
031 * @since 8.3
032 */
033public class EditProfilePage extends AbstractPage {
034
035    @Required
036    @FindBy(id = "editUser:nxl_user_1:nxw_email_1")
037    WebElement emailInput;
038
039    @Required
040    @FindBy(id = "editUser:nxl_userprofile_1:nxw_birthdate_1InputDate")
041    WebElement birthDateInput;
042
043    @Required
044    @FindBy(id = "editUser:nxl_userprofile_1:nxw_phonenumber_1")
045    WebElement phoneNumberInput;
046
047    @Required
048    @FindBy(xpath = "//input[@value=\"Save\"]")
049    WebElement saveButton;
050
051    public EditProfilePage(WebDriver driver) {
052        super(driver);
053    }
054
055    public EditProfilePage setEmail(String email) {
056        emailInput.sendKeys(email);
057        return asPage(EditProfilePage.class);
058    }
059
060    public EditProfilePage setBirthDate(String birthDate) {
061        birthDateInput.sendKeys(birthDate);
062        return asPage(EditProfilePage.class);
063    }
064
065    public EditProfilePage setPhoneNumber(String phoneNumber) {
066        phoneNumberInput.sendKeys(phoneNumber);
067        return asPage(EditProfilePage.class);
068    }
069
070    public UserHomePage saveProfile() {
071        saveButton.click();
072        return asPage(UserHomePage.class);
073    }
074}