public void RT01350_ActivateUserAndFindEmailUserActivated()
        {
            if (!_activationLinkClicked)
            {
                RT01320_NavigateToUserActivationPage();
            }

            if (!_activationLinkClicked)
            {
                Assert.Warn("Cannot run because test method "
                            + "RT01320_NavigateToUserActivationPage has failed");
            }
            UserDirectoryApi.SetUserStatus(TestConfig.NewUser, UserStatus.Active);
            WaitForNewMail(_mm.ClientCxM, _waitMailTimeoutSeconds);
            var isReceived = _mm.IsUserActivationEmailReceived();

            Assert.IsTrue(isReceived, "No user activated email received");
            _isNewUserActivatedByAdmin = true;
        }
Ejemplo n.º 2
0
        // daily report emails send at 8:00 AM (Europe/Kiev),
        // this test needs some time to prepare environment, so run it before 7:59 AM
        public void RT07310_FollowItemsEmailReport()
        {
            if (DateTime.Now.TimeOfDay > new TimeSpan(07, 59, 00))
            {
                Assert.Inconclusive("Canceled run. The test should be started before 07:59 AM");
            }
            CurrentTenant = TenantTitle.reportitems;
            var userProperties = UserDirectoryApi.GetUserData(TestConfig.NewUser);

            if (userProperties == null)
            {
                AccountApi.CreateNewAccount(TestConfig.NewUser);
                UserDirectoryApi.SetUserStatus(TestConfig.NewUser, UserStatus.Active);
                UserDirectoryApi.AssignRolesToUser(TestConfig.NewUser,
                                                   new [] { UserRole.CxmAdmin });
                userProperties = UserDirectoryApi.GetUserData(TestConfig.NewUser);
            }
            CurrentUser = TestConfig.NewUser;
            const string itemTitle = "Daily report template";
            var          itemsReportEmailSubject = $"Items report {CurrentTenantCode}";
            Item         item = null, custItem1 = null, custItem2 = null;
            var          app       = AddAppIbeacon(TestConfig.IbeaconAppVersions[1], true);

            Parallel.Invoke(
                () => item = ItemApi.SearchItem(itemTitle),
                () => AddPlaceNoType(PlaceStatus.NoDevice, isAddChild: false, pageToBeOpened: 0,
                                     isCreateNewPlace: true),
                () => AddItem(ItemType.Employee),
                () => AddItem(ItemType.CustomerProfile, isAddNew: true),
                () => AddItem(ItemType.Car),
                () => custItem1 = AddItem(ItemType.CustomerProfile, isAddNew: true),
                () => custItem2 = AddItem(ItemType.CustomerProfile, isAddNew: true),
                () => ItemApi.FollowItems(ItemType.CustomerProfile),
                () => ItemApi.FollowItems(ItemType.Car),
                () => ItemApi.FollowItems(ItemType.Employee)
                );
            Assert.IsNotNull(item,
                             $@"Item '{itemTitle}' not found. Is iBeacon app imported and available on tenant " +
                             $"{CurrentTenantCode}?");
            AddItemToIbeaconApp(app, "$.texts.emails.itemsFollowReportTemplate", item);

            Parallel.Invoke(
                () => _mm.InboxHousekeeping(_mm.ClientCxM),
                () => ItemApi.DeleteItem(custItem1.Id),
                () => ItemApi.SaveItem(custItem2),
                () => AddItem(ItemType.PorscheCar, isAddNew: true),
                () => AddItem(ItemType.CustomerProfile, isAddNew: true),
                () => AddItem(ItemType.UsedCar, isAddNew: true),
                () => AddItem(ItemType.ServiceBooking, isAddNew: true)
                );

            // it's time to start checking mail box
            WaitForTimeOfDay(new TimeSpan(08, 00, 00));
            // expects a new email within 600 seconds
            var gotNewMail         = WaitForNewMail(_mm.ClientCxM, 600);

            Assert.IsTrue(gotNewMail, $"There is no new daily report found in mailbox {TestConfig.MailServerLogin}");

            var hasUserName        = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                $"{userProperties.GivenName} {userProperties.FamilyName}");

            Assert.IsTrue(hasUserName, "Item report email has no user firstname or lastname");

            var tenantTitle        = CurrentTenant.ToString();
            var hasTenantTitle     = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                tenantTitle);

            Assert.IsTrue(hasTenantTitle, $@"Item report email has no tenant title '{tenantTitle}'");

            var custProfileContent = $"{ItemTypeCustomerProfile}: 1 new {ItemTypeCustomerProfile}, " +
                                     $"1 updated {ItemTypeCustomerProfile}, 1 deleted {ItemTypeCustomerProfile}";
            var hasCustProfileInfo = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                custProfileContent);

            Assert.IsTrue(hasCustProfileInfo, $@"Item report email has no text: '{custProfileContent}'");

            var hasPorscheCarsAndUsedCars = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                $"{ItemTypePorscheCar}s, {ItemTypeUsedCar}s");

            Assert.IsTrue(hasPorscheCarsAndUsedCars,
                          "Item report email has no info about updated item types: " +
                          $@"'{ItemTypePorscheCar}s, {ItemTypeUsedCar}s'");

            var hasPorscheCarsInfo = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                $"{ItemTypePorscheCar}: 1 new {ItemTypePorscheCar}");

            Assert.IsTrue(hasPorscheCarsInfo,
                          $@"Item report email has no info about followed item: '{ItemTypePorscheCar}: 1 new " +
                          $@"{ItemTypePorscheCar}'");

            var hasUsedCarsInfo = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                $"{ItemTypeUsedCar}: 1 new {ItemTypeUsedCar}");

            Assert.IsTrue(hasUsedCarsInfo,
                          $@"Item report email has no info about followed item: '{ItemTypeUsedCar}: 1 new " +
                          $@"{ItemTypeUsedCar}'");

            var hasNoEmployeeInfo = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                ItemTypeEmployee);

            Assert.IsTrue(hasNoEmployeeInfo,
                          $"Item report email must contain no {ItemTypeEmployee} items info");

            var hasNoServiceBookingInfo = _mm.IsMailBodyContainsText(
                _mm.ClientCxM,
                itemsReportEmailSubject,
                ItemTypeServiceBooking);

            Assert.IsTrue(hasNoServiceBookingInfo,
                          $"Item report email must contain no {ItemTypeServiceBooking} items info");
        }
Ejemplo n.º 3
0
        public void RT09010_Models()
        {
            var newUser = new User
            {
                Email    = $"Auto{RandomNumber}@ameria.de",
                Password = CurrentUser.Password
            };

            Parallel.Invoke(
                () => AccountApi.CreateNewAccount(newUser),
                () => _role = UserDirectoryApi.SetRolePermissions(
                    _role,
                    "Login",
                    "GetAnyLocation",
                    "ImportApp",
                    "GetAnyApp",
                    "ModifyOwnApp",
                    "ModifyAnyApp",
                    "ImportAppVersion",
                    "DeleteOwnAppVersion",
                    "DeleteAnyAppVersion",
                    "ChangePorscheCar",
                    "ModifyPorschePdfCar",
                    "ModifyPorscheUsedCar",
                    "ViewPorscheCar",
                    "ViewPorschePdfCar",
                    "ViewPorscheUsedCar"),
                () => AddAppDpt(AppStatus.Any, TestConfig.DptAppVersions[0])
                );
            UserDirectoryApi.SetUserStatus(newUser, UserStatus.Active);
            UserDirectoryApi.AddRoleToUser(newUser, _role, TenantTitle.import);
            CurrentUser = newUser;
            TestStart(isSelectTenant: false);

            OpenItemsPage();
            Click(PageFooter.AddItemButton);
            ClickUntilShown(ItemsPage.TypeDropDown, CommonElement.DropDownOptionList);
            var availableTypes = new List <string>
            {
                ItemTypeCars, ItemTypePorscheCar, ItemTypeUsedCar, ItemTypePdfCar
            };

            Assert.IsTrue(AreCollectionsEqual(GetElementsText(CommonElement.DropDownOptionList), availableTypes),
                          "Only following item types should be available: " + string.Join(", ", availableTypes));

            OpenAppsPage();
            Click(PageFooter.AddAppInAppsButton);
            var name = FileManager.GetFileByVersion(TestConfig.DptMobileAppFolderRt09010,
                                                    TestConfig.DptMobileAppFileRt09010, TestConfig.DptAppEarliestVersionRt09010);

            FileManager.Upload(name);
            Assert.IsTrue(IsElementFound(AppsPage.YouDontHavePermissionsDialog),
                          @"Error dialog 'You don't have permissions to modify models' should be shown");

            Click(AppsPage.OkButton);
            Assert.IsTrue(IsElementNotFoundQuickly(AppsPage.YouDontHavePermissionsDialog),
                          @"Error dialog 'You don't have permissions to modify models' should be closed");
            Assert.IsTrue(IsPageContainsUri(TestConfig.AppsUri), $@"App '{AppName}' should not be uploaded");

            OpenItemsPage();
            Click(PageFooter.AddItemButton);
            ClickUntilShown(ItemsPage.TypeDropDown, CommonElement.DropDownOptionList);
            Assert.IsFalse(AreElementsContainText(CommonElement.DropDownOptionList, AppName),
                           $@"Dropdown Type should not contain '{AppName}'");
            Assert.IsTrue(AreCollectionsEqual(GetElementsText(CommonElement.DropDownOptionList), availableTypes),
                          "Only following item types should be available: " + string.Join(", ", availableTypes));

            UserDirectoryApi.SetRolePermissions(
                _role,
                "Login",
                "GetAnyLocation",
                "ImportApp",
                "GetAnyApp",
                "ModifyOwnApp",
                "ModifyAnyApp",
                "ImportAppVersion",
                "DeleteOwnAppVersion",
                "DeleteAnyAppVersion",
                "ChangePorscheCar",
                "ModifyPorschePdfCar",
                "ModifyPorscheUsedCar",
                "ViewPorscheCar",
                "ViewPorschePdfCar",
                "ViewPorscheUsedCar",
                "ModifyModel");
            OpenAppsPage();
            RefreshPage();
            Click(PageFooter.AddAppInAppsButton);
            FileManager.Upload(name);
            Assert.IsTrue(IsElementFound(AppsPage.YouDontHavePermissionsDialog),
                          @"Error dialog 'You don't have permissions to create models' should be shown");

            Click(AppsPage.OkButton);
            Assert.IsTrue(IsPageContainsUri(TestConfig.AppsUri), $@"App '{AppName}' should not be uploaded");

            OpenItemsPage();
            Click(PageFooter.AddItemButton);
            ClickUntilShown(ItemsPage.TypeDropDown, CommonElement.DropDownOptionList);
            Assert.IsFalse(AreElementsContainText(CommonElement.DropDownOptionList, AppName),
                           $@"Dropdown Type should not contain '{AppName}'");
            Assert.IsTrue(AreCollectionsEqual(GetElementsText(CommonElement.DropDownOptionList), availableTypes),
                          "Only following item types should be available: " + string.Join(", ", availableTypes));

            UserDirectoryApi.SetRolePermissions(
                _role,
                "Login",
                "GetAnyLocation",
                "ImportApp",
                "GetAnyApp",
                "ModifyOwnApp",
                "ModifyAnyApp",
                "ImportAppVersion",
                "DeleteOwnAppVersion",
                "DeleteAnyAppVersion",
                "ChangePorscheCar",
                "ModifyPorschePdfCar",
                "ModifyPorscheUsedCar",
                "ViewPorscheCar",
                "ViewPorschePdfCar",
                "ViewPorscheUsedCar",
                "CreateModel");
            OpenAppsPage();
            RefreshPage();
            Click(PageFooter.AddAppInAppsButton);
            FileManager.Upload(name);
            Assert.IsTrue(IsElementFound(AppsPage.AppTitle) && AreElementsContainText(AppsPage.AppTitle, AppName),
                          $@"App '{AppName}' should be uploaded");

            OpenItemsPage();
            Click(PageFooter.AddItemButton);
            ClickUntilShown(ItemsPage.TypeDropDown, CommonElement.DropDownOptionList);
            Assert.IsFalse(AreElementsContainText(CommonElement.DropDownOptionList, AppName),
                           $@"Dropdown Type should not contain '{AppName}'");
            Assert.IsTrue(AreCollectionsEqual(GetElementsText(CommonElement.DropDownOptionList), availableTypes),
                          "Only following item types should be available: " + string.Join(", ", availableTypes));

            UserDirectoryApi.SetRolePermissions(
                _role,
                "Login",
                "GetAnyLocation",
                "ImportApp",
                "GetAnyApp",
                "ModifyOwnApp",
                "ModifyAnyApp",
                "ImportAppVersion",
                "DeleteOwnAppVersion",
                "DeleteAnyAppVersion",
                "ChangePorscheCar",
                "ModifyPorschePdfCar",
                "ModifyPorscheUsedCar",
                "ViewPorscheCar",
                "ViewPorschePdfCar",
                "ViewPorscheUsedCar",
                "CreateModel",
                "ViewTestmodel1",
                "ModifyTestmodel1");
            OpenItemsPage();
            RefreshPage();
            Click(PageFooter.AddItemButton);
            ClickUntilShown(ItemsPage.TypeDropDown, CommonElement.DropDownOptionList);
            availableTypes.Add(ItemTypeTestModel1);
            Assert.IsTrue(AreCollectionsEqual(GetElementsText(CommonElement.DropDownOptionList), availableTypes),
                          "Only following item types should be available: " + string.Join(", ", availableTypes));

            DropDownSelect(ItemsPage.TypeDropDown, ItemTypeTestModel1);
            Assert.IsTrue(CountElements(ItemsPage.ErrorPlaceholder) == 2,
                          "Title and Picture fields must have validation errors");

            SendText(ItemsPage.Title, "12345678901");
            Assert.IsTrue(IsElementFoundQuickly(ItemsPage.ErrorNotMore10Chars),
                          @"Error 'Not more than 10 characters are allowed' should be shown");

            Click(PageFooter.CancelButton);
            OpenAppsPage();
            Click(PageFooter.AddAppInAppsButton);
            name = FileManager.GetFileByVersion(TestConfig.DptMobileAppFolderRt09010,
                                                TestConfig.DptMobileAppFileRt09010, TestConfig.DptAppLatestVersionRt09010);
            FileManager.Upload(name);
            Assert.IsTrue(IsElementFound(AppsPage.YouDontHavePermissionsDialog),
                          @"Error dialog 'You don't have permissions to create/modify models' should be shown");

            Click(AppsPage.OkButton);
            Assert.IsTrue(IsElementNotFoundQuickly(AppsPage.YouDontHavePermissionsDialog),
                          @"Error dialog 'You don't have permissions to create/modify models' should be closed");
            Assert.IsTrue(IsPageContainsUri(TestConfig.AppsUri), $@"App '{AppName}' should not be uploaded");

            OpenItemsPage();
            Click(PageFooter.AddItemButton);
            DropDownSelect(ItemsPage.TypeDropDown, ItemTypeTestModel1);
            Assert.IsTrue(CountElements(ItemsPage.ErrorPlaceholder) == 2,
                          "Title and Picture fields must have validation errors");

            UserDirectoryApi.SetRolePermissions(
                _role,
                "Login",
                "GetAnyLocation",
                "ImportApp",
                "GetAnyApp",
                "ModifyOwnApp",
                "ModifyAnyApp",
                "ImportAppVersion",
                "DeleteOwnAppVersion",
                "DeleteAnyAppVersion",
                "ChangePorscheCar",
                "ModifyPorschePdfCar",
                "ModifyPorscheUsedCar",
                "ViewPorscheCar",
                "ViewPorschePdfCar",
                "ViewPorscheUsedCar",
                "CreateModel",
                "ViewTestmodel1",
                "ModifyTestmodel1",
                "ModifyModel");
            Click(PageHeader.PageAppsButton);
            Click(ItemsPage.OkButton);
            Click(PageFooter.AddAppInAppsButton);
            FileManager.Upload(name);
            Assert.IsTrue(IsElementFound(AppsPage.AppTitle) && AreElementsContainText(AppsPage.AppTitle, AppName),
                          $@"App '{AppName}' should be uploaded");

            OpenItemsPage();
            RefreshPage();
            Click(PageFooter.AddItemButton);
            DropDownSelect(ItemsPage.TypeDropDown, ItemTypeTestModel1);
            Assert.IsTrue(CountElements(ItemsPage.ErrorPlaceholder) == 1,
                          "AppTitle field only must have validation error");

            SendText(ItemsPage.Title, "12345678901");
            Assert.IsTrue(IsElementNotFoundQuickly(CommonElement.ValidationError), "No validation errors should be shown");

            SubmitForm();
            Assert.IsTrue(IsViewMode(), "Item should be saved successfully");

            OpenItemsPage();
            ClickUntilShown(PageHeader.FilterDropDown, CommonElement.DropDownOptionList);
            Assert.IsTrue(AreElementsContainText(CommonElement.DropDownOptionList, ItemTypeTestModel1),
                          $@"Filter dropdown should contain '{ItemTypeTestModel1}'");
        }