[java-idp-integration-tests] 02/02: Passes by itself, but not with others.

Tom Zeller tzeller at dragonacea.biz
Sun Dec 17 19:47:36 UTC 2023


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=399ca5703530bb9ff1eba55837346449d4f5212d

commit 399ca5703530bb9ff1eba55837346449d4f5212d
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Sun Dec 17 13:47:20 2023 -0600

    Passes by itself, but not with others.
    
    So move to its own class.
    
    https://shibboleth.atlassian.net/browse/IDP-2175
---
 .../tests/consent/UserPrefsRevokeConsentTest.java  | 152 +++++++++++++++++++++
 1 file changed, 152 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/integration/tests/consent/UserPrefsRevokeConsentTest.java b/src/test/java/net/shibboleth/idp/integration/tests/consent/UserPrefsRevokeConsentTest.java
new file mode 100644
index 0000000..01bdda9
--- /dev/null
+++ b/src/test/java/net/shibboleth/idp/integration/tests/consent/UserPrefsRevokeConsentTest.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache 
+ * License, Version 2.0 (the "License"); you may not use this file except in 
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.integration.tests.consent;
+
+import javax.annotation.Nullable;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import net.shibboleth.idp.integration.tests.BrowserData;
+import net.shibboleth.idp.integration.tests.saml2.AbstractSAML2IntegrationTest;
+
+/**
+ * Test consent revocation using the user prefs page.
+ */
+public class UserPrefsRevokeConsentTest extends AbstractSAML2IntegrationTest {
+
+    @BeforeClass
+    public void setUpURLs() throws Exception {
+
+        startFlowURLPath = "/sp/SAML2/InitSSO/Redirect";
+
+        loginPageURLPath = "/idp/profile/SAML2/Redirect/SSO";
+
+        responsePageURLPath = "/sp/SAML2/POST/ACS";
+    }
+
+    /**
+     * Test consent revocation using the user prefs page.
+     * 
+     * Only for IdP version 5 or later.
+     * 
+     * @param browserData
+     *            browser/os/version triplet provided by data provider
+     * @throws Exception
+     *             if an error occurs
+     */
+    @Test(dataProvider = "sauceOnDemandBrowserDataProvider")
+    public void testUserPrefsRevokeConsent(@Nullable final BrowserData browserData) throws Exception {
+
+        if (idpVersion.startsWith("4")) {
+            return;
+        }
+
+        startSeleniumClient(browserData);
+
+        enableModule("idp.intercept.Consent");
+
+        assertModulesAreEnabled("idp.intercept.Consent");
+
+        enableAttributeReleaseConsent();
+
+        enableModules("idp.UserPrefs");
+
+        assertModulesAreEnabled("idp.UserPrefs");
+
+        startServer();
+
+        startFlow();
+
+        waitForLoginPage();
+
+        login();
+
+        // attribute release
+
+        waitForAttributeReleasePage();
+
+        releaseAllAttributes();
+
+        rememberConsent();
+
+        submitForm();
+
+        // response
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // start login flow again
+
+        startFlow();
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // user prefs page
+
+        getAndWaitForUserPrefsPage();
+
+        // check the un-checked revoke consent checkbox
+        WebElement revokeConsentCheckbox = driver.findElement(By.id(REVOKE_CONSENT_ID));
+        Assert.assertFalse(revokeConsentCheckbox.isSelected());
+        clickWorkaround(revokeConsentCheckbox);
+
+        // start login flow again, should prompt for consent
+
+        startFlow();
+
+        // attribute release
+
+        waitForAttributeReleasePage();
+
+        releaseAllAttributes();
+
+        rememberConsent();
+
+        submitForm();
+
+        // response
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // start login flow again, should not prompt for consent
+
+        startFlow();
+
+        waitForResponsePage();
+
+        validateResponse();
+
+        // revoke consent checkbox should not be checked
+
+        getAndWaitForUserPrefsPage();
+
+        revokeConsentCheckbox = driver.findElement(By.id(REVOKE_CONSENT_ID));
+        Assert.assertFalse(revokeConsentCheckbox.isSelected());
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list