emberjs / emberjs/ember-test-helpers

Observers not triggered in ember acceptance tests

Open
#1,337 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
188
Forks
254
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.