Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3335] Convert JS tests to Selenium#3601

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
takluyver merged 6 commits intojupyter:masterfromarovit:test_empty_arrows
Jun 10, 2018

Conversation

@arovit
Copy link
Contributor

  1. Converting 'empty_arrows_keys.js' into selenium based testcase
  2. Moved "delete_cell" method to utils.py and modified references to use it from there
  3. Added a generalized method "trigger_keystrokes" to send keystrokes to browser

2. Moved "delete_cell" method to utils.py and modified references to use it from there3. added a generalized method "trigger_keystrokes" to send keystrokes to browser
@arovitarovit mentioned this pull requestMay 7, 2018
@arovit
Copy link
ContributorAuthor

arovit commentedMay 7, 2018
edited
Loading

The selenium test "test_dualmode_insertcell.py" fails here. I am inclined towards saying my changes don't affect this testcase but let me see if I can fix it.

@arovit
Copy link
ContributorAuthor

@takluyver can I please get your attention to this PR.

@takluyver
Copy link
Member

Please don't pester me, especially just one day after opening it. I have other things to do as well! I'm also not the only person who can review PRs, at least in theory.

@arovit
Copy link
ContributorAuthor

Apologies for pushing. I understand you must be swamped with PR reviews and own work.

@takluyver
Copy link
Member

No worries. I'll have a look now.

For future reference, it's OK to give a PR a friendly ping if it goes a couple of weeks without anyone looking at it. It might have been forgotten, or the maintainers might think you're going to do something else. But "can I please get your attention" comes across as a bit demanding. One way I sometimes do this is to ask the maintainers "is there anything more I should do on this?".


defdelete_cell(self,index):
self.focus_cell(index)
self.to_command_mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this should have() at the end, otherwise it's not doing anything. I can see it's just moved from another file, but it's worth checking while we're looking at it.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

my bad, I should have noticed. I will check on this.

foreach_key_combinationinkeys:
keys=each_key_combination.split('-')
iflen(keys)>1:# key has modifiers eg. control, alt, shift
modifiers_keys=list(map(lambdax:getattr(Keys,x.upper()),keys[:-1]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

list(map(lambda is a pretty good sign that a list comprehension would be clearer. ;-)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, muscle memory of using maps in Python2.
You are right, "list comprehension" would be much clearer.

# delete all the cells
notebook.trigger_keydown('up')
notebook.trigger_keydown('down')
assertremove_cells(notebook);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The original JS version of the test removes the cells before doing the up/down keys. So it's testing up/down inside an empty notebook. But to be honest, I have no idea what that test is meant to achieve. You can't even really have an empty notebook - if you delete the last cell, it creates a new one for you. Like Nature, Jupyter abhors a vacuum.

Maybe it would be more use to test that behaviour instead - delete all cells, check there's a new one there.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, I agree that test was testing minimal behavior. Yes, Sure, I can add do this check.

…dded assert to check presence of cell and remove 'return True' from remove_cells
deftest_empty_arrows_keys(notebook):
# delete all the cells
notebook.trigger_keydown('up')
notebook.trigger_keydown('down')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's get rid of the up/down, since they're not really testing anything, rename the function totest_delete_all_cells, and maybe move it intotest_deletecell.py

@arovit
Copy link
ContributorAuthor

Thanks for reviewing, removed the up and down arrow movement and moved the logic into test_deletecell.py

@arovit
Copy link
ContributorAuthor

Please let me know if anything else needs to be worked on here.

notebook.focus_cell(index)
notebook.to_command_mode
notebook.current_cell.send_keys('dd')
defremove_cells(notebook):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's call thisremove_all_cells, just to be clear what it's doing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Also, I think the implementation could be more efficient. If you look at whatnotebook.index() does, it's actually querying the browser for the full list of cells to find out where the given cell is. We don't need to know that, we just need to know howmany cells to delete. Then we can do it by deleting the first cell N times.

Copy link
ContributorAuthor

@arovitarovitJun 8, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

makes sense. The current way is quite inefficient

assertlen(notebook.cells)==2
assertcell_is_deletable(notebook,1)

remove_cells(notebook)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Careful! If you look at the code just above this, it's making one of the cells undeletable. So we're not actually deleting all the cells here.

Copy link
ContributorAuthor

@arovitarovitJun 8, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You are right. Sorry, did not notice as I just moved the deletion test to this file.

@arovit
Copy link
ContributorAuthor

Thanks for reviewing, changed the code according to the comments.

@arovitarovit closed thisJun 8, 2018
@arovitarovit reopened thisJun 8, 2018
@takluyvertakluyver added this to the5.6 milestoneJun 10, 2018
@takluyvertakluyver merged commitebe0176 intojupyter:masterJun 10, 2018
@mpacermpacer changed the title[WIP] [3335] Convert JS tests to Selenium[3335] Convert JS tests to SeleniumJun 13, 2018
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsApr 1, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@takluyvertakluyvertakluyver left review comments

Assignees

No one assigned

Projects

None yet

Milestone

5.6

Development

Successfully merging this pull request may close these issues.

2 participants

@arovit@takluyver

[8]ページ先頭

©2009-2025 Movatter.jp