Exemple #1
0
        public async Task FieldsInListTest()
        {
            var today    = DateTime.Today;
            var customer = await customerRepository.CreateAsync(shop.OrganizationId, new Customer { Name = "Дмитрий", Phone = "71234567890" });

            var service1 = await productHelper.CreateServiceAsync("Услуга 1", 100);

            var service2 = await productHelper.CreateServiceAsync("Услуга 2", 50);

            var product1 = await productHelper.CreateProductAsync("Товар 1", 25, ProductUnit.Liter);

            var product2 = await productHelper.CreateProductAsync("Товар 2", 12, ProductUnit.Piece);

            var order = WorkOrderBuilder.CreateWithCustomer(customer)
                        .WithNumber(new WorkOrderNumber("БЮ", 123))
                        .WithReceptionDate(today - 1.Days())
                        .WithCompletionDatePlanned(today + 1.Days())
                        .WithStatus(WorkOrderStatus.New)
                        .AddShopServiceFromMarketProduct(service1)
                        .AddShopServiceFromMarketProduct(service2)
                        .AddShopProductFromMarketProduct(product1)
                        .AddShopProductFromMarketProduct(product2)
                        .Build();

            await workOrderHelper.CreateOrderAsync(order);

            var workOrderListPage = LoadWorkOrderList();

            var workOrderItem = workOrderListPage.NotIssuedOrders.WorkOrderItem.First();

            workOrderItem.Name.Text.Wait().EqualTo("Заказ-наряд БЮ-000123");
            workOrderItem.Customer.Text.Wait().EqualTo("Дмитрий, +7 123 456-78-90");
            workOrderItem.Description.Text.Wait().EqualTo("Услуга 1");
            workOrderItem.ReceptionDate.Value.Wait().EqualTo(today - 1.Days());
            workOrderItem.TotalSum.Value.Wait().EqualTo(187);

            var workOrderViewPage = workOrderListPage.GoToNotIssuedOrder();

            workOrderViewPage.ServicesBlock.SpoilerCaption.Click();
            workOrderViewPage.ServicesBlock.RowItem.First().RemoveLink.Click();
            workOrderViewPage.ServicesBlock.RowItem.First().RemoveLink.Click();
            workOrderListPage = workOrderViewPage.SaveAndGoToList();

            workOrderItem = workOrderListPage.NotIssuedOrders.WorkOrderItem.First();
            workOrderItem.Description.Text.Wait().EqualTo("Товар 1");
            workOrderItem.TotalSum.Value.Wait().EqualTo(37);

            workOrderViewPage = workOrderListPage.GoToNotIssuedOrder();
            workOrderViewPage.ProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.ProductsBlock.RowItem.First().RemoveLink.Click();
            workOrderViewPage.ProductsBlock.RowItem.First().RemoveLink.Click();
            workOrderViewPage.SaveAndGoToList();

            workOrderItem = workOrderListPage.NotIssuedOrders.WorkOrderItem.First();
            workOrderItem.Description.Text.Wait().EqualTo("-");
            workOrderItem.TotalSum.Value.Wait().EqualTo(0);
        }
Exemple #2
0
        public async Task RemovingData()
        {
            var customer = await CreateDefaultCustomer();

            var worker = await workerHelper.CreateAsync("Сотрудник для удаления");

            var service = await productHelper.CreateServiceAsync("Услуга для удаления", 100);

            var product = await productHelper.CreateProductAsync("Товар для удаления", 50);

            var order = WorkOrderBuilder.CreateWithCustomer(customer)
                        .WithReceptionWorker(worker)
                        .AddShopServiceFromMarketProduct(service, worker)
                        .AddShopProductFromMarketProduct(product)
                        .Build();

            await workOrderHelper.CreateOrderAsync(order);

            var workOrderListPage = LoadWorkOrderList();
            var workOrderViewPage = workOrderListPage.GoToNotIssuedOrder();

            workOrderViewPage.InfoBlock.Worker.Text.Wait().EqualTo("Сотрудник для удаления");
            workOrderViewPage.ServicesBlock.SpoilerCaption.Click();
            workOrderViewPage.ServicesBlock.RowItem.First().CheckRow("Услуга для удаления", 100, "1", 100, "Сотрудник для удаления");
            workOrderViewPage.ProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.ProductsBlock.RowItem.First().CheckRow("Товар для удаления", 50, "1", 50);

            await productHelper.RemoveAsync(service);

            await productHelper.RemoveAsync(product);

            await workerHelper.RemoveAsync(worker.Id);

            RefreshPage();

            workOrderViewPage.WaitPresence();
            workOrderViewPage.InfoBlock.Worker.WaitAbsence();
            workOrderViewPage.ServicesBlock.SpoilerCaption.Click();
            workOrderViewPage.ServicesBlock.RowItem.First().CheckRow("?", 100, "1", 100);
            workOrderViewPage.ServicesBlock.RowItem.First().Worker.WaitAbsence();
            workOrderViewPage.ProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.ProductsBlock.RowItem.First().CheckRow("?", 50, "1", 50);
        }
Exemple #3
0
        public async Task ChangeStatusTest()
        {
            await CreateDefaultWorkOrder();

            var customer = await CreateDefaultCustomer();

            var order1 = WorkOrderBuilder.CreateWithCustomer(customer).Build();
            var order2 = WorkOrderBuilder.CreateWithCustomer(customer).WithNumber(new WorkOrderNumber("ЯЯ", 999999)).Build();
            await workOrderHelper.CreateOrderAsync(order1);

            await workOrderHelper.CreateOrderAsync(order2);

            var workOrderListPage = LoadWorkOrderList();

            workOrderListPage.NotIssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд АА-000001", "Заказ-наряд ЯЯ-999999");
            workOrderListPage.IssuedOrders.WaitEmpty();

            workOrderListPage.NotIssuedOrders.WorkOrderItem.ElementAt(0).Status.SelectByValue(WorkOrderStatus.InProgress);
            var workOrderViewPage = workOrderListPage.GoToNotIssuedOrder(1);

            workOrderViewPage.HeaderBlock.WorkOrderStatus.SelectByValue(WorkOrderStatus.Completed);
            workOrderListPage = workOrderViewPage.SaveAndGoToList();
            workOrderListPage.NotIssuedOrders.WorkOrderItem.ElementAt(1).Status.WaitValue(WorkOrderStatus.Completed);
            workOrderListPage.NotIssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд АА-000001", "Заказ-наряд ЯЯ-999999");
            workOrderListPage.IssuedOrders.WaitEmpty();

            workOrderListPage.NotIssuedOrders.WorkOrderItem.ElementAt(0).Status.SelectByValue(WorkOrderStatus.IssuedToClient);
            workOrderListPage.NotIssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд АА-000001");
            workOrderListPage.IssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд ЯЯ-999999");

            workOrderListPage.NotIssuedOrders.WorkOrderItem.ElementAt(0).Status.SelectByValue(WorkOrderStatus.IssuedToClient);
            workOrderListPage.NotIssuedOrders.WaitEmpty();
            workOrderListPage.IssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд АА-000001", "Заказ-наряд ЯЯ-999999");

            workOrderListPage.IssuedOrders.WorkOrderItem.ElementAt(0).Status.SelectByValue(WorkOrderStatus.New);
            workOrderListPage.NotIssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд ЯЯ-999999");
            workOrderListPage.IssuedOrders.WaitItemNamesEquivalentTo("Заказ-наряд АА-000001");
        }
        public async Task CreationTest()
        {
            var today = DateTime.Now.Date;

            var customer = await customerHelper.CreateAsync("Машенька", "71234567890", "Комментарий из клиента");

            var worker1 = await workerHelper.CreateAsync("Приёмщик по телефону");

            var worker2 = await workerHelper.CreateAsync("Пьяный механик");

            var service1 = await productHelper.CreateServiceAsync("Накачать шины азотом", 150);

            var service2 = await productHelper.CreateServiceAsync("Прокатило", 999);

            var product1 = await productHelper.CreateProductAsync("Азот", 25, ProductUnit.Liter);

            var product2 = await productHelper.CreateProductAsync("Ничего", 250, ProductUnit.Piece);

            var workOrderListPage = LoadWorkOrderList();
            var workOrderViewPage = workOrderListPage.CreateNewOrder();

            workOrderViewPage.HeaderBlock.ReceptionDate.SetValue(today);
            workOrderViewPage.ClientBlock.NameSelector.TypeAndSelect("Машенька");

            workOrderViewPage.InfoBlock.Phone.SetValue("78007006050");
            workOrderViewPage.InfoBlock.Worker.SelectByValue("Приёмщик по телефону");
            workOrderViewPage.InfoBlock.WarrantyNumber.SetRawValue("123ыюя456asd");
            workOrderViewPage.InfoBlock.CompletionDatePlanned.SetValue(today + 1.Days());
            workOrderViewPage.InfoBlock.CompletionDateFact.SetValue(today + 2.Days());

            workOrderViewPage.ServicesBlock.SpoilerCaption.Click();
            workOrderViewPage.ServicesBlock.RowItem.First().CardNameSelector.TypeAndSelect("Накачать шины азотом");
            workOrderViewPage.ServicesBlock.RowItem.First().Quantity.SetRawValue("4");
            workOrderViewPage.ServicesBlock.RowItem.First().Worker.SelectByValue("Пьяный механик");
            workOrderViewPage.ServicesBlock.RowItem.ElementAt(1).CardNameSelector.TypeAndSelect("Прокатило");
            workOrderViewPage.ServicesBlock.RowItem.ElementAt(1).Quantity.SetRawValue("1");

            workOrderViewPage.ProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.ProductsBlock.RowItem.First().CardNameSelector.TypeAndSelect("Азот");
            workOrderViewPage.ProductsBlock.RowItem.First().Quantity.SetRawValue("0,75");
            workOrderViewPage.ProductsBlock.RowItem.ElementAt(1).CardNameSelector.TypeAndSelect("Ничего");
            workOrderViewPage.ProductsBlock.RowItem.ElementAt(1).Quantity.SetRawValue("1");

            workOrderViewPage.CustomerValuesBlock.SpoilerCaption.Click();
            workOrderViewPage.CustomerValuesBlock.TypeSelector.SelectByValue(CustomerValueType.Vehicle);
            workOrderViewPage.CustomerValuesBlock.VehicleValue.WaitPresence();
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Brand.SetRawValue("Маленькая");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Model.SetRawValue("Красненькая");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Comment.SetRawValue("Машинка");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.RegisterSign.SetRawValue("123ВУASD");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Vin.SetRawValue("JT2EL46D0P0308478");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.BodyNumber.SetRawValue("Number1");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.EngineNumber.SetRawValue("Number2");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Year.SetRawValue("1901");

            workOrderViewPage.CustomerProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.CustomerProductsBlock.RowItem.First().Name.SetRawValue("Ёлочка-вонючка");
            workOrderViewPage.CustomerProductsBlock.RowItem.First().Quantity.SetRawValue("ящик");

            workOrderViewPage.AdditionalText.SetRawValue("Машина норм, а девочка на любителя.");

            workOrderViewPage.ClientBlock.SelectedName.Text.Wait().EqualTo("Машенька");
            workOrderViewPage.ClientBlock.SelectedPhone.Value.Wait().EqualTo("71234567890");
            workOrderViewPage.ClientBlock.SelectedInfo.Text.Wait().EqualTo("Комментарий из клиента");

            workOrderViewPage.ServicesBlock.RowItem.First().TotalPrice.Value.Wait().EqualTo(600);
            workOrderViewPage.ServicesBlock.RowItem.ElementAt(1).TotalPrice.Value.Wait().EqualTo(999);
            workOrderViewPage.ServicesBlock.TotalSum.Value.Wait().EqualTo(1599);

            workOrderViewPage.ProductsBlock.RowItem.First().TotalPrice.Value.Wait().EqualTo(18.75m);
            workOrderViewPage.ProductsBlock.RowItem.ElementAt(1).TotalPrice.Value.Wait().EqualTo(250);
            workOrderViewPage.ProductsBlock.TotalSum.Value.Wait().EqualTo(268.75m);
            workOrderViewPage.ProductsBlock.SumForServicesAndProducts.Value.Wait().EqualTo(1867.75m);

            workOrderViewPage.SaveButton.Click();
            workOrderListPage = workOrderViewPage.GoToPage <WorkOrderListPage>();

            var workOrder = await workOrderHelper.ReadSingleAsync();

            var expectedWorkOrder = WorkOrderBuilder
                                    .CreateWithCustomer(customer)
                                    .WithNumber(new WorkOrderNumber("АА", 1))
                                    .WithStatus(WorkOrderStatus.New)
                                    .WithReceptionDate(today)
                                    .WithShopPhone("78007006050")
                                    .WithReceptionWorker(worker1)
                                    .WithWarrantyNumber("123ыюя456asd")
                                    .WithCompletionDatePlanned(today + 1.Days())
                                    .WithCompletionDateFact(today + 2.Days())
                                    .AddShopServiceFromMarketProduct(service1, worker2, 4)
                                    .AddShopServiceFromMarketProduct(service2, quantity: 1)
                                    .AddShopProductFromMarketProduct(product1, 0.75m)
                                    .AddShopProductFromMarketProduct(product2, 1)
                                    .AddCustomerProduct("Ёлочка-вонючка", "ящик")
                                    .WithVehicleCustomerValue(builder => builder
                                                              .WithBrand("Маленькая")
                                                              .WithModel("Красненькая")
                                                              .WithAdditionalInfo("Машинка")
                                                              .WithRegisterSign("123ВУASD")
                                                              .WithVin("JT2EL46D0P0308478")
                                                              .WithBodyNumber("Number1")
                                                              .WithEngineNumber("Number2")
                                                              .WithYear(1901))
                                    .WithAdditionalText("Машина норм, а девочка на любителя.")
                                    .WithTotalSum(1867.75m)
                                    .WithFirstProduct(service1)
                                    .Build();

            workOrder.Should().BeEquivalentTo(expectedWorkOrder, opt => opt.Excluding(x => x.Id));

            workOrderViewPage = workOrderListPage.GoToNotIssuedOrder();

            workOrderViewPage.HeaderBlock.SeriesInput.Text.Wait().EqualTo("АА");
            workOrderViewPage.HeaderBlock.NumberInput.Text.Wait().EqualTo("000001");
            workOrderViewPage.HeaderBlock.ReceptionDate.Value.Wait().EqualTo(today);
            workOrderViewPage.HeaderBlock.WorkOrderStatus.Text.Wait().EqualTo("Новый заказ");

            workOrderViewPage.ClientBlock.SelectedName.Text.Wait().EqualTo("Машенька");
            workOrderViewPage.ClientBlock.SelectedPhone.Value.Wait().EqualTo("71234567890");
            workOrderViewPage.ClientBlock.SelectedInfo.Text.Wait().EqualTo("Комментарий из клиента");

            workOrderViewPage.InfoBlock.Phone.Value.Wait().EqualTo("78007006050");
            workOrderViewPage.InfoBlock.Worker.Text.Wait().EqualTo("Приёмщик по телефону");
            workOrderViewPage.InfoBlock.WarrantyNumber.Text.Wait().EqualTo("123ыюя456asd");
            workOrderViewPage.InfoBlock.CompletionDatePlanned.Value.Wait().EqualTo(today + 1.Days());
            workOrderViewPage.InfoBlock.CompletionDateFact.Value.Wait().EqualTo(today + 2.Days());

            workOrderViewPage.ServicesBlock.SpoilerCaption.Click();
            workOrderViewPage.ServicesBlock.RowItem.Count.Wait().EqualTo(3);
            workOrderViewPage.ServicesBlock.RowItem.First().CheckRow("Накачать шины азотом", 150, "4", 600, "Пьяный механик");
            workOrderViewPage.ServicesBlock.RowItem.Skip(1).First().CheckRow("Прокатило", 999, "1", 999);
            workOrderViewPage.ServicesBlock.TotalSum.Value.Wait().EqualTo(1599);

            workOrderViewPage.ProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.ProductsBlock.RowItem.Count.Wait().EqualTo(3);
            workOrderViewPage.ProductsBlock.RowItem.First().CheckRow("Азот", 25, "0,750", 18.75m);
            workOrderViewPage.ProductsBlock.RowItem.Skip(1).First().CheckRow("Ничего", 250, "1", 250);
            workOrderViewPage.ProductsBlock.TotalSum.Value.Wait().EqualTo(268.75m);
            workOrderViewPage.ProductsBlock.SumForServicesAndProducts.Value.Wait().EqualTo(1867.75m);

            workOrderViewPage.CustomerProductsBlock.SpoilerCaption.Click();
            workOrderViewPage.CustomerProductsBlock.RowItem.Count.Wait().EqualTo(2);
            workOrderViewPage.CustomerProductsBlock.RowItem.First().Name.Text.Wait().EqualTo("Ёлочка-вонючка");
            workOrderViewPage.CustomerProductsBlock.RowItem.First().Quantity.Text.Wait().EqualTo("ящик");

            workOrderViewPage.CustomerValuesBlock.SpoilerCaption.Click();
            workOrderViewPage.CustomerValuesBlock.TypeSelector.Text.Wait().EqualTo("Автомобиль");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Brand.Text.Wait().EqualTo("Маленькая");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Model.Text.Wait().EqualTo("Красненькая");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Comment.Text.Wait().EqualTo("Машинка");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.RegisterSign.Text.Wait().EqualTo("123ВУASD");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Vin.Text.Wait().EqualTo("JT2EL46D0P0308478");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.BodyNumber.Text.Wait().EqualTo("Number1");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.EngineNumber.Text.Wait().EqualTo("Number2");
            workOrderViewPage.CustomerValuesBlock.VehicleValue.Year.Value.Wait().EqualTo(1901);

            workOrderViewPage.AdditionalText.Text.Wait().EqualTo("Машина норм, а девочка на любителя.");
        }
        protected async Task CreateDefaultWorkOrder()
        {
            var customer = await CreateDefaultCustomer();

            await workOrderService.CreateNewOrderAsync(shop.Id, WorkOrderBuilder.CreateWithCustomer(customer).Build());
        }