see previous commit for explanation why we do it like that!
Also simplify how the mocked backend API returns a promise and
wait for it on the assertions.
When the SUT calls history.push that will cause a page redirect
inside the browser. However it doesn't cause the new page to be
rendered when running the test suite hence all assertions fail!
The reason for this is that Jest + RTL use jsdom under the hood,
which partially implements HTML/DOM APIs but **IS NOT** a browser!
It also turns out RTL is not well suited for end-to-end scenarios
which cover multiple pages.
This commit:
- patches renderWithReduxRouter() to also return the history object
so we can set a spy on it later
- changes eslint confirugration to ignore unused variables starting
with underscore
- updates the verifyCancelButton() function and scenarios which
make use of it
instead of waiting inside verifyCancelButton() make it return the
result of waitFor, which is a promise, and wait on it inside each
individual test scenario.
- `npm run test:single` runs jest with `-w 1`, makes the output readable
- adds testIds to the radio buttons, I think it's a bit bugged where if
you click the label it'll automatically switch to the first radio button
(even if you click the label of the 2nd button)
- moved a misplaced wait
otherwise we get:
Error: The element(s) given to waitForElementToBeRemoved are
already removed. waitForElementToBeRemoved requires that the
element(s) exist(s) before waiting for removal.
- Make activation key input field required
- Registration step in CreateImageWizard
- should allow choosing activation keys
- should hide input fields when clicking Register the system later
This reverts commit bd99a90faa.
While this is common in cockpit's projects, osbuild projects refrain
from rebasing branches.
Rebasing on master as it happens to be when the test is running, leaves
you in a state where you neither know that the branch itself is working,
nor that it will work when you actually do merge it later, because
master might have changed in between.
This was a bit confusing because in the inline documentation, I wrote
that a compose used state as a key. However this changed to status
pretty early on and I forgot to update it.
Also use an actual uuid with proper length.
- sanity validation of each of the 4 steps
- click through buttons Next/Back/Cancel
Notes:
- add data-testid attribute for the release select field b/c
there's no better way to query it
- add @testing-library/jest-dom for additional asserts
anticipate common mistakes
eslint-plugin-testing-library: for writing tests with Testing Library
eslint-plugin-jest-dom: for writing tests with jest-dom
As mentioned in the previous commit, `<Main>` doesn't really
belong in App.js, it instead belongs in LandingPage.js, because
it creates the html/css wrapper for the main contents, as a
sibling to the `<PageHeader>` component used in LandingPage.js.
However, including `<Main>` in LandingPage.js will cause the
tests to fail. Therefore, just the html and classes that
`<Main>` creates is used in LandingPage.js.
`<Main>` doesn't really belong in App.js given the html it renders,
but there's some additional thing happening with this component
that requires it to be here to support tests. This update addresses
the extra padding that it creates by being used at this level.
Closes#17
Basic jest tests are added for the landing page. These tests use the
react testing library so the enzyme dependencies are removed from the
package.json. The travis config is also updated.
The Main component in the LandingPage component has been moved to the
App component. This is required so the tests can mock the store without
any insights information.
* package.json: Clean up scripts
* travis: Run travis build scripts
These run with NODE_ENV=production, which is needed to have correct
routing on all clouddot instances.
The starter app has been updated over the last few months and new
options are required in the `scripts` section of `package.json`.
Bring the `scripts` section in line with the starter app to fix some
issues around routing requests to `/beta` in CI.
Signed-off-by: Major Hayden <major@redhat.com>