# Aurelia-store connectTo causing element not found in tests

**URL:** <https://discourse.aurelia.io/t/aurelia-store-connectto-causing-element-not-found-in-tests/3290>\
**Category:** Help Requests\
**Created:** [March 8, 2020, 9:50am UTC](https://discourse.aurelia.io/t/aurelia-store-connectto-causing-element-not-found-in-tests/3290 "2020-03-08T09:50:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xenoterracide](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/xenoterracide/32/1728_2.png) [@xenoterracide](https://discourse.aurelia.io/u/xenoterracide)\
**Post date:** [March 8, 2020, 9:50am UTC](https://discourse.aurelia.io/t/aurelia-store-connectto-causing-element-not-found-in-tests/3290/1 "2020-03-08T09:50:23Z")

</div>

I have this

```auto
@connectTo<State>({
  selector: (store) => store.state.pipe(pluck('gui')).pipe(pluck('navbar')).pipe(pluck('burgerIsOpen')),
  target: 'burgerIsOpen',
})

```

and it works fine in a normal browser context

```auto
FAILED TESTS:
  Stage App Component
    ✖ should render message
      HeadlessChrome 80.0.3987 (Linux 0.0.0)
    Uncaught TypeError: Cannot read property 'gui' of undefined thrown

```

this is my configuration

```auto
import Game from './components/games/Game';
import { NavBarState } from './general/navbar/NavBarState';

export interface State {
  readonly gui: UiState;
  readonly domain: DomainState;
}

interface UiState {
  navbar: NavBarState;
}
interface DomainState {
  readonly games: Game[];
  readonly myGames: Game[];
}

export const initialState: State = {
  gui: {
    navbar: {
      burgerIsOpen: false,
    },
  },
  domain: {
    games: [
      { name: 'Warhammer 40k', id: '40k' },
      { name: 'Age of Sigmar', id: 'aos' },
    ],
    myGames: [],
  }
};

```

```auto
import { Aurelia, LogManager } from 'aurelia-framework';
import { ConsoleAppender } from 'aurelia-logging-console';
import { PLATFORM } from 'aurelia-pal';
import { LogLevel } from 'aurelia-store';
import { setAutoFreeze } from 'immer';

import * as environment from '../config/environment.json';
import { initialState } from './State';

export function configure(aurelia: Aurelia) {
  aurelia.use
    .standardConfiguration()
    .feature(PLATFORM.moduleName('resources/index'));

  LogManager.addAppender(new ConsoleAppender());
  LogManager.setLevel(LogManager.logLevel.debug);
  LogManager.getLogger('main').debug('initializing');
  setAutoFreeze(environment.debug || environment.testing);

  if (environment.testing) {
    aurelia.use.plugin(PLATFORM.moduleName('aurelia-testing'));
  }
  aurelia.use.plugin(PLATFORM.moduleName('aurelia-store'), {
    initialState,
    logDispatchedActions: true,
    logDefinitions: {
      dispatchedActions: LogLevel.info
    }
  });

  aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}

```

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [March 8, 2020, 5:14pm UTC](https://discourse.aurelia.io/t/aurelia-store-connectto-causing-element-not-found-in-tests/3290/2 "2020-03-08T17:14:48Z")

</div>

This is a known issue which cant be solved but worked around. See [https://github.com/aurelia/store/issues/56](https://github.com/aurelia/store/issues/56)
