protected function wait_until_contents_are_updated($filepickernode) {

        $exception = new ExpectationException(
            'The file manager contents are requiring too much time to be updated',
            $this->getSession()
        );

        // Looks for the loading image not being displayed. For single-file filepickers is
        // only used when accessing the filepicker, there is no filemanager-loading after selecting the file.
        $this->find(
            'xpath',
            "//div[contains(concat(' ', normalize-space(@class), ' '), ' filemanager ')]" .
                "[not(contains(concat(' ', normalize-space(@class), ' '), ' fm-updating '))]" .
            "|" .
            "//div[contains(concat(' ', normalize-space(@class), ' '), ' filemanager-loading ')]" .
                "[contains(@style, 'display: none;')]",
            $exception,
            $filepickernode
        );
    }