Skip to content

Commit

Permalink
fix: update breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirajn2311 committed Sep 4, 2024
1 parent e15dd12 commit 127d447
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/flutter-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ jobs:

- name: Create .env file
run: |
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" > .env
echo "NEWSKEY=$GHOST_NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIA_APP_ID" >> .env
echo "ALGOLIAKEY=$ALGOLIA_KEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/flutter-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ jobs:

- name: Create .env file
run: |
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" > .env
echo "NEWSKEY=$GHOST_NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIA_APP_ID" >> .env
echo "ALGOLIAKEY=$ALGOLIA_KEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mobile-curriculum-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: |
cd mobile/mobile-app
echo "DEVELOPMENTMODE=true" > .env
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
flutter pub get
flutter test test/widget_test.dart
Expand Down
6 changes: 2 additions & 4 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ workflows:
scripts:
- name: Create .env file
script: |
echo "NEWSURL=$NEWSURL" > .env
echo "NEWSKEY=$NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIAAPPID" >> .env
echo "ALGOLIAKEY=$ALGOLIAKEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down Expand Up @@ -109,8 +108,7 @@ workflows:
scripts:
- name: Create .env file
script: |
echo "NEWSURL=$NEWSURL" > .env
echo "NEWSKEY=$NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIAAPPID" >> .env
echo "ALGOLIAKEY=$ALGOLIAKEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down
10 changes: 7 additions & 3 deletions mobile-app/integration_test/news/bookmark_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:freecodecamp/main.dart' as app;
import 'package:freecodecamp/ui/views/news/news-feed/news_feed_viewmodel.dart';
import 'package:freecodecamp/ui/views/news/news-tutorial/news_tutorial_view.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -29,15 +28,20 @@ void main() {
await binding.takeScreenshot('news/news-feed');

// Tap on the first tutorial
final Finder firstTutorial = find.byType(NewsFeedLazyLoading).first;
final Finder firstTutorial = find
.descendant(
of: find.byKey(const Key('news-tutorial-0')),
matching: find.byType(InkWell),
)
.first;
final Finder firstTutorialImage = find
.descendant(
of: firstTutorial,
matching: find.byType(AspectRatio),
)
.first;
final ValueKey firstTutorialKey =
tester.firstWidget<NewsFeedLazyLoading>(firstTutorial).key! as ValueKey;
tester.firstWidget<InkWell>(firstTutorial).key! as ValueKey;

expect(firstTutorial, findsOneWidget);
expect(firstTutorialImage, findsOneWidget);
Expand Down
7 changes: 5 additions & 2 deletions mobile-app/lib/ui/views/news/news-feed/news_feed_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ class NewsFeedView extends StatelessWidget {
height: 3,
),
builderDelegate: PagedChildBuilderDelegate<Tutorial>(
itemBuilder: (context, tutorial, index) =>
tutorialThumbnailBuilder(tutorial, model),
itemBuilder: (context, tutorial, index) => Container(
key: Key('news-tutorial-$index'),
child: tutorialThumbnailBuilder(tutorial, model),
),
),
),
),
Expand Down Expand Up @@ -122,6 +124,7 @@ class NewsFeedView extends StatelessWidget {

InkWell tutorialThumbnailBuilder(Tutorial tutorial, NewsFeedViewModel model) {
return InkWell(
key: Key(tutorial.id),
splashColor: Colors.transparent,
onTap: () {
model.navigateTo(tutorial.id, tutorial.title);
Expand Down
4 changes: 2 additions & 2 deletions mobile-app/sample.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

###NEWS###

NEWSKEY=
NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/
HASHNODE_PUBLICATION_ID=

ALGOLIAAPPID=
ALGOLIAKEY=

Expand Down
1 change: 1 addition & 0 deletions mobile-app/test/services/news/bookmark_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final Tutorial testTutorial = Tutorial(
'Python Game Development - How to Make a Turtle Racing Game with PyCharm',
profileImage:
'https://www.freecodecamp.org/news/content/images/2022/02/profile.jpg',
authorId: '',
authorName: 'Shahan Chowdhury',
authorSlug: 'shahan',
text:
Expand Down

0 comments on commit 127d447

Please sign in to comment.