Skip to content

Commit d1ff5ab

Browse files
authored
Test on Microsoft Edge (#1339)
* Install edge * Move files * here we go * okey * Almost there * Force framework * Change log location * Remove log, we know it's working * CodeFactor
1 parent 5d4b111 commit d1ff5ab

File tree

8 files changed

+380
-1
lines changed

8 files changed

+380
-1
lines changed

appveyor-edge.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 1.0.{build}
2+
branches:
3+
only:
4+
- master
5+
image: Visual Studio 2017
6+
configuration: Release
7+
environment:
8+
git_access_token:
9+
secure: FxcQ9C8a/NgcQB5dFdZts6ZWEDT4zMhA4qPQAYwWc7huMmhmTIl1sbFEIaAWQMTL
10+
PUPPETEER_EXECUTABLE_PATH: C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe
11+
install:
12+
- ps: >-
13+
cd c:\projects\puppeteer-sharp-edge\appveyor\edge
14+
15+
.\InstallEdge.ps1
16+
17+
cd c:\projects\puppeteer-sharp-edge
18+
19+
before_build:
20+
- ps: >-
21+
dotnet restore .\lib\PuppeteerSharp.sln
22+
23+
New-SelfSignedCertificate -Subject "localhost" -FriendlyName "Puppeteer" -CertStoreLocation "cert:\CurrentUser\My"
24+
25+
Get-ChildItem -Path cert:\CurrentUSer\my | where { $_.friendlyname -eq "Puppeteer" } | Export-Certificate -FilePath C:\projects\puppeteer-sharp-edge\lib\PuppeteerSharp.TestServer\testCert.cer
26+
27+
build:
28+
project: .\lib\PuppeteerSharp.sln
29+
publish_nuget: true
30+
include_nuget_references: true
31+
verbosity: minimal
32+
test_script:
33+
- cmd: >-
34+
cd .\lib\PuppeteerSharp.Tests
35+
36+
dotnet test -f netcoreapp2.2 -s test.runsettings
37+
cache:
38+
- $HOME/.nuget/packages
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#
2+
# Module manifest for module 'ImageHelpers'
3+
#
4+
# Generated by: chrispat
5+
#
6+
# Generated on: 11/1/2017
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'ImageHelpers.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '0.0.1'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = 'c9334909-16a1-48f1-a94a-c7baf1b961d9'
22+
23+
# Author of this module
24+
Author = 'chrispat'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'Unknown'
28+
29+
# Copyright statement for this module
30+
Copyright = '(c) 2017 chrispat. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
Description = 'Helper functions for creating vsts images'
34+
35+
# Minimum version of the Windows PowerShell engine required by this module
36+
# PowerShellVersion = ''
37+
38+
# Name of the Windows PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the Windows PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# CLRVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
# RequiredModules = @()
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
# FormatsToProcess = @()
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72+
FunctionsToExport = '*'
73+
74+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75+
CmdletsToExport = '*'
76+
77+
# Variables to export from this module
78+
VariablesToExport = '*'
79+
80+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
81+
AliasesToExport = '*'
82+
83+
# DSC resources to export from this module
84+
# DscResourcesToExport = @()
85+
86+
# List of all modules packaged with this module
87+
# ModuleList = @()
88+
89+
# List of all files packaged with this module
90+
# FileList = @()
91+
92+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
93+
PrivateData = @{
94+
95+
PSData = @{
96+
97+
# Tags applied to this module. These help with module discovery in online galleries.
98+
# Tags = @()
99+
100+
# A URL to the license for this module.
101+
# LicenseUri = ''
102+
103+
# A URL to the main website for this project.
104+
# ProjectUri = ''
105+
106+
# A URL to an icon representing this module.
107+
# IconUri = ''
108+
109+
# ReleaseNotes of this module
110+
# ReleaseNotes = ''
111+
112+
} # End of PSData hashtable
113+
114+
} # End of PrivateData hashtable
115+
116+
# HelpInfo URI of this module
117+
# HelpInfoURI = ''
118+
119+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
120+
# DefaultCommandPrefix = ''
121+
122+
}
123+
124+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[CmdletBinding()]
2+
param()
3+
4+
. $PSScriptRoot\PathHelpers.ps1
5+
. $PSScriptRoot\InstallHelpers.ps1
6+
. $PSScriptRoot\MarkdownHelpers.ps1
7+
8+
Export-ModuleMember -Function @(
9+
'Test-MachinePath'
10+
'Get-MachinePath'
11+
'Set-MachinePath'
12+
'Add-MachinePathItem'
13+
'Get-SystemVariable'
14+
'Set-SystemVariable'
15+
'Install-MSI'
16+
'Install-EXE'
17+
'Add-ContentToMarkdown'
18+
'Add-SoftwareDetailsToMarkdown'
19+
)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
function Install-MSI
2+
{
3+
Param
4+
(
5+
[String]$MsiUrl,
6+
[String]$MsiName
7+
)
8+
9+
$exitCode = -1
10+
11+
try
12+
{
13+
Write-Host "Downloading $MsiName..."
14+
$FilePath = "${env:Temp}\$MsiName"
15+
16+
Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath
17+
18+
$Arguments = ('/i', $FilePath, '/QN', '/norestart' )
19+
20+
Write-Host "Starting Install $MsiName..."
21+
$process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru
22+
$exitCode = $process.ExitCode
23+
24+
if ($exitCode -eq 0 -or $exitCode -eq 3010)
25+
{
26+
Write-Host -Object 'Installation successful'
27+
return $exitCode
28+
}
29+
else
30+
{
31+
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
32+
exit $exitCode
33+
}
34+
}
35+
catch
36+
{
37+
Write-Host -Object "Failed to install the MSI $MsiName"
38+
Write-Host -Object $_.Exception.Message
39+
exit -1
40+
}
41+
}
42+
43+
44+
function Install-EXE
45+
{
46+
Param
47+
(
48+
[String]$Url,
49+
[String]$Name,
50+
[String[]]$ArgumentList
51+
)
52+
53+
$exitCode = -1
54+
55+
try
56+
{
57+
Write-Host "Downloading $Name..."
58+
$FilePath = "${env:Temp}\$Name"
59+
60+
Invoke-WebRequest -Uri $Url -OutFile $FilePath
61+
62+
Write-Host "Starting Install $Name..."
63+
$process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -Wait -PassThru
64+
$exitCode = $process.ExitCode
65+
66+
if ($exitCode -eq 0 -or $exitCode -eq 3010)
67+
{
68+
Write-Host -Object 'Installation successful'
69+
return $exitCode
70+
}
71+
else
72+
{
73+
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
74+
return $exitCode
75+
}
76+
}
77+
catch
78+
{
79+
Write-Host -Object "Failed to install the Executable $Name"
80+
Write-Host -Object $_.Exception.Message
81+
return -1
82+
}
83+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function Add-ContentToMarkdown {
2+
[CmdletBinding()]
3+
param(
4+
$Content = ""
5+
)
6+
7+
Add-Content 'C:\InstalledSoftware.md' $Content
8+
}
9+
10+
11+
function Add-SoftwareDetailsToMarkdown {
12+
[CmdletBinding()]
13+
param(
14+
$SoftwareName = "",
15+
$DescriptionMarkdown = ""
16+
)
17+
18+
$Content = @"
19+
20+
## $SoftwareName
21+
22+
$DescriptionMarkdown
23+
"@
24+
Add-ContentToMarkdown -Content $Content
25+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
function Test-MachinePath{
2+
[CmdletBinding()]
3+
param(
4+
[string]$PathItem
5+
)
6+
7+
$currentPath = Get-MachinePath
8+
9+
$pathItems = $currentPath.Split(';')
10+
11+
if($pathItems.Contains($PathItem))
12+
{
13+
return $true
14+
}
15+
else
16+
{
17+
return $false
18+
}
19+
}
20+
21+
function Set-MachinePath{
22+
[CmdletBinding()]
23+
param(
24+
[string]$NewPath
25+
)
26+
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name Path -Value $NewPath
27+
return $NewPath
28+
}
29+
30+
function Add-MachinePathItem
31+
{
32+
[CmdletBinding()]
33+
param(
34+
[string]$PathItem
35+
)
36+
37+
$currentPath = Get-MachinePath
38+
$newPath = $PathItem + ';' + $currentPath
39+
return Set-MachinePath -NewPath $newPath
40+
}
41+
42+
function Get-MachinePath{
43+
[CmdletBinding()]
44+
param(
45+
46+
)
47+
$currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
48+
return $currentPath
49+
}
50+
51+
function Get-SystemVariable{
52+
[CmdletBinding()]
53+
param(
54+
[string]$SystemVariable
55+
)
56+
$currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable).$SystemVariable
57+
return $currentPath
58+
}
59+
60+
function Set-SystemVariable{
61+
[CmdletBinding()]
62+
param(
63+
[string]$SystemVariable,
64+
[string]$Value
65+
)
66+
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable -Value $Value
67+
return $Value
68+
}

appveyor/edge/InstallEdge.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
################################################################################
2+
## File: Install-EdgePreview.ps1
3+
## Team: Automated Testing
4+
## Desc: Install Microsoft Edge preview
5+
################################################################################
6+
#Save the current value in the $p variable.
7+
Copy-Item -Path .\ImageHelpers -Destination $home\Documents\WindowsPowerShell\Modules\ImageHelpers -Recurse -Force
8+
9+
Import-Module -Name ImageHelpers -Force
10+
11+
$temp_install_dir = 'C:\Windows\Installer'
12+
New-Item -Path $temp_install_dir -ItemType Directory -Force
13+
14+
Install-EXE -Url "https://go.microsoft.com/fwlink/?linkid=2069324&Channel=Dev&language=en-us&Consent=1" -Name "MicrosoftEdgeSetup.exe" -ArgumentList "/silent /install"
15+
16+
# Add some things to stop Edge from auto updating.
17+
New-NetFirewallRule -DisplayName "BlockEdgeUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe"
18+
19+
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdgeUpdate" -Force
20+
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdgeUpdate" -Name "AutoUpdateCheckPeriodMinutes" -Value 00000000 -Force
21+
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdgeUpdate" -Name "UpdateDefault" -Value 00000000 -Force
22+
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdgeUpdate" -Name "DisableAutoUpdateChecksCheckboxValue" -Value 00000001 -Force
23+
New-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdgeUpdate" -Name "Update{8A69D345-D564-463C-AFF1-A69D9E530F96}" -Value 00000000 -Force

lib/PuppeteerSharp/Launcher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ private static string GetOrFetchChromeExecutable(LaunchOptions options)
166166
{
167167
throw new FileNotFoundException("Failed to launch chrome! path to executable does not exist", chromeExecutable);
168168
}
169-
170169
return chromeExecutable;
171170
}
172171

0 commit comments

Comments
 (0)