Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8587b609
Unverified
Commit
8587b609
authored
Sep 14, 2021
by
Kate Lovett
Committed by
GitHub
Sep 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update local gold api (#90072)
parent
7d368dcf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
28 deletions
+50
-28
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+34
-12
skia_client.dart
packages/flutter_goldens_client/lib/skia_client.dart
+16
-16
No files found.
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
8587b609
...
...
@@ -210,7 +210,7 @@ void main() {
);
});
test
(
'Creates traceID correctly'
,
()
{
test
(
'Creates traceID correctly'
,
()
async
{
String
traceID
;
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
...
...
@@ -231,11 +231,19 @@ void main() {
httpClient:
fakeHttpClient
,
);
traceID
=
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
RunInvocation
md5
=
const
RunInvocation
(
<
String
>[
'md5'
,
'-s'
,
'{"CI":"luci","Platform":"linux","name":"flutter.golden.1","source_type":"flutter"}'
,
],
null
,
);
process
.
processResults
[
md5
]
=
ProcessResult
(
12345678
,
0
,
'12345678'
,
''
);
traceID
=
await
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
expect
(
traceID
,
equals
(
'
,CI=luci,Platform=linux,name=flutter.golden.1,source_type=flutter,
'
),
equals
(
'
12345678
'
),
);
// Browser
...
...
@@ -258,12 +266,19 @@ void main() {
platform:
platform
,
httpClient:
fakeHttpClient
,
);
traceID
=
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
md5
=
const
RunInvocation
(
<
String
>[
'md5'
,
'-s'
,
'{"Browser":"chrome","CI":"luci","Platform":"linux","name":"flutter.golden.1","source_type":"flutter"}'
,
],
null
,
);
process
.
processResults
[
md5
]
=
ProcessResult
(
12345678
,
0
,
'12345678'
,
''
);
traceID
=
await
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
expect
(
traceID
,
equals
(
'
,Browser=chrome,CI=luci,Platform=linux,name=flutter.golden.1,source_type=flutter,
'
),
equals
(
'
12345678
'
),
);
// Locally - should defer to luci traceID
...
...
@@ -281,12 +296,19 @@ void main() {
platform:
platform
,
httpClient:
fakeHttpClient
,
);
traceID
=
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
md5
=
const
RunInvocation
(
<
String
>[
'md5'
,
'-s'
,
'{"CI":"luci","Platform":"macos","name":"flutter.golden.1","source_type":"flutter"}'
,
],
null
,
);
process
.
processResults
[
md5
]
=
ProcessResult
(
12345678
,
0
,
'12345678'
,
''
);
traceID
=
await
skiaClient
.
getTraceID
(
'flutter.golden.1'
);
expect
(
traceID
,
equals
(
'
,CI=luci,Platform=macos,name=flutter.golden.1,source_type=flutter,
'
),
equals
(
'
12345678
'
),
);
});
...
...
packages/flutter_goldens_client/lib/skia_client.dart
View file @
8587b609
...
...
@@ -285,10 +285,10 @@ class SkiaGoldClient {
/// Gold at head.
Future
<
String
?>
getExpectationForTest
(
String
testName
)
async
{
late
String
?
expectation
;
final
String
traceID
=
getTraceID
(
testName
);
final
String
traceID
=
await
getTraceID
(
testName
);
await
io
.
HttpOverrides
.
runWithHttpOverrides
<
Future
<
void
>>(()
async
{
final
Uri
requestForExpectations
=
Uri
.
parse
(
'https://flutter-gold.skia.org/json/v
1
/latestpositivedigest/
$traceID
'
'https://flutter-gold.skia.org/json/v
2
/latestpositivedigest/
$traceID
'
);
late
String
rawResponse
;
try
{
...
...
@@ -410,20 +410,20 @@ class SkiaGoldClient {
}
/// Returns a trace id based on the current testing environment to lookup
/// the latest positive digest on Flutter Gold
.
///
/// Trace IDs are case sensitive and should be in alphabetical order for the
/// keys, followed by the rest of the paramset, also in alphabetical order.
/// There should also be leading and trailing commas.
///
/// Example TraceID for Flutter Gold:
/// ',CI=cirrus,Platform=linux,name=cupertino.activityIndicator.inprogress.1.0,source_type=flutter,'
String
getTraceID
(
String
testName
)
{
return
'
${platform.environment[_kTestBrowserKey] == null ? ',' : ',Browser=${platform.environment[_kTestBrowserKey]}
,'
}
'
'
CI
=
luci
,
'
'
Platform
=
$
{
platform
.
operatingSystem
},
'
'
name
=
$testName
,
'
'
source_type
=
flutter
,
'
;
/// the latest positive digest on Flutter Gold
with a hex-encoded md5 hash of
///
the image keys.
Future
<
String
>
getTraceID
(
String
testName
)
async
{
final
Map
<
String
,
dynamic
>
keys
=
<
String
,
dynamic
>{
if
(
platform
.
environment
[
_kTestBrowserKey
]
!=
null
)
'Browser'
:
platform
.
environment
[
_kTestBrowserKey
],
'CI'
:
'luci'
,
'Platform'
:
platform
.
operatingSystem
,
'name'
:
testName
,
'source_type'
:
'flutter'
,
};
final
String
jsonTrace
=
json
.
encode
(
keys
);
final
io
.
ProcessResult
md5Result
=
await
process
.
run
(<
String
>[
'md5'
,
'-s'
,
jsonTrace
]);
final
String
md5Sum
=
md5Result
.
stdout
.
toString
().
split
(
' '
).
last
.
trim
();
return
md5Sum
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment