Projects STRLCPY Taipan Commits 90bd8fe3
🤬
  • ■ ■ ■ ■ ■ ■
    Src/EndToEndTests/EndToEndTests.fsproj
    skipped 41 lines
    42 42   <Reference Include="mscorlib" />
    43 43   <Reference Include="System" />
    44 44   <Reference Include="System.Core" />
     45 + <Reference Include="System.IO.Compression" />
     46 + <Reference Include="System.IO.Compression.FileSystem" />
    45 47   <Reference Include="System.Numerics" />
    46 48   <Reference Include="System.Xml" />
    47 49   <Reference Include="System.Xml.Linq" />
    skipped 2547 lines
  • ■ ■ ■ ■ ■ ■
    Src/EndToEndTests/Program.fs
    1 1  open System
     2 +open System.Net
     3 +open System.IO
    2 4  open System.Reflection
    3 5  open ES.Taipan.Crawler
    4 6  open ES.Taipan.Discoverer
    skipped 2 lines
    7 9  open Microsoft.FSharp.Quotations.Patterns
    8 10  open Microsoft.FSharp.Quotations.DerivedPatterns
    9 11  open FSharp.Quotations.Evaluator
     12 +open System.IO.Compression
    10 13   
    11 14  let allTests : Expr<Uri -> unit> list = [
    12 15  
    skipped 102 lines
    115 118  
    116 119  ]
    117 120   
     121 +let downloadFile(url: String) =
     122 + let webClient = new WebClient()
     123 + let tempFilename = Path.Combine(Path.GetTempPath(), Path.GetTempFileName())
     124 + webClient.DownloadFile(url, tempFilename)
     125 + tempFilename
     126 + 
     127 +let extractZipFileToFolder(zipFile: String, destFolder: String) =
     128 + Directory.CreateDirectory(destFolder) |> ignore
     129 + ZipFile.ExtractToDirectory(zipFile, destFolder)
     130 + 
     131 +let downloadChromeBins(directory: String) =
     132 + let windZip = downloadFile("https://s3.eu-west-2.amazonaws.com/taipansec/chrome-win32.zip")
     133 + let chromeWin32Bins = Path.Combine(directory, "ChromeBins", "Windows32")
     134 + Directory.CreateDirectory(chromeWin32Bins) |> ignore
     135 + extractZipFileToFolder(windZip, chromeWin32Bins)
     136 + File.Delete(windZip)
     137 + 
     138 +let downloadChromeDriver(directory: String) =
     139 + let driveZip = downloadFile("https://s3.eu-west-2.amazonaws.com/taipansec/driver.zip")
     140 + Directory.CreateDirectory(directory) |> ignore
     141 + extractZipFileToFolder(driveZip, directory)
     142 + File.Delete(driveZip)
     143 + 
     144 +let verifyChromBinaryInstallation() =
     145 + let curDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
     146 + let chromeWin32Bins = Path.Combine(curDir, "ChromeBins")
     147 + let driverFolder = Path.Combine(curDir, "driver")
     148 + 
     149 + if not(Directory.Exists(chromeWin32Bins)) || not(Directory.Exists(driverFolder)) then
     150 + Console.WriteLine("Download Chrome Windows binary and driver")
     151 + downloadChromeBins(curDir)
     152 + downloadChromeDriver(curDir)
     153 + 
    118 154  let runTest (grovieraUri: Uri) (testExpr: Expr<Uri -> unit>) =
    119 155   match testExpr with
    120 156   | Lambda (_, c) ->
    skipped 13 lines
    134 170  
    135 171  [<EntryPoint>]
    136 172  let main argv =
     173 + verifyChromBinaryInstallation()
    137 174   let grovieraUri = Utility.runGrovieraServer()
    138 175   let run = runTest grovieraUri
    139 176   allTests |> List.iter(run)
    skipped 3 lines
Please wait...
Page is in error, reload to recover