Exemplo n.º 1
0
        public void When_FourLanguagesAdded_Expect_AddDisabled()
        {
            try
            {
                // arrange
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);
                foreach (var i in new string[] { "1", "2", "3" })
                {
                    var language = ReadFromExcel(i);
                    language.Id = helper.GetOrAdd(language);
                    _setUpContext.Add(language);
                }

                // act
                ProfilePage profilePage = new ProfilePage(Driver); // reload
                profilePage.Open();
                var newLanguage = ReadFromExcel("4");
                profilePage.MainSection.EnterLanguageDetails(newLanguage);
                Driver.WaitForAjax();
                newLanguage.Id = helper.GetOrAdd(newLanguage);
                _setUpContext.Add(newLanguage);

                // assert
                Driver.WaitForAjax();
                Assert.That(profilePage.MainSection.IsAddRowButtonEnbaled(), Is.False);
            }
            catch (Exception e)
            {
                if (e is AssertionException)
                {
                    throw;
                }
                Assert.Fail($"Error has occurred\nMessage : {e.Message}\nStackTrace : {e.StackTrace}");
            }
        }
Exemplo n.º 2
0
        public void When_ValidShareSkillData_Expect_UpdateSuccessful(ShareSkill addedShareSkill, ShareSkill shareSkillToUpdate)
        {
            try
            {
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);
                addedShareSkill.Id = helper.GetOrAdd(addedShareSkill);
                _setUpContext.Add(addedShareSkill);

                ListingManagementPage listingManagementPage = new ListingManagementPage(Driver);
                listingManagementPage.Open();
                SkillSharePage shareSkillPage = listingManagementPage.UpdateShareSkill(addedShareSkill);
                shareSkillPage.EnterShareSkill(shareSkillToUpdate);
                Driver.WaitForAjax();
                shareSkillToUpdate.Id = helper.GetOrAdd(shareSkillToUpdate);
                _setUpContext.Add(shareSkillToUpdate);
                Driver.WaitForAjax();

                Assert.Multiple(() =>
                {
                    Assert.AreEqual(listingManagementPage.Url, Driver.GetCurrentUrl());
                    Assert.That(listingManagementPage.SearchShareSkill(shareSkillToUpdate), Is.Not.Null);
                });
            }
            catch (Exception e)
            {
                if (e is AssertionException)
                {
                    throw;
                }
                Assert.Fail($"Error has occurred\nMessage : {e.Message}\nStackTrace : {e.StackTrace}");
            }
        }
        public void When_ExistingSkillData_Expect_DeleteSuccessful(ShareSkill shareSkillToDelete)
        {
            try
            {
                // arrange
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);
                shareSkillToDelete.Id = helper.GetOrAdd(shareSkillToDelete);
                _setUpContext.Add(shareSkillToDelete);
                // act
                // find an existing skill
                ListingManagementPage listingManagementPage = new ListingManagementPage(Driver);
                listingManagementPage.Open();
                Driver.WaitForAjax();

                listingManagementPage.DeleteShareSkill(shareSkillToDelete);
                // assert
                Assert.Multiple(() =>
                {
                    Assert.AreEqual(listingManagementPage.Url, Driver.GetCurrentUrl());
                    Assert.That($"{shareSkillToDelete.Title} has been deleted", Is.EqualTo(listingManagementPage.GetSuccessPopUpMessage()));
                });
            }
            catch (Exception e)
            {
                if (e is AssertionException)
                {
                    throw;
                }
                Assert.Fail($"Error has occurred\nMessage : {e.Message}\nStackTrace : {e.StackTrace}");
            }
        }
        public void When_FilterCategory_Expect_FilterSuccessful(ShareSkill expectedSkilShare, string category, string subcategory)
        {
            try
            {
                // arrange
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);
                // act
                // find an existing skill
                expectedSkilShare.Id = helper.GetOrAdd(expectedSkilShare);
                _setUpContext.Add(expectedSkilShare);
                Driver.WaitForAjax();

                SearchResultPage searchResultPage = new ProfilePage(Driver).SearchBar.SearchSkill("Cucumber");
                searchResultPage.RefineResultsPane.FilterByCategory(category);
                Driver.WaitForAjax();
                searchResultPage.RefineResultsPane.FilterBySubCategory(subcategory);
                Driver.WaitForAjax();
                // assert
                Assert.Multiple(() =>
                {
                    Assert.That(searchResultPage.ResultSection.SearchResults.SearchResultList.IsNullOrEmpty(), Is.False);
                    Assert.True(searchResultPage.ResultSection.SearchResults.SearchResultList.First().GetSkillTitle() == expectedSkilShare.Title);
                });
            }
            catch (Exception e)
            {
                if (e is AssertionException)
                {
                    throw;
                }
                Assert.Fail($"Error has occurred\nMessage : {e.Message}\nStackTrace : {e.StackTrace}");
            }
        }
        public void When_ValidEducationDetails_Expect_AdddSuccessful(Education education)
        {
            try
            {
                DataSetUpHelper helper = new DataSetUpHelper(ValidCredentials.Username, ValidCredentials.Password);

                // act
                ProfilePage profilePage = new ProfilePage(Driver); // reload
                profilePage.Open();
                profilePage.MainSection.EnterEducationDetails(education);
                Driver.WaitForAjax();
                education.Id = helper.GetOrAdd(education);
                _setUpContext.Add(education);

                // assert
                Driver.WaitForAjax();
                Assert.IsTrue(profilePage.MainSection.SearchForRow(education));
                Assert.That(
                    "Education has been added",
                    Is.EqualTo(profilePage.GetSuccessPopUpMessage()));
            }
            catch (Exception e)
            {
                if (e is AssertionException)
                {
                    throw;
                }
                Assert.Fail($"Error has occurred\nMessage : {e.Message}\nStackTrace : {e.StackTrace}");
            }
        }
        public void WhenIListMySkillForTrade(string skillTitle)
        {
            StepDefinitionType stepDefinitionType = _context.StepContext.StepInfo.StepDefinitionType;
            ExcelData          data = ExcelDataReaderUtil.FetchRowUsingKey(skillTitle);
            var shareSkill          = ObjectFactory.CreateInstance <ShareSkill>(data);

            _context.Set(shareSkill, skillTitle);
            // assumption that title is considered unique (even though it seems to have an internal ID that is not visible on page)
            if (stepDefinitionType == StepDefinitionType.When)
            {
                SkillSharePage.EnterShareSkill(shareSkill);
            }
            // retrieve ID
            shareSkill.Id = _helper.GetOrAdd(shareSkill);
            TestHelper.GetListOfObjectsToBeRemoved(_context).Add(shareSkill);
        }
Exemplo n.º 7
0
        public void GivenIAlreadyHaveAsFollows(ProfileInfoType type, Table table)
        {
            var details = CreateProfileDetails(type, table);
            //Type elementType = details.FirstOrDefault()?.GetType();
            //var genericMethod = typeof(Enumerable).GetMethod("Cast").MakeGenericMethod(elementType);
            //System.Collections.IEnumerable converted = genericMethod.Invoke(null, new[] { details }) as System.Collections.IEnumerable;
            //var credentials = TestBase.Credentials;
            //var helper = new DataSetUpHelper(credentials.Username, credentials.Password); // share helper in the same thread? not sure
            //initialise

            var objectsToBeDeleted = TestHelper.GetListOfObjectsToBeRemoved(_context);

            foreach (var detail in details)
            {
                detail.Id = _helper.GetOrAdd((object)detail);
                objectsToBeDeleted.Add(detail);
            }
        }
Exemplo n.º 8
0
        public void GivenTheSkillSearchResultsForAreShown(string searchKey)
        {
            ExcelData data       = ExcelDataReaderUtil.FetchRowUsingKey(searchKey);
            var       shareSkill = ObjectFactory.CreateInstance <ShareSkill>(data);

            _context.Set(shareSkill);
            // assumption that title is considered unique (even though it seems to have an internal ID that is not visible on page)
            // retrieve ID
            shareSkill.Id = _helper.GetOrAdd(shareSkill);

            var objectsToBeDeleted = TestHelper.GetListOfObjectsToBeRemoved(_context);

            objectsToBeDeleted.Add(shareSkill);

            ListingManagementPage listPage = new ListingManagementPage(_driver);

            listPage.Open();
            searchResultPage = listPage.SearchBar.SearchSkill(searchKey);
            _driver.WaitForAjax();
        }