Skip to content

Commit

Permalink
browserfeatcl needs some maintenance, disabling at the moment
Browse files Browse the repository at this point in the history
  • Loading branch information
david-dick committed Oct 18, 2024
1 parent 7e911b4 commit 5906af5
Showing 1 changed file with 146 additions and 144 deletions.
290 changes: 146 additions & 144 deletions t/04-browserfeatcl.t
Original file line number Diff line number Diff line change
Expand Up @@ -363,159 +363,161 @@ SKIP: {
ok($javascript =~ /delete[ ]window[.]ContentVisibilityAutoStateChangeEvent/, "Extension code includes ContentVisibilityAutoStateChangeEvent");
ok($javascript =~ /delete[ ]window[.]ShadowRoot/, "Extension code includes ShadowRoot");
}
my $nightly_failures_found = 0;
foreach my $version (reverse (6 .. 123)) {
ok(1, "About to go to Firefox v$version");
my $agent = $firefox->agent(version => $version);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent(version => $version) produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent() contains Firefox version '$1' in the agent string (real version is " . $firefox->browser_version() . ")");
my $test_result_version = $1;
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Firefox[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)(?:[.]9)?[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Firefox");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
if ($ENV{FIREFOX_BCD}) {
my $nightly_failures_found = 0;
foreach my $version (reverse (6 .. 123)) {
ok(1, "About to go to Firefox v$version");
my $agent = $firefox->agent(version => $version);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent(version => $version) produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent() contains Firefox version '$1' in the agent string (real version is " . $firefox->browser_version() . ")");
my $test_result_version = $1;
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Firefox[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)(?:[.]9)?[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Firefox");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
foreach my $version (reverse (80 .. 121)) {
my $chrome_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$version.0.0.0 Safari/537.36";
ok(1, "About to go to Chrome v$version - $chrome_user_agent");
my $agent = $firefox->agent($chrome_user_agent);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent('$chrome_user_agent') produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Chrome\/$version/smx, "\$firefox->agent() contains Chrome version '$version' in the agent string (real version is Firefox v" . $firefox->browser_version() . ")");
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Chrom(?:e|ium)[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Chrome");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
foreach my $version (reverse (80 .. 121)) {
my $chrome_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$version.0.0.0 Safari/537.36";
ok(1, "About to go to Chrome v$version - $chrome_user_agent");
my $agent = $firefox->agent($chrome_user_agent);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent('$chrome_user_agent') produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Chrome\/$version/smx, "\$firefox->agent() contains Chrome version '$version' in the agent string (real version is Firefox v" . $firefox->browser_version() . ")");
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Chrom(?:e|ium)[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Chrome");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
foreach my $version (reverse (9 .. 17)) {
my $safari_user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/$version Safari/605.1.15";
ok(1, "About to go to Safari v$version - $safari_user_agent");
my $agent = $firefox->agent($safari_user_agent);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent('$safari_user_agent') produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Version\/$version[ ]Safari\/(\d+)/smx, "\$firefox->agent() contains Safari version '$version' in the agent string (real version is Firefox v" . $firefox->browser_version() . ")");
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Safari[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)[.]9[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Safari");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
foreach my $version (reverse (9 .. 17)) {
my $safari_user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/$version Safari/605.1.15";
ok(1, "About to go to Safari v$version - $safari_user_agent");
my $agent = $firefox->agent($safari_user_agent);
ok($agent =~ /Firefox\/(\d+)/smx, "\$firefox->agent('$safari_user_agent') produces the actual agent string which contains Firefox version '$1'");
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->go("http://$nginx_listen:" . $nginx->port()), "Loaded browserfeatcl");
$agent = $firefox->agent();
ok($agent =~ /Version\/$version[ ]Safari\/(\d+)/smx, "\$firefox->agent() contains Safari version '$version' in the agent string (real version is Firefox v" . $firefox->browser_version() . ")");
my $extracted_report = $firefox->await(sub { $firefox->has_class('success') or $firefox->has_class('error') })->text();
TODO: {
local $TODO = $firefox->nightly() ? "Nightly releases may break feature detection from browser-compat-data" : q[];
ok($extracted_report =~ /You[']re[ ]using[ ]Safari[ ](\d+)(?:[.]\d+)?(?:[ ]\-[ ](\d+)[.]9[!])?/smx, "browserfeatcl reports '$extracted_report' which matches Safari");
my ($min_version, $max_version) = ($1, $2);
if (defined $max_version) {
my $result;
if ($min_version <= $version && $version <= $max_version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches between $min_version and $max_version which includes fake version '$version'");
} elsif (defined $min_version) {
my $result;
if ($min_version == $version) {
$result = 1;
} elsif ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok($result, "browserfeatcl matches $min_version which equals fake version '$version'");
} else {
if ($firefox->nightly()) {
$nightly_failures_found += 1;
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
ok(0, "browserfeatcl failed to output any version when looking for fake version '$version'");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
if ($nightly_failures_found) {
diag("$nightly_failures_found nightly failures have been found");
}
check_webdriver($firefox,
webdriver_definition_script => $webdriver_definition_script,
webdriver_def_regex => $webdriver_def_regex,
webdriver_prototype_call_script => $webdriver_prototype_call_script,
webdriver_prototype_call_regex => $webdriver_prototype_call_regex,
);
ok($firefox->agent(undef), "\$firefox->agent(undef) to reset agent string to original");
}
if ($nightly_failures_found) {
diag("$nightly_failures_found nightly failures have been found");
}
ok($firefox->quit() == 0, "\$firefox->quit() was successful()");
ok($nginx->stop() == 0, "Stopped nginx on $nginx_listen:" . $nginx->port());
Expand Down

0 comments on commit 5906af5

Please sign in to comment.