Documentation and code polishing

This commit is contained in:
Martin Bartoš 2021-12-06 09:07:41 +01:00 committed by Marek Posolda
parent 8e1c1af5c6
commit 12fe5e0012
2 changed files with 4 additions and 76 deletions

View file

@ -529,6 +529,9 @@ Then run the WebAuthn tests as above with the additional system property for spe
-DchromeDriverVersion=77.0.3865.40
```
**For Windows**: Probably, you encounter issues with execution those tests on the Windows platform due to Chrome Driver is not available.
In this case, please define the path to the local Chrome Driver by adding this property `-Dwebdriver.chrome.driver=C:/path/to/chromedriver.exe`.
**Warning:** Please, be aware the WebAuthn tests are still in a development phase and there is a high chance those tests will not be stable.
## Social Login

View file

@ -75,8 +75,7 @@ public class SigningInTest extends BaseAccountPageTest {
@Page
private OTPSetup otpSetupPage;
/* @Page
private WebAuthnRegisterPage webAuthnRegisterPage;*/
private SigningInPage.CredentialType passwordCredentialType;
private SigningInPage.CredentialType otpCredentialType;
@ -249,67 +248,6 @@ public class SigningInTest extends BaseAccountPageTest {
testRemoveCredential(otp1);
}
/* @Test
public void twoFactorWebAuthnTest() {
testWebAuthn(false);
}
@Test
public void passwordlessWebAuthnTest() {
testWebAuthn(true);
}
private void testWebAuthn(boolean passwordless) {
testContext.setTestRealmReps(emptyList());
SigningInPage.CredentialType credentialType;
final String expectedHelpText;
final String providerId;
if (passwordless) {
credentialType = webAuthnPwdlessCredentialType;
expectedHelpText = "Use your security key for passwordless sign in.";
providerId = WebAuthnPasswordlessRegisterFactory.PROVIDER_ID;
}
else {
credentialType = webAuthnCredentialType;
expectedHelpText = "Use your security key to sign in.";
providerId = WebAuthnRegisterFactory.PROVIDER_ID;
}
assertFalse(credentialType.isSetUp());
// no way to simulate registration cancellation
assertTrue("Set up link for \"" + credentialType.getType() + "\" is not visible", credentialType.isSetUpLinkVisible());
assertEquals("Security Key", credentialType.getTitle());
assertEquals(expectedHelpText, credentialType.getHelpText());
final String label1 = "WebAuthn is convenient";
final String label2 = "but not yet widely adopted";
SigningInPage.UserCredential webAuthn1 = addWebAuthnCredential(label1, passwordless);
assertTrue(credentialType.isSetUp());
assertEquals(1, credentialType.getUserCredentialsCount());
assertUserCredential(label1, true, webAuthn1);
SigningInPage.UserCredential webAuthn2 = addWebAuthnCredential(label2, passwordless);
assertEquals(2, credentialType.getUserCredentialsCount());
assertUserCredential(label2, true, webAuthn2);
RequiredActionProviderRepresentation requiredAction = new RequiredActionProviderRepresentation();
requiredAction.setEnabled(false);
testRealmResource().flows().updateRequiredAction(providerId, requiredAction);
refreshPageAndWaitForLoad();
assertFalse("Set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isSetUpLinkVisible());
assertFalse("Not set up link for \"" + credentialType.getType() + "\" is visible", credentialType.isNotSetUpLabelVisible());
assertTrue("Title for \"" + credentialType.getType() + "\" is not visible", credentialType.isTitleVisible());
assertEquals(2, credentialType.getUserCredentialsCount());
testRemoveCredential(webAuthn1);
}*/
@Test
public void setUpLinksTest() {
testSetUpLink(otpCredentialType, CONFIGURE_TOTP.name());
@ -346,19 +284,6 @@ public class SigningInTest extends BaseAccountPageTest {
return getNewestUserCredential(otpCredentialType);
}
/*private SigningInPage.UserCredential addWebAuthnCredential(String label, boolean passwordless) {
SigningInPage.CredentialType credentialType = passwordless ? webAuthnPwdlessCredentialType : webAuthnCredentialType;
credentialType.clickSetUpLink();
webAuthnRegisterPage.assertCurrent();
webAuthnRegisterPage.clickRegister();
webAuthnRegisterPage.registerWebAuthnCredential(label);
waitForPageToLoad();
signingInPage.assertCurrent();
return getNewestUserCredential(credentialType);
}*/
private SigningInPage.UserCredential getNewestUserCredential(SigningInPage.CredentialType credentialType) {
List<CredentialRepresentation> credentials = testUserResource().credentials();
SigningInPage.UserCredential userCredential =