Skip to content

Commit

Permalink
Schrodinger GUI test: fulltext search
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-lizner committed Dec 8, 2018
1 parent 617516e commit b9861a8
Show file tree
Hide file tree
Showing 3 changed files with 277 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
import org.testng.Assert;
import org.testng.annotations.Test;
import com.evolveum.midpoint.testing.schrodinger.TestBase;
import java.io.File;

/**
* Created by matus on 5/21/2018.
Expand All @@ -19,8 +20,18 @@ public class PolyStringTests extends TestBase {
private static final String TEST_USER_JOZKO_FULL_NAME = "Jožko Jörg Nguyễn Trißtan Guðmund Mrkvička";
private static final String TEST_USER_JOZKO_ADDITIONAL_NAME = "Jörg Nguyễn Trißtan Guðmund ";

private static final String INIT_BASIC_CONFIG_DEPENDENCY = "turnOnFullTextSearch";
private static final String CREATE_USER_WITH_DIACRITIC_DEPENDENCY = "createUserWithDiacritic";
private static final String SEARCH_USER_WITH_DIACRITIC_DEPENDENCY = "searchForUserWithDiacritic";

private static final File SYSTEM_CONFIGURATION_FULLTEXT_FILE = new File("./src/test/resources/configuration/objects/systemconfig/system-configuration-fulltext.xml");

@Test
public void turnOnFullTextSearch(){
importObject(SYSTEM_CONFIGURATION_FULLTEXT_FILE,true);
}

@Test (dependsOnMethods = INIT_BASIC_CONFIG_DEPENDENCY)
public void createUserWithDiacritic(){
UserPage user = basicPage.newUser();

Expand Down Expand Up @@ -66,6 +77,36 @@ public void searchForUserWithDiacritic(){
.and()
.currentTableContains(TEST_USER_JOZKO_NAME)
);

}

@Test (dependsOnMethods = {SEARCH_USER_WITH_DIACRITIC_DEPENDENCY})
public void fullTextSearchForUserWithDiacritic(){

ListUsersPage usersPage = basicPage.listUsers();

Assert.assertTrue(
usersPage
.table()
.search()
.byFullText()
.inputValue(TEST_USER_JOZKO_NAME)
.pressEnter()
.and()
.currentTableContains(TEST_USER_JOZKO_NAME)
);

Assert.assertTrue(
usersPage
.table()
.search()
.byFullText()
.inputValue(TEST_USER_JOZKO_NAME_NO_DIAC)
.pressEnter()
.and()
.currentTableContains(TEST_USER_JOZKO_NAME)
);

}

}
@@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ Licensed 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.
-->
<systemConfiguration oid="00000000-0000-0000-0000-000000000001" version="0"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3">
<name>SystemConfiguration</name>
<!-- <globalAccountSynchronizationSettings> -->
<!-- <assignmentPolicyEnforcement>relative</assignmentPolicyEnforcement> -->
<!-- </globalAccountSynchronizationSettings> -->
<globalSecurityPolicyRef oid="00000000-0000-0000-0000-000000000120"/>
<logging>
<classLogger>
<level>ERROR</level>
<package>ro.isdc.wro.extensions.processor.css.Less4jProcessor</package>
</classLogger>
<classLogger>
<!-- disabled because of MID-744, helper insert messages on ERROR
level which should not be there (probably should be on TRACE) -->
<level>OFF</level>
<package>org.hibernate.engine.jdbc.spi.SqlExceptionHelper</package>
</classLogger>
<!-- Disabled because we treat locking-related exceptions in the repository.
Otherwise the log is filled-in with (innocent but ugly-looking) messages like
"ERROR (o.h.engine.jdbc.batch.internal.BatchingBatch): HHH000315: Exception executing batch [Deadlock detected.
The current transaction was rolled back." -->
<classLogger>
<level>OFF</level>
<package>org.hibernate.engine.jdbc.batch.internal.BatchingBatch</package>
</classLogger>
<!-- Disabled because of the same reason; this time concerning messages like
"INFO (org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl):
HHH000010: On release of batch it still contained JDBC statements" -->
<classLogger>
<level>WARN</level>
<package>org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl</package>
</classLogger>
<!-- Diesabled because of MID-4636 -->
<classLogger>
<level>OFF</level>
<package>org.hibernate.internal.ExceptionMapperStandardImpl</package>
</classLogger>
<classLogger>
<!-- disabled because of MID-1612, jasper library needs to be fixed -->
<level>OFF</level>
<package>net.sf.jasperreports.engine.fill.JRFillDataset</package>
</classLogger>
<classLogger>
<!-- disabled because we don't need to see every property file
loading message (unnecessary log pollution) -->
<level>WARN</level>
<package>org.apache.wicket.resource.PropertiesFactory</package>
</classLogger>
<classLogger>
<!-- disabled because we don't need to see every log message for every key
when resource bundle doesn't exist for specific locale (unnecessary log pollution) -->
<level>ERROR</level>
<package>org.springframework.context.support.ResourceBundleMessageSource</package>
</classLogger>
<classLogger>
<!-- Standard useful logger -->
<level>INFO</level>
<package>com.evolveum.midpoint.model.impl.lens.projector.Projector</package>
</classLogger>
<classLogger>
<!-- Standard useful logger -->
<level>INFO</level>
<package>com.evolveum.midpoint.model.impl.lens.Clockwork</package>
</classLogger>

<appender xsi:type="c:FileAppenderConfigurationType" name="MIDPOINT_LOG"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pattern>%date [%X{subsystem}] [%thread] %level \(%logger\): %msg%n</pattern>
<fileName>${midpoint.home}/log/midpoint.log</fileName>
<filePattern>${midpoint.home}/log/midpoint-%d{yyyy-MM-dd}.%i.log</filePattern>
<maxHistory>10</maxHistory>
<maxFileSize>100MB</maxFileSize>
<append>true</append>
</appender>
<!-- Appender for profiling purposes -->
<appender xsi:type="c:FileAppenderConfigurationType" name="MIDPOINT_PROFILE_LOG"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pattern>%date %level: %msg%n</pattern>
<fileName>${midpoint.home}/log/midpoint-profile.log</fileName>
<filePattern>${midpoint.home}/log/midpoint-profile-%d{yyyy-MM-dd}.%i.log</filePattern>
<maxHistory>10</maxHistory>
<maxFileSize>100MB</maxFileSize>
<append>true</append>
</appender>
<rootLoggerAppender>MIDPOINT_LOG</rootLoggerAppender>
<rootLoggerLevel>INFO</rootLoggerLevel>
<auditing>
<enabled>false</enabled>
<details>false</details>
</auditing>
</logging>
<cleanupPolicy>
<auditRecords>
<maxAge>P3M</maxAge>
</auditRecords>
<closedTasks>
<maxAge>P1M</maxAge>
</closedTasks>
</cleanupPolicy>
<adminGuiConfiguration>
<userDashboardLink>
<targetUrl>/self/profile</targetUrl>
<label>Profile</label>
<description>View/edit your profile</description>
<icon>
<cssClass>fa fa-user</cssClass>
</icon>
<color>green</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfProfile</authorization>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll</authorization>
</userDashboardLink>
<userDashboardLink>
<targetUrl>/self/credentials</targetUrl>
<label>Credentials</label>
<description>View/edit your credentials</description>
<icon>
<cssClass>fa fa-shield</cssClass>
</icon>
<color>blue</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfCredentials</authorization>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll</authorization>
</userDashboardLink>
<userDashboardLink>
<targetUrl>/admin/users</targetUrl>
<label>List users</label>
<icon>
<cssClass>fa fa-users</cssClass>
</icon>
<color>red</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#users</authorization>
</userDashboardLink>
<userDashboardLink>
<targetUrl>/admin/resources</targetUrl>
<label>List resources</label>
<icon>
<cssClass>fa fa-database</cssClass>
</icon>
<color>purple</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#resources</authorization>
</userDashboardLink>
<enableExperimentalFeatures>true</enableExperimentalFeatures>
</adminGuiConfiguration>
<internals>
<enableExperimentalCode>true</enableExperimentalCode>
</internals>
<fullTextSearch>
<indexed> <!-- no "objectType" element means this applies to all objects -->
<item>name</item>
<item>description</item>
</indexed>
<indexed>
<objectType>UserType</objectType>
<item>fullName</item>
<item>givenName</item>
<item>familyName</item>
<item>additionalName</item>
<item>nickName</item>
<item>emailAddress</item>
<item>telephoneNumber</item>
<item>honorificPrefix</item>
<item>honorificSuffix</item>
<item>title</item>
<item>employeeNumber</item>
<item>employeeType</item>
<item>costCenter</item>
<item>organization</item>
<item>organizationalUnit</item>
<item>locality</item>
</indexed>
<indexed>
<objectType>AbstractRoleType</objectType> <!-- use AbstractRoleType for self-service with Role catalog ! -->
<item>displayName</item>
<item>identifier</item>
</indexed>
<indexed>
<objectType>RoleType</objectType> <!-- there can be more "objectType" elements for a single entry (not shown here) -->
<item>roleType</item>
</indexed>
<indexed>
<objectType>OrgType</objectType>
<item>orgType</item>
<item>costCenter</item>
<item>locality</item>
<item>mailDomain</item>
</indexed>
<indexed>
<objectType>ServiceType</objectType>
<item>serviceType</item>
<item>locality</item>
</indexed>
</fullTextSearch>
</systemConfiguration>
@@ -0,0 +1,25 @@
package com.evolveum.midpoint.schrodinger.component.common;

import com.codeborne.selenide.SelenideElement;
import com.evolveum.midpoint.schrodinger.component.Component;

/**
* Created by martin.lizner on 12/08/2018.
*/
public class InputBox<T> extends Component<T> {
public InputBox(T parent, SelenideElement parentElement) {
super(parent, parentElement);
}

public InputBox<T> inputValue(String input) {
getParentElement().setValue(input);

return this;
}

public T pressEnter() {
getParentElement().pressEnter();

return this.getParent();
}
}

0 comments on commit b9861a8

Please sign in to comment.