-
Notifications
You must be signed in to change notification settings - Fork 130
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
Publish Button test in Jest #749
Conversation
Thanks for opening this pull request! This space is protected by our Code of Conduct - and we're here to help. |
Hmm, i'm seeing in the tests:
This means we need to get jquery into the test file. Let me think and we should be able to do that. |
OK - more closely following the example in https://stackoverflow.com/a/48763451 now! Fingers 🤞 |
OK, so the issue here is that we're trying to use jQuery, but within Puppeteer's browser, we can't directly access jQuery. We'd have to do it in a block like this: await page.goto('http://localhost/jest/table.html');
await page.addScriptTag({url: 'https://code.jquery.com/jquery-3.3.1.slim.min.js'});
const result = await page.evaluate(() => {
try {
var table = $("table").attr("id");
return table;
} catch (e) {
return e.message;
}
});
await console.log("result", result); That's a lot of trouble, and we can't do assertions inside, i think? not sure. But maybe we can install this: https://github.com/melbourne2991/jquery-puppeteer and it would "just work"? worth a shot. I'll try this tomorrow. I'm so sorry this is much more complex than we'd thought! We'll get through it together though! References: |
Or easier maybe native puppeteer selectors? https://github.com/puppeteer/puppeteer/blob/v10.4.0/docs/api.md#pageselector |
Hi @TarunRaveesh, we're currently working on converting jasmine tests to jest and the conversion is a bit tricky. @NARUDESIGNS has resolved this issue in #785. You did a great job and we appreciate the time you spent working on this PR. If you'd like to work on another issue, leave a comment here and I'll find another one for you. Thank you! |
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
grunt jasmine
fixes #0000
-style reference to original issue #@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.
Thanks!
fixes #745