Skip to content

Commit

Permalink
schrodinger test for searching by item with lookupTable (MID-5983, MI…
Browse files Browse the repository at this point in the history
…D-6055)
  • Loading branch information
skublik committed Mar 20, 2020
1 parent 1d9846c commit 43c01be
Show file tree
Hide file tree
Showing 7 changed files with 553 additions and 17 deletions.
Expand Up @@ -9,19 +9,44 @@

import com.codeborne.selenide.Selenide;

import com.evolveum.midpoint.schrodinger.component.assignmentholder.AssignmentHolderObjectListTable;
import com.evolveum.midpoint.schrodinger.component.common.Paging;
import com.evolveum.midpoint.schrodinger.component.common.Popover;
import com.evolveum.midpoint.schrodinger.component.common.Search;
import com.evolveum.midpoint.schrodinger.page.user.ListUsersPage;
import com.evolveum.midpoint.schrodinger.page.user.UserPage;

import com.evolveum.midpoint.testing.schrodinger.scenarios.ScenariosCommons;

import org.openqa.selenium.Keys;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;

import static com.codeborne.selenide.Selenide.screenshot;

/**
* Created by Viliam Repan (lazyman).
*/
public class UsersTest extends AbstractSchrodingerTest {

private static final File LOOKUP_TABLE_SUBTYPES = new File("src/test/resources/configuration/objects/lookuptable/subtypes.xml");
private static final File OT_FOR_LOOKUP_TABLE_SUBTYPES = new File("src/test/resources/configuration/objects/objecttemplate/object-template-for-lookup-table-subtypes.xml");
private static final File SYSTEM_CONFIG_WITH_LOOKUP_TABLE = new File("src/test/resources/configuration/objects/systemconfig/system-configuration-with-lookup-table.xml");

@BeforeClass
@Override
public void beforeClass() throws IOException {
super.beforeClass();
importObject(LOOKUP_TABLE_SUBTYPES, true);
importObject(OT_FOR_LOOKUP_TABLE_SUBTYPES, true);
importObject(SYSTEM_CONFIG_WITH_LOOKUP_TABLE, true);

}

@Test
public void testUserTablePaging() {
ListUsersPage users = basicPage.listUsers();
Expand Down Expand Up @@ -52,6 +77,45 @@ public void testUserTablePaging() {
paging.actualPageMinusOne();
}

@Test
public void testSearchWithLookupTable() {

UserPage user = basicPage.newUser();
user.selectTabBasic()
.form()
.addAttributeValue("name", "searchUser")
.addAttributeValue("subtype", "Extern")
.and()
.and()
.clickSave();


ListUsersPage users = basicPage.listUsers();

Assert.assertTrue(
users
.table()
.search()
.byItem("subtype")
.inputValueWithEnter("Extern")
.and()
.and()
.currentTableContains("searchUser")
);

Assert.assertFalse(
users
.table()
.search()
.byItem("subtype")
.inputValueWithEnter("Employee")
.and()
.and()
.currentTableContains("searchUser")
);

}

private void addUser(String name) {
UserPage user = basicPage.newUser();
user.selectTabBasic()
Expand Down
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2014-2018 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<lookupTable oid="d74d9990-3953-11e6-ab88-7fda62960e11">
<name>Subtypes</name>
<row id="1">
<key>EMP</key>
<label>Employee</label>
</row>
<row id="2">
<key>EXT</key>
<label>Extern</label>
</row>
</lookupTable>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2014-2018 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<objectTemplate oid="6fd041a4-3954-11e6-b2db-63400448082e">
<name>lookup table item subtypes</name>
<item>
<ref>subtype</ref>
<displayName>subtype</displayName>
<valueEnumerationRef oid="d74d9990-3953-11e6-ab88-7fda62960e11"/>
</item>
</objectTemplate>

0 comments on commit 43c01be

Please sign in to comment.