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

[FE Flake]: Contributor dashboard page Expected 'Topic 1' to be undefined. #16529

Closed
gp201 opened this issue Nov 12, 2022 · 7 comments
Closed
Assignees
Labels
bug Label to indicate an issue is a regression

Comments

@gp201
Copy link
Member

gp201 commented Nov 12, 2022

Stacktrace

Chrome Headless 107.0.5304.87 (Linux x86_64) Contributor dashboard page when user is logged in should not set active topic name when no topics are returned FAILED
	Error: Expected 'Topic 1' to be undefined.
	    at <Jasmine>
	    at UserContext.<anonymous> (core/templates/combined-tests.spec.js:98615:41)
	    at UserContext.<anonymous> (core/templates/combined-tests.spec.js:720401:34)
	    at ./node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (core/templates/combined-tests.spec.js:721630:30)
	Error: Expected spy setActiveTopicName not to have been called.
	    at <Jasmine>
	    at UserContext.<anonymous> (core/templates/combined-tests.spec.js:98617:22)
	    at UserContext.<anonymous> (core/templates/combined-tests.spec.js:720401:34)
	    at ./node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (core/templates/combined-tests.spec.js:721630:30)

This seems to have been caused due to the spy getting defined twice.

once in the beforeEach

getTranslatableTopicNamesAsyncSpy = spyOn(
contributionOpportunitiesService, 'getTranslatableTopicNamesAsync');
getTranslatableTopicNamesAsyncSpy.and.returnValue(
Promise.resolve(['Topic 1', 'Topic 2']));

again in the test:

getTranslatableTopicNamesAsyncSpy.and.returnValue(
Promise.resolve([]));

Additional Information

Seeds:

  1. 419

Complete Log

Debug Doc

@gp201 gp201 assigned heyimShivam and gp201 and unassigned heyimShivam Nov 12, 2022
@gp201
Copy link
Member Author

gp201 commented Nov 12, 2022

@sagangwee This flake seems to have been introduced via #15841 Can you please open a fix for this?

You solve this by either splitting the tests using a nested describe function where getTranslatableTopicNamesAsyncSpy returns a topics in one and in the other it returns an empty list or define the spy for each test explicitly.

@gp201
Copy link
Member Author

gp201 commented Nov 12, 2022

@heyimShivam Should ngOnInit be called before every test?

Since ngOnInit is called inside tests again.

@gp201 gp201 changed the title [FE Flake]: Duplicate spy returnValue's in Contributor dashboard page spec file. [FE Flake]: Contributor dashboard page Expected 'Topic 1' to be undefined. Nov 17, 2022
@U8NWXD U8NWXD unassigned gp201 Dec 6, 2022
@sagangwee
Copy link
Contributor

@gp201 Hmmm I would have expected the existing code to override the currently set return value on the spy. Does the flake have something to do with the fakeAsync wrapper?

@U8NWXD U8NWXD added the bug Label to indicate an issue is a regression label Feb 25, 2023
@U8NWXD
Copy link
Member

U8NWXD commented Feb 25, 2023

Closing because this flake did not appear in 120 consecutive runs on develop:

@U8NWXD U8NWXD closed this as completed Feb 25, 2023
@gp201
Copy link
Member Author

gp201 commented Mar 10, 2023

Reappeared in develop once on 10 March 2023; commit number: e86d2a3

GitHub Action run
https://github.com/oppia/oppia/actions/runs/4377536374
log.zip

@gp201
Copy link
Member Author

gp201 commented Jun 13, 2023

@462702985
Copy link
Contributor

462702985 commented Jun 21, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label to indicate an issue is a regression
Projects
Archived in project
Status: In Progress
Development

No branches or pull requests

5 participants