Grid UI Unit Tests - #8865
Conversation
| "<rootDir>/src" | ||
| ], | ||
| testMatch: [ | ||
| "<rootDir>/src/tests/*.test.ts", |
There was a problem hiding this comment.
| "<rootDir>/src/tests/*.test.ts", | |
| "<rootDir>/src/tests/*.test.ts", | |
| "<rootDir>/src/tests/*.test.tsx", |
| @@ -0,0 +1,30 @@ | |||
| import * as React from 'react'; | |||
There was a problem hiding this comment.
rename this file so that it ends with tsx instead of ts
| @@ -0,0 +1,15 @@ | |||
| import * as React from 'react'; | |||
There was a problem hiding this comment.
rename this file so that it ends with tsx instead of ts
| }, { | ||
| isChecked: boolean | ||
| }> { | ||
| constructor(props) { |
There was a problem hiding this comment.
| constructor(props) { | |
| constructor(props: any) { |
6504624 to
de70765
Compare
| "last 1 safari version" | ||
| ] | ||
| }, | ||
| "devDependencies": { |
There was a problem hiding this comment.
All of these need to be at the to be in the top level package.json file in the root of the repo
| "jest.config.js" | ||
| ], | ||
| data = [ | ||
| "//:jest.config.js" |
There was a problem hiding this comment.
By having // you're telling it to look at the root of the repo which means it will error.
| "--ci", | ||
| "--colors", | ||
| "--config", | ||
| "jest.config.js" |
There was a problem hiding this comment.
| "jest.config.js" | |
| "$(location jest.config.js)" |
That will find it local to the bazel build
2f66ac0 to
4ed5897
Compare
| @@ -0,0 +1,3 @@ | |||
| import { configure } from 'enzyme'; | |||
There was a problem hiding this comment.
This file should probably be a .tsx file so we don't get that weird issue we had before
| @@ -0,0 +1,19 @@ | |||
| module.exports = { | |||
There was a problem hiding this comment.
We don't need this file, we can use the one that is in the grid-ui directory
| const cache = new InMemoryCache(); | ||
| const link = new HttpLink({ | ||
| uri: GridConfig.serverUri, | ||
| fetch |
There was a problem hiding this comment.
Is this line needed? It feels like this would error since it's not in an object format
There was a problem hiding this comment.
Yes, its needed.
There are some tests that fail with the following message:
Test suite failed to run
Invariant Violation:
fetch is not found globally and no fetcher passed, to fix pass a fetch for
your environment like https://www.npmjs.com/package/unfetch.
For example:
import fetch from 'unfetch';
import { createHttpLink } from 'apollo-link-http';
const link = createHttpLink({ uri: '/graphql', fetch: fetch });
20 |
21 | const cache = new InMemoryCache();
> 22 | const link = new HttpLink({
| ^
23 | uri: GridConfig.serverUri,
24 | });
25 |
at new InvariantError (../../../../../../../../../node_modules/ts-invariant/lib/invariant.esm.js:12:28)
at Object.<anonymous>.exports.checkFetcher (../../../../../../../../../node_modules/apollo-link-http-common/src/index.ts:178:11)
at Object.<anonymous>.exports.createHttpLink (../../../../../../../../../node_modules/apollo-link-http/src/httpLink.ts:46:3)
at new HttpLink (../../../../../../../../../node_modules/apollo-link-http/src/httpLink.ts:259:11)
at Object.<anonymous> (../../../../src/App.tsx:22:14)
at Object.<anonymous> (../../../../src/core/Status.ts:2:1)
at Object.<anonymous> (../../../../src/screens/Console/Console.tsx:14:1)
at Object.<anonymous> (../../../../src/screens/Console/Console.keybinds.ts:4:1)
at Object.<anonymous> (../../../../src/components/KeyBoard/KeyBoardHelp.tsx:7:1)
at Object.<anonymous> (../../../../src/components/NavBar/NavBar.tsx:12:1)
at Object.<anonymous> (../../../../src/tests/components/NavBar.test.tsx:3:1)
When checked on SO, that was the fix that was suggested on multiple questions of similar error stack trace.
There was a problem hiding this comment.
I am able to build and start the server. UI page opens fine.
There was a problem hiding this comment.
Ok, can we have it as a key/value pair then
| "--ci", | ||
| "--colors", | ||
| "--config", | ||
| "$(rootpath jest.config.js)" |
There was a problem hiding this comment.
| "$(rootpath jest.config.js)" | |
| "$(location jest.config.js)" |
4ed5897 to
3c0535e
Compare
Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Motivation and Context
Types of changes
Checklist