public void AssertIndexPage()
 {
     PageContentElement            = AppElement.FindElement(By.CssSelector("div.pageContent"));
     PlanningPokerContainerElement = PageContentElement.FindElement(By.CssSelector("div.planningPokerContainer"));
     ContainerElement = PlanningPokerContainerElement.FindElement(By.XPath("./div[@class='container']"));
     CreateTeamForm   = ContainerElement.FindElement(By.CssSelector("form[name='createTeam']"));
     JoinTeamForm     = ContainerElement.FindElement(By.CssSelector("form[name='joinTeam']"));
 }
        public void AssertMessageBox(string text)
        {
            var messageBoxElement = PageContentElement.FindElement(By.Id("messageBox"));

            Assert.AreEqual("block", messageBoxElement.GetCssValue("display"));

            var messageBodyElement = messageBoxElement.FindElement(By.CssSelector("div.modal-body"));

            Assert.AreEqual(text, messageBodyElement.Text);
        }
Example #3
0
        public void WritePdf_TableWidthTooLarge()
        {
            var tooWideTable = @"{ ""HasHeaderRow"": true, ""TableType"": ""Table"", ""Columns"": [ { ""Name"": ""Sarake 1"", ""WidthInCm"": 21, ""HeightInCm"": 0, ""Type"": ""Text"" } ], ""RowData"": [] }";
            var table1       = new PageContentElement {
                ContentType = ElementType.Table, Table = tooWideTable
            };
            var result1 = Assert.Throws <Exception>(() => CallCreatePdf(new PageContentElement[] { table1 }));

            Assert.IsFalse(File.Exists(_destinationFullPath));
        }
Example #4
0
        public void WritePdf_LogoNotFound()
        {
            _fileProperties.FileExistsAction = FileExistsActionEnum.Overwrite;

            var logoPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Files\no_such_logo.png");
            var header   = new PageContentElement {
                ContentType = ElementType.Header, FontFamily = "Times New Roman", FontSize = 8, FontStyle = FontStyleEnum.Regular, LineSpacingInPt = 11, ParagraphAlignment = ParagraphAlignmentEnum.Right, SpacingAfterInPt = 0, SpacingBeforeInPt = 8, ImagePath = logoPath, HeaderFooterStyle = HeaderFooterStyleEnum.LogoText, BorderWidthInPt = 0.5, ImageHeightInCm = 0.5
            };

            header.Text = @"This is a header";

            var result = Assert.Throws <FileNotFoundException>(() => CallCreatePdf(new PageContentElement[] { header }));

            Assert.IsFalse(File.Exists(_destinationFullPath));
        }
Example #5
0
        public void TestSetup()
        {
            _folder = Path.Combine(Path.GetTempPath(), "pdfwriter_tests");
            _destinationFullPath = Path.Combine(_folder, _fileName);

            if (!Directory.Exists(_folder))
            {
                Directory.CreateDirectory(_folder);
            }

            _fileProperties = new FileProperties {
                Directory = _folder, FileName = _fileName, FileExistsAction = FileExistsActionEnum.Error, Unicode = true
            };
            _docSettings = new DocumentSettings {
                MarginBottomInCm = 2, MarginLeftInCm = 2.5, MarginRightInCm = 2.5, MarginTopInCm = 5, Orientation = PageOrientationEnum.Portrait, Size = PageSizeEnum.A4
            };

            var logoPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Files\logo.png");

            _header = new PageContentElement {
                ContentType = ElementType.Header, FontFamily = "Times New Roman", FontSize = 8, FontStyle = FontStyleEnum.Regular, LineSpacingInPt = 11, ParagraphAlignment = ParagraphAlignmentEnum.Right, SpacingAfterInPt = 0, SpacingBeforeInPt = 8, ImagePath = logoPath, HeaderFooterStyle = HeaderFooterStyleEnum.LogoText, BorderWidthInPt = 0.5, ImageHeightInCm = 0.5
            };
            _footer = new PageContentElement {
                ContentType = ElementType.Footer, FontFamily = "Times New Roman", FontSize = 8, FontStyle = FontStyleEnum.Regular, LineSpacingInPt = 11, ParagraphAlignment = ParagraphAlignmentEnum.Center, SpacingAfterInPt = 0, SpacingBeforeInPt = 8, HeaderFooterStyle = HeaderFooterStyleEnum.TextPagenum, BorderWidthInPt = 0.0
            };
            _title = new PageContentElement {
                ContentType = ElementType.Paragraph, FontFamily = "Times New Roman", FontSize = 16, FontStyle = FontStyleEnum.Bold, LineSpacingInPt = 11, ParagraphAlignment = ParagraphAlignmentEnum.Left, SpacingAfterInPt = 0, SpacingBeforeInPt = 8
            };
            _paragraphContent = new PageContentElement {
                ContentType = ElementType.Paragraph, FontFamily = "Times New Roman", FontSize = 11, FontStyle = FontStyleEnum.Regular, LineSpacingInPt = 11, ParagraphAlignment = ParagraphAlignmentEnum.Left, SpacingAfterInPt = 0, SpacingBeforeInPt = 8
            };

            var tablePath       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Files\ContentDefinition.json");
            var tableDefinition = File.ReadAllText(tablePath);

            _tableContent = new PageContentElement {
                ContentType = ElementType.Table, Table = tableDefinition
            };

            _options = new Options {
                UseGivenCredentials = false, ThrowErrorOnFailure = true
            };
        }