Skip to content

Commit

Permalink
Enable use of ERMD2WListFilter for "ListMovie" page configuration and…
Browse files Browse the repository at this point in the history
… add functional tests.
  • Loading branch information
fbarthez committed Nov 14, 2015
1 parent e3d3bb7 commit 6e6011d
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tests/ERModernMoviesTest/Resources/user.d2wmodel
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOOrQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "Edit*Movie"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "Inspect*Movie"; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "subTask"; "value" = "tab"; }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "RuleIsDisabled"; "selectorName" = "isEqual"; "value" = "YES"; }, {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "entity.name"; "selectorName" = "isEqualTo"; "value" = "Studio"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isEqualTo"; "value" = "edit"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "propertyKey"; "selectorName" = "isEqualTo"; "value" = "movies"; }); }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "componentName"; "value" = "ERMDEditRelationship"; }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "RuleIsDisabled"; "selectorName" = "isEqual"; "value" = "YES"; }, {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "entity.name"; "selectorName" = "isEqualTo"; "value" = "Movie"; }, {"class" = "com.webobjects.eocontrol.EOOrQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isEqualTo"; "value" = "inspect"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isEqualTo"; "value" = "edit"; }); }); }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "tabSectionsContents"; "value" = ("title", "plotSummary"); }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isEqualTo"; "value" = "ListMovie"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "searchKey"; "value" = ("title", "category", "revenue", "dateReleased", "plotSummary.summary"); }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "documentation" = "This rule is not necessary, but something like it can be used if you wish to overide the default Embedded configuration name based on say, propertyKey. ie: You wish to differentiate between multiple relationships with the same destination entity name."; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "RuleIsDisabled"; "selectorName" = "isEqual"; "value" = "YES"; }, {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "entity.name"; "selectorName" = "isEqualTo"; "value" = "Studio"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isEqualTo"; "value" = "edit"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "propertyKey"; "selectorName" = "isEqualTo"; "value" = "movies"; }); }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "listConfigurationName"; "value" = "ListEmbeddedFooMovie"; }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "smartRelationship"; "selectorName" = "isNotEqualTo"; "value" = {"class" = "com.webobjects.foundation.NSKeyValueCoding$Null"; }; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "smartRelationship.isToMany"; "selectorName" = "isEqualTo"; "value" = {"class" = "java.lang.Number"; "value" = "0"; }; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "task"; "selectorName" = "isEqualTo"; "value" = "inspect"; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "componentName"; "value" = "ERD2WDisplayToOne"; }; },
{"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "documentation" = "Specify the display property keys for a given embedded configuration."; "lhs" = {"class" = "com.webobjects.eocontrol.EOAndQualifier"; "qualifiers" = ({"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isEqualTo"; "value" = "ListEmbeddedMovie"; }, {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "parentPageConfiguration"; "selectorName" = "isLike"; "value" = "*Studio"; }); }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "displayPropertyKeys"; "value" = ("title", "category", "rated"); }; },
Expand Down
1 change: 1 addition & 0 deletions Tests/ERModernMoviesTest/Resources/user.d2wmodel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
100 : (pageConfiguration like 'Edit*Movie' or pageConfiguration like 'Inspect*Movie') => subTask = "tab" [com.webobjects.directtoweb.Assignment],
100 : (entity.name = 'Studio' and task = 'edit' and propertyKey = 'movies') => componentName = "ERMDEditRelationship" [com.webobjects.directtoweb.Assignment],
100 : (entity.name = 'Movie' and (task = 'inspect' or task = 'edit')) => tabSectionsContents = ("title", "plotSummary") [com.webobjects.directtoweb.Assignment],
100 : pageConfiguration = 'ListMovie' => searchKey = ("title", "category", "revenue", "dateReleased", "plotSummary.summary") [com.webobjects.directtoweb.Assignment],
100 : (entity.name = 'Studio' and task = 'edit' and propertyKey = 'movies') => listConfigurationName = "ListEmbeddedFooMovie" [com.webobjects.directtoweb.Assignment],
100 : (smartRelationship != null and smartRelationship.isToMany = 0 and task = 'inspect') => componentName = "ERD2WDisplayToOne" [com.webobjects.directtoweb.Assignment],
100 : (pageConfiguration = 'ListEmbeddedMovie' and parentPageConfiguration like '*Studio') => displayPropertyKeys = ("title", "category", "rated") [com.webobjects.directtoweb.Assignment],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package er.modern.movies.test;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.value;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import static com.codeborne.selenide.Selenide.open;

import org.junit.Test;
import org.openqa.selenium.By;

import com.codeborne.selenide.Condition;

public class ListFilterIT extends AbstractSelenideIT {

@Test
public void filterByPartialTitleTest() {
open("/");
$(By.linkText("Login")).click();
// get list of all movies
$(By.linkText("Find")).click();
$("input[type=search]").setValue("fiction");
// verify "Pulp Fiction" is listed
$(".ListMovieObjTable").shouldHave(text("Pulp Fiction"));
// and that it is the only match
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(1);
}

@Test
public void filterByCategoryTest() {
open("/");
$(By.linkText("Login")).click();
// get list of all movies
$(By.linkText("Find")).click();
$("input[type=search]").setValue("noir");
// verify "Heathers" is listed
$(".ListMovieObjTable").shouldHave(text("Heathers"));
// and that it is one of 5 matches
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(5);
}

@Test
public void filterByPlotSummaryTest() {
open("/");
$(By.linkText("Login")).click();
// get list of all movies
$(By.linkText("Find")).click();
$("input[type=search]").setValue("dark");
// verify "Heathers" is listed
$(".ListMovieObjTable").shouldHave(text("Heathers"));
// and that it is one of 2 matches
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(2);
$("input[type=search]").setValue("darkn");
// verify "Apocalypse Now" is listed
$(".ListMovieObjTable").shouldHave(text("Apocalypse Now"));
// and that it is the only match
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(1);
}

@Test
public void filterByDateTest() {
open("/");
$(By.linkText("Login")).click();
// get list of all movies
$(By.linkText("Find")).click();
$("input[type=search]").setValue("1987");
// verify "The Untouchables" is listed
$(".ListMovieObjTable").shouldHave(text("The Untouchables"));
// and that it is one of 3 matches
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(3);
$("input[type=search]").setValue("01/03/1987");
// verify "The Untouchables" is listed
$(".ListMovieObjTable").shouldHave(text("The Untouchables"));
// and that it is the only match
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(1);
}

@Test
public void filterByRevenueTest() {
open("/");
$(By.linkText("Login")).click();
// get list of all movies
$(By.linkText("Find")).click();
$("input[type=search]").setValue("400000");
// verify "Jurassic Park" is listed
$(".ListMovieObjTable").shouldHave(text("Jurassic Park"));
// and that it is one of 5 matches
$$(".ListMovieObjTable tr.ObjRow").shouldHaveSize(5);
}

}

0 comments on commit 6e6011d

Please sign in to comment.