Sign inSign up

franciscoaditazz/codeceptjs-puppeteer

By franciscoaditazz

•Updated over 8 years ago

Image
0

94

franciscoaditazz/codeceptjs-puppeteer repository overview

⁠codeceptjs-pupeteer

This container lets you run codeceptjs automated tests for UI applications.

⁠How to run this container

⁠1) Create working directory:

$ mkdir ~/PuppeteerDocker

⁠2) Create Dockerfile within folder ~/PuppeteerDocker
FROM codeception/codeceptjs
RUN npm i codeceptjs-puppeteer
RUN ln -sf /codecept/bin/codecept.js /usr/local/bin/codeceptjs
⁠3) Build docker image
$ cd ~/PuppeteerDocker 
$ docker build -t franciscoaditazz/codeceptjs-puppeteer:1.0.0 .
⁠4) Run docker container sharing local folder where config and test files will live

docker run --name puppeteer_run -it -v ~/PuppeteerDocker:/home/CodeceptPuppeteerTest franciscoaditazz/codeceptjs-puppeteer:1.0.0 /bin/bash

⁠5) Within the container, generate config file:
$ cd /home/CodeceptPuppeteerTest
$ codeceptjs init
⁠6) Within the container, generate test file:

$ codeceptjs gt

⁠7) Replace both codecept.json and test file with the ones below
⁠codecept.json
{
  "tests": "./*_test.js",
  "timeout": 10000,
  "output": "./output",
  "helpers": {
    "Puppeteer": {
      "url": "http://www.google.com",
      "chrome": {
          "args" : ["--no-sandbox"]
      }
    }
  },
  "include": {},
  "bootstrap": false,
  "mocha": {},
  "name": "CodeceptPTest"
}
⁠demo_test.js
Feature('Google Search');

Scenario('Test a Google Search', (I) => {

    I.say("TEST HAS STARTED");
    I.amOnPage('/');
    I.saveScreenshot('OpenBrowser.png');
    I.fillField({ css: '#lst-ib'}, 'Im running a search with Puppeteer');
    I.saveScreenshot('FilledField.png');
    I.click('btnK');
    I.wait(5);
    I.saveScreenshot('SearchCompleted.png');
    I.say("TEST HAS FINISHED!");

});
⁠8) Run your tests cases:

$ codeceptjs run

⁠9) Validate the results and screenshots on the output directory

Tag summary

Content type

Image

Digest

Size

1 GB

Last updated

over 8 years ago

docker pull franciscoaditazz/codeceptjs-puppeteer:1.0.0