This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Button | |
| Given I go to home | |
| When I click the login button | |
| Then the login button is not visible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Given, When, Then } from 'cucumber'; | |
| import { act } from 'react-dom/test-utils'; | |
| import Element from './path/to/Element'; | |
| Given(/I go to (.*)$/, function(link) { | |
| window.location.hash = `#/${link}`; | |
| }); | |
| When(/I click the (\S+) button$/, function(id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { setWorldConstructor } from 'cucumber'; | |
| setWorldConstructor( | |
| class World { | |
| // this class gets instantiated before the tests start and | |
| // the value created from that instatiation is what is available in hooks and steps as "this" | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { act } from 'react-dom/test-utils' | |
| import { AfterAll, BeforeAll } from 'cucumber'; | |
| import App from './path/to/your/app'; | |
| const $root = document.createElement('div'); | |
| document.body.appendChild($root); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "moduleFileExtensions": [ | |
| "feature", // <--- *1 | |
| ], | |
| "setupFilesAfterEnv": [ | |
| "<rootDir>/node_modules/cucumber-jest/dist/init.js", // <--- *2 | |
| "<rootDir>/test/world.ts", | |
| "<rootDir>/test/hooks.tsx", | |
| "<rootDir>/test/steps.ts" | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Element from './path/to/Element' | |
| // imagine this element <input type="text" data-test-id="foo"/> | |
| const $element = new Element({ | |
| id: 'foo' | |
| }); | |
| $element.setValue('bar'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {isEqual} from "lodash"; | |
| import {outdent} from "outdent"; | |
| import {act} from "react-dom/test-utils"; | |
| import {fireEvent} from "@testing-library/react"; | |
| export type ElementProps = { | |
| id?: string; | |
| root?: string; | |
| selector?: string; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {isEqual} from "lodash"; | |
| import {outdent} from "outdent"; | |
| import {act} from "react-dom/test-utils"; | |
| import {fireEvent} from "@testing-library/react"; | |
| import {dblClick} from "@testing-library/user-event"; | |
| export type JSDOMElementProps = { | |
| id?: string; | |
| root?: string; | |
| selector?: string; |