Coder Social home page Coder Social logo

codeceptjs-explore's Introduction

CodeceptJS Sample How-To

This project was used by me (Gaston) while ramping-up on CodeceptJS. These are my notes, so no warranty is provided.

Goals:

  • Quickly ramp-up on CodeceptJS
  • Create a simple, yet useful test (i.e. log into Peregrine)
  • Run tests locally
  • Run tests on Docker
  • Record test run

Run Tests Locally

  1. Run tests on your machine.
$ ./local-run.sh

or

$ npm run test

Record Tests with Docker

  1. Build the Docker image (or pull it from DockerHub).
$ ./docker-build.sh
  1. Run the tests and capture video.
$ ./docker-run.sh

or

$ npm run docker-test

How This Project Was Created

This project was bootstrapped using the following instructions.

  1. Create a workspace.
$ mkdir codeceptjs-explore && cd codeceptjs-explore
  1. Install CodeceptJS and Puppeteer.
$ npm init -y
$ npm install codeceptjs puppeteer --save-dev
  1. Create a CodeceptJS project.
$ npx codeceptjs init

All the defaults were used, except for these changes:

  • What helpers do you want to use?: Puppeteer
  • [Puppeteer] Base url of site to be tested: http://localhost:8080
  • Feature which is being tested: Peregrine Login
  1. Start Peregrine locally in another terminal.

  2. Edit login_test.js.

Feature('login');
  
Scenario('Log into Peregrine', (I) => {
  I.amOnPage('/');
  I.see('Log In');
  I.fillField('Username', 'admin');
  I.fillField('Password', 'admin');
  I.click('Log In');
  I.see('your websites');
});
  1. To run tests on your machine with Docker, add --no-sandbox argument to codecept.conf.js. See issues/1022.
Puppeteer: {
...
    chrome: {
        ...
        args: ['--no-sandbox']
    }
}

codeceptjs-explore's People

Contributors

gastongonzalez avatar

Watchers

Ruben avatar James Cloos avatar  avatar

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.