Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

TypeError: Cannot read property 'ELEMENT' of undefined #915

Closed
@mgol

Description

@mgol

When issues from #902 were resolved & Protractor 0.24.1 was released, I tried again to upgrade from 0.22.0. Unfortunately, I get a cryptic error:

  1) Item panel toolbox note tab adding notes (type: pin) should remove just created notes
   Message:
     TypeError: Cannot read property 'ELEMENT' of undefined
   Stacktrace:
     TypeError: Cannot read property 'ELEMENT' of undefined
==== async task ====
WebDriver.call(function)
==== async task ====
Asynchronous test function: it()
Error
    at null.<anonymous> (/Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/test/e2e/spec/item-panel.defs.js:316:17)
    at null.<anonymous> (/Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/test/e2e/spec/item-panel.defs.js:251:13)
    at null.<anonymous> (/Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/test/e2e/spec/item-panel.defs.js:243:9)

The test itself is as follows (line 316 column 17 points to the it):

it('should remove just created notes', function () {
    tabElems.notes.element(by.repeater('note in page.notes'))
        .then(function (collection) {
            collection.forEach(function (noteElem) {
                // Activate a note.
                noteElem.element(by.css('.item-header')).click();

                noteElem.element(by.css('.delete')).click();
            });
            tabElems.notes
                .all(by.repeater('note in page.notes'))
                .then(function (collection) {
                    expect(collection.length).toBe(0);
                });
        });
});

The `beforeEach block:

beforeEach(function () {
    ['info', 'search', 'view', 'notes', 'bookmarks'].forEach(function (tabName) {
        tabTriggerElems[tabName] = $('cbn-item-panel-toolbox .tab-links button.tab-' + tabName + '-link');
        tabElems[tabName] = $('cbn-item-panel-toolbox .tabs-content .tab-' + tabName);
    });
});

The whole test file is quite complicated so for now I'm just sharing this info. The error should be more descriptive anyway, especially that it points just to the test definition and not to anything inside it. Does it say a lot to you? I can try to isolate sth further if there's a need but that might not be easy.

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