Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELIFECYCLE error when I run npm run test... HELP! #48

Open
lucamarial opened this issue Oct 1, 2019 · 1 comment
Open

ELIFECYCLE error when I run npm run test... HELP! #48

lucamarial opened this issue Oct 1, 2019 · 1 comment

Comments

@lucamarial
Copy link

lucamarial commented Oct 1, 2019

Problem

I have a problem running my tests for the rock paper scissors challenge. I installed the e2e training wheels, load my js code inside the html body in script tags, run npm in the terminal and the tests passed. Without making any changes, the next day I run the tests again and it showes me an ELIFECYCLE error and that the document is not defined.

Feature test

require('../spec.helper');

describe('User can make a choice between Rock, Paper or Scissors', () => {
  before(async () => {
    await browser.init()
    await browser.visitPage('http://localhost:8080/')
  });

  beforeEach(async () => {
    await browser.page.reload();
  });

  after(() => {
    browser.close();
  });

  it('renders the Rock button', async () => {
    let button = await browser.getContent("[Id='r']")
    expect(button).to.eql('Rock');
  });

  it('renders the Paper button', async () => {
    let button = await browser.getContent("[Id='p']")
    expect(button).to.eql('Paper');
  });

  it('renders the Scissors button', async () => {
    let button = await browser.getContent("[Id='s']")
    expect(button).to.eql('Scissors');
  });
});

Specs

require('../spec.helper')

describe('Rock-Paper-Scissor Game', () => {

    describe('smoke tests', () => {
        it('should exist', () => {
            expect(RockPaperScissors).to.exist;
        })

        it('should be a function', () => {
            expect(RockPaperScissors).to.be.a('function');
        })
    })
})

Spec-helper

const chai = require('chai');
const BrowserHelpers = require('e2e_training_wheels')
global.browser = new BrowserHelpers()
global.expect = chai.expect;
global.RockPaperScissors = require('./src/js/rockpaperscissors')

Screenshots

Screenshot from 2019-10-01 12-36-32

Screenshot from 2019-10-01 12-36-59

How did you try to solve the problem?

Usually the problem is solved when I change node version to the latest version, but not this time.
I also tried to remove the node_modules and reinstall it.

github repo

@tochman
Copy link
Member

tochman commented Oct 2, 2019

Hi, there is not enough info here. the error relates to document not being defined. Please provide more context. What does the test look like? When is the js code being loaded on the page? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants