public void TestFindDocumentWithDifferentColumnTypes() { var document = CqlDocumentsForTests.GetCqlConnectorDeliveryContext(serializer); var document2 = CqlDocumentsForTests.GetCqlConnectorDeliveryContext(serializer); using (var context = new CqlDbContext()) context.InsertDocuments(new[] { document, document2 }); using var browser = new BrowserForTests(); var showTableEntriesPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("CqlConnectorDeliveryContext"); showTableEntriesPage.OpenFilter.Click(); showTableEntriesPage.FilterModal.GetFilter("TimeSliceId").DateTimeInTicks.ClearAndInputText(document.TimeSliceId.UtcTicks.ToString()); showTableEntriesPage.FilterModal.GetFilter("TimeSliceShardNumber").Input.ClearAndInputText(document.TimeSliceShardNumber.ToString()); showTableEntriesPage.FilterModal.GetFilter("ContextId").Input.ClearAndInputText(document.ContextId.ToString()); showTableEntriesPage.FilterModal.Apply.Click(); showTableEntriesPage.BusinessObjectItems.WaitCount(1); var row = showTableEntriesPage.BusinessObjectItems[0]; row.FindColumn("TimeSliceId").WaitText(document.TimeSliceId.ToString("yyyy-MM-ddTHH:mm:ss.ffK")); row.FindColumn("TimeSliceShardNumber").WaitText(document.TimeSliceShardNumber.ToString()); row.FindColumn("ContextId").WaitText(document.ContextId.ToString()); row.Delete.Click(); showTableEntriesPage.ConfirmDeleteObjectModal.Delete.Click(); browser.RefreshUntil(showTableEntriesPage, x => x.NothingFound.IsPresent.Get()); GetConnectorDeliveryContext(document).Length.Should().Be(0); GetConnectorDeliveryContext(document2).Single().Should().BeEquivalentTo(document2); }
public void TestDownloadByteContent() { var content = string.Join("\n", new[] { "this is large file content" }.Concat(Enumerable.Range(0, 10000).Select(i => (i % 256).ToString()))); var blobId = Guid.NewGuid(); using (var context = new CqlDbContext()) context.GetTable <CqlActiveBoxState>().Insert(new CqlActiveBoxState { PartitionKey = "0", LastProcessedEventId = "0", BoxId = blobId, Content = Encoding.UTF8.GetBytes(content), }).SetTimestamp(DateTimeOffset.UtcNow).Execute(); using var browser = new BrowserForTests(); var tempFileStoragePage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("CqlActiveBoxState"); tempFileStoragePage.OpenFilter.Click(); tempFileStoragePage.FilterModal.GetFilter("PartitionKey").Input.ClearAndInputText("0"); tempFileStoragePage.FilterModal.GetFilter("BoxId").Input.ClearAndInputText(blobId.ToString()); tempFileStoragePage.FilterModal.Apply.Click(); tempFileStoragePage.BusinessObjectItems.WaitCount(1); var detailsPage = tempFileStoragePage.BusinessObjectItems[0].Details.ClickAndGoTo <BusinessObjectDetailsPage>(); detailsPage.RootAccordion.FindField("Content").FieldValue.DownloadLink.Click(); Thread.Sleep(1000); var file = browser.DownloadFile("CqlActiveBoxState-Content-dGhpcy.bin"); file.Should().Be(content); }
public void TestRestrictionsForManyItems() { var totalCount = 100123; var scopeId = GenerateRandomUsersAndAssertCount(totalCount)[0].ScopeId; using var browser = new BrowserForTests(); var businessObjectPage = browser.SwitchTo <BusinessObjectTablePage>("UsersTable"); businessObjectPage.OpenFilter.Click(); businessObjectPage.FilterModal.ScopeId.ClearAndInputText(scopeId); businessObjectPage.FilterModal.Apply.Click(); businessObjectPage.ItemsCountInfo.WaitTextContains("Всего 50000+"); businessObjectPage.DownloadLink.Click(); businessObjectPage.DownloadLimitModal.Header.WaitText("Слишком большой список"); businessObjectPage.DownloadLimitModal.Body.WaitText("Мы умеем выгружать не более 50000 объектов из этой таблицы. Уточните запрос с помощью фильтров, чтобы записей стало меньше."); businessObjectPage.DownloadLimitModal.Cancel.Click(); var adminBusinessObjectPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("UsersTable"); adminBusinessObjectPage.OpenFilter.Click(); adminBusinessObjectPage.FilterModal.ScopeId.ClearAndInputText(scopeId); adminBusinessObjectPage.FilterModal.Apply.Click(); adminBusinessObjectPage.ItemsCountInfo.WaitTextContains("Всего 100123"); var content = DownloadFile(browser, businessObjectPage); content.Length.Should().Be(100125); }
public void TestChangeNumericValue() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var integerRow = businessObjectEditingPage.RootAccordion.FindField("ShardNumber"); integerRow.FieldValue.WaitText("0"); integerRow.Edit.Click(); integerRow.FieldValue.Input.AppendText($"{Keys.Control}a"); integerRow.FieldValue.Input.AppendText("12.,45"); integerRow.Save.Click(); integerRow.FieldValue.WaitText("1245"); integerRow.Edit.Click(); integerRow.FieldValue.Input.AppendText($"{Keys.Control}a"); integerRow.FieldValue.Input.AppendText("14ab"); integerRow.Save.Click(); integerRow.FieldValue.WaitText("14"); browser.WebDriver.Navigate().Refresh(); integerRow = businessObjectEditingPage.RootAccordion.FindField("ShardNumber"); integerRow.FieldValue.WaitText("14"); GetDocument(documentName, documentId).ShardNumber.Should().Be(14); var decimalRow = businessObjectEditingPage.RootAccordion.FindField("DocumentPrice"); decimalRow.FieldValue.WaitText("10.1"); decimalRow.Edit.Click(); decimalRow.FieldValue.Input.AppendText($"{Keys.Control}a"); decimalRow.FieldValue.Input.AppendText("12,45"); decimalRow.Save.Click(); decimalRow.FieldValue.WaitText("12.45"); browser.WebDriver.Navigate().Refresh(); decimalRow = businessObjectEditingPage.RootAccordion.FindField("DocumentPrice"); decimalRow.FieldValue.WaitText("12.45"); GetDocument(documentName, documentId).DocumentPrice.Should().Be(12.45m); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); var nullableDecimalRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_TotalAmount"); nullableDecimalRow.FieldValue.WaitText("10.2"); nullableDecimalRow.Edit.Click(); nullableDecimalRow.FieldValue.Input.AppendText($"{Keys.Control}a{Keys.Delete}"); nullableDecimalRow.Save.Click(); nullableDecimalRow.FieldValue.WaitText("null"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); nullableDecimalRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_TotalAmount"); nullableDecimalRow.FieldValue.WaitText("null"); GetDocument(documentName, documentId).DocumentContent.TotalAmount.Should().BeNull(); }
public void TestCanNotEditScopeIdAndId() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var row = businessObjectEditingPage.RootAccordion.FindField("id"); row.Edit.WaitAbsence(); }
public void TestChangeValueInArrayElement() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_0").ToggleButton.Click(); var inArrayFieldRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_GoodItems_0_Name"); inArrayFieldRow.FieldValue.WaitText("Name of lintem"); inArrayFieldRow.Edit.Click(); inArrayFieldRow.FieldValue.Input.ClearAndInputText("Changed name"); inArrayFieldRow.Save.Click(); inArrayFieldRow.FieldValue.WaitText("Changed name"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_0").ToggleButton.Click(); inArrayFieldRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_GoodItems_0_Name"); inArrayFieldRow.FieldValue.WaitText("Changed name"); GetDocument(documentName, documentId).DocumentContent.GoodItems[0].Name.Should().Be("Changed name"); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_1").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_1_CustomDeclarationNumbers").ToggleButton.Click(); var inArrayInArrayFieldRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_GoodItems_1_CustomDeclarationNumbers_0"); inArrayInArrayFieldRow.FieldValue.WaitText("224"); inArrayInArrayFieldRow.Edit.Click(); inArrayInArrayFieldRow.FieldValue.Input.ClearAndInputText("225a"); inArrayInArrayFieldRow.Save.Click(); inArrayInArrayFieldRow.FieldValue.WaitText("225a"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_1").ToggleButton.Click(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent_GoodItems_1_CustomDeclarationNumbers").ToggleButton.Click(); inArrayInArrayFieldRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_GoodItems_1_CustomDeclarationNumbers_0"); inArrayInArrayFieldRow.FieldValue.WaitText("225a"); GetDocument(documentName, documentId).DocumentContent.GoodItems[1].CustomDeclarationNumbers[0].Should().Be("225a"); }
public void DeleteViaDetailsPage(bool confirmDeletion) { var ftpUser = CreateFtpUser(); using var browser = new BrowserForTests(); var detailsPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>("FtpUser", $"Id={ftpUser.Id}"); detailsPage.Delete.Click(); ConfirmDeletion(detailsPage.ConfirmDeleteObjectModal, confirmDeletion); if (confirmDeletion) { detailsPage.GoTo <BusinessObjectTablePage>(); } AssertFtpUserExistence(ftpUser.Id, confirmDeletion); }
public void TestAllowSort() { using (var context = new EntityFrameworkDbContext()) { var serializer = new Serializer(new AllPropertiesExtractor()); var customer = new Customer { Age = 1, Name = "13" }; context.Tests.Add(new TestTable { Id = 1, CompositeKey = Guid.NewGuid().ToString(), String = "123", Customer = customer, CustomerSerialized = serializer.Serialize(customer), }); context.Users.Add(new UsersTable { Email = "123", Id = Guid.NewGuid(), Patronymic = "1", Surname = "2", FirstName = "3", ScopeId = "scopeId", }); context.SaveChanges(); } using var browser = new BrowserForTests(); var usersPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("UsersTable"); usersPage = browser.RefreshUntil(usersPage, x => x.BusinessObjectItems.IsPresent.Get()); usersPage.TableHeader.WaitPresence(); usersPage.TableHeader.SortByColumn("Header_Id"); var largeObjectPage = browser.SwitchTo <BusinessObjectTablePage>("TestTable"); largeObjectPage = browser.RefreshUntil(largeObjectPage, x => x.BusinessObjectItems.IsPresent.Get()); largeObjectPage.TableHeader.WaitPresence(); largeObjectPage.TableHeader.WaitNotSortable("Header_Index"); largeObjectPage.TableHeader.WaitNotSortable("Header_String"); largeObjectPage.TableHeader.WaitNotSortable("Header_DateTime"); }
public void TestChangeDocumentDates() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var filledDateRow = businessObjectEditingPage.RootAccordion.FindField("DocumentDate"); filledDateRow.FieldValue.WaitTextContains("2014-12-11"); filledDateRow.Edit.Click(); filledDateRow.FieldValue.Date.ClearAndInputText("13.12.2014"); filledDateRow.FieldValue.Time.ClearAndInputText("10:18"); filledDateRow.Save.Click(); filledDateRow.FieldValue.WaitTextContains("2014-12-13"); browser.WebDriver.Navigate().Refresh(); filledDateRow = businessObjectEditingPage.RootAccordion.FindField("DocumentDate"); filledDateRow.FieldValue.WaitTextContains("2014-12-13"); GetDocument(documentName, documentId).DocumentDate.Should().Be(new DateTimeOffset(2014, 12, 13, 10, 18, 00, 00, TimeSpan.Zero)); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); var unfilledDateRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_DeliveryDate"); unfilledDateRow.FieldValue.WaitText("null"); unfilledDateRow.Edit.Click(); unfilledDateRow.FieldValue.Date.ClearAndInputText("14.12.2014"); unfilledDateRow.FieldValue.Time.ClearAndInputText("20:19"); unfilledDateRow.Save.Click(); unfilledDateRow.FieldValue.WaitText("2014-12-14T20:19:00Z"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); unfilledDateRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_DeliveryDate"); unfilledDateRow.FieldValue.WaitText("2014-12-14T20:19:00Z"); GetDocument(documentName, documentId).DocumentContent.DeliveryDate.Should().Be(new DateTime(2014, 12, 14, 20, 19, 00, 00, DateTimeKind.Utc)); }
public void TestChangeBooleanValue() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var booleanRow = businessObjectEditingPage.RootAccordion.FindField("IsLargeDocument"); booleanRow.FieldValue.WaitText("false"); booleanRow.Edit.Click(); booleanRow.FieldValue.BooleanSelect.WaitItems(new[] { "false", "true" }); booleanRow.FieldValue.BooleanSelect.SelectValueByText("true"); booleanRow.Save.Click(); booleanRow.FieldValue.WaitText("true"); browser.WebDriver.Navigate().Refresh(); booleanRow = businessObjectEditingPage.RootAccordion.FindField("IsLargeDocument"); booleanRow.FieldValue.WaitText("true"); GetDocument(documentName, documentId).IsLargeDocument.Should().BeTrue(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); var nullableBoolRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_WasRead"); nullableBoolRow.FieldValue.WaitText("true"); nullableBoolRow.Edit.Click(); nullableBoolRow.FieldValue.BooleanSelect.WaitItems(new[] { "null", "false", "true" }); nullableBoolRow.FieldValue.BooleanSelect.SelectValueByText("null"); nullableBoolRow.Save.Click(); nullableBoolRow.FieldValue.WaitText("null"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); nullableBoolRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_WasRead"); nullableBoolRow.FieldValue.WaitText("null"); GetDocument(documentName, documentId).DocumentContent.WasRead.Should().BeNull(); }
public void TestChangeEnumValue() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var filledEnumRow = businessObjectEditingPage.RootAccordion.FindField("DocumentType"); filledEnumRow.FieldValue.WaitText("Orders"); filledEnumRow.Edit.Click(); filledEnumRow.FieldValue.EnumSelect.WaitItems(new[] { "Orders", "Desadv" }); filledEnumRow.FieldValue.EnumSelect.SelectValueByText("Desadv"); filledEnumRow.Save.Click(); filledEnumRow.FieldValue.WaitText("Desadv"); browser.WebDriver.Navigate().Refresh(); filledEnumRow = businessObjectEditingPage.RootAccordion.FindField("DocumentType"); filledEnumRow.FieldValue.WaitText("Desadv"); GetDocument(documentName, documentId).DocumentType.Should().Be(DocumentType.Desadv); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); var nullableEnumRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_OrderStatus"); nullableEnumRow.FieldValue.WaitText("Processed"); nullableEnumRow.Edit.Click(); nullableEnumRow.FieldValue.EnumSelect.WaitItems(new[] { "null", "Processed", "Failed" }); nullableEnumRow.FieldValue.EnumSelect.SelectValueByText("null"); nullableEnumRow.Save.Click(); nullableEnumRow.FieldValue.WaitText("null"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); nullableEnumRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_OrderStatus"); nullableEnumRow.FieldValue.WaitText("null"); GetDocument(documentName, documentId).DocumentContent.OrderStatus.Should().BeNull(); }
public void TestDeleteDocumentWithClusteringKeyPart() { var documents = CqlDocumentsForTests.GetCqlDocumentBindingMetaEntries(serializer); var firstPartnerPartyId = documents[0].FirstPartnerPartyId; var secondPartnerPartyId = documents[0].SecondPartnerPartyId; var documentType = documents[0].DocumentType; var documentCirculationId = documents[0].DocumentCirculationId.ToString(); using (var context = new CqlDbContext()) context.InsertDocuments(documents); using var browser = new BrowserForTests(); var showTableEntriesPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("DocumentBindingsMeta"); showTableEntriesPage.OpenFilter.Click(); showTableEntriesPage.FilterModal.GetFilter("BindingType").EnumSelect.SelectValueByText("ByPriceList"); showTableEntriesPage.FilterModal.GetFilter("FirstPartnerPartyId").Input.ClearAndInputText(firstPartnerPartyId); showTableEntriesPage.FilterModal.GetFilter("SecondPartnerPartyId").Input.ClearAndInputText(secondPartnerPartyId); showTableEntriesPage.FilterModal.GetFilter("DocumentNumber").Input.ClearAndInputText("0"); showTableEntriesPage.FilterModal.GetFilter("DocumentDate").Date.ClearAndInputText("10.10.2000"); showTableEntriesPage.FilterModal.GetFilter("DocumentTime").DateTimeInTicks.ClearAndInputText(new DateTime(2020, 10, 10, 13, 12, 11, DateTimeKind.Utc).Ticks.ToString()); showTableEntriesPage.FilterModal.GetFilter("DocumentType").Input.ClearAndInputText(documentType); showTableEntriesPage.FilterModal.GetFilter("DocumentCirculationId").Input.ClearAndInputText(documentCirculationId); showTableEntriesPage.FilterModal.Apply.Click(); showTableEntriesPage.BusinessObjectItems.WaitCount(1); showTableEntriesPage.BusinessObjectItems[0].FindColumn("DocumentCirculationId").WaitText(documentCirculationId); showTableEntriesPage.BusinessObjectItems[0].Delete.Click(); showTableEntriesPage.ConfirmDeleteObjectModal.Delete.Click(); showTableEntriesPage = browser.RefreshUntil(showTableEntriesPage, x => x.NothingFound.IsPresent.Get()); showTableEntriesPage.OpenFilter.Click(); showTableEntriesPage.FilterModal.GetFilter("DocumentType").Input.Clear(); showTableEntriesPage.FilterModal.GetFilter("DocumentCirculationId").Input.Clear(); showTableEntriesPage.FilterModal.Apply.Click(); showTableEntriesPage.BusinessObjectItems.WaitCount(9); GetBindingMeta(documents[0]).Length.Should().Be(0); }
public void TestLinkFromFindShouldReferToDetailPage() { var document = CqlDocumentsForTests.GetCqlDocumentPrintingInfo(); using (var context = new CqlDbContext()) context.GetTable <DocumentPrintingInfo>().Insert(document).SetTimestamp(DateTimeOffset.UtcNow).Execute(); using var browser = new BrowserForTests(); var printingInfoPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("DocumentPrintingInfo"); printingInfoPage.BusinessObjectItems.Count.Wait().That(Is.GreaterThan(0)); printingInfoPage.OpenFilter.Click(); printingInfoPage.FilterModal.GetFilter("Id").Input.ClearAndInputText(document.Id.ToString()); printingInfoPage.FilterModal.Apply.Click(); printingInfoPage.BusinessObjectItems.WaitCount(1); printingInfoPage.BusinessObjectItems[0].FindColumn("Id").WaitText(document.Id.ToString()); var detailsPage = printingInfoPage.BusinessObjectItems[0].Details.ClickAndGoTo <BusinessObjectDetailsPage>(); detailsPage.Header.WaitPresence(); CheckDocumentPrintingInfoFields(detailsPage, document); }
public void DeleteViaSearchPage(bool confirmDeletion) { var ftpUser = CreateFtpUser(); using var browser = new BrowserForTests(); var businessObjectPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("FtpUser"); businessObjectPage.OpenFilter.Click(); businessObjectPage.FilterModal.GetFilter("Login").Input.ClearAndInputText(ftpUser.Login); businessObjectPage.FilterModal.Apply.Click(); businessObjectPage = browser.RefreshUntil(businessObjectPage, x => x.BusinessObjectItems.IsPresent.Get()); businessObjectPage.BusinessObjectItems.WaitCount(1); businessObjectPage.BusinessObjectItems[0].Delete.Click(); ConfirmDeletion(businessObjectPage.ConfirmDeleteObjectModal, confirmDeletion); if (confirmDeletion) { businessObjectPage.BusinessObjectItems.WaitAbsence(); } AssertFtpUserExistence(ftpUser.Id, confirmDeletion); }
public void TestChangeOrganizationName() { var documentId = CreateDocument(documentName); using var browser = new BrowserForTests(); var businessObjectEditingPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectDetailsPage>(documentName, $"Id={documentId}"); var filledNumberRow = businessObjectEditingPage.RootAccordion.FindField("DocumentNumber"); filledNumberRow.FieldValue.WaitText("123"); filledNumberRow.Edit.Click(); filledNumberRow.FieldValue.Input.ClearAndInputText("2qwe123QWE2"); filledNumberRow.Save.Click(); filledNumberRow.FieldValue.WaitText("2qwe123QWE2"); browser.WebDriver.Navigate().Refresh(); filledNumberRow = businessObjectEditingPage.RootAccordion.FindField("DocumentNumber"); filledNumberRow.FieldValue.WaitText("2qwe123QWE2"); GetDocument(documentName, documentId).DocumentNumber.Should().Be("2qwe123QWE2"); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); var unfilledNumberRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_OrdersNumber"); unfilledNumberRow.FieldValue.WaitText("null"); unfilledNumberRow.Edit.Click(); unfilledNumberRow.FieldValue.Input.ClearAndInputText("123"); unfilledNumberRow.Save.Click(); unfilledNumberRow.FieldValue.WaitText("123"); browser.WebDriver.Navigate().Refresh(); businessObjectEditingPage.RootAccordion.FindAccordionToggle("DocumentContent").ToggleButton.Click(); unfilledNumberRow = businessObjectEditingPage.RootAccordion.FindField("DocumentContent_OrdersNumber"); unfilledNumberRow.FieldValue.WaitText("123"); GetDocument(documentName, documentId).DocumentContent.OrdersNumber.Should().Be("123"); }
public void TestSuperUserCanEditOrDeleteObject() { var document = CqlDocumentsForTests.GetCqlDocumentPrintingInfo(); using (var context = new CqlDbContext()) context.GetTable <DocumentPrintingInfo>().Insert(document).SetTimestamp(DateTimeOffset.UtcNow).Execute(); using var browser = new BrowserForTests(); var printingInfoPage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("DocumentPrintingInfo"); printingInfoPage.OpenFilter.Click(); printingInfoPage.FilterModal.GetFilter("Id").Input.ClearAndInputText(document.Id.ToString()); printingInfoPage.FilterModal.Apply.Click(); var detailsPage = printingInfoPage.BusinessObjectItems[0].Details.ClickAndGoTo <BusinessObjectDetailsPage>(); var id = detailsPage.RootAccordion.FindField("Id"); id.Edit.WaitAbsence(); var partyId = detailsPage.RootAccordion.FindField("PartyId"); partyId.Edit.WaitAbsence(); var fileId = detailsPage.RootAccordion.FindField("FileId"); fileId.Edit.Click(); fileId.FieldValue.Input.ClearAndInputText("Abc"); fileId.Save.Click(); fileId.Value.WaitText("Abc"); var status = detailsPage.RootAccordion.FindField("Status"); status.Edit.Click(); status.FieldValue.EnumSelect.WaitText("Finished"); status.FieldValue.EnumSelect.WaitItems(new[] { "Unknown", "Pending", "Failed", "Finished" }); status.FieldValue.EnumSelect.SelectValueByText("Failed"); status.Save.Click(); status.Value.WaitText("Failed"); var timestamp = detailsPage.RootAccordion.FindField("Timestamp"); timestamp.Edit.Click(); timestamp.FieldValue.Date.ClearAndInputText("13.12.2013"); timestamp.Save.Click(); timestamp.Value.Text.Wait().That(Does.StartWith("2013-12-13")); document.FileId = "Abc"; document.Status = DocumentPrintingStatus.Failed; detailsPage = browser.Refresh(detailsPage); CheckDocumentPrintingInfoFields(detailsPage, document); detailsPage.Delete.Click(); printingInfoPage = detailsPage.ConfirmDeleteObjectModal.Delete.ClickAndGoTo <BusinessObjectTablePage>(); printingInfoPage.OpenFilter.Click(); printingInfoPage.FilterModal.GetFilter("Id").Input.ClearAndInputText(document.Id.ToString()); printingInfoPage.FilterModal.Apply.Click(); printingInfoPage.NothingFound.WaitPresence(); printingInfoPage.BusinessObjectItems.WaitAbsence(); }