Skip to content
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

Add initial CustomerSheet end-to-end tests. #8525

Merged
merged 3 commits into from
May 24, 2024

Conversation

samer-stripe
Copy link
Collaborator

@samer-stripe samer-stripe commented May 23, 2024

Summary

Add initial CustomerSheet end-to-end tests for cards.

Motivation

Ensures card LPM behavior is working end-to-end on Android

Testing

  • Added tests
  • Modified tests
  • Manually verified

Copy link
Contributor

github-actions bot commented May 23, 2024

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │     2 MiB │     2 MiB │  0 B │   4.3 MiB │   4.3 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │  0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │   8.1 KiB │   8.1 KiB │  0 B 
      res │ 301.5 KiB │ 301.5 KiB │  0 B │   455 KiB │   455 KiB │  0 B 
   native │   7.3 MiB │   7.3 MiB │  0 B │  18.4 MiB │  18.4 MiB │  0 B 
    asset │   1.5 MiB │   1.5 MiB │  0 B │   1.5 MiB │   1.5 MiB │  0 B 
    other │    87 KiB │    87 KiB │ +2 B │ 161.5 KiB │ 161.5 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │  12.2 MiB │  12.2 MiB │ +2 B │  25.8 MiB │  25.8 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 21688 │ 21688 │ 0 (+0 -0) 
   types │  6869 │  6869 │ 0 (+0 -0) 
 classes │  5634 │  5634 │ 0 (+0 -0) 
 methods │ 31448 │ 31448 │ 0 (+0 -0) 
  fields │ 18315 │ 18315 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3404 │ 3404 │  0
APK
   compressed    │  uncompressed   │                                           
──────────┬──────┼──────────┬──────┤                                           
 size     │ diff │ size     │ diff │ path                                      
──────────┼──────┼──────────┼──────┼───────────────────────────────────────────
  1.2 KiB │ +2 B │  1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA                       
    272 B │ +1 B │    120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
 29.1 KiB │ -1 B │   64 KiB │  0 B │ ∆ META-INF/CERT.SF                        
──────────┼──────┼──────────┼──────┼───────────────────────────────────────────
 30.5 KiB │ +2 B │ 65.3 KiB │  0 B │ (total)

@samer-stripe samer-stripe force-pushed the samer/customer-sheet-playground-ui branch from 993f71c to c79c564 Compare May 23, 2024 21:25
@samer-stripe samer-stripe force-pushed the samer/add-initial-customer-sheet-e2e-tests branch 2 times, most recently from f6e13f5 to 476b725 Compare May 23, 2024 23:01
Base automatically changed from samer/customer-sheet-playground-ui to master May 23, 2024 23:32
@samer-stripe samer-stripe force-pushed the samer/add-initial-customer-sheet-e2e-tests branch 2 times, most recently from 85f7289 to bbf2a42 Compare May 24, 2024 02:57
)

state.value = PlaygroundState.Customer(snapshot = snapshot)
customerAdapter.value = adapter
Copy link
Collaborator Author

@samer-stripe samer-stripe May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing the adapter as part of the PlaygroundState caused the ViewModel to leak since we store the PlaygroundState in PlaygroundTestDriver. Moved it into its own flow.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. Was the view model holding onto it, or what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The methods passed into the CustomerAdapter reference ViewModel attributes (for example, settings in order to the update them).

This was a one way to solve. We could instead change the implementation to prefetch ephemeralKey & setupIntentClientSecret when preparing CustomerSheet.

@samer-stripe samer-stripe marked this pull request as ready for review May 24, 2024 13:35
@samer-stripe samer-stripe requested review from a team as code owners May 24, 2024 13:35

launchCustomerSheet()

if (isManagePaymentMethodScreen()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the individual tests aware of this instead of doing it automatically?

I think we did this approach in payment sheet, but it was mostly to preserve the existing tests passing if I remember right.

Copy link
Collaborator Author

@samer-stripe samer-stripe May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably yeah. With these initial cases, we shouldn't end up in this screen since we have a new customer. Otherwise, it is a bug. I'll remove the check for now and add it back for SavedPaymentMethod testing.

)

state.value = PlaygroundState.Customer(snapshot = snapshot)
customerAdapter.value = adapter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. Was the view model holding onto it, or what?

@samer-stripe samer-stripe force-pushed the samer/add-initial-customer-sheet-e2e-tests branch 2 times, most recently from 1a2816c to 2b44fc8 Compare May 24, 2024 17:09
@samer-stripe samer-stripe enabled auto-merge (squash) May 24, 2024 19:08
@samer-stripe samer-stripe merged commit 9468357 into master May 24, 2024
12 checks passed
@samer-stripe samer-stripe deleted the samer/add-initial-customer-sheet-e2e-tests branch May 24, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants