Skip to content

Observers not triggered in ember acceptance tests #1337

@ItzzzManoj

Description

@ItzzzManoj

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions