コード例 #1
0
ファイル: Program.cs プロジェクト: janiarrowdev/StandardTasks
            public void EditServiceListing()
            {
                // Creates a toggle for the given test, adds all log events under it
                test = extent.StartTest("Edit A Listing");

                // Edit A Service Listing
                ManageListing ManageListingObj = new ManageListing();

                ManageListingObj.ViewManageListingPage();

                try
                {
                    string ActualResult = ManageListingObj.PerformAction("Edit");

                    //If Action Performed succesfully, page redirects to Service Listing Page
                    string ExpectedResult = "ServiceListing";

                    Assert.AreEqual(ExpectedResult, ActualResult);

                    // Screenshot
                    String img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Edit Service");
                    test.Log(LogStatus.Info, "Edit Service Successfully" + img);
                }
                catch (Exception e)
                {
                    Base.test.Log(LogStatus.Error, "Error in Edit Service : " + e.Message);
                }

                //Edit the Service
                ServiceListing serviceListingObj = new ServiceListing();
                //serviceListingObj.SaveNew();
            }
コード例 #2
0
            public void viewListedService()
            {
                NavigationBar  navigationBar  = new NavigationBar();
                ManageListings manageListings = navigationBar.clickOnManageListing();
                ServiceListing serviceListing = manageListings.viewListedService();

                serviceListing.isServiceDetailsCorrect();
            }
コード例 #3
0
            public void TC_009_03_CreateNewShareSkill()
            {
                try
                {
                    GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                    test = extent.StartTest("Create New Share Skill Record");
                    // create an object for serviceLIsting page

                    ServiceListing skillObj = new ServiceListing();

                    //click on the share skill button
                    skillObj.ShareSkillBtnClick();

                    //enter all the details from the excel
                    string title = GlobalDefinitions.ExcelLib.ReadData(2, "Title");
                    string desc  = GlobalDefinitions.ExcelLib.ReadData(2, "Description");
                    skillObj.inputTitleDescription(title, desc);

                    //enter category and sub category details
                    skillObj.SelectCategSubcateg(GlobalDefinitions.ExcelLib.ReadData(2, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

                    // enter tags value
                    skillObj.InputTags(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));

                    //enter service type and location type
                    skillObj.ServiceAndLocationTypeSelect(GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"));

                    //enter yesterday as start date in Available days
                    string date = GlobalDefinitions.ExcelLib.ReadData(2, "AvailableDays");
                    skillObj.StartDateSelect(date);

                    //enter skill trade details
                    skillObj.inputCreditTradeDetails(GlobalDefinitions.ExcelLib.ReadData(2, "credit"));

                    //enter active status
                    skillObj.ActiveBtnClick();

                    //click on save button
                    skillObj.SaveBtnClick();

                    if (skillObj.ShareSkillPageTitle().Equals("ListingManagement"))
                    {
                        Base.test.Log(LogStatus.Pass, "New share skill record created sucessfully");
                        Assert.True(true);
                    }
                    else
                    {
                        Base.test.Log(LogStatus.Fail, "New Share skill record not saved");
                        Assert.Fail();
                    }
                }
                catch (Exception e)
                {
                    Base.test.Log(LogStatus.Fail, e);
                    Assert.Fail();
                }
            }
コード例 #4
0
        public void EditSkill(string TitleForServcToBeEdited, int rownumber)
        {
            bool editMatchFound = false;

            TestCase_Name = $"Editing existing services for title {TitleForServcToBeEdited}";
            test          = extent.CreateTest(TestCase_Name);

            //Create an instance for the SignIn page
            SignIn JoinObj = new SignIn(driver);

            //Invoke the LoginSteps to verify if the user can log in with valid credentials
            JoinObj.LoginSteps();

            //Invoke the function to validate if the user has logged in successfully and the home page is displayed
            JoinObj.ValidateHomePage();

            //Create an instance for the HomePage
            HomePage listObj = new HomePage(driver);

            //Invoke the funtion to navigate to Manage Listings
            listObj.navigateToManageListings();

            //Create an instance for the Listing Management page
            ListingManagement obj = new ListingManagement(driver, TitleForServcToBeEdited, rownumber);

            //Invoke the function to check if the service to be edited is available in the Manage Listings
            editMatchFound = obj.NavigateToEditDetails();

            //Create instances for ServiceListing Page and SearchSkill Page
            ServiceListing editObj = new ServiceListing(driver, rownumber);
            SearchSkill    SrchObj = new SearchSkill(driver, rownumber);

            //Proceed to Edit service only if the service to be edited is found
            if (editMatchFound)
            {
                //Invoke the function to Edit services
                editObj.EditServices();

                //Implicit wait
                Wait.wait(2, driver);

                //Invoke the function to search for service after edit
                obj.SearchSkillsAfterEdit();

                //Invoke the function to validate the search result
                SrchObj.SkillSrchResult();

                //Implicit wait
                Wait.wait(2, driver);

                //Create an instance for ServiceDetail Page
                ServiceDetail ViewEditdDetailObj = new ServiceDetail(driver, rownumber);

                //Invoke the function to validate the edited details
                ViewEditdDetailObj.ValidateServiceDetail();
            }
        }
コード例 #5
0
        public async Task <IActionResult> CreateService([Bind("ServiceListingId,AccountId,ServiceTitle,ServiceDescription,ListingDate,ImageFile, ServiceLocation")] ServiceListing serviceListing)
        {
            serviceListing.ListingDate = DateTime.Now;
            string userId = "";

            try
            {
                userId = HttpContext.Session.GetString("userId");
            }
            catch (Exception)
            {
                // Do nothing
            }

            var sellerAccountId = await _context.Accounts
                                  .FirstOrDefaultAsync(s => s.AccountId.ToString() == userId);


            if (ModelState.IsValid)
            {
                try
                {
                    serviceListing.AccountId = sellerAccountId.AccountId;

                    if (serviceListing.ImageFile != null)
                    {
                        //Save image to wwwroot/images
                        string wwwRootPath = _hostEnvironment.WebRootPath;
                        string fileName    = Path.GetFileNameWithoutExtension(serviceListing.ImageFile.FileName);
                        string extension   = Path.GetExtension(serviceListing.ImageFile.FileName);
                        serviceListing.ServiceImage = fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                        string path = Path.Combine(wwwRootPath + "/Images/", fileName);
                        using (var fileStream = new FileStream(path, FileMode.Create))
                        {
                            await serviceListing.ImageFile.CopyToAsync(fileStream);
                        }
                    }
                    else
                    {
                        serviceListing.ServiceImage = "geekium_symbol.png";
                    }

                    _context.Add(serviceListing);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception)
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewData["AccountId"] = new SelectList(_context.Accounts, "AccountId", "Email", serviceListing.AccountId);
            return(View(serviceListing));
        }
コード例 #6
0
        public async void CreateService_InputViableServiceData_ModelReturnsValid()
        {
            // Arrange
            MyListingsController controller = new MyListingsController(context, _hostEnvironment);
            ServiceListing       list       = InitializeServiceListing();

            // Act
            await controller.CreateService(list);

            // Assert
            Assert.True(controller.ModelState.IsValid);
        }
コード例 #7
0
        public async Task EditService_PassInServiceListingAndServiceListingId_ModelIsValid()
        {
            // Assert
            MyListingsController controller = new MyListingsController(context, _hostEnvironment);
            ServiceListing       list       = InitializeServiceListing();

            // Act
            context.Add(list);
            list.ServiceDescription = "Hello";
            await controller.EditService(0, list);

            // Assert
            Assert.True(controller.ModelState.IsValid);
        }
コード例 #8
0
        public ServiceListing InitializeServiceListing()
        {
            context.Add(InitializeAccount());
            ServiceListing listing = new ServiceListing
            {
                AccountId          = 1,
                ServiceTitle       = "Nothing",
                ServiceDescription = "Literally nothing",
                ListingDate        = Convert.ToDateTime("2020-10-02"),
                ServiceImage       = null
            };

            return(listing);
        }
コード例 #9
0
        public async Task DeleteConfirmedService_PassInInitializedServiceId_ReturnRedirection()
        {
            // Assert
            MyListingsController controller = new MyListingsController(context, _hostEnvironment);
            ServiceListing       list       = InitializeServiceListing();

            InitializeSeller();

            // Act
            context.Add(list);
            var result = await controller.DeleteConfirmedService(0);

            // Assert
            Assert.IsType <RedirectToActionResult>(result);
        }
コード例 #10
0
            public void TC_009_01_CheckShareskillClickable()
            {
                test = extent.StartTest("Share Skill Button visible test");
                ServiceListing skillObj = new ServiceListing();

                if (skillObj.IsShareSkillBtnClickable())
                {
                    Base.test.Log(LogStatus.Info, "Share skill button is clickable");
                    Assert.IsTrue(true);
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Test failed");
                    Assert.Fail();
                }
            }
コード例 #11
0
ファイル: Program.cs プロジェクト: janiarrowdev/StandardTasks
            public void SaveNewService()
            {
                //Allocate the number of services to be saved
                int NoOfServices = 2;

                ServiceListing ServiceListingObj = new ServiceListing();

                for (int i = 0; i < NoOfServices; i++)
                {
                    // Creates a toggle for the given test, adds all log events under it
                    test = extent.StartTest("Save New Service");

                    // Open Share Skill Page
                    if (i == 0)
                    {
                        Profile profilePG = new Profile();
                        profilePG.ViewShareSkillPage();
                    }
                    else
                    {
                        ManageListing manageListingObj = new ManageListing();
                        manageListingObj.ViewShareSkillPage();
                    }

                    try
                    {
                        // Save New Service Listing

                        string ActualResult = ServiceListingObj.SaveNew(i);

                        //If Shared succesfully, the record should display in ManageListings Page
                        string ExpectedResult = "True";

                        Assert.AreEqual(ExpectedResult, ActualResult);

                        // Screenshot
                        String img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "ShareSkill_" + i);
                        test.Log(LogStatus.Info, "Share Skill Successfully_" + i + ": " + img);
                    }
                    catch (Exception e)
                    {
                        Base.test.Log(LogStatus.Error, "Error in Shared Skill Save : " + e.Message);
                    }
                }
            }
コード例 #12
0
            public void TC_WorkSamplesUpload()
            {
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                test = extent.StartTest("Uploading File Test");
                // create an object for serviceLIsting page

                ServiceListing skillObj = new ServiceListing();

                //click on the share skill button
                skillObj.ShareSkillBtnClick();

                //enter all the details from the excel
                Thread.Sleep(2000);
                string title = GlobalDefinitions.ExcelLib.ReadData(3, "Title");
                string desc  = GlobalDefinitions.ExcelLib.ReadData(3, "Description");

                skillObj.inputTitleDescription(title, desc);

                //work samples file upload
                skillObj.WorkSamplesUploadClick();

                //AutoIt - Handles windows that do not belong to browser

                AutoItX3 autoIt = new AutoItX3();

                autoIt.WinActivate("Open"); //Activate - so that the next set of actions happen on this window
                Thread.Sleep(2000);
                autoIt.Send(@"C:\Users\sudha\Desktop\FileUploadTest.docx");
                Thread.Sleep(2000);
                //  autoIt.Send("{ENTER}");
                // autoIt.MouseClick("Button1",0,0, 1, 0);
                autoIt.ControlClick("Open", "", "Button1");

                //Check whether document uploaded property or not
                if (skillObj.IsWorkSamplesDocUpload())
                {
                    Base.test.Log(LogStatus.Pass, "Document uploaded successfully using AutoIt");
                    Assert.True(true);
                }
                else
                {
                    test.Log(LogStatus.Fail, "Document not uploaded");
                    Assert.Fail();
                }
            }
コード例 #13
0
            public void TC_009_02_skillPageTitleCheck()
            {
                test = extent.StartTest("Share skill page title check");
                ServiceListing skillObj = new ServiceListing();

                //click on the share skill button
                skillObj.ShareSkillBtnClick();
                string expectedTitle = "ServiceListing";

                //compare the page title

                if (expectedTitle.Equals(skillObj.ShareSkillPageTitle()))
                {
                    Base.test.Log(LogStatus.Pass, "Page Title Test Passed");
                    Assert.Pass();
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Page Title test Failed");
                    Assert.Fail();
                }
            }
コード例 #14
0
            public void Validate_Add_Service()
            {
                test = extent.StartTest("Starting Add Service test");
                ServiceListing service = new ServiceListing();

                string PageTitle = service.AddService();

                Global.GlobalDefinitions.wait(5000);

                try
                {
                    string Expected = "Manage Listings";

                    WebDriverWait wait = new WebDriverWait(Global.GlobalDefinitions.driver, TimeSpan.FromSeconds(10));
                    wait.Until(ExpectedConditions.ElementExists((By.XPath("//h2[contains(text(),'Manage Listings')]"))));

                    Assert.AreEqual(Expected, Global.GlobalDefinitions.driver.FindElement(By.XPath("//h2[contains(text(),'Manage Listings')]")).Text);
                    Global.Base.test.Log(LogStatus.Pass, "Service is added successfully");
                }
                catch (Exception e) {
                    Global.Base.test.Log(LogStatus.Fail, "Service is not added" + e);
                }
            }
コード例 #15
0
 public void GivenAddServiceListingData()
 {
     ServiceListing.SaveServiceListing();
 }
コード例 #16
0
 public void WhenISaveTheSkillDetails()
 {
     ServiceListingObj = new ServiceListing();
     ServiceListingObj.SaveNew(1);
 }
コード例 #17
0
 public void GivenEnteredAllTheRequiredFieldsInServiceListingPage()
 {
     ServiceListing.SaveServiceListing();
 }
コード例 #18
0
            public void TC_CheckStartDate()
            {
                try
                {
                    GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                    test = extent.StartTest("Create New Share Skill Record");
                    // create an object for serviceLIsting page

                    ServiceListing skillObj = new ServiceListing();

                    //click on the share skill button
                    skillObj.ShareSkillBtnClick();

                    //enter all the details from the excel
                    string title = GlobalDefinitions.ExcelLib.ReadData(4, "Title");
                    string desc  = GlobalDefinitions.ExcelLib.ReadData(4, "Description");
                    skillObj.inputTitleDescription(title, desc);

                    //enter category and sub category details
                    skillObj.SelectCategSubcateg(GlobalDefinitions.ExcelLib.ReadData(4, "Category"), GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

                    // enter tags value
                    skillObj.InputTags(GlobalDefinitions.ExcelLib.ReadData(4, "Tags"));

                    //enter service type and location type
                    skillObj.ServiceAndLocationTypeSelect(GlobalDefinitions.ExcelLib.ReadData(4, "ServiceType"), GlobalDefinitions.ExcelLib.ReadData(4, "LocationType"));

                    //enter yesterday as start date in Available days
                    DateTime date = DateTime.Today.AddDays(-1);
                    skillObj.StartDateSelect(date.ToString("dd-MM-yyyy"));

                    //enter skill trade details
                    skillObj.inputCreditTradeDetails(GlobalDefinitions.ExcelLib.ReadData(4, "credit"));

                    //enter active status
                    skillObj.ActiveBtnClick();

                    //click on save button
                    skillObj.SaveBtnClick();

                    Thread.Sleep(2000);
                    if (skillObj.ShareSkillPageTitle().Equals("ServiceListing"))
                    {
                        if (skillObj.IsErrorDateMsg().Equals("Start Date cannot be set to a day in the past"))
                        {
                            Base.test.Log(LogStatus.Pass, "Test Passed- Past date not accepting as start date");
                            Assert.True(true);
                        }
                        else
                        {
                            Base.test.Log(LogStatus.Fail, "Test Failed - should return proper error message for past date");
                            Assert.Fail();
                        }
                    }
                    else
                    {
                        Base.test.Log(LogStatus.Fail, "Test Failed - Should not save the record with past date as start date");
                        Assert.Fail();
                    }
                }
                catch (Exception e)
                {
                    Base.test.Log(LogStatus.Fail, e);
                    Assert.Fail();
                }
            }