GithubHelp home page GithubHelp logo

isabella232 / todo-react-typescript-subsecond Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cucumber/todo-react-typescript-subsecond

0.0 0.0 0.0 1.04 MB

Tiny Todo app in React and TypeScript demonstrating sub-second test feedback

License: MIT License

Shell 0.93% TypeScript 79.84% Gherkin 5.28% JavaScript 2.28% HTML 8.09% CSS 3.59%

todo-react-typescript-subsecond's Introduction

todo-react-typescript-subsecond

Tiny Todo app in React and TypeScript demonstrating sub-second test feedback

Start the app

npm start

Run tests

npm test

Run tests in a particular assembly

# Look for possible values in features/support/TodoWorld.ts
ASSEMBLY=... ./cucumber

Run Cucumber-Electron interactively

ASSEMBLY=react ./cucumber -i

Keep each actor's DOM (omit cleaning up)

ASSEMBLY=react KEEP_DOM=1 ./cucumber -i

Run on CBT

Make sure you've built the client-side JavaScript:

npm run build

Define your CBT credentials:

export CBT_USERNAME=...
export CBT_AUTHKEY=...

Run with a specific browser:

ASSEMBLY=webdriver BROWSER=MicrosoftEdge CBT=1 CBT_VERSION=79 ./cucumber
ASSEMBLY=webdriver BROWSER=chrome CBT=1 CBT_VERSION=55 ./cucumber

Patterns

Test code

  • Step definitions only interact with an actor
    • No information about UI or technology "leaks" through its API
    • There are multiple implementations of IActor
  • Then steps are synchronous
    • It's previous steps' responsibility to ensure the system is in a "settled" state
    • The ReactActor and WebDriverActor implementation uses @cucumber/microdata to query the DOM
  • Optimisations
    • Run webpack before Webdriver (takes time to run webpack)
    • Reuse "heavy" resources between scenarios
      • The same WebDriver browser instance (takes time to launch a new browser)
      • The same CBT tunnel (takes time to connect)

Production code

  • The React app is completely decoupled from the network (HTTP)
    • React hooks for writing/reading data to/from the server - defined as custom types
    • Different implementations of these hooks - HTTP and direct in-memory access
    • The hook implementatins are injected into the React app during assembly

todo-react-typescript-subsecond's People

Contributors

aslakhellesoy 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.