forked from mirrors/gecko-dev
Bug 1782184 - Move first load prompts handling code under interactive tests r=perftest-reviewers,kshampur
The cookie prompt handling code was initially added under `test_cmds` but it got in conflict with the interactive sites code (the prompts are for pageload sites while the interactive sites are a different type). This patch is adding a new section in the json that is specially for handling the cookie prompts for pageload sites. We have to handle prompts for the login sites. but we don't currently encounter those prompts on CI and locally the login code doesn't work ATM. So this affects local site recording from Europe. Differential Revision: https://phabricator.services.mozilla.com/D153748
This commit is contained in:
parent
03cc630a3f
commit
6ce6e42c08
3 changed files with 107 additions and 73 deletions
|
|
@ -147,6 +147,17 @@ def before_runs(env):
|
||||||
inject_deterministic = test_site.get("inject_deterministic", True)
|
inject_deterministic = test_site.get("inject_deterministic", True)
|
||||||
env.set_arg("proxy-deterministic", inject_deterministic)
|
env.set_arg("proxy-deterministic", inject_deterministic)
|
||||||
|
|
||||||
|
dismiss_cookie_prompt = test_site.get("dismiss_cookie_prompt", [])
|
||||||
|
if dismiss_cookie_prompt:
|
||||||
|
parsed_cmds = [
|
||||||
|
":::".join([str(i) for i in item])
|
||||||
|
for item in dismiss_cookie_prompt
|
||||||
|
if item
|
||||||
|
]
|
||||||
|
add_option(
|
||||||
|
env, "browsertime.dismiss_cookie_prompt", ";;;".join(parsed_cmds)
|
||||||
|
)
|
||||||
|
|
||||||
cmds = test_site.get("test_cmds", [])
|
cmds = test_site.get("test_cmds", [])
|
||||||
if cmds:
|
if cmds:
|
||||||
parsed_cmds = [":::".join([str(i) for i in item]) for item in cmds if item]
|
parsed_cmds = [":::".join([str(i) for i in item]) for item in cmds if item]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "allrecipes",
|
"name": "allrecipes",
|
||||||
"test_url": "https://www.allrecipes.com/"
|
"test_url": "https://www.allrecipes.com/",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='onetrust-reject-all-handler']"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
|
|
@ -18,28 +21,46 @@
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "bing",
|
"name": "bing",
|
||||||
"test_url": "https://www.bing.com/"
|
"test_url": "https://www.bing.com/",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='bnp_btn_reject']"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "bing-search-restaurants",
|
"name": "bing-search-restaurants",
|
||||||
"test_url": "https://www.bing.com/search?q=restaurants+in+exton+pa+19341"
|
"test_url": "https://www.bing.com/search?q=restaurants+in+exton+pa+19341",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='bnp_btn_reject']"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "booking",
|
"name": "booking",
|
||||||
"test_url": "https://www.booking.com/"
|
"test_url": "https://www.booking.com/",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
||||||
|
["click.byXpathAndWait", "/html/body/div[5]/div[3]/div[3]/div[1]/button"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "cnn",
|
"name": "cnn",
|
||||||
"test_url": "https://cnn.com",
|
"test_url": "https://cnn.com",
|
||||||
"secondary_url": "https://www.cnn.com/weather"
|
"secondary_url": "https://www.cnn.com/weather",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
||||||
|
["click.byXpathAndWait", "/html/body/div[14]/div[3]/div[3]/div[1]/button[2]"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "cnn-ampstories",
|
"name": "cnn-ampstories",
|
||||||
"test_url": "https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other"
|
"test_url": "https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
||||||
|
["click.byXpathAndWait", "/html/body/div[14]/div[3]/div[3]/div[1]/button[2]"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
|
|
@ -119,7 +140,11 @@
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "web-de",
|
"name": "web-de",
|
||||||
"test_url": "https://web.de/magazine/politik/politologe-glaubt-grossen-koalition-herbst-knallen-33563566"
|
"test_url": "https://web.de/magazine/politik/politologe-glaubt-grossen-koalition-herbst-knallen-33563566",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "//*[@id='edit-purpose-settings']"],
|
||||||
|
["click.byXpathAndWait", "//*[@id='save-purpose-settings']"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
|
|
@ -129,12 +154,18 @@
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "youtube",
|
"name": "youtube",
|
||||||
"test_url": "https://m.youtube.com"
|
"test_url": "https://m.youtube.com",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "/html/body/div[2]/ytm-consent-bump-v2-renderer/div/div[2]/div[3]/c3-material-button[2]/button/div/div"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "youtube-watch",
|
"name": "youtube-watch",
|
||||||
"test_url": "https://www.youtube.com/watch?v=COU5T-Wafa4"
|
"test_url": "https://www.youtube.com/watch?v=COU5T-Wafa4",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "/html/body/div[2]/ytm-consent-bump-v2-renderer/div/div[2]/div[3]/c3-material-button[2]/button/div/div"]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"desktop": [
|
"desktop": [
|
||||||
|
|
@ -147,16 +178,18 @@
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "bing-search",
|
"name": "bing-search",
|
||||||
"test_url": "https://www.bing.com/search?q=barack+obama"
|
"test_url": "https://www.bing.com/search?q=barack+obama",
|
||||||
|
"dismiss_cookie_prompt": [
|
||||||
|
["click.byXpathAndWait", "/html/body/div[1]/div[1]/div/div[2]/div[2]/button[2]/a"]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "buzzfeed",
|
"name": "buzzfeed",
|
||||||
"test_url": "https://www.buzzfeed.com/",
|
"test_url": "https://www.buzzfeed.com/",
|
||||||
"secondary_url": "https://www.buzzfeed.com/quizzes",
|
"secondary_url": "https://www.buzzfeed.com/quizzes",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[2]/div/button[2]"],
|
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[2]/div/button[2]"]
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[3]/div[2]/button"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -172,9 +205,9 @@
|
||||||
"media.allowed-to-play.enabled": false,
|
"media.allowed-to-play.enabled": false,
|
||||||
"media.block-autoplay-until-in-foreground": true
|
"media.block-autoplay-until-in-foreground": true
|
||||||
},
|
},
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
||||||
["click.byXpathAndWait", "/html/body/div[13]/div[2]/div/section/div[17]/button[2]"]
|
["click.byXpathAndWait", "/html/body/div[13]/div[3]/div[3]/div[1]/button[2]"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -182,18 +215,16 @@
|
||||||
"name": "ebay",
|
"name": "ebay",
|
||||||
"test_url": "https://www.ebay.com/",
|
"test_url": "https://www.ebay.com/",
|
||||||
"secondary_url": "https://www.ebay.com/deals",
|
"secondary_url": "https://www.ebay.com/deals",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[5]/div[1]/div[2]/div[2]/div[2]/a"],
|
["click.byXpathAndWait", "//*[@id='gdpr-banner-decline']"]
|
||||||
["click.byXpathAndWait", "/html/body/div[4]/div/div[2]/section[3]/section/button"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": false,
|
"login": false,
|
||||||
"name": "espn",
|
"name": "espn",
|
||||||
"test_url": "http://www.espn.com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words",
|
"test_url": "http://www.espn.com/nba/story/_/page/allstarweekend25788027/the-comparison-lebron-james-michael-jordan-their-own-words",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "//*[@id='onetrust-pc-btn-handler']"],
|
["click.byXpathAndWait", "/html/body/div[10]/div[2]/div/div/div[3]/button"]
|
||||||
["click.byXpathAndWait", "/html/body/div[10]/div[2]/div[3]/div[1]/button"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -206,11 +237,7 @@
|
||||||
"login": true,
|
"login": true,
|
||||||
"name": "facebook",
|
"name": "facebook",
|
||||||
"test_url": "https://www.facebook.com",
|
"test_url": "https://www.facebook.com",
|
||||||
"secondary_url": "https://www.facebook.com/marketplace/?ref=bookmark",
|
"secondary_url": "https://www.facebook.com/marketplace/?ref=bookmark"
|
||||||
"test_cmds": [
|
|
||||||
["click.byXpathAndWait", "/html/body/div[3]/div[2]/div/div/div/div/div[3]/button[1]"],
|
|
||||||
["click.byXpathAndWait", "/html/body/div[3]/div[2]/div/div/div/div/div[3]/button[1]"]
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"login": true,
|
"login": true,
|
||||||
|
|
@ -240,7 +267,7 @@
|
||||||
"login": true,
|
"login": true,
|
||||||
"name": "google",
|
"name": "google",
|
||||||
"test_url": "https://www.google.com/search?hl=en&q=barack+obama&cad=h",
|
"test_url": "https://www.google.com/search?hl=en&q=barack+obama&cad=h",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[3]/div[3]/span/div/div/div/div[3]/button[1]/div"],
|
["click.byXpathAndWait", "/html/body/div[3]/div[3]/span/div/div/div/div[3]/button[1]/div"],
|
||||||
["click.byXpathAndWait", "/html/body/c-wiz/div/div/div/div[2]/form/div/button/div[2]"]
|
["click.byXpathAndWait", "/html/body/c-wiz/div/div/div/div[2]/form/div/button/div[2]"]
|
||||||
]
|
]
|
||||||
|
|
@ -260,7 +287,7 @@
|
||||||
"login": true,
|
"login": true,
|
||||||
"name": "google-mail",
|
"name": "google-mail",
|
||||||
"test_url": "https://mail.google.com/",
|
"test_url": "https://mail.google.com/",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div/div/span[2]/a[2]"]
|
["click.byXpathAndWait", "/html/body/div/div/span[2]/a[2]"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -281,9 +308,8 @@
|
||||||
"name": "imgur",
|
"name": "imgur",
|
||||||
"test_url": "https://imgur.com/gallery/m5tYJL6",
|
"test_url": "https://imgur.com/gallery/m5tYJL6",
|
||||||
"inject_deterministic": false,
|
"inject_deterministic": false,
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[2]/div/button[2]"],
|
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[2]/div/button[2]"]
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div/div[3]/div[2]/button"]
|
|
||||||
],
|
],
|
||||||
"secondary_url": "https://imgur.com/gallery/L13Ci",
|
"secondary_url": "https://imgur.com/gallery/L13Ci",
|
||||||
"preferences": {
|
"preferences": {
|
||||||
|
|
@ -311,12 +337,8 @@
|
||||||
"name": "microsoft",
|
"name": "microsoft",
|
||||||
"test_url": "https://www.microsoft.com/en-us/",
|
"test_url": "https://www.microsoft.com/en-us/",
|
||||||
"secondary_url": "https://support.microsoft.com/en-us",
|
"secondary_url": "https://support.microsoft.com/en-us",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div[2]/div/div/div/div[2]/button[2]"],
|
["click.byXpathAndWait", "/html/body/div[3]/div[1]/div/div/div[2]/div/div/div/div[2]/button[2]"]
|
||||||
["click.byXpath", "/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/div/form/dl/dt[2]/div/div/div[2]/label"],
|
|
||||||
["click.byXpath", "/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/div/form/dl/dt[3]/div/div/div[2]/label"],
|
|
||||||
["click.byXpath", "/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/div/form/dl/dt[4]/div/div/div[2]/label"],
|
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/div/div[2]/button[1]"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -330,9 +352,8 @@
|
||||||
"name": "nytimes",
|
"name": "nytimes",
|
||||||
"test_url": "https://www.nytimes.com/2020/02/19/opinion/surprise-medical-bill.html",
|
"test_url": "https://www.nytimes.com/2020/02/19/opinion/surprise-medical-bill.html",
|
||||||
"secondary_url": "https://www.nytimes.com/section/opinion/columnists",
|
"secondary_url": "https://www.nytimes.com/section/opinion/columnists",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div/div/div[2]/div/div[2]/div/div/div[1]/div[3]/div[3]/a"],
|
["click.byXpathAndWait", "/html/body/div/div[2]/main/div[3]/div[2]/div/div[2]/button[2]"]
|
||||||
["click.byXpathAndWait", "//*[@id='opt-out-of-new-york-times-nonessential-trackers']"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -362,7 +383,7 @@
|
||||||
"name": "reddit",
|
"name": "reddit",
|
||||||
"test_url": "https://www.reddit.com/r/technology/comments/9sqwyh/we_posed_as_100_senators_to_run_ads_on_facebook/",
|
"test_url": "https://www.reddit.com/r/technology/comments/9sqwyh/we_posed_as_100_senators_to_run_ads_on_facebook/",
|
||||||
"secondary_url": "https://www.reddit.com/r/technology/",
|
"secondary_url": "https://www.reddit.com/r/technology/",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div[2]/div[3]/div[1]/section/div/section/section/form[1]/button"]
|
["click.byXpathAndWait", "/html/body/div[1]/div/div[2]/div[3]/div[1]/section/div/section/section/form[1]/button"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -385,9 +406,9 @@
|
||||||
"media.allowed-to-play.enabled": false,
|
"media.allowed-to-play.enabled": false,
|
||||||
"media.block-autoplay-until-in-foreground": true
|
"media.block-autoplay-until-in-foreground": true
|
||||||
},
|
},
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[1]/div/div[2]/div[1]/div/div/div[3]/div/button/div/div/div"],
|
["click.byXpathAndWait", "/html/body/div[1]/div/div[2]/div[1]/div/div/div/div[3]/div/button"],
|
||||||
["click.byXpathAndWait", "/html/body/div[3]/div/div/div/div/div/div[1]/div[2]/div/button/div/div"]
|
["click.byXpathAndWait", "/html/body/div[3]/div/div/div/div/div/div[1]/div[2]/div[2]/button"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -400,9 +421,9 @@
|
||||||
"name": "wikia",
|
"name": "wikia",
|
||||||
"test_url": "https://marvel.fandom.com/wiki/Black_Panther",
|
"test_url": "https://marvel.fandom.com/wiki/Black_Panther",
|
||||||
"secondary_url": "https://marvel.fandom.com/wiki/Celestials",
|
"secondary_url": "https://marvel.fandom.com/wiki/Celestials",
|
||||||
"test_cmds": [
|
"dismiss_cookie_prompt": [
|
||||||
["click.byXpathAndWait", "/html/body/div[6]/div/div/div[2]/div[1]"],
|
["click.byXpathAndWait", "/html/body/div[6]/div/div/div[2]/div[1]"],
|
||||||
["click.byXpathAndWait", "/html/body/div[7]/div/div/div[2]/div[2]"]
|
["click.byXpathAndWait", "/html/body/div[6]/div/div/div[2]/div[2]"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -421,12 +442,8 @@
|
||||||
"name": "youtube",
|
"name": "youtube",
|
||||||
"test_url": "https://www.youtube.com",
|
"test_url": "https://www.youtube.com",
|
||||||
"secondary_url": "https://www.youtube.com/watch?v=JrdEMERq8MA",
|
"secondary_url": "https://www.youtube.com/watch?v=JrdEMERq8MA",
|
||||||
"test_cmds ": [
|
"dismiss_cookie_prompt ": [
|
||||||
["click.byXpathAndWait", "/html/body/ytd-app/ytd-consent-bump-v2-lightbox/tp-yt-paper-dialog/div[4]/div[2]/div[5]/div[2]/ytd-button-renderer[1]/a"],
|
["click.byXpathAndWait", "/html/body/ytd-app/ytd-consent-bump-v2-lightbox/tp-yt-paper-dialog/div[4]/div[2]/div[6]/div[1]/ytd-button-renderer[1]/a"]
|
||||||
["click.byXpath", "/html/body/c-wiz/div/div/div/div[2]/div[2]/div[2]/div/div[2]/div[1]/div/button"],
|
|
||||||
["click.byXpath", "/html/body/c-wiz/div/div/div/div[2]/div[3]/div[2]/div/div[2]/div[1]/div/button"],
|
|
||||||
["click.byXpath", "/html/body/c-wiz/div/div/div/div[2]/div[4]/div[2]/div[2]/div/div[2]/div[1]/div/button"],
|
|
||||||
["click.byXpathAndWait", "/html/body/c-wiz/div/div/div/div[2]/form/div/button/div[2]"]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -332,11 +332,34 @@ async function perform_live_login(context, commands) {
|
||||||
await login(context, commands, final_button);
|
await login(context, commands, final_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function dismissCookiePrompt(input_cmds, context, commands) {
|
||||||
|
context.log.info("Searching for cookie prompt elements...");
|
||||||
|
let cmds = input_cmds.split(";;;");
|
||||||
|
for (let cmdstr of cmds) {
|
||||||
|
let [cmd, ...args] = cmdstr.split(":::");
|
||||||
|
context.log.info(cmd, args);
|
||||||
|
let result = await commands.js.run(
|
||||||
|
`return document.evaluate("` +
|
||||||
|
args +
|
||||||
|
`", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;`
|
||||||
|
);
|
||||||
|
if (result) {
|
||||||
|
context.log.info("Element found, clicking on it.");
|
||||||
|
await run_command(cmdstr, context, commands);
|
||||||
|
} else {
|
||||||
|
context.log.info(
|
||||||
|
"Element not found! The cookie prompt may have not appeared, please check the screenshots."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function pageload_test(context, commands) {
|
async function pageload_test(context, commands) {
|
||||||
let testUrl = context.options.browsertime.url;
|
let testUrl = context.options.browsertime.url;
|
||||||
let secondaryUrl = context.options.browsertime.secondary_url;
|
let secondaryUrl = context.options.browsertime.secondary_url;
|
||||||
let testName = context.options.browsertime.testName;
|
let testName = context.options.browsertime.testName;
|
||||||
let input_cmds = context.options.browsertime.commands || "";
|
let dismissPrompt = context.options.browsertime.dismiss_cookie_prompt || "";
|
||||||
|
context.log.info(context.options.browsertime);
|
||||||
|
|
||||||
// If the user has RAPTOR_LOGINS configured correctly, a local login pageload
|
// If the user has RAPTOR_LOGINS configured correctly, a local login pageload
|
||||||
// test can be attempted. Otherwise if attempting it in CI, only sites with the
|
// test can be attempted. Otherwise if attempting it in CI, only sites with the
|
||||||
|
|
@ -362,26 +385,9 @@ async function pageload_test(context, commands) {
|
||||||
await commands.wait.byTime(1000);
|
await commands.wait.byTime(1000);
|
||||||
|
|
||||||
await commands.measure.start(testUrl);
|
await commands.measure.start(testUrl);
|
||||||
if (input_cmds) {
|
await commands.wait.byTime(40000);
|
||||||
context.log.info("Searching for cookie prompt elements...");
|
if (dismissPrompt) {
|
||||||
let cmds = input_cmds.split(";;;");
|
await dismissCookiePrompt(dismissPrompt, context, commands);
|
||||||
for (let cmdstr of cmds) {
|
|
||||||
let [cmd, ...args] = cmdstr.split(":::");
|
|
||||||
context.log.info(cmd, args);
|
|
||||||
let result = await commands.js.run(
|
|
||||||
`return document.evaluate("` +
|
|
||||||
args +
|
|
||||||
`", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;`
|
|
||||||
);
|
|
||||||
if (result) {
|
|
||||||
context.log.info("Element found, clicking on it.");
|
|
||||||
await run_command(cmdstr, context, commands);
|
|
||||||
} else {
|
|
||||||
context.log.info(
|
|
||||||
"Element not found! The cookie prompt may have not appeared, please check the screenshots."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
commands.screenshot.take("test_url_" + testName);
|
commands.screenshot.take("test_url_" + testName);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue