Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid UI Unit Tests #8865

Merged
merged 4 commits into from
Nov 25, 2020
Merged

Conversation

raju249
Copy link
Member

@raju249 raju249 commented Nov 11, 2020

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

"<rootDir>/src"
],
testMatch: [
"<rootDir>/src/tests/*.test.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<rootDir>/src/tests/*.test.ts",
"<rootDir>/src/tests/*.test.ts",
"<rootDir>/src/tests/*.test.tsx",

@@ -0,0 +1,30 @@
import * as React from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this file so that it ends with tsx instead of ts

@@ -0,0 +1,15 @@
import * as React from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this file so that it ends with tsx instead of ts

}, {
isChecked: boolean
}> {
constructor(props) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constructor(props) {
constructor(props: any) {

@raju249 raju249 marked this pull request as draft November 12, 2020 03:37
@@ -61,5 +61,19 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"jest.config.js"
"$(location jest.config.js)"

That will find it local to the bazel build

@raju249 raju249 marked this pull request as ready for review November 23, 2020 04:23
@@ -0,0 +1,3 @@
import { configure } from 'enzyme';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should probably be a .tsx file so we don't get that weird issue we had before

jest.config.js Outdated
@@ -0,0 +1,19 @@
module.exports = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this file, we can use the one that is in the grid-ui directory

@@ -21,6 +22,7 @@ import NodeType from "./models/node";
const cache = new InMemoryCache();
const link = new HttpLink({
uri: GridConfig.serverUri,
fetch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line needed? It feels like this would error since it's not in an object format

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am able to build and start the server. UI page opens fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can we have it as a key/value pair then

"--ci",
"--colors",
"--config",
"$(rootpath jest.config.js)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"$(rootpath jest.config.js)"
"$(location jest.config.js)"

@AutomatedTester AutomatedTester merged commit 78eca82 into SeleniumHQ:trunk Nov 25, 2020
pujagani pushed a commit to pujagani/selenium that referenced this pull request Nov 26, 2020

Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants