@@ -489,8 +489,6 @@ def test_reject_pre_moderated_preprint(
489
489
page_not_found_page = PreprintPageNotFoundPage (driver , verify = True )
490
490
assert page_not_found_page .page_header .text == 'Page not found'
491
491
492
- @pytest .mark .skip
493
- # skip until bug is fixed [ENG-5055]
494
492
def test_approve_withdrawal_request_pre_moderated_preprint (
495
493
self , session , driver , log_in_if_not_already
496
494
):
@@ -582,9 +580,8 @@ def test_approve_withdrawal_request_pre_moderated_preprint(
582
580
assert PreprintDetailPage (driver , verify = True )
583
581
WebDriverWait (driver , 5 ).until (EC .visibility_of (preprint_page .title ))
584
582
assert preprint_page .title .text == preprint_title
585
- assert (
586
- preprint_page .status_explanation .text == 'This preprint has been withdrawn.'
587
- )
583
+ # Add assert for "This preprint has been withdrawn" after [ENG-5092] is fixed.
584
+ assert preprint_page .withdraw_reason .present ()
588
585
589
586
def test_decline_withdrawal_request_pre_moderated_preprint (
590
587
self , session , driver , log_in_if_not_already
@@ -763,8 +760,6 @@ def test_accept_post_moderated_preprint(
763
760
assert preprint_page .title .text == preprint_title
764
761
assert provider_id in driver .current_url
765
762
766
- @pytest .mark .skip
767
- # Skip until bug is fixed [ENG-5055]
768
763
def test_moderator_withdrawal_post_moderated_preprint (
769
764
self , session , driver , log_in_if_not_already
770
765
):
@@ -849,12 +844,9 @@ def test_moderator_withdrawal_post_moderated_preprint(
849
844
assert PreprintDetailPage (driver , verify = True )
850
845
WebDriverWait (driver , 5 ).until (EC .visibility_of (preprint_page .title ))
851
846
assert preprint_page .title .text == preprint_title
852
- assert (
853
- preprint_page .status_explanation .text == 'This preprint has been withdrawn.'
854
- )
847
+ # Add assert for "This preprint has been withdrawn" after [ENG-5092] is fixed.
848
+ assert preprint_page .withdraw_reason .present ()
855
849
856
- @pytest .mark .skip
857
- # Skip until bug is fixed [ENG-5055]
858
850
def test_approve_withdrawal_request_post_moderated_preprint (
859
851
self , session , driver , log_in_if_not_already
860
852
):
@@ -946,9 +938,8 @@ def test_approve_withdrawal_request_post_moderated_preprint(
946
938
assert PreprintDetailPage (driver , verify = True )
947
939
WebDriverWait (driver , 5 ).until (EC .visibility_of (preprint_page .title ))
948
940
assert preprint_page .title .text == preprint_title
949
- assert (
950
- preprint_page .status_explanation .text == 'This preprint has been withdrawn.'
951
- )
941
+ # Add assert for "This preprint has been withdrawn" after [ENG-5092] is fixed.
942
+ assert preprint_page .withdraw_reason .present ()
952
943
953
944
def test_decline_withdrawal_request_post_moderated_preprint (
954
945
self , session , driver , log_in_if_not_already
@@ -1089,8 +1080,6 @@ def test_preprint_detail_page(self, driver):
1089
1080
1090
1081
@markers .smoke_test
1091
1082
@markers .core_functionality
1092
- @pytest .mark .skip
1093
- # skip until we have reliable data test locators [ENG-5046]
1094
1083
class TestPreprintMetrics :
1095
1084
@pytest .fixture (scope = 'session' )
1096
1085
def latest_preprint_node (self ):
@@ -1107,12 +1096,16 @@ def test_preprint_views_count(self, driver, latest_preprint_node):
1107
1096
preprint_page = PreprintDetailPage (driver , guid = latest_preprint_node )
1108
1097
preprint_page .goto ()
1109
1098
assert PreprintDetailPage (driver , verify = True )
1110
- match = re .search (
1111
- r'Views: (\d+) \| Downloads:' , preprint_page .views_downloads_counts .text
1099
+
1100
+ # Preprint page shows a string on the front end and api returns a non-string value from the db
1101
+ assert preprint_page .views_count .text == str (api_views_count )
1102
+ # Wait for most of the page to finish loading before reloading page
1103
+ WebDriverWait (driver , 10 ).until (
1104
+ EC .visibility_of (preprint_page .default_citation )
1112
1105
)
1113
- assert match is not None
1114
- page_views_count = int ( match . group ( 1 ))
1115
- assert api_views_count == page_views_count
1106
+ # "response 404 (backend NotFound), service rules for the path non-existent"
1107
+ # error message shows when the preprint fails to load
1108
+ assert not preprint_page . response_404
1116
1109
# Don't reload the page in Production since we don't want to artificially
1117
1110
# inflate the metrics
1118
1111
if not settings .PRODUCTION :
@@ -1122,7 +1115,7 @@ def test_preprint_views_count(self, driver, latest_preprint_node):
1122
1115
# The initial load of the page above adds 1 to the views count, and the
1123
1116
# following reload adds a 2nd view to the count. But the update to the
1124
1117
# database can take a couple of seconds, so immediately accessing the api
1125
- # to get the count below may not show the 2nd view. Hence we are just
1118
+ # to get the count below may not show the 2nd view. Hence, we are just
1126
1119
# checking that the views count did increase but not by how much.
1127
1120
# Unfortunately this means that we are not checking for any issues like
1128
1121
# double-counting.
@@ -1145,10 +1138,7 @@ def test_preprint_downloads_count(self, driver, latest_preprint_node):
1145
1138
preprint_page = PreprintDetailPage (driver , guid = latest_preprint_node )
1146
1139
preprint_page .goto ()
1147
1140
assert PreprintDetailPage (driver , verify = True )
1148
- page_downloads_count = int (
1149
- preprint_page .views_downloads_counts .text .split ('Downloads:' )[1 ]
1150
- )
1151
- assert api_downloads_count == page_downloads_count
1141
+ assert str (api_downloads_count ) == preprint_page .downloads_count .text
1152
1142
# Don't download the Preprint in Production since we don't want to artificially
1153
1143
# inflate the metrics
1154
1144
if not settings .PRODUCTION :
0 commit comments