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

[Tests] GUI macOS test_discovered_page random fails #6630

Closed
drew2a opened this issue Dec 8, 2021 · 2 comments · Fixed by #6643
Closed

[Tests] GUI macOS test_discovered_page random fails #6630

drew2a opened this issue Dec 8, 2021 · 2 comments · Fixed by #6643

Comments

@drew2a
Copy link
Contributor

drew2a commented Dec 8, 2021

The random test fails during #6629
console

=================================== FAILURES ===================================
_____________________________ test_discovered_page _____________________________

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

    @pytest.mark.guitest
    def test_discovered_page(window):
        QTest.mouseClick(window.left_menu_button_discovered, Qt.LeftButton)
>       tst_channels_widget(window, window.discovered_page, "discovered_page", sort_column=2)

src/tribler-gui/tribler_gui/tests/test_gui.py:244: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

window = <tribler_gui.tribler_window.TriblerWindow object at 0x1321838b0>
widget = <tribler_gui.widgets.channelcontentswidget.ChannelContentsWidget object at 0x13380ac10>
widget_name = 'discovered_page', sort_column = 2, test_filter = True
test_subscribe = True

    def tst_channels_widget(window, widget, widget_name, sort_column=1, test_filter=True, test_subscribe=True):
        wait_for_list_populated(widget.content_table)
        screenshot(window, name=f"{widget_name}-page")
    
        # Sort
        widget.content_table.sortByColumn(sort_column, 1)
        wait_for_list_populated(widget.content_table)
        screenshot(window, name=f"{widget_name}-sorted")
        max_items = min(widget.content_table.model().channel_info["total"], 50)
        assert widget.content_table.verticalHeader().count() <= max_items
    
        # Filter
        if test_filter:
            old_num_items = widget.content_table.verticalHeader().count()
            QTest.keyClick(widget.channel_torrents_filter_input, 'r')
            wait_for_list_populated(widget.content_table)
            screenshot(window, name=f"{widget_name}-filtered")
            assert widget.content_table.verticalHeader().count() <= old_num_items
            QTest.keyPress(widget.channel_torrents_filter_input, Qt.Key_Backspace)
            wait_for_list_populated(widget.content_table)
    
        if test_subscribe:
            # Unsubscribe and subscribe again
            index = get_index_of_row_column(widget.content_table, 0, widget.model.column_position[Column.VOTES])
            widget.content_table.on_subscribe_control_clicked(index)
            QTest.qWait(200)
>           window.dialog.button_clicked.emit(0)
E           AttributeError: 'NoneType' object has no attribute 'button_clicked'

src/tribler-gui/tribler_gui/tests/test_gui.py:222: AttributeError
@drew2a drew2a added this to the 7.12.0 December milestone Dec 8, 2021
@ichorid ichorid self-assigned this Dec 8, 2021
@devos50
Copy link
Contributor

devos50 commented Dec 11, 2021

Hopefully, #6600 would fix this since it removes some of the qWait calls (I'll finish that PR ASAP).

@devos50
Copy link
Contributor

devos50 commented Dec 11, 2021

I noticed an error in the test. When testing for subscribe, it always clicks the subscribe toggle in the first row. If this is a personal channel, however, this will fail since the row then does not have a subscribe toggle. This is probably the reason for the error reported in this issue. The easiest fix is probably to sort on the 'subscribed' column which ensures that the first row contains a non-personal channel that the user has not subscribed to. Evidence:
screenshot_discovered_page-filtered

devos50 added a commit to devos50/tribler that referenced this issue Dec 11, 2021
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.

3 participants