This repository has been archived by the owner on Jul 12, 2019. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog
New
chai
as assertion libraryWhat is this?
This is the parser which parses the exportable tests.
This parser, with our exportable-test structure, is now confirmed to work with Jest (this repo) and Mocha. The exportable tests have been confirmed to work in Angular CLI environments.
Exportable test parser
This test parser is meant to create
describe
/it
/expect
test structures. If it's output was being printed out, it would look like any other describe/it tests:Exportable test structure
Inside
src/test-parser.js
is the breakdown of an exportable test object's available properties - documented in thescenario-test-object
typedef JSDoc block.The example in this repo via the fixture (see below) is a very basic example of a test.
Test fixtures
PR includes fixtures for the tests which are:
standardDiv
is the one test. This test only checks the content of the HTMLexpect
functions is why I addedchai
. Jest's assertion library doesn't allow that parameter out of the boxHow Jest runs the tests
yarn test
triggers the tests insidesrc/__tests__/test-parser-test.js
div--variant-one.html
TestParser
(the test parsing func) usingdocument
- which contains the DOM fragmentNext steps
Real-world example
This PR only includes testing of a basic example-fixture.
@elizabethsjudd is working on an actual test for the
accordion
component which will include separate tests per user type. Her tests will show how to test changes to the DOM using this exportable test format.Carbon POC
While we can get these tests running in this environment, we should also test that they could work within one of carbon-components-react/angular/vue.
Chai assertions / assertion library selection
The second parameter allows us to tie the
expect
statements to a specific scenario-requirement. But we don't want to mix the assertion types. The assertion library for these exportable tests should be something that would work in at least all four framework test environments, plus Selenium.Confirming all requirements are met
We have tests which reads the Gherkin and the exportable tests and determines if there is a test for every requirement. I didn't want to include that in this PR so that we can focus on the exportable test structure