コード例 #1
0
        public void ThenUserCanCompareHeaderColumnOfDownloadedXlsxFileWithWebPageHeader()
        {
            string pendRenDownXlpath = @"C:\Users\Anuruddha.Tiwari\Downloads\quadrantOne.xlsx";

            try
            {
                string s1 = ActivityHomePage.MonthStartHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 0).Contains(s1));

                test.Info("Assert pass successfully for compare the 1st column header with respect to present header under Media Sales");

                string s2 = ActivityHomePage.NewHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 1).Contains(s2));

                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");


                string s3 = ActivityHomePage.RenewHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 2).Contains(s3));

                test.Info("Assert pass successfully for compare the 3rd column header with respect to present header under Media Sales");


                string s4 = ActivityHomePage.TotalHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 3).Contains(s4));
                test.Info("Assert pass successfully for compare the 4th column header with respect to present header under Media Sales");


                //Assert Fail due to mismatch header

                string s5 = ActivityHomePage.PyFinalHeader(SelectBrowser.driver).Text;
                string s6 = ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 4);
                bool   b  = s6.Contains(s5);
                Console.WriteLine(b);
                test.Info("Assert Fail for compare the 5th column header with respect to present header under Media Sales");
                //Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 4).Contains(s5));



                string s7 = ActivityHomePage.RateHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 5).Contains(s7));
                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");



                //scrool
                IWebElement horizontal_scroll = ActivityHomePage.DeltaHeader(SelectBrowser.driver);
                ScrollHoriZontal.Hover(SelectBrowser.driver, horizontal_scroll);
                Thread.Sleep(10000);


                //After scrool

                string s8 = ActivityHomePage.DeltaHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 6).Contains(s8));
                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");
                // Console.WriteLine("Assert pass for all 6 headers");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception==>" + ex);
                ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
            }
        }