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

Observers not triggered in ember acceptance tests #1337

Open
ItzzzManoj opened this issue Feb 8, 2023 · 0 comments
Open

Observers not triggered in ember acceptance tests #1337

ItzzzManoj opened this issue Feb 8, 2023 · 0 comments

Comments

@ItzzzManoj
Copy link

Hi, I have a complex app and we do write test cases for testing.

While writing a test case for one case, we came to know about this issue.

I'm having a file in which two acceptance tests are written, something like this:

module() {
  test('acceptance 1', function() {
   ...logic
  }
  
  test('acceptance 2', function() {
   ...logic
  }
}

As we all know, whenever a property changes both beginPropertyChanges and endPropertyChanges function will be called. What happens in my case is, when the acceptance 1 test is running it increments the deferred variable in beginPropertyChanges and due to some error endPropertyChanges haven't triggered. Due to this all observers are getting broken. (As deferred variable will be 1 and not zero)

  function beginPropertyChanges() {
    deferred++;
    suspendedObserverDeactivation();
  }

  function endPropertyChanges() {
    deferred--;
    if (deferred <= 0) {
      flushSyncObservers();
      resumeObserverDeactivation();
    }
  }

So when acceptance 2 test run, it fails due to observers brokage. How I can fix this (how to make deferred as zero when test 2 is running) so that test 2 will get passed?

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

No branches or pull requests

1 participant