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

Settings page tests #63

Merged
merged 14 commits into from
Feb 2, 2021
Merged

Settings page tests #63

merged 14 commits into from
Feb 2, 2021

Conversation

saachipahwa
Copy link
Collaborator

Using shared prefs to find the current postcode and support code isn't working, I'm using the setMockInitialValues method but when it builds the widgets, it doesn't use these mock values.

I'll look into it again but let me know if you have any ideas

@thevirtuoso1973 thevirtuoso1973 linked an issue Jan 19, 2021 that may be closed by this pull request
@saachipahwa saachipahwa marked this pull request as draft January 19, 2021 13:27
@thevirtuoso1973
Copy link
Collaborator

thevirtuoso1973 commented Jan 21, 2021

I've tried it and it seems to be working for me, see PR #72.

@saachipahwa
Copy link
Collaborator Author

Should i change the settings widgets to pass in prefs, so i can test it with the fake pref in the unit test? Not sure if its worth it, we can just test shared prefs on its own like what i just pushed? @thevirtuoso1973

@thevirtuoso1973
Copy link
Collaborator

thevirtuoso1973 commented Jan 29, 2021

No, there's prob a way to make it work. In what way was it originally not working again? It worked for me: #72

@saachipahwa
Copy link
Collaborator Author

image
This fails because it's not using the fake pref

@thevirtuoso1973
Copy link
Collaborator

I'll look into it. You could test out the change button in the meantime.

@thevirtuoso1973
Copy link
Collaborator

thevirtuoso1973 commented Jan 29, 2021

@saachipahwa Oh I just figured it out, it's cos its a future so it won't be immediately available. Use pumpAndSettle to wait for it to load.
image

@saachipahwa saachipahwa marked this pull request as ready for review February 2, 2021 22:27
Copy link
Collaborator

@thevirtuoso1973 thevirtuoso1973 left a comment

Choose a reason for hiding this comment

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

Have a look at the failing checks.

lib/pages/settings_page.dart Outdated Show resolved Hide resolved
Comment on lines +12 to +19
//tests setting and getting shared pref values
testWidgets("Shared preferences test", (WidgetTester tester) async {
SharedPreferences.setMockInitialValues(
{'postcode': 'ha5', 'support_code': '123'});
SharedPreferences pref = await SharedPreferences.getInstance();
expect(pref.getString('postcode'), 'ha5');
expect(pref.getString('support_code'), '123');
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need to do this in future tests, but fine for now.

@thevirtuoso1973 thevirtuoso1973 merged commit 1eb184e into develop Feb 2, 2021
@thevirtuoso1973 thevirtuoso1973 deleted the settings-page-test branch February 2, 2021 23:31
thevirtuoso1973 added a commit that referenced this pull request Feb 22, 2021
* sentry

* wb circle colour fix

* comments and smaller shadow blur

* theme colors in graph

* fix bug and add test

* P2P wellbeing sharing (#82)

* implement keypair generation

* implement private/public key to PEM, and fingerprint generation from public key

* fix key generation by calling encode

* POST new user to backend

* use `compute` so screen doesn't hang

* friend adding & basic outline of share UI

* fix bug with user password

* implement retrieving latest data

* fix crypto, make list better

* implement the friend_graph.dart

* implement sending data to friend

* implement seemingly working wellbeing sharing, add QR code

* use FAB instead of button

* add working refresh

* fix rendering issue with QR camera

* add stepper with working add_friend_page.dart

* change to score so it fits screen

* add sharing to QR with ShareButton

* format and clean up

* refresh automatically every 2 minutes

* fix exception with graph & refresh

* adding explicit view button

* add unread data indication

* add a TODO item

* notify user of sent success & failure

* display name instead of identifier

* attempt to integrate with iOS

* add container around QrImage to fix

* send notification when new data received

* remove unused notification

* fix bug with unread indicator not showing

* increment version

* fix qr size

Co-authored-by: saachipahwa <[email protected]>

* some cleanup, notably publish_screen.dart slipped through, even though I
remember removing it from a previous conflict.

* Coach mark timing (#106)

* reducing time

* remove testing stuff

* fixing wb time

* wait longer in case exeuction is slow

* Settings page tests (#63)

* initial tests: commented out shared prefs problem

* settings page tests cleaning up

* remove db stuff

* test shared prefs by itself

* change button

* change buttons test

* comments

* current postcode and support tests

* comment

* fix for change postcode

* remove constructors

* Language changes 2 (#109)

* steps nudge

* intro language fixes

* 'friend' to 'care network'

* un-personifying app?

* removing steps specific nudge

* range change

* remove low steps function

* add to network

* init notifications and check if data is from friend

* fix multiple crypto setup, and add TODO

* use ChartTitle to add left/right axis labels

* add axes labels and split up a long string

* add deeplink and share button that sends to BASE_URL

* fix url, scaffold bug, and don't show/request camera permissions unless needed

* set initialUri back to null once handled, add enum, and update version

* fix null issue with _result

* intro pg remove and settings show scheduled notif

* small nudge page and sharing page changes

* pod

* coach mark issue

* add test for add_friend_page_test.dart, mocking DB and ScaffoldState

* fix null bug

* order the friends list

* check if user adding themselves, and write test for this

* pass wellbeing record into home to fix state

* extend ChangeNotifier and use provider for the DBs

* use provider in sharing_page.dart

* wbCheckTime

* little fixes

* pod

* set state

* past weeks to weeks

* cleanup sharing_page.dart and .gitignore

* req changes 2

* fixing home page coach mark

* reducing time but still works

* wrap provider around MaterialApp and fix tests

* fix bug with infinite loading, although I don't see why sorting didn't
work when using provider.

* 400 coach mark

* remove comment, pad left

* Usability feedback (#119)

* intro pg remove and settings show scheduled notif

* small nudge page and sharing page changes

* pod

* coach mark issue

* wbCheckTime

* little fixes

* set state

* past weeks to weeks

* req changes 2

* fixing home page coach mark

* reducing time but still works

* 400 coach mark

* remove comment, pad left

* update version

* implement Comparable and sort before display

* figma copy over and nudge notif

* base url

* center postcode caption

* Use convex bottom bar (#130)

* use convex bottom bar

* colours

Co-authored-by: saachipahwa <[email protected]>

* remove old code that was left in (#126)

* Share url through contacts + SMS (#132)

* add contact_share_page.dart and display contact

* fix contact state

* implement _sendToSelected, launch the sms URI

* add comment on possible issue

* change button text

* use different separator depending on platform

* remove duplicate yaml

* try undocumented ios feature for multiple contacts

* use flutter_sms plugin

* null check on contact name and format

* add custom scheme to Info-Debug.plist

* lazy load contact avatar after initial retrieval (#139)

* Polish  (#133)

* remove old code that was left in (#126)

* small changes

* sharing page description

* remove comment

* buttons to friends widget

* change of key name, comment,

* pod

* scroll bar in intro screen

* qr code description

* button name change

* pod

* help button

* QR scanner page subtitles

* comment

* launcher icon

* settings page with sections

* settings page test fix

* fix coach mark mistake

* pod

* splash screen

* underline see here and center notif selector

* caption

* formatting settings descriptions

* network page updates

* sharing page: colours, bold words, customscroll

* remove custom scroll attempt

* splash screen longer, nw button colours

* home tutorial sized box fix

* splash screen only shows when loading

* make loadaftersplash neater

* blue i button instead of ? button

* version 1.3.0

* ios launch screen

* pod

* main logo font change -> KiteOne

* launch screen

* no more splash screen

* settings page reformat

* remove unused import

* moving wb share button

* smaller logo

* remove launch screen

* removec Future.value and print

* Add linter stuff to dev branch (#147)

* Create linter.yml

* Add badge for linter

* fix linter complaints, trailing spaces and headings

* don't validate RUBY or JSCPD

* remove check on push to dev

Co-authored-by: saachipahwa <[email protected]>

* change linter setting

* update workflows

* use container with flutter

* remove linter (too pedantic even for me)

* change badge

* fix badge

* fix badge - third time's the charm

* change name

Co-authored-by: saachipahwa <[email protected]>
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.

Add Settings Page Widget Test
2 participants