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

Actual tests #6

Open
2 of 7 tasks
shakeelmohamed opened this issue May 12, 2015 · 18 comments
Open
2 of 7 tasks

Actual tests #6

shakeelmohamed opened this issue May 12, 2015 · 18 comments

Comments

@shakeelmohamed
Copy link
Member

The next tests need to be sending many different URL forms & user behaviors validating the JS object player which represents the YouTube player object that gets embedded and determine if the video is playing, also lots of error checking tests.

TODO:

@shakeelmohamed shakeelmohamed modified the milestone: Nice for GA May 14, 2015
@shakeelmohamed
Copy link
Member Author

Once upon a time, using Zombie's browser.evaluate("player") would be useful, but there's a race condition where sometimes the player object isn't ready yet.

I've tried:

  • Zombie's browser.wait with a timeout as high as 10 seconds
  • setTimeout with a high timeout

No solution in sight, so test work is pretty much blocked by this issue

@shakeelmohamed
Copy link
Member Author

It seems like both browser.evaluate() and browser.assert.global() aren't working correctly. The tests will probably just need to look at the DOM for now

@shakeelmohamed
Copy link
Member Author

I think the only way past this blocker is to change to Zombie 4.x, thus forcing us to use Node.js 0.12+ which is pretty reasonable now that they're over 5.x

@shakeelmohamed
Copy link
Member Author

Updating Zombie to 4.x and Node.js to 4.x solves these problems!!!! 🎉

Now comes the hard part... writing tests

@shakeelmohamed
Copy link
Member Author

I believe these tests will all need to be rewritten using Browserstack... stay tuned 🕙

@shakeelmohamed
Copy link
Member Author

@shakeelmohamed
Copy link
Member Author

We need some coverage for #146

@shakeelmohamed
Copy link
Member Author

more potential guidance: https://github.com/Krinkle/travis-ci-node-and-browser-qunit

@joaniedavis
Copy link
Contributor

@shakeelmohamed It looks like this issue is pretty old. Is it still relevant to work on? If so, do you have any tips on how I could get started?

@shakeelmohamed
Copy link
Member Author

@joaniedavis there's plenty to do :) I would spend a few minutes playing around with the website and look to add some test that hit basic scenarios:

  • searching and making sure there search results are returned
  • clicking one of those search results
  • ensuring a video has started playing (by checking that the time has increased from 0:00 after a 2 second delay)

That's just one example, feel free to outline some test cases before writing them and I can let you know which ones make sense

@joaniedavis
Copy link
Contributor

@shakeelmohamed I've spent some time digging through the code and the tests and I think I have a sense of how to write some more. Here's the basic list I'm thinking of starting with:

  • Searching and making sure results are returned
    • If more than 5 results, only display 5
    • If no results, display an error message
  • Ensuring a video has started playing
  • Expected behavior for clicking on a video
  • Expected behavior for clicking each of the show description/show player/repeat buttons

Do those sound like reasonable test cases?
Also, do you have thoughts for or against splitting up the index.js file into multiple, smaller, test files?

@shakeelmohamed
Copy link
Member Author

@joaniedavis yeah those seem like a great starting place. Yes, feel free to split up the tests into smaller files

@joaniedavis
Copy link
Contributor

@shakeelmohamed I'm working on this still, but progress is slower since the current code structure is challenging to test. Do you have thoughts on breaking up everything.js into smaller modules? I'd understand if you'd prefer to avoid a total structural overhaul, and if that's the case, do you have any thoughts on how to unit test some of the above functionality?

@shakeelmohamed
Copy link
Member Author

@joaniedavis thanks, take your time. I'm more concerned with having functional tests that simulate user behavior than unit tests at this time.

I think once we have sufficient functional tests we can think about a refactor into smaller modules. The main reason I started this was out of simplicity because I didn't want to introduce a build step since the website is hosted statically with GitHub pages.

@joaniedavis
Copy link
Contributor

@shakeelmohamed I've spent a couple hours trying to get some additional functionality tests implemented, but I'm afraid I don't understand Javascript and the test framework well enough to make major improvements. Would you like me to submit the changes I have to just split up the tests into more manageable files anyway?

@shakeelmohamed
Copy link
Member Author

@joaniedavis sure, let's take a look at what you've got so far and I can provide some pointers

@shakeelmohamed
Copy link
Member Author

With #416, we now have an opportunity for a) test cleanup b) test utility functions and c) more tests

@shakeelmohamed
Copy link
Member Author

There are some interesting AI tools that may help with test creation: https://github.com/jamesmurdza/awesome-ai-devtools?tab=readme-ov-file#testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants