/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 * 
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.keycloak.testsuite.console.page.clients.credentials;

import org.keycloak.testsuite.page.Form;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;

/**
 *
 * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
 */
public class ClientCredentialsForm extends Form {

    @FindBy(id = "clientAuthenticatorType")
    private Select clientAuthenticatorType;
    
    @FindBy(xpath = "//button[text()='Regenerate Secret']")
    private WebElement regenerateSecretButton;

    @FindBy(xpath = "//button[text()='Generate new keys and certificate']")
    private WebElement generateNewKeysAndCert;
    
    @FindBy(xpath = "//button[text()='Regenerate registration access token']")
    private WebElement regenerateRegistrationAccessTokenButton;
    
    public void selectClientIdAndSecret() {
        clientAuthenticatorType.selectByVisibleText("Client Id and Secret");
    }
    
    public void selectSignedJwt() {
        clientAuthenticatorType.selectByVisibleText("Signed Jwt");
    }

    public void regenerateSecret() {
        regenerateSecretButton.click();
    }

    public void regenerateRegistrationAccessToken() {
        regenerateRegistrationAccessTokenButton.click();
    }

    public void generateNewKeysAndCert() {
        generateNewKeysAndCert.click();
    }
}

@@ -1253,16 +1253,71 @@
 .Select;
+%0Aimport static org.keycloak.testsuite.util.WaitUtils.*;
 %0A%0A/**%0A *
@@ -1527,20 +1527,16 @@
 orType;%0A
-    
 %0A    @Fi
@@ -1562,33 +1562,40 @@
 ton%5B
-text()='Regenerate Secret
+@data-ng-click='changePassword()
 '%5D%22)
@@ -1641,16 +1641,37 @@
 tButton;
+ // Regenerate Secret
 %0A%0A    @F
@@ -1698,49 +1698,44 @@
 ton%5B
-text()='G
+@data-ng-click='g
 enerate
- new keys and certificate
+SigningKey()
 '%5D%22)
@@ -1781,16 +1781,53 @@
 AndCert;
+ // Generate new keys and certificate
 %0A    %0A  
@@ -1858,17 +1858,25 @@
 ton%5B
-text()='R
+@data-ng-click='r
 egen
@@ -1880,18 +1880,17 @@
 generate
- r
+R
 egistrat
@@ -1896,21 +1896,21 @@
 tion
- a
+A
 ccess
- t
+T
 oken
+()
 '%5D%22)
@@ -1973,16 +1973,56 @@
 nButton;
+ // Regenerate registration access token
 %0A    %0A  
@@ -2290,32 +2290,97 @@
 erateSecret() %7B%0A
+        waitUntilElement(regenerateSecretButton).is().visible();%0A
         regenera
@@ -2460,24 +2460,106 @@
 ssToken() %7B%0A
+        waitUntilElement(regenerateRegistrationAccessTokenButton).is().visible();%0A
         rege
@@ -2649,24 +2649,89 @@
 AndCert() %7B%0A
+        waitUntilElement(generateNewKeysAndCert).is().visible();%0A
         gene

Fix ClientCredentialsForm (cherry picked from commit 3e825bf)