Code Monkey home page Code Monkey logo

ampft-example's Introduction

ampft-example

This repo contains an example implementation of the abstract AMP E2E Functional Test API.

To run, try the package.json scripts

yarn
./install-drivers.sh

yarn run test-amp
yarn run test-expect
yarn run test-github
yarn run test-hello
yarn run test-iframe

You can also run tests using:

yarn run test spec/test-amp.js

To run a specific test case, you can use Mocha's grep functionality to find test cases matching a regex. For example:

yarn run test spec/test-amp.js -g "scroll"

Writing tests

Tests can be written with mocha style structure, and using the API methods from the FunctionalTestController API.

import * as describes from '../lib/describes';
import {expect} from '../lib/expect';

describes.endtoend('First test', {
    engines: ['puppeteer'],
}, async env => {
  let controller;

  beforeEach(async () => {
    controller = env.controller;
    await controller.navigateTo('https://www.google.com');
  });

  it('should expect hello to not equal world', async () => {
    await expect('hello').to.not.equal('world');
  });
});

Debugging tests

Tests can be debugged using the Chrome debugger. Run the test command and pass the --inspect-brk flag. Then open Chrome DevTools and click the Node icon. This will allow you to step through the code. The DevTools breakpoints can sometimes not trigger, but debugger statements in test code or component code are a dependable way to interrupt control flow.

ampft-example's People

Contributors

cvializ avatar

Watchers

 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.