Giter VIP home page Giter VIP logo

e2e-testing-nightwatch's People

Contributors

algorgeous avatar codejockie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

e2e-testing-nightwatch's Issues

Thanks and Feedback

Super Tutorial!

It may have been some while and things moving may have upset the code!

I ran your repo and some tests worked but some did not. I really liked the filters.spec.js

I put some effort on sign.in.spec
https://cjdocs.herokuapp.com/auth/signin is very slow
so I changed globals.js and added an extra 0! waitForConditionTimeout: 100000

This version of signinPage.js worked apart for a non-show-stopper error

const signinCommands = {  
  signin(email, password) {
    return this
      .waitForElementVisible('@signinTop')
      .click('@signinTop')
      .waitForElementVisible('@emailInput')
      .setValue('@emailInput', email)
      .setValue('@passwordInput', password)
      .waitForElementVisible('@signinButton')
      .click('@signinButton')
      .click('@signinButton')
  }
};

export default {  
  url: 'https://cjdocs.herokuapp.com/auth/signin',
  commands: [signinCommands],
  elements: {
    emailInput: {
      selector: 'input[type=email]'
    },
    passwordInput: {
      selector: 'input[name=password]'
    },
    signinButton: {
      selector: 'button[type="submit"]'
    },
    signinTop: {
      selector: 'a[href="/signin"]'
    }
  }
};

Changes

  1. Had to insert a signinTop
  2. You may have missed quotes around submit
  3. But .click('@signinButton') with only 1 does not work;
    2 does but gives a error that does not stop instancesPage code execution

One change of text in signin.spec.js Welcome to the Docs Home! no CJ

module.exports = {
  'User can sign in'(client) {
    const signinPage = client.page.signinPage();
    const instancesPage = client.page.instancesPage();

    signinPage
      .navigate()
      .signin(process.env.EMAIL, process.env.PASSWORD);

    instancesPage.expect.element('@homepageWelcomeTitle').text.to.contain('Welcome to the Docs Home!');

    client.end();
  }
};

OUTPUT
C:\winreactjs\e2e-testing-nightwatch>nightwatch --env local

[Signin Spec] Test Suite

i Connected to 127.0.0.1 on port 4444 (5888ms).
Using: chrome (81.0.4044.138) on Windows NT platform.

Running: User can sign in

√ Element <a[href="/signin"]> was visible after 74 milliseconds.
√ Element <input[type=email]> was visible after 112 milliseconds.
√ Element <button[type="submit"]> was visible after 50 milliseconds.
Error while running .getElementText() protocol action: stale element reference: element is not attached to the page document

√ Expected element <//div/h2> text to contain: "Welcome to the Docs Home!" (2178ms)

OK. 4 assertions passed. (7.353s)

Regards & Thanks
Jayanta@Kolkata

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.