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

Add tests #53

Open
kaicataldo opened this issue Oct 19, 2019 · 5 comments
Open

Add tests #53

kaicataldo opened this issue Oct 19, 2019 · 5 comments
Assignees
Labels
internal This change is not user facing
Milestone

Comments

@kaicataldo
Copy link
Member

Once the basic functionality has been sorted out, we should split the code into smaller modules and add some tests.

@kaicataldo kaicataldo added the internal This change is not user facing label Oct 19, 2019
@nickserv
Copy link
Member

nickserv commented Oct 19, 2019

Nice, I was just thinking about this. I feel like since we have so many edge cases with site support (even with only GitHub and Stack Overflow for now), end to end tests with Cypress could be really useful for regression testing. Also we won't need to restructure code for end to end tests, assuming there's a way to install extensions. It still may be useful to have some unit and integration tests though.

@nickserv nickserv added this to the 1.0 milestone Oct 22, 2019
@Wicked7000
Copy link
Contributor

Agreed this would be good to do, although I'm not sure how easy it would be to achieve with Cypress as there are some pretty specific edge cases that I don't know how you could simulate. (At least without just using static web pages)

i.e: Creator of an issue see's a special button when commenting, Owner/Maintainer of a project see's special buttons when commenting on PRs (same with issues) ..etc

I think it would also be good to have some unit tests too though.

@nickserv
Copy link
Member

It's possible to install a Chrome extension in Cypress, but we may still need to mock the chrome APIs and extension URLs. I'm giving this a try, and if it's too difficult to get something working without complex mocks, I might switch to something like Puppeteer or Selenium.

@nickserv
Copy link
Member

I've tried Cypress and Puppeteer, but they don't seem to support what we need to fully test the extension. Selenium works, but we'd have to authenticate a GitHub account in the tests as the extension only works logged in. I think integration/unit testing would be a better approach, I'm making progress with Jest.

@nickserv nickserv self-assigned this Nov 2, 2019
@nickserv nickserv mentioned this issue Nov 2, 2019
10 tasks
@nickserv
Copy link
Member

nickserv commented Nov 5, 2019

Anyone should be able to start setting up some Jest tests based on #81, but I still have a few in-progress tests that I need to figure out. Please let me know if there's anything you plan on testing so we can coordinate, and only mock/stub what's needed for test environment support so we can keep tests as realistic as possible.

Here are my test plan ideas so far (some of which I've already started implementing):

  • Integration test classes and functions in src/content with dom-testing-library and jest-dom
  • Integration test React components in src/options with react-testing-library and jest-dom
  • Unit/integration test other stuff as needed (I've already tried end to end tests and it's not worth it: Chrome extension support is limited in most frameworks, and even when it's not, it's a pain to deal with GitHub auth)

This was referenced Nov 5, 2019
@nickserv nickserv modified the milestones: 1.0, 2.0, 1.1 Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal This change is not user facing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants