diff --git a/.ado/Get-ShellScaling.ps1 b/.ado/Get-ShellScaling.ps1 new file mode 100644 index 00000000000..5f1e6bc9b02 --- /dev/null +++ b/.ado/Get-ShellScaling.ps1 @@ -0,0 +1,26 @@ +Add-Type @' + using System; + using System.Runtime.InteropServices; + using System.Drawing; + + public class DPI { + [DllImport("gdi32.dll")] + static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + + public enum DeviceCap { + VERTRES = 10, + DESKTOPVERTRES = 117 + } + + public static float scaling() { + Graphics g = Graphics.FromHwnd(IntPtr.Zero); + IntPtr desktop = g.GetHdc(); + int LogicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.VERTRES); + int PhysicalScreenHeight = GetDeviceCaps(desktop, (int)DeviceCap.DESKTOPVERTRES); + + return (float)PhysicalScreenHeight / (float)LogicalScreenHeight; + } + } +'@ -ReferencedAssemblies 'System.Drawing.dll' + +[Math]::round([DPI]::scaling(), 2) * 100 \ No newline at end of file diff --git a/.ado/SetupLocalDumps.cmd b/.ado/SetupLocalDumps.cmd new file mode 100644 index 00000000000..6afd36134dd --- /dev/null +++ b/.ado/SetupLocalDumps.cmd @@ -0,0 +1,11 @@ +setlocal +set CRASHDUMPS_FOLDER=%BUILD_ARTIFACTSTAGINGDIRECTORY%\ReactUWPTestAppTreeDump\CrashDumps +reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" /s +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\ReactUWPTestApp.exe" /v DumpFolder /t REG_SZ /d %CRASHDUMPS_FOLDER% +reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\ReactUWPTestApp.exe" /v DumpType /t REG_DWORD /d 2 +if not exist %CRASHDUMPS_FOLDER% ( + md %CRASHDUMPS_FOLDER% +) else ( + del %CRASHDUMPS_FOLDER%\* /s /q +) +endlocal \ No newline at end of file diff --git a/.ado/templates/e2e-test-job.yml b/.ado/templates/e2e-test-job.yml index e31b4037136..19c7d5735d7 100644 --- a/.ado/templates/e2e-test-job.yml +++ b/.ado/templates/e2e-test-job.yml @@ -23,6 +23,12 @@ jobs: - template: prepare-env.yml + - task: CmdLine@2 + displayName: Set LocalDumps + inputs: + script: $(Build.SourcesDirectory)\.ado\SetupLocalDumps.cmd + workingDirectory: $(Build.SourcesDirectory) + - task: NuGetCommand@2 displayName: NuGet restore - ReactUWPTestApp inputs: @@ -74,6 +80,11 @@ jobs: targetType: 'inline' script: 'if ((Get-Process React*) -eq $Null) { echo "TestApp is not running"; exit 1}' + - task: CmdLine@2 + displayName: mkdir errorShots + inputs: + script: mkdir $(Build.SourcesDirectory)\packages\E2ETest\errorShots + - task: CmdLine@2 displayName: run e2etest inputs: @@ -87,7 +98,28 @@ jobs: targetFolder: $(Build.StagingDirectory)/ReactUWPTestAppTreeDump contents: TreeDump\** condition: succeededOrFailed() - + + - task: CopyFiles@2 + displayName: Copy tree dump screenshots + inputs: + sourceFolder: $(Build.SourcesDirectory)\packages\E2ETest\errorShots + targetFolder: $(Build.StagingDirectory)/ReactUWPTestAppTreeDump + condition: succeededOrFailed() + + - task: PowerShell@2 + displayName: "MSInfo32" + inputs: + targetType: "inline" + script: "Start-Process msinfo32 -ArgumentList '/report $(Build.StagingDirectory)\\ReactUWPTestAppTreeDump\\msinfo32.txt' -Wait" + condition: failed() + + - task: PowerShell@2 + displayName: "Get-ShellScaling" + inputs: + targetType: "inline" + script: ". $(Build.SourcesDirectory)\\.ado\\Get-ShellScaling.ps1 > $(Build.StagingDirectory)\\ReactUWPTestAppTreeDump\\scaleFactor.txt" + condition: failed() + - task: PublishBuildArtifacts@1 displayName: "Publish Artifact:ReactUWPTestAppTreeDump" inputs: diff --git a/.gitignore b/.gitignore index 2dfa77403f6..780d8dd9321 100644 --- a/.gitignore +++ b/.gitignore @@ -155,4 +155,5 @@ bld/ # OpenCover *_coverage.xml -tsdoc-metadata.json \ No newline at end of file +tsdoc-metadata.json +*.dmp diff --git a/change/react-native-windows-2020-04-14-05-43-39-jsonTreeDump.json b/change/react-native-windows-2020-04-14-05-43-39-jsonTreeDump.json new file mode 100644 index 00000000000..70d3996a8f0 --- /dev/null +++ b/change/react-native-windows-2020-04-14-05-43-39-jsonTreeDump.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "run_wdio.js will run the tests but also set the exit code to zero/non-zero on success/failure respectively. This is important to break the CI/PR build on test failures, which we weren't doing until now.", + "packageName": "react-native-windows", + "email": "asklar@winse.microsoft.com", + "dependentChangeType": "patch", + "date": "2020-04-14T12:43:39.263Z" +} \ No newline at end of file diff --git a/packages/E2ETest/app/ControlStyleTestPage.tsx b/packages/E2ETest/app/ControlStyleTestPage.tsx index 62686dcf729..9e91fd263ba 100644 --- a/packages/E2ETest/app/ControlStyleTestPage.tsx +++ b/packages/E2ETest/app/ControlStyleTestPage.tsx @@ -3,7 +3,8 @@ * Licensed under the MIT License. */ -import { Switch, CheckBox, TextInput, View, StyleSheet, Button } from 'react-native'; + // Bug:4596 Switch +import { /* Switch, */ CheckBox, TextInput, View, StyleSheet, Button } from 'react-native'; import { DatePicker, Picker } from 'react-native-windows'; import React, { useState } from 'react'; import { SHOWBORDER_ON_CONTROLSTYLE, TREE_DUMP_RESULT } from './Consts'; @@ -56,7 +57,11 @@ export function ControlStyleTestPage() { return ( - + { + /* + // Bug:4596 Switch + + */} { - var previousState = passwordHidden; - setPasswordHidden(!previousState); - } + var previousState = passwordHidden; + setPasswordHidden(!previousState); + }; const onPress = () => { if (userName === 'username' && password === 'password') { @@ -49,29 +62,42 @@ export function LoginTestPage() { }; return ( - { setUserName(text.nativeEvent.text) }} /> + onChange={text => { + setUserName(text.nativeEvent.text); + }} + /> - { setPassword(text.nativeEvent.text) }} /> + placeholderTextColor="rgba(225,225,225,0.7)" + secureTextEntry={passwordHidden} + onChange={text => { + setPassword(text.nativeEvent.text); + }} + /> -