Giter Site home page Giter Site logo

Add unit tests about kap HOT 30 OPEN

wulkano avatar wulkano commented on May 15, 2024
Add unit tests

from kap.

Comments (30)

zeke avatar zeke commented on May 15, 2024 3

https://github.com/electron/electron-api-demos/blob/master/tests/index.js is a pretty good Spectron example to start from.

I tried AVA for a bit but it was quite slow to start up every time because it's doing so much transpilation.

from kap.

sindresorhus avatar sindresorhus commented on May 15, 2024 3

@zeke That should only be the first run. We cache everything. Unless you're using babel-register, which circumvents our cache, but I don't see why babel-register would be used here. Node.js 6 also improved require time significantly, so should help. We're working on a promising solution: avajs/ava#1052.

from kap.

zeke avatar zeke commented on May 15, 2024 3

@sindresorhus sweet! I will give AVA another go.

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024 2

Hi guys,

I know a number of people have already tried to take on this PR.
I am a complete beginner when it comes to writing tests.

I've just added in a sample test to run and confirm that it is setup correctly.
I will probably be back in a bit to ask some questions.
Currently using the two packages Spectron and Ava as suggested from the original comment

Thanks

from kap.

makhambettorezhan avatar makhambettorezhan commented on May 15, 2024 2

Been using your app and it is very simple. It would mean great deal to me to contribute to this project. I've seen some of the people already added some tests but I'd like to add some more. And for now I'm learning examples of AVA and Spectron. Hope I can add some tests soon.

from kap.

matheuss avatar matheuss commented on May 15, 2024 1

Thanks for the link @zeke – will be needed since I never used Spectron 😅

Yeah, AVA takes some time to start – but it's awesome 😌 cc @sindresorhus

from kap.

hyalkaf avatar hyalkaf commented on May 15, 2024 1

I would like to start working on this. Maybe I can start doing tests in chunks and make pull requests for them?

from kap.

brodeynewman avatar brodeynewman commented on May 15, 2024 1

Awesome. I will start on this today then.
Also, do we have a preference on what test libraries / frameworks we use? I usually go with Jest due to Istanbul coverage reporting being built in, and mix Enzyme in for React component testing.

from kap.

brodeynewman avatar brodeynewman commented on May 15, 2024 1

Expect a PR for some tests soon 😄

from kap.

skllcrn avatar skllcrn commented on May 15, 2024 1

I highly suggest creating a markdown table with what you intended to cover with the tests, that way we have a better idea of what exactly we aim to cover @dhuang612 🙏 Thank you for bringing this issue back to life!

from kap.

matheuss avatar matheuss commented on May 15, 2024

Sounds amazing @hyalkaf 😄 You could write the first ones and then send a [WIP] PR and then just keep adding the others 😄

from kap.

fokusferit avatar fokusferit commented on May 15, 2024

Any progress here ? 😄

Otherwise I would try to start on it. Is the decision on AVA now final or Spectron ?

from kap.

sindresorhus avatar sindresorhus commented on May 15, 2024

@fokusferit No progress. Feel free to take it on. AVA + Spectron. Example here: https://github.com/electron/spectron/blob/master/README.md#with-ava

from kap.

brodeynewman avatar brodeynewman commented on May 15, 2024

Has any progress been made on this yet? I'd like to start chunking away at this.
First time contributing to this project btw.

from kap.

skllcrn avatar skllcrn commented on May 15, 2024

That'd be fantastic @brodeynewman! There hasn't been any substantial progress on this, you can grab the latest version of Kap off master, here's how to get set up: https://github.com/wulkano/kap/blob/master/contributing.md

from kap.

skllcrn avatar skllcrn commented on May 15, 2024

That makes sense, you can also look into AVA with Enzyme!

from kap.

sindresorhus avatar sindresorhus commented on May 15, 2024

I would prefer AVA and Enzyme. See: https://github.com/avajs/ava/blob/master/docs/recipes/react.md Make sure you install yarn install [email protected] (latest version). For code coverage, see: https://github.com/avajs/ava/blob/master/docs/recipes/code-coverage.md

from kap.

bringking avatar bringking commented on May 15, 2024

@brodeynewman any progress on this? would love to be able to test changes in here

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

okay,

So I got it setup in package.json and hooked it up to npm test.
When I setup the test.js page following this guide:
https://github.com/electron-userland/spectron#with-ava

I get the following error:

 TypeError: Tests must have a title

So I opened up a new issue on spectron's repo
electron-userland/spectron#434

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

never mind I understand my issue

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

sent a PR could I get a review on work done so far?

Screen Shot 2019-09-12 at 4 23 44 PM

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

just wanted to send a quick update.
I have made the changes that the reviewer requested.
Right now circle ci is timing out on this ava test without ever running it.
The test passes both on my local machine, and when I push the commit to this repo.
Investigating into circle ci.

Included screenshots into my PR

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

opened up an issue with this repo

electron-userland/spectron#439
https://github.com/electron-userland/spectron

still getting the same issue of having the test timeout when using ci

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

been reviewing documents on spectron and ava to try and find the correct param I am missing to get this working on circleci. Since the no output for 10 minutes error means that the environment isn't being setup correctly.
So it seems like I need to start setting up some sort of way to fake the browser existing for the ci tests to pass?
I've been looking into this
https://blog.logrocket.com/introduction-to-headless-browser-testing-44b82310b27c/
and will need changes to be made to the config.yml

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

I am basing my previous statement from this article available on electronjs which talks about headless testing and mentions circleci

https://electronjs.org/docs/tutorial/testing-on-headless-ci

currently reading through circleci docs

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

Hello,

I have a question, could someone tell me if the circleci logs are saying anything?
The only response I am getting from that for my tests is a timeout which isn't a helpful message.

I understand that spectron has webdriverio as a wrapper so that should be enough to run it?

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

Hey guys,

So a docker image needs to be setup to replicate the environment so that these tests can be run.
Here is an article about it from circleci
https://circleci.com/blog/docker-what-you-should-know/
https://circleci.com/docs/2.0/building-docker-images/

Basically tests can't be added until this is configured, that's why the timeouts have been happening.
Could you guys setup an electron docker and then I can get this test to pass and continue to work on others?

Here's an example of another github repo with working tests and their config.yml has a docker image setup for electron

https://github.com/CityOfZion/neon-wallet/blob/dev/.circleci/config.yml

Thanks guys

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

I now have a better understanding of next steps. I'll get working on this and resubmit the pr

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

Hi,

created PR #730 for this issue.

from kap.

dhuang612 avatar dhuang612 commented on May 15, 2024

added some more tests

from kap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.