Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding schrodinger tests for labs of demo 101 and resolving some bugs…
… from testing
- Loading branch information
Showing
75 changed files
with
8,595 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...-impl/src/test/resources/lens/ppolicy/value-policy-generate-without-limit-with-unique.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2019 Evolveum and contributors | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<valuePolicy xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
oid="81818181-76e0-59e2-8888-3d4f02d3fffb" | ||
version="10"> | ||
<name> | ||
<orig xmlns="http://prism.evolveum.com/xml/ns/public/types-3">Numeric PIN Policy</orig> | ||
<norm xmlns="http://prism.evolveum.com/xml/ns/public/types-3">numeric pin policy</norm> | ||
</name> | ||
<description>A policy useful for generating long password without limit, but with more unique characters.</description> | ||
<c:stringPolicy xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" | ||
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" | ||
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3" | ||
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" | ||
xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3" | ||
xmlns:apti="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" | ||
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" | ||
xmlns:enc="http://www.w3.org/2001/04/xmlenc#"> | ||
<c:description>String validation policy</c:description> | ||
<c:limitations> | ||
<c:minLength>30</c:minLength> | ||
<c:minUniqueChars>29</c:minUniqueChars> | ||
<c:checkPattern/> | ||
</c:limitations> | ||
</c:stringPolicy> | ||
</valuePolicy> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
...gertest/src/test/java/com/evolveum/midpoint/testing/schrodinger/labs/AbstractLabTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/* | ||
* Copyright (c) 2010-2019 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.testing.schrodinger.labs; | ||
|
||
import com.codeborne.selenide.Selenide; | ||
|
||
import com.evolveum.midpoint.schrodinger.MidPoint; | ||
import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable; | ||
import com.evolveum.midpoint.schrodinger.component.resource.ResourceAccountsTab; | ||
import com.evolveum.midpoint.schrodinger.component.resource.ResourceShadowTable; | ||
import com.evolveum.midpoint.schrodinger.page.configuration.AboutPage; | ||
import com.evolveum.midpoint.schrodinger.page.resource.AccountPage; | ||
import com.evolveum.midpoint.schrodinger.page.resource.ViewResourcePage; | ||
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage; | ||
import com.evolveum.midpoint.schrodinger.page.user.UserPage; | ||
import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest; | ||
import com.evolveum.midpoint.testing.schrodinger.scenarios.SynchronizationTests; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testng.annotations.AfterClass; | ||
|
||
import java.io.File; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* @author skublik | ||
*/ | ||
|
||
public class AbstractLabTest extends AbstractSchrodingerTest { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(AbstractLabTest.class); | ||
|
||
protected static final String LAB_DIRECTORY = "./src/test/resources/labs/"; | ||
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "objects/"; | ||
protected static final String LAB_SOURCES_DIRECTORY = LAB_DIRECTORY + "sources/"; | ||
|
||
protected static final File EXTENSION_SCHEMA_FILE = new File(LAB_DIRECTORY +"schema/extension-example.xsd"); | ||
protected static final File CSV_1_SIMPLE_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-simple.xml"); | ||
protected static final File CSV_1_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access.xml"); | ||
protected static final File CSV_1_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-1.csv"); | ||
protected static final File NUMERIC_PIN_FIRST_NONZERO_POLICY_FILE = new File(LAB_OBJECTS_DIRECTORY + "valuePolicies/numeric-pin-first-nonzero-policy.xml"); | ||
protected static final File CSV_2_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-2-canteen.xml"); | ||
protected static final File CSV_2_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-2.csv"); | ||
protected static final File CSV_3_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap.xml"); | ||
protected static final File CSV_3_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-3.csv"); | ||
|
||
protected static final String DIRECTORY_CURRENT_TEST = "labTests"; | ||
protected static final String EXTENSION_SCHEMA_NAME = "extension-example.xsd"; | ||
protected static final String CSV_1_FILE_SOURCE_NAME = "csv-1.csv"; | ||
protected static final String CSV_1_RESOURCE_NAME = "CSV-1 (Document Access)"; | ||
protected static final String CSV_2_FILE_SOURCE_NAME = "csv-2.csv"; | ||
protected static final String CSV_2_RESOURCE_NAME = "CSV-2 (Canteen Ordering System)"; | ||
protected static final String CSV_3_FILE_SOURCE_NAME = "csv-3.csv"; | ||
protected static final String CSV_3_RESOURCE_NAME = "CSV-3 (LDAP)"; | ||
|
||
protected static final String PASSWORD_ATTRIBUTE_RESOURCE_KEY = "User password attribute name"; | ||
protected static final String UNIQUE_ATTRIBUTE_RESOURCE_KEY = "Unique attribute name"; | ||
|
||
protected static final String CSV_1_UNIQUE_ATTRIBUTE_NAME = "login"; | ||
protected static final String CSV_1_PASSWORD_ATTRIBUTE_NAME = "password"; | ||
protected static final String CSV_1_ACCOUNT_OBJECT_CLASS_LINK = "AccountObjectClass (Default Account)"; | ||
|
||
protected static final List<String> CSV_1_RESOURCE_ATTRIBUTES = Arrays.asList("login", "lname", "groups", "enumber", "phone", "dep", "fname", "dis"); | ||
|
||
protected static File csv1TargetFile; | ||
protected static File csv2TargetFile; | ||
protected static File csv3TargetFile; | ||
|
||
@AfterClass | ||
@Override | ||
public void afterClass() { | ||
LOG.info("Finished tests from class {}", getClass().getName()); | ||
|
||
Selenide.clearBrowserCookies(); | ||
Selenide.clearBrowserLocalStorage(); | ||
Selenide.close(); | ||
} | ||
|
||
public UserPage showUser(String userName){ | ||
UserPage user = showUserInTable(userName).clickByName(userName); | ||
Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); | ||
return user; | ||
} | ||
|
||
public AssignmentHolderObjectListTable<ListUsersPage, UserPage> showUserInTable(String userName) { | ||
return basicPage.listUsers() | ||
.table() | ||
.search() | ||
.byName() | ||
.inputValue(userName) | ||
.updateSearch() | ||
.and(); | ||
} | ||
|
||
public AccountPage showShadow(String resourceName, String searchedItem, String itemValue){ | ||
return showShadow(resourceName, searchedItem, itemValue, null, false); | ||
} | ||
|
||
public AccountPage showShadow(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository){ | ||
return getShadowTable(resourceName, searchedItem, itemValue, intent, useRepository) | ||
.clickByName(itemValue); | ||
} | ||
|
||
public boolean existShadow(String resourceName, String searchedItem, String itemValue){ | ||
return existShadow(resourceName, searchedItem, itemValue, null, false); | ||
} | ||
|
||
public boolean existShadow(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository){ | ||
ResourceShadowTable table = getShadowTable(resourceName, searchedItem, itemValue, intent, useRepository); | ||
return table.containsText(itemValue); | ||
} | ||
public ResourceShadowTable getShadowTable(String resourceName, String searchedItem, String itemValue) { | ||
return getShadowTable(resourceName, searchedItem, itemValue, null, false); | ||
} | ||
|
||
public ResourceShadowTable getShadowTable(String resourceName, String searchedItem, String itemValue, String intent, boolean useRepository) { | ||
ResourceAccountsTab<ViewResourcePage> tab = basicPage.listResources() | ||
.table() | ||
.search() | ||
.byName() | ||
.inputValue(resourceName) | ||
.updateSearch() | ||
.and() | ||
.clickByName(resourceName) | ||
.clickAccountsTab(); | ||
if (useRepository) { | ||
tab.clickSearchInRepository(); | ||
} else { | ||
tab.clickSearchInResource(); | ||
} | ||
Selenide.sleep(1000); | ||
if (intent != null && !intent.isBlank()) { | ||
tab.setIntent(intent); | ||
Selenide.sleep(MidPoint.TIMEOUT_DEFAULT_2_S); | ||
} | ||
return tab.table() | ||
.search() | ||
.resetBasicSearch() | ||
.byItem(searchedItem) | ||
.inputValueWithEnter(itemValue) | ||
.and() | ||
.and(); | ||
} | ||
} |
Oops, something went wrong.