Write Lint Checks for the End-to-End Tests #11496
Comments
* Add lint check for e2e action scripts * Add exclude list for end-to-end-action-checks lint test * Fix end-to-end-action-checks to exclude by base filename * Shorten action checks rule name * Fix e2e-action lint failure * Limit e2e-action checks to e2e files * Move e2e-action file include/exclude lists to .eslintrc * Add files to e2e-action exclude list * Remove Lint Check for action.clear Rich text editors have a .clear() function, so we cannot use a lint check to find cases where we want to use action.clear instead. * Remove checks for clear from e2e-action.spec.js * Use function name as messageId in e2e-action lint check * Remove mistakenly committed tmp.py file * Remove unnecessary newline from .eslintrc * Simplify e2e-action lint logic * Replace elem.sendKeys with action.select2 * Remove click before select2
|
Hi , I am a new here and would like to contribute on this issue.Please guide me further. |
|
Welcome @RituCs! Could you pick one of the tasks at the top of this issue? Then I'll assign it to you |
|
Thank You @U8NWXD.I have no idea which issue is good for me. I know Python and little bit Javascript. |
…1734) * Add lint check for e2e action scripts * Add exclude list for end-to-end-action-checks lint test * Fix end-to-end-action-checks to exclude by base filename * Shorten action checks rule name * Fix e2e-action lint failure * Limit e2e-action checks to e2e files * Move e2e-action file include/exclude lists to .eslintrc * Add files to e2e-action exclude list * Remove Lint Check for action.clear Rich text editors have a .clear() function, so we cannot use a lint check to find cases where we want to use action.clear instead. * Remove checks for clear from e2e-action.spec.js * Use function name as messageId in e2e-action lint check * Remove mistakenly committed tmp.py file * Remove unnecessary newline from .eslintrc * Simplify e2e-action lint logic * Replace elem.sendKeys with action.select2 * Remove click before select2
|
I am working on |
|
@AdityaDubey0 I assigned you! Let me know if you have any questions |
|
Hi @U8NWXD , I am working on the subtask 'Making sure constant variable names are in all-caps ' of issue #8423. I created a js file and wrote my rule code in it, and a spec.js file in which I wrote my tests. My test code is like this: 'const a = 5'. When I ran 'python -m scripts.run_custom_eslint_tests' to check my linter against my test cases, I got an error 'A fatal parsing error occurred: Parsing error: The keyword 'const' is reserved'. Can you please guide me what am I doing wrong? |
|
@Mayank-gaur I think this should be added below line 117 since I think you'll be able to fix all the lint failures your rule introduces. The Regarding your parsing error, I haven't seen that before. @Hudda might be able to help more--they have more experience with the linter. You might try testing out your rule with https://astexplorer.net/. I found it very helpful for writing lint rules |
|
Thanks @U8NWXD. I have one more query please guide me. I added my rules in 'opensource/oppia/scripts/linters/custom_eslint_checks/rules' directory, still when I am adding it to eslintrc file, should I add it as 'oppia/rule-name : "error"' or should I use the full path 'opensource/oppia/scripts/linters/custom_eslint_checks/rules/rule-name' ? |
|
You should use |
|
Thanks @U8NWXD ! |
|
@U8NWXD Can you please assign me |
|
Hi, I'm a first-time contributor and I'd like to attempt some of these issues. Could you please assign me "Do not call .last() on a list of ElementArrayFinders" and "Do not access .length of ElementArrayFinders"? |
|
@U8NWXD, can you assign me |
|
Hey, |
|
@U8NWXD, My lint-check, which disallows use of My question: I added my rule in line 119 of UPDATE: Repositioning my rule with |
|
@MA86 yes, please add it next to |
|
@suryasiriki4 done |
|
@Varun8216889 I've assigned you to |
|
thank u |
|
@suryasiriki4 Regarding (1) I don't think there's a drop-in replacement. We'd expect to use something like a for loop instead. Regarding (2) this should also be checked in |
|
@U8NWXD, |
|
@MA86 done! |
|
@U8NWXD May I please be assigned to |
|
@SAEb-ai done (also, I think you can assign yourself now since you're a collaborator!) |
|
Hi @U8NWXD, Do you happen to know:
FYI, while searching the codebase, I found 45 places in 8 different files where Thanks a bunch! |
|
@MA86 sorry for the late reply. Yes, an No, we should not assume that all |
|
@U8NWXD, thanks for the answers! I'll take a fresh look at this issue and see how far I go. |
|
@U8NWXD Hi, I would like to work on this issue. This is my first open-source contribution so please assign me a file accordingly. |
|
@Aakash-Raj-2001 it looks like you've asked to be assigned in a bunch of issues. For your first contribution, please pick one to start with |
|
@U8NWXD Hi, I would like to work on this issue. And being totally new to this environment I really don't know how to being. All issue seems to be assigned, Can I get any issue assigned to me? Also a bit of resource on how to being would be of great help. |
|
Deassigned @suryasiriki4 @ahreehong @iabouara24 @SAEb-ai @Varun8216889 @MA86 due to inactivity. If you are still working on your tasks, let me know and I'll re-assign you |
|
@U8NWXD Hi, this is my first open source project and I would like some guidance on getting started. Do you know of any issue I can begin working on? Thanks |
|
@ruinan-liu I assigned you to "Do not use For guidance on how to get started with the project, see our wiki page. To get started on this issue in particular, see the instructions at the top |
|
@U8NWXD Hi there, I have a quick question regarding my check. So I updated in the protractor-practices.js a rule to check that no array uses the .filter() function, it passes the test |
|
@ruinan-liu I responded on gitter
|

To improve the quality of our end-to-end testing code, we want to create lint checks for common bad practices. If you would like to help with this issue, please leave a comment on this issue with the task you want to work on.
How to Write E2E Lint Checks
action.clear. If this happens, please let us know so we can remove it from the list.scripts/linters/custom_eslint_checks/rules/.*.spec.jsfile to test your code.oppia/e2e-actioninoverridesof.eslintrcnode_modules/eslint-plugin-oppia/directory and runyarn installto install your linter.python -m scripts.run_custom_eslint_teststo check that the tests you wrote pass.You can also check out #11734 as an example of how to add these checks. If you have any questions, please reach out to @U8NWXD.
Lint Checks to Add
action.clickinstead of calling.click()on an element. @U8NWXDaction.sendKeysinstead of calling.sendKeyson an element. @U8NWXD.first()on a list of ElementArrayFinders.Reserved for GSoC.last()on a list of ElementArrayFinders.Reserved for GSoC.get()on a list of ElementArrayFinders.Reserved for GSoCbrowser.sleep()calls @AdityaDubey0[])..lengthof ElementArrayFinders.browser.switchTo().activeElement(). There might be some exceptions.await (await browser.switchTo().activeElement()).sendKeys(explanation);. There should be no exceptions to this.forEach. @vashuteotia123filter. @ruinan-liu.then(). @MA86Notes
action.clearinstead of calling.clear()on an element. This is because it's valid to call.clear()on rich text editors.The text was updated successfully, but these errors were encountered: