-
Notifications
You must be signed in to change notification settings - Fork 249
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
test(authenticator): add golden tests for new configs #1831
test(authenticator): add golden tests for new configs #1831
Conversation
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.
Missing license header on one file. Looks good, though - thanks!
@@ -44,10 +44,44 @@ class AuthenticatorGoldenComparator extends LocalFileComparator { | |||
} | |||
if (!result.passed) { | |||
safePrint( | |||
'A tolerable difference of ${result.diffPercent * 100}% was found when ' | |||
'D1 tolerable difference of ${result.diffPercent * 100}% was found when ' |
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.
What does D1 mean here?
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.
That was a cmd + f and replace mistake. Updated.
AuthenticatorStep.resetPassword, | ||
]; | ||
|
||
testMatrix3(TestConfig.values, steps, Brightness.values, ( |
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.
Note: This runs 120 tests (5 configs, 3 initial steps, 2 brightnesses, 4 themes). Some are a bit repetitive. I think it is fine for now though since this runs in about 90 seconds. At some point I would like to add golden tests for each step (confirm sign up, confirm reset password, etc.). At that point I may only run the theme tests for a couple configs.
export 'package:amplify_auth_cognito/src/types.dart'; | ||
|
||
/// A stub of [AmplifyAuthCognito] that creates users in memory. | ||
class AmplifyAuthCognitoStub extends AuthPluginInterface |
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.
Note: This stub is from the Authenticator demo on the docs site. Everything other than addPlugin()
and fetchAuthSession()
could be a no-op for the current test suite since those should be the only methods called to load the authenticator.
This could be used to run integration tests with a stubbed backend, which would allow us to create golden tests for all the steps. I am open to trimming this down to just what is needed for now, but I think it could be useful in the future.
@@ -44,10 +44,44 @@ class AuthenticatorGoldenComparator extends LocalFileComparator { | |||
} | |||
if (!result.passed) { | |||
safePrint( | |||
'A tolerable difference of ${result.diffPercent * 100}% was found when ' | |||
'D1 tolerable difference of ${result.diffPercent * 100}% was found when ' |
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.
That was a cmd + f and replace mistake. Updated.
…elson/amplify-flutter into test/authenticator-golden-tests
@@ -0,0 +1,202 @@ | |||
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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.
Note: I renamed this file because the name didn't make sense anymore. New name + all the changes are making this look like a new file.
* chore: add stubs for auth cognito and amplify * test: refactor tests, add tests for new configs * chore: regenerate golden files * chore: update comment, fix accidential cmd f change * chore: add license headers * chore: make internal mocks private
* chore: add stubs for auth cognito and amplify * test: refactor tests, add tests for new configs * chore: regenerate golden files * chore: update comment, fix accidential cmd f change * chore: add license headers * chore: make internal mocks private
* chore: add stubs for auth cognito and amplify * test: refactor tests, add tests for new configs * chore: regenerate golden files * chore: update comment, fix accidential cmd f change * chore: add license headers * chore: make internal mocks private
…y tests (#2455) * test(authenticator): add golden tests for new configs (#1831) * chore: add stubs for auth cognito and amplify * test: refactor tests, add tests for new configs * chore: regenerate golden files * chore: update comment, fix accidential cmd f change * chore: add license headers * chore: make internal mocks private * chore: update auth, amplify stub * chore: update golden snapshots * chore: add tests for different device size, pixelRatio * chore: re-generate golden snapshots * chore: remove print statement * chore: address PR comments
Issue #, if available: #1827
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.