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

[Main] test_tags_dialog fails on Windows #6541

Closed
drew2a opened this issue Nov 10, 2021 · 1 comment · Fixed by #6547
Closed

[Main] test_tags_dialog fails on Windows #6541

drew2a opened this issue Nov 10, 2021 · 1 comment · Fixed by #6547

Comments

@drew2a
Copy link
Contributor

drew2a commented Nov 10, 2021

I saw random test_tags_dialog fails during the #6540

Full console

=================================== FAILURES ===================================
_______________________________ test_tags_dialog _______________________________

window = <tribler_gui.tribler_window.TriblerWindow object at 0x12f312790>

    def test_tags_dialog(window):
        """
        Test the behaviour of the dialog where a user can edit tags.
        """
        QTest.mouseClick(window.left_menu_button_popular, Qt.LeftButton)
        widget = window.popular_page
        wait_for_list_populated(widget.content_table)
    
        # Test the tag modification dialog
        idx = widget.content_table.model().index(0, 0)
        widget.content_table.on_edit_tags_clicked(idx)
        screenshot(window, name="edit_tags_dialog")
        assert widget.content_table.add_tags_dialog
        wait_for_signal(widget.content_table.add_tags_dialog.suggestions_loaded)
    
        # Edit the first tag
        tags_input = widget.content_table.add_tags_dialog.dialog_widget.edit_tags_input
        num_tags = len(tags_input.tags) - 1  # To account for the 'dummy' tag at the end of the input field.
        QTest.mouseClick(tags_input, Qt.LeftButton, pos=tags_input.tags[0].rect.center().toPoint())
        QTest.keyClick(tags_input, Qt.Key_Home)
        assert tags_input.editing_index == 0
        assert tags_input.cursor_ind == 0
        screenshot(window, name="edit_tags_dialog_edit_first_tag")
    
        # Test selecting a single character
        QTest.keyClick(tags_input, Qt.Key_Right)
        QTest.keySequence(tags_input, QKeySequence.SelectPreviousChar)
        assert tags_input.select_size == 1
        QTest.keySequence(tags_input, QKeySequence.SelectNextChar)
        screenshot(window, name="edit_tags_dialog_first_tag_partial_selection")
        assert tags_input.select_size == 1
    
        # Test navigating between the first and second tag using the keyboard buttons
        QTest.keyClick(tags_input, Qt.Key_Home)
        for _ in range(len(tags_input.tags[0].text) + 1):
            QTest.keyClick(tags_input, Qt.Key_Right)
    
        assert tags_input.editing_index == 1
        QTest.keyClick(tags_input, Qt.Key_Left)
        assert tags_input.editing_index == 0
    
        # Select all text of the first tag
        QTest.keySequence(tags_input, QKeySequence.SelectAll)
        screenshot(window, name="edit_tags_dialog_edit_first_tag_selected")
    
        # Remove the second tag
        cross_rect = tags_input.compute_cross_rect(tags_input.tags[1].rect)
        QTest.mouseClick(tags_input, Qt.LeftButton, pos=cross_rect.center().toPoint())
>       assert len(tags_input.tags) == num_tags - 1
E       assert 4 == 3
E         +4
E         -3
@devos50
Copy link
Contributor

devos50 commented Nov 10, 2021

It looks to me like a race condition: the removal of the tag probably has not been fully processed before the assert is called. I will think of a solution to this.

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

Successfully merging a pull request may close this issue.

2 participants