Exemplo n.º 1
0
        public void TestObjectKeysValidation()
        {
            var printingInfo   = CqlDocumentsForTests.GetCqlDocumentPrintingInfo();
            var printingInfoId = printingInfo.Id.ToString();

            using (var context = new CqlDbContext())
                context.InsertDocument(printingInfo);

            using var browser = new BrowserForTests();
            var showTableEntriesPage = browser.SwitchTo <BusinessObjectTablePage>("DocumentPrintingInfo");

            showTableEntriesPage.OpenFilter.Click();
            showTableEntriesPage.FilterModal.Apply.Click();
            var searchField = showTableEntriesPage.FilterModal.GetFilter("Id");

            searchField.InputValidation.ExpectIsOpenedWithMessage("Поле должно быть заполнено");
            searchField.Input.ClearAndInputText(Guid.NewGuid().ToString());
            showTableEntriesPage.FilterModal.Apply.Click();

            showTableEntriesPage.BusinessObjectItems.WaitAbsence();
            showTableEntriesPage.NothingFound.WaitPresence();

            showTableEntriesPage.OpenFilter.Click();
            searchField = showTableEntriesPage.FilterModal.GetFilter("Id");
            searchField.Input.ClearAndInputText(printingInfoId);
            showTableEntriesPage.FilterModal.Apply.Click();

            showTableEntriesPage.BusinessObjectItems.WaitCount(1);
            showTableEntriesPage.BusinessObjectItems[0].FindColumn("Id").WaitText(printingInfoId);
        }
        public void TestNonSuperUserCantEditOrDeleteObject()
        {
            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.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>();

            detailsPage.RootAccordion.FindField("PartyId").Edit.WaitAbsence();
            detailsPage.Delete.WaitAbsence();
        }
        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 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();
        }