private void CheckItemValues(Dictionary <string, Constraint> elementsList) { var form = Actor.AsksFor(ItemPageContent.Form); Actor.ChecksThat(Readonly.Of(BaseFormElements.InputOfField(woodTypeProperty, form)), elementsList[woodTypeProperty]); Actor.ChecksThat(Enabled.Of(BaseFormElements.SelectOfField(paintColorProperty, form)), elementsList[paintColorProperty]); Actor.ChecksThat(Enabled.Of(BaseFormElements.InputOfField(dateCreatedProperty, form)), elementsList[dateCreatedProperty]); Actor.ChecksThat(Readonly.Of(BaseFormElements.InputOfField(chairNumberProperty, form)), elementsList[chairNumberProperty]); }
public void S_1_012_CreateNewItemsTest() { var today = DateTime.Today; const string greenColor = "#1A8804"; const string blueColor = "#1908EF"; const string redColor = "#EF0808"; //2 Actor.AttemptsTo( Open.NavigationPanel, Pin.NavigationPanel ); //3.a Actor.AttemptsTo(Create.Item.OfItemType(itemTypeName).ByContextMenu); //3.b var form = Actor.AsksFor(ItemPageContent.Form); FillItemValues(oakTypeValue, redColorValue, today); Actor.ChecksThat(Readonly.Of(BaseFormElements.InputOfField(chairNumberProperty, form)), Is.True); //3.c Actor.AttemptsTo( Save.OpenedItem.ByDoneButton(), Close.ActiveItemPage.ByCloseButton ); //3.d Actor.AttemptsTo(Open.SearchPanel.OfTocItemWithPath(itemTypeName).ByContextMenu); //3.e Actor.AttemptsTo( Search.Simple.InMainGrid.With(new Dictionary <string, string>() { [columnLabel] = oakTypeValue }), Open.Item.InMainGrid.WithRowNumber(1).ByContextMenu.ForView ); var firstChairNumber = FormattableString.Invariant($"1{sequencePadWith}3A"); form = Actor.AsksFor(ItemPageContent.Form); Actor.ChecksThat(Value.Of(BaseFormElements.InputOfField(woodTypeProperty, form)), Is.EqualTo(oakTypeValue)); Actor.ChecksThat(SelectedOptionName.Of(BaseFormElements.SelectOfField(paintColorProperty, form)), Is.EqualTo(redColorValue)); Actor.ChecksThat(Value.Of(BaseFormElements.InputOfField(chairNumberProperty, form)), Is.EqualTo(firstChairNumber)); var dropdownParent = Actor.AsksFor(Parent.Of(BaseFormElements.SelectOfField(paintColorProperty, form))); Actor.ChecksThat(ColorValue.Of(dropdownParent).AndTheProperty("background-color"), Is.EqualTo(ColorTranslator.FromHtml(redColor))); CheckPaintColorOption(blueColorValue, blueColor); CheckPaintColorOption(greenColorValue, greenColor); Actor.ChecksThat(Value.Of(BaseFormElements.InputOfField(dateCreatedProperty, form)), Is.EqualTo(today.ToString("d", Settings.CultureInfo))); //3.f Actor.AttemptsTo( Close.ActiveItemPage.ByCloseButton, Close.ActiveItemPage.ByCloseButton ); //3.g - 3.h Actor.AttemptsTo(Create.Item.OfItemType(itemTypeName).BySecondaryMenu()); //3.i FillItemValues(birchTypeValue, blueColorValue, today.AddDays(7)); //3.j Actor.AttemptsTo( Save.OpenedItem.ByDoneButton(), Close.ActiveItemPage.ByCloseButton ); //3.k Actor.AttemptsTo(Create.Item.OfItemType(itemTypeName).BySecondaryMenu()); //3.l FillItemValues(cellValue, greenColorValue, today.AddDays(-7)); //3.m Actor.AttemptsTo( Save.OpenedItem.ByDoneButton(), Close.ActiveItemPage.ByCloseButton ); //4.a Actor.AttemptsTo( Open.SearchPanel.OfTocItemWithPath(itemTypeName).BySecondaryMenu, Search.WithCurrentSearchCriteria.InMainGrid ); //4.b Actor.AttemptsTo(Open.Item.InMainGrid.WithValueInCell(columnLabel, cellValue).ByDoubleClick); CheckItemValues(new Dictionary <string, Constraint> { { woodTypeProperty, Is.True }, { paintColorProperty, Is.False }, { dateCreatedProperty, Is.False }, { chairNumberProperty, Is.True } }); //4.c Actor.AttemptsTo(Close.ActiveItemPage.ByCloseButton); //4.d Actor.AttemptsTo(Open.Item.InMainGrid.WithValueInCell(columnLabel, cellValue).ByContextMenu); Actor.AttemptsTo(Edit.OpenedItem.ByButton); CheckItemValues(new Dictionary <string, Constraint> { { woodTypeProperty, Is.False }, { paintColorProperty, Is.True }, { dateCreatedProperty, Is.True }, { chairNumberProperty, Is.True } }); //4.e Actor.AttemptsTo(Save.OpenedItem.BySaveButton); Actor.AttemptsTo(Close.ActiveItemPage.ByCloseButton); //5.a Actor.AttemptsTo(Search.WithCurrentSearchCriteria.InMainGrid); //5.a.i columnLabel = Actor.AsksFor(LocaleState.LabelOf.GridColumn(itemTypeName, chairNumberProperty)); Actor.ChecksThat(MainGridState.Unfrozen.HasItemWithValueInColumn(firstChairNumber, columnLabel), Is.True); Actor.ChecksThat(MainGridState.Unfrozen.HasItemWithValueInColumn(FormattableString.Invariant($"1{sequencePadWith}6A"), columnLabel), Is.True); Actor.ChecksThat(MainGridState.Unfrozen.HasItemWithValueInColumn(FormattableString.Invariant($"1{sequencePadWith}9A"), columnLabel), Is.True); }