double all sleep
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

This commit is contained in:
Mylloon 2023-05-16 02:48:48 +02:00
parent 2d9a51d74a
commit e456fa5bda
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 12 additions and 12 deletions

View file

@ -24,7 +24,7 @@ let rec check ctx =
Unix.sleep timeout; Unix.sleep timeout;
if ctx.debug then print_endline "Refresh profile page..."; if ctx.debug then print_endline "Refresh profile page...";
refresh_page ctx.session_id; refresh_page ctx.session_id;
Unix.sleep 4; Unix.sleep 8;
check ctx check ctx
in in
(* Time to wait until next check *) (* Time to wait until next check *)

View file

@ -19,9 +19,9 @@ let inject_username session_id creds =
in in
(* Insert the username *) (* Insert the username *)
send_keys session_id input_username creds.username; send_keys session_id input_username creds.username;
Unix.sleep 1; Unix.sleep 2;
send_keys session_id input_username Keys.return; send_keys session_id input_username Keys.return;
Unix.sleep 3 Unix.sleep 6
;; ;;
let rec _inject_password session_id creds try_count = let rec _inject_password session_id creds try_count =
@ -47,9 +47,9 @@ let rec _inject_password session_id creds try_count =
| Some input -> | Some input ->
(* Insert password *) (* Insert password *)
send_keys session_id input creds.password; send_keys session_id input creds.password;
Unix.sleep 1; Unix.sleep 2;
send_keys session_id input Keys.return; send_keys session_id input Keys.return;
Unix.sleep 3 Unix.sleep 6
| None -> () | None -> ()
;; ;;
@ -63,9 +63,9 @@ let inject_2fa session_id secret input =
in in
(* Insert 2FA code *) (* Insert 2FA code *)
send_keys session_id input code; send_keys session_id input code;
Unix.sleep 1; Unix.sleep 2;
send_keys session_id input Keys.return; send_keys session_id input Keys.return;
Unix.sleep 5 Unix.sleep 10
;; ;;
let login_twitter ctx username password secret = let login_twitter ctx username password secret =
@ -108,7 +108,7 @@ let go_to_profile ctx =
(fmt (fmt
"https://twitter.com%s/with_replies" "https://twitter.com%s/with_replies"
(get_attribute ctx.session_id profile_button "href"))); (get_attribute ctx.session_id profile_button "href")));
Unix.sleep 4 Unix.sleep 8
;; ;;
let find_latest_tweet ctx = let find_latest_tweet ctx =
@ -160,7 +160,7 @@ let tweet ctx msg =
else List.nth l 0 else List.nth l 0
in in
send_keys ctx.session_id tweet_area msg; send_keys ctx.session_id tweet_area msg;
Unix.sleep 1; Unix.sleep 2;
let send_tweet_button = let send_tweet_button =
match find ctx.session_id (XPath "//div[@data-testid='tweetButton']") with match find ctx.session_id (XPath "//div[@data-testid='tweetButton']") with
| [] -> raise (Any (fmt "Send-tweet button not found")) | [] -> raise (Any (fmt "Send-tweet button not found"))
@ -170,5 +170,5 @@ let tweet ctx msg =
else List.nth l 0 else List.nth l 0
in in
click ctx.session_id send_tweet_button; click ctx.session_id send_tweet_button;
Unix.sleep 4 Unix.sleep 8
;; ;;

View file

@ -66,7 +66,7 @@ let run_process path args =
let pid = let pid =
Unix.create_process command (Array.of_list args) output_fd output_fd output_fd Unix.create_process command (Array.of_list args) output_fd output_fd output_fd
in in
Unix.sleepf 0.5; Unix.sleep 1;
out_channel, pid out_channel, pid
;; ;;

View file

@ -70,7 +70,7 @@ let rec wait_for_load session_id =
| `String res -> | `String res ->
if not (res = "complete") if not (res = "complete")
then ( then (
Unix.sleep 1; Unix.sleep 2;
wait_for_load session_id) wait_for_load session_id)
| _ -> raise (Any "Error when waiting for page to load")) | _ -> raise (Any "Error when waiting for page to load"))
| _ -> raise (Any "wait_for_load | Invalid JSON") | _ -> raise (Any "wait_for_load | Invalid JSON")