-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add tree dump utility to E2E test framework and fix Image border issue #3754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
cc64ce1
Initial TreeDump change
c25021a
ReactControl.cpp
6c2916f
first dump
71fba93
Update plus Image border fix and tests
01648c7
buildci
1c1d4c6
Add uiaID property to TreeDump
88f9b0e
Remove not needed change
91c43d2
Change files
2f91657
Fix release build crash issue and change Default.rd.xml to support tr…
5275f13
Address PR comments and update the tests
30f6f96
Merge branch 'master' into treedump
9427f4c
Make TreeDump utility more robust to detect failure
8cf5ea5
Update yml to copy the tree dump artifacts
dcd83d0
Copy file try env again
7180fb7
Try pipeline one more time
98a1282
Test should pass this time!
ed5818a
format
b6aedd8
Tests should pass this time!
db8b680
remove msbuild.binlog from commit
ae7527d
Address PR comments
44aebf8
format
84336b6
Fix a bug: updating conerRadius should not be conditioned undr border…
59ecc0f
Address PR comments
84991ef
Add dump files
52a6a6f
Address PR comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
change/react-native-windows-2019-12-10-12-31-34-treedump.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "TreeDump for E2E test and fix for image border issue", | ||
"packageName": "react-native-windows", | ||
"email": "dida@ntdev.microsoft.com", | ||
"commit": "88f9b0eaecfe88e2243b66d969420131224f1c56", | ||
"date": "2019-12-10T20:31:33.939Z" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import {StyleSheet, View, Image, Button, requireNativeComponent} from 'react-native' | ||
import React, { useState } from 'react'; | ||
import { TREE_DUMP_RESULT, SHOW_IMAGE_BORDER, IMAGE_CONTAINER } from './Consts'; | ||
const TreeDumpControl = requireNativeComponent('TreeDumpControl'); | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
height:300, | ||
width:500, | ||
backgroundColor: 'yellow', | ||
alignItems:'center', | ||
}, | ||
containerWithBorder: { | ||
height:300, | ||
width:500, | ||
borderRadius: 10.0, | ||
borderWidth:10, | ||
borderColor: '#00ff0055', | ||
backgroundColor: 'yellow', | ||
alignItems:'center', | ||
}, | ||
imageWithBorder: { | ||
height: '100%', | ||
width: '100%', | ||
borderRadius: 10.0, | ||
borderWidth:10, | ||
borderColor: '#0000ff55', | ||
backgroundColor: 'red', | ||
}, | ||
image: { | ||
height: '100%', | ||
width: '100%', | ||
backgroundColor: 'red', | ||
}, | ||
treeDumpControl: { | ||
height: 150, | ||
width: 500, | ||
margin: 10, | ||
}, | ||
}); | ||
|
||
export function ImageTestPage() { | ||
const [imageWithBorder, setImageBorder] = useState(false); | ||
const [clickCount, setClickCount] = useState(0); | ||
const onPressBorder = () => { | ||
var previousImageBorderState = imageWithBorder; | ||
setImageBorder(!previousImageBorderState); | ||
var previousClickCount = clickCount; | ||
setClickCount(previousClickCount+1); | ||
} | ||
return( | ||
<View> | ||
<View testID={IMAGE_CONTAINER} style={imageWithBorder?styles.containerWithBorder:styles.container}> | ||
<Image | ||
style={imageWithBorder?styles.imageWithBorder:styles.image} | ||
resizeMode={'center'} | ||
source={{uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='}} | ||
/> | ||
</View > | ||
<Button title= {imageWithBorder?"Hide Border":"Show Border"} | ||
onPress={onPressBorder} | ||
testID={SHOW_IMAGE_BORDER}/> | ||
<TreeDumpControl style={styles.treeDumpControl} dumpID={imageWithBorder?'ImageWithBorder':(clickCount == 0 ? 'ImageWithoutBorder':'ImageWithoutBorder-Subsequent')} uiaID={IMAGE_CONTAINER} testID={TREE_DUMP_RESULT} /> | ||
</View>); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import { BasePage, By } from './BasePage'; | ||
import { SHOW_IMAGE_BORDER } from '../../app/Consts'; | ||
|
||
class ImageTestPage extends BasePage { | ||
backToHomePage() { | ||
this.homeButton.click(); | ||
this.waitForPageLoaded(); | ||
} | ||
|
||
isPageLoaded() { | ||
return super.isPageLoaded(); | ||
} | ||
|
||
toggleImageBorder() { | ||
this._imageBorder.click(); | ||
} | ||
|
||
private get _imageBorder() { | ||
return By(SHOW_IMAGE_BORDER); | ||
} | ||
} | ||
|
||
export default new ImageTestPage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import HomePage from '../pages/HomePage'; | ||
import ImageTestPage from '../pages/ImageTestPage'; | ||
import assert from 'assert'; | ||
|
||
beforeAll(() => { | ||
HomePage.backToHomePage(); | ||
HomePage.clickAndGotoImagePage(); | ||
}); | ||
|
||
describe('ImageWithoutBorderTest', () => { | ||
/* Test case #1: view and image displayed with no border and cornerRadius */ | ||
it('ImageWithoutBorderTest', () => { | ||
const result = ImageTestPage.getTreeDumpResult(); | ||
assert(result, '#1. Dump comparison for image without border!'); | ||
}); | ||
|
||
/* Test case #2: Click button once, update view and image with round border*/ | ||
it('ImageWithBorderTest', () => { | ||
ImageTestPage.toggleImageBorder(); | ||
const result = ImageTestPage.getTreeDumpResult(); | ||
assert(result, '#2. Dump comparison for image with border!'); | ||
}); | ||
|
||
/* Test case #3: Click button one more, remove border from view and image but tree sturcture is different from #1*/ | ||
it('ImageWithoutBorderTest', () => { | ||
ImageTestPage.toggleImageBorder(); | ||
const result = ImageTestPage.getTreeDumpResult(); | ||
assert(result, '#3. Second dump comparison for image without border!'); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/E2ETest/windows/ReactUWPTestApp/Assets/TreeDump/ImageWithBorder.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[Windows.UI.Xaml.Controls.Border] | ||
Background=#FFFFFF00 | ||
BorderBrush=#5500FF00 | ||
BorderThickness=10,10,10,10 | ||
Clip=[NULL] | ||
CornerRadius=10,10,10,10 | ||
Height=300 | ||
HorizontalAlignment=Stretch | ||
Margin=0,0,0,0 | ||
Padding=0,0,0,0 | ||
RenderSize=500,300 | ||
VerticalAlignment=Stretch | ||
Visibility=Visible | ||
Width=500 | ||
[react.uwp.ViewPanel] | ||
Background=[NULL] | ||
BorderBrush=#5500FF00 | ||
BorderThickness=10,10,10,10 | ||
Clip=[NULL] | ||
CornerRadius=10,10,10,10 | ||
HorizontalAlignment=Stretch | ||
Margin=0,0,0,0 | ||
RenderSize=480,280 | ||
VerticalAlignment=Stretch | ||
Visibility=Visible | ||
[Windows.UI.Xaml.DependencyObject] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no event you can wait for? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was going to add event and wait for that, but we have issues with the optimized constructor with Context parameter on release build issue, so I decided to do polling for now. Will open a issue to revisit later after Jon fixes the Custom ViewManager bug.
In reply to: 357846482 [](ancestors = 357846482)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to open an issue to add a WaitForIdle or similar.
In reply to: 357870760 [](ancestors = 357870760,357846482)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create #3779 to track this.
In reply to: 358440736 [](ancestors = 358440736,357870760,357846482)