Skip to content

oushanskeen/xplay

Repository files navigation

XPlay

This repo stores a very basic boilerplate code for the model-based testing with XState and Playwright.

alt text

npm install
npx playwright test ./tests/helloPage.test.js

Notes:

  1. 'Test Machine' describes transitions and store links to state asserts described in ...
const testMachine = createMachine({
  id: 'testMachine',
  predictableActionArguments: true,
  initial: 'start',
  context: {
    testContext: 'sampleTestContext'
  },
  states: {
    "start": {
      description: "todo: ?",
      meta: states.start.meta,
      on: {
        "NEXT": {
          description: "todo: ?",
          target: "end"
        }
      }
    },
    "end": {
      description: "todo: ?",
      type: "final"
    }
  }
})
  1. ... 'states'.
const states = {
  start: {
    meta: {
      test: async (page, params) => {

        await page.goto('https://www.google.com');
        const title = await page.title();
        await expect(title).toContain('Google');

      }
    }
  }
}

About

Basic xstate + playwright boilerplate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors