Skip to content

Commit

Permalink
Tests: Fix urls and tab names (#2293)
Browse files Browse the repository at this point in the history
* Fix urls and tab names

* Fix more tabs in tests

* Fix more selenium tests

* use API 2 to edit email and tilde groups (#2308)

* use API 2 to edit email and tilde groups

* use API 2 client

* use API 2 client

* add mandatory values for API 2

---------

Co-authored-by: Melisa Bok <[email protected]>
  • Loading branch information
enrubio and melisabok authored Aug 6, 2024
1 parent 243ebba commit 4ea83e9
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 55 deletions.
4 changes: 2 additions & 2 deletions openreview/openreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -2845,10 +2845,10 @@ def to_json(self):
:rtype: dict
"""
body = {
'invitation': self.invitation,
'invitation': self.invitation if self.invitation else '~/-/profiles',
'signatures': self.signatures,
'content': self.content,
'metaContent': self.metaContent
'metaContent': self.metaContent if self.metaContent else {},
}
if self.id:
body['id'] = self.id
Expand Down
18 changes: 10 additions & 8 deletions tests/test_arr_venue_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4791,9 +4791,11 @@ def test_email_options(self, client, openreview_client, helpers, test_client, re
)

def send_email(email_option, role):
request_page(selenium, f"http://localhost:3030/group?id=aclweb.org/ACL/ARR/2023/August/Program_Chairs#{role}-status", pc_client.token, wait_for_element='header')
status_table = selenium.find_element(By.ID, f'{role}-status')
reviewer_msg_div = status_table.find_element(By.CLASS_NAME, 'ac-status-menu').find_element(By.ID, f'message-{role}s')
role_tab_id_format = role.replace('_', '-')
role_message_id_format = role.replace('_', '')
request_page(selenium, f"http://localhost:3030/group?id=aclweb.org/ACL/ARR/2023/August/Program_Chairs#{role_tab_id_format}-status", pc_client.token, wait_for_element='header')
status_table = selenium.find_element(By.ID, f'{role_tab_id_format}-status')
reviewer_msg_div = status_table.find_element(By.CLASS_NAME, 'ac-status-menu').find_element(By.ID, f'message-{role_message_id_format}s')
modal_content = reviewer_msg_div.find_element(By.CLASS_NAME, 'modal-dialog').find_element(By.CLASS_NAME, 'modal-content')
modal_body = modal_content.find_element(By.CLASS_NAME, 'modal-body')
modal_form = modal_body.find_element(By.CLASS_NAME, 'form-group')
Expand All @@ -4805,7 +4807,7 @@ def send_email(email_option, role):
custom_funcs = message_menu.find_elements(By.XPATH, '*')

opts = [e for e in custom_funcs if e.text == email_option][0].click()
reviewer_msg_div = status_table.find_element(By.CLASS_NAME, 'ac-status-menu').find_element(By.ID, f'message-{role}s')
reviewer_msg_div = status_table.find_element(By.CLASS_NAME, 'ac-status-menu').find_element(By.ID, f'message-{role_message_id_format}s')
modal_content = reviewer_msg_div.find_element(By.CLASS_NAME, 'modal-dialog').find_element(By.CLASS_NAME, 'modal-content')
modal_body = modal_content.find_element(By.CLASS_NAME, 'modal-body')
modal_form = modal_body.find_element(By.CLASS_NAME, 'form-group')
Expand Down Expand Up @@ -4856,15 +4858,15 @@ def users_with_message(email_option, members):
area_chairs = openreview_client.get_group('aclweb.org/ACL/ARR/2023/August/Area_Chairs').members

## Test 'Available ACs with No Assignments and No Emergency Metareviewing Response'
send_email('Available ACs with No Assignments and No Emergency Metareviewing Response', 'areachair')
send_email('Available ACs with No Assignments and No Emergency Metareviewing Response', 'area_chair')
assert users_with_message('Available ACs with No Assignments and No Emergency Metareviewing Response', area_chairs) == {'~AC_ARRFive1'}

## Test 'Available Area Chairs with No Assignments'
send_email('Available ACs with No Assignments', 'areachair')
send_email('Available ACs with No Assignments', 'area_chair')
assert users_with_message('Available ACs with No Assignments', area_chairs) == {'~AC_ARRFive1', '~AC_ARRSix1'}

## Test 'ACs with assigned checklists, not all completed'
send_email('ACs with assigned checklists, not all completed', 'areachair')
send_email('ACs with assigned checklists, not all completed', 'area_chair')
emailed_users = users_with_message('ACs with assigned checklists, not all completed', area_chairs)

assignment_edges = {
Expand Down Expand Up @@ -4906,7 +4908,7 @@ def users_with_message(email_option, members):
assert emailed_users == {'~AC_ARROne1', '~AC_ARRFour1', '~AC_ARRTwo1'}

## Test 'ACs with assigned checklists, none completed'
send_email('ACs with assigned checklists, none completed', 'areachair')
send_email('ACs with assigned checklists, none completed', 'area_chair')
emailed_users = users_with_message('ACs with assigned checklists, none completed', area_chairs)

acs_with_zero_submitted_checklists = set()
Expand Down
12 changes: 6 additions & 6 deletions tests/test_double_blind_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ def test_post_submissions(self, client, test_client, peter_client, selenium, req
assert tabs.find_elements(By.ID, 'recent-activity')
assert len(tabs.find_element(By.ID, 'recent-activity').find_elements(By.CLASS_NAME, 'activity-list')) == 1

request_page(selenium, "http://localhost:3030/group?id=AKBC.ws/2019/Conference/Authors", test_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=AKBC.ws/2019/Conference/Authors", test_client.token, wait_for_element='your-papers')
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

# Guest user
Expand Down Expand Up @@ -396,12 +396,12 @@ def test_post_submissions(self, client, test_client, peter_client, selenium, req
assert tabs.find_elements(By.ID, 'recent-activity')
assert len(tabs.find_element(By.ID, 'recent-activity').find_elements(By.CLASS_NAME, 'activity-list')) == 1

request_page(selenium, "http://localhost:3030/group?id=AKBC.ws/2019/Conference/Authors", peter_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=AKBC.ws/2019/Conference/Authors", peter_client.token, wait_for_element='your-papers')
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

def test_recruit_reviewers(self, client, selenium, request_page, helpers):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_eccv_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ def test_desk_reject_submission(self, conference, client, test_client, selenium,
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 5

def test_withdraw_submission(self, conference, client, test_client, selenium, request_page, helpers):
Expand Down Expand Up @@ -1103,8 +1103,8 @@ def test_withdraw_submission(self, conference, client, test_client, selenium, re
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 4

def test_review_stage(self, conference, client, test_client, selenium, request_page, helpers):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_iclr_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ def conference(self, client, helpers):
conference.set_program_chairs(['[email protected]'])
return conference

def test_create_conference(self, client, conference, helpers):
def test_create_conference(self, client, conference, helpers, openreview_client):

helpers.create_user('[email protected]', 'Program', 'ICLRChair')
helpers.create_user('[email protected]', 'ReviewerOne', 'ICLR', ['[email protected]'])
## confirm alternate email
client.add_members_to_group('~ReviewerOne_ICLR1', '[email protected]')
client.add_members_to_group('[email protected]', '~ReviewerOne_ICLR1')
openreview_client.add_members_to_group('~ReviewerOne_ICLR1', '[email protected]')
openreview_client.add_members_to_group('[email protected]', '~ReviewerOne_ICLR1')
helpers.create_user('[email protected]', 'ReviewerFive', 'ICLR')
helpers.create_user('[email protected]', 'ReviewerSix', 'ICLR', ['[email protected]'])
## confirm alternate email
client.add_members_to_group('~ReviewerSix_ICLR1', '[email protected]')
client.add_members_to_group('[email protected]', '~ReviewerSix_ICLR1')
openreview_client.add_members_to_group('~ReviewerSix_ICLR1', '[email protected]')
openreview_client.add_members_to_group('[email protected]', '~ReviewerSix_ICLR1')

pc_client = openreview.Client(username='[email protected]', password=helpers.strong_password)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_icml_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ def test_registrations(self, client, openreview_client, helpers, test_client, re
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.LINK_TEXT, "Submission Status")
assert tabs.find_element(By.LINK_TEXT, "Area Chairs Status")
assert tabs.find_element(By.LINK_TEXT, "Senior Area Chairs Tasks")
assert tabs.find_element(By.LINK_TEXT, "Area Chair Status")
assert tabs.find_element(By.LINK_TEXT, "Senior Area Chair Tasks")

registration_forum = sac_client.get_notes(invitation='ICML.cc/2023/Conference/Senior_Area_Chairs/-/Registration_Form')
assert len(registration_forum) == 1
Expand Down Expand Up @@ -2322,7 +2322,7 @@ def test_reviewer_reassignment(self, client, openreview_client, helpers, seleniu

# Test referrer in SAC edge browser URL
sac_client = openreview.api.OpenReviewClient(username = '[email protected]', password=helpers.strong_password)
request_page(selenium, "http://localhost:3030/group?id=ICML.cc/2023/Conference/Senior_Area_Chairs#Area_Chairs-status", sac_client.token, wait_for_element='tabs-container')
request_page(selenium, "http://localhost:3030/group?id=ICML.cc/2023/Conference/Senior_Area_Chairs#area-chair-status", sac_client.token, wait_for_element='tabs-container')
link = selenium.find_element(By.CLASS_NAME, 'note').find_element(By.LINK_TEXT, 'Modify Reviewers Assignments')
assert link
assert link.get_attribute("href") == 'http://localhost:3030/edges/browse?start=ICML.cc/2023/Conference/Area_Chairs/-/Assignment,tail:~AC_ICMLOne1&traverse=ICML.cc/2023/Conference/Reviewers/-/Assignment&edit=ICML.cc/2023/Conference/Reviewers/-/Invite_Assignment&browse=ICML.cc/2023/Conference/Reviewers/-/Affinity_Score;ICML.cc/2023/Conference/Reviewers/-/Bid;ICML.cc/2023/Conference/Reviewers/-/Custom_Max_Papers,head:ignore&hide=ICML.cc/2023/Conference/Reviewers/-/Conflict&maxColumns=2&preferredEmailInvitationId=ICML.cc/2023/Conference/-/Preferred_Emails&version=2&referrer=[Senior%20Area%20Chairs%20Console](/group?id=ICML.cc/2023/Conference/Senior_Area_Chairs)'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_neurips_conference_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ def test_sac_bidding(self, client, openreview_client, helpers, request_page, sel
edges=sac_client.get_edges_count(invitation='NeurIPS.cc/2023/Conference/Senior_Area_Chairs/-/Affinity_Score', tail='~SeniorArea_GoogleChair1')
assert edges == 3

tasks_url = 'http://localhost:3030/group?id=NeurIPS.cc/2023/Conference/Senior_Area_Chairs#Senior_Area_Chairs-tasks'
tasks_url = 'http://localhost:3030/group?id=NeurIPS.cc/2023/Conference/Senior_Area_Chairs#senior-area-chair-tasks'
request_page(selenium, tasks_url, sac_client.token, by=By.LINK_TEXT, wait_for_element='Senior Area Chairs Bid')

task_panel = selenium.find_element(By.LINK_TEXT, "Senior Area Chairs Tasks")
task_panel = selenium.find_element(By.LINK_TEXT, "Senior Area Chair Tasks")
task_panel.click()

assert selenium.find_element(By.LINK_TEXT, "Senior Area Chairs Bid")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_profile_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ def test_remove_name_and_update_relations(self, openreview_client, helpers):
assert 'username' in profile.content['names'][0]
assert profile.content['names'][0]['username'] == '~Juan_Alternate_Last1'

john_client = openreview.Client(username='[email protected]', password=helpers.strong_password)
john_client = openreview.api.OpenReviewClient(username='[email protected]', password=helpers.strong_password)
profile = john_client.get_profile()
assert len(profile.content['relations']) == 2
assert profile.content['relations'][1]['username'] == '~Juan_Alternate_Last1'
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sac_paper_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,6 @@ def test_set_assignments(self, client, openreview_client, helpers, selenium, req
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.LINK_TEXT, "Submission Status")
assert tabs.find_element(By.LINK_TEXT, "Senior Area Chairs Tasks")
assert tabs.find_element(By.LINK_TEXT, "Senior Area Chair Tasks")
with pytest.raises(NoSuchElementException):
tabs.find_element(By.LINK_TEXT, "Area Chairs Status")
tabs.find_element(By.LINK_TEXT, "Area Chair Status")
26 changes: 13 additions & 13 deletions tests/test_single_blind_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ def test_post_submissions(self, client, test_client, peter_client, selenium, req
assert allsubmissions_tab
assert len(allsubmissions_tab.find_element(By.CLASS_NAME, 'submissions-list').find_elements(By.TAG_NAME, 'li')) == 2

request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-papers')
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

# Guest user
Expand Down Expand Up @@ -280,12 +280,12 @@ def test_post_submissions(self, client, test_client, peter_client, selenium, req
assert allsubmissions_tab
assert len(allsubmissions_tab.find_element(By.CLASS_NAME, 'submissions-list').find_elements(By.TAG_NAME, 'li')) == 2

request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", peter_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", peter_client.token, wait_for_element='your-papers')
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

def test_close_submission(self, client, test_client, selenium, request_page):
Expand Down Expand Up @@ -615,12 +615,12 @@ def test_consoles(self, client, test_client, selenium, request_page, helpers):
console = tabs.find_element(By.ID, 'your-consoles').find_elements(By.TAG_NAME, 'ul')[0]
assert 'Author Console' == console.find_element(By.TAG_NAME, 'a').text

request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-papers')
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

conference.set_authorpage_header({
Expand All @@ -629,7 +629,7 @@ def test_consoles(self, client, test_client, selenium, request_page, helpers):
'schedule': 'This is a schedule'
})

request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS/Authors", test_client.token, wait_for_element='your-papers')

header = selenium.find_element(By.ID, 'header')
assert header
Expand All @@ -640,13 +640,13 @@ def test_consoles(self, client, test_client, selenium, request_page, helpers):
tabs = selenium.find_element(By.CLASS_NAME, 'tabs-container')
assert tabs
assert tabs.find_element(By.ID, 'author-tasks')
assert tabs.find_element(By.ID, 'your-submissions')
papers = tabs.find_element(By.ID, 'your-submissions').find_element(By.CLASS_NAME, 'console-table')
assert tabs.find_element(By.ID, 'your-papers')
papers = tabs.find_element(By.ID, 'your-papers').find_element(By.CLASS_NAME, 'console-table')
assert len(papers.find_elements(By.TAG_NAME, 'tr')) == 2

# Reviewer user
reviewer_client = openreview.Client(baseurl = 'http://localhost:3000', username='[email protected]', password=helpers.strong_password)
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS", reviewer_client.token, wait_for_element='your-submissions')
request_page(selenium, "http://localhost:3030/group?id=NIPS.cc/2018/Workshop/MLITS", reviewer_client.token, wait_for_element='your-papers')
notes_panel = selenium.find_element(By.ID, 'notes')
assert notes_panel
tabs = notes_panel.find_element(By.CLASS_NAME, 'tabs-container')
Expand Down
1 change: 1 addition & 0 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def test_subdomains(self):
assert openreview.tools.subdomains(' ') == []

def test_replace_members_with_ids(self, client, test_client):
test_client = openreview.api.OpenReviewClient(token=test_client.token)
test_client.post_profile(openreview.Profile(
referent='~SomeFirstName_User1',
signatures = ['~SomeFirstName_User1'],
Expand Down
Loading

0 comments on commit 4ea83e9

Please sign in to comment.