George Baugh 2 gadi atpakaļ
vecāks
revīzija
b55c6aa8f1
6 mainītis faili ar 15 papildinājumiem un 6 dzēšanām
  1. 0 1
      MANIFEST.SKIP
  2. 4 0
      conf/Changes
  3. 1 1
      dist.ini
  4. 7 1
      generate_perl_modules.pl
  5. 2 2
      lib/Playwright/Util.pm
  6. 1 1
      package.json

+ 0 - 1
MANIFEST.SKIP

@@ -1,4 +1,3 @@
-MANIFEST.SKIP
 cover_db/*
 .travis.yml
 weaver.ini

+ 4 - 0
conf/Changes

@@ -1,5 +1,9 @@
 Revision history for Playwright
 
+1.210 2022-05-11 TEODESIAN
+    - Update for playwright v1.21
+    - Changed versioning to match the version of playwright it's tested against
+
 0.019 2022-02-22 TEODESIAN
     - Update for playwright v1.19
 

+ 1 - 1
dist.ini

@@ -1,5 +1,5 @@
 name = Playwright
-version = 0.019
+version = 1.210
 author = George S. Baugh <george@troglodyne.net>
 license = MIT
 copyright_holder = Troglodyne LLC

+ 7 - 1
generate_perl_modules.pl

@@ -21,6 +21,7 @@ while (<DATA>) {
 # Next, grab the API JSON and iterate to build classes.
 our $raw = File::Slurper::read_binary("$FindBin::Bin/api.json");
 our $spec = JSON::decode_json($raw);
+
 $spec = Playwright::Util::arr2hash($spec,'name');
 
 our %mapper = (
@@ -73,6 +74,11 @@ our %bogus_methods = (
 # Playwright methods we can't actually have work here
 our @banned = ('_api_request');
 
+my $ncallback = sub {
+    $_[0] =~ s/#.*$//;
+    return shift;
+};
+
 my @modules;
 foreach my $class ( keys(%$spec), 'Mouse', 'Keyboard' ) {
     next if $class eq 'Playwright';
@@ -81,7 +87,7 @@ foreach my $class ( keys(%$spec), 'Mouse', 'Keyboard' ) {
     push(@modules,$pkg);
     my @seen;
 
-    my $members = Playwright::Util::arr2hash($spec->{$class}{members},'name');
+    my $members = Playwright::Util::arr2hash($spec->{$class}{members},'name', $ncallback);
     foreach my $method ( ( keys( %$members ), 'on', 'evaluate', 'evaluateHandle' ) ) {
         next if grep { $_ eq $method } @banned;
         my $renamed = $method;

+ 2 - 2
lib/Playwright/Util.pm

@@ -50,9 +50,9 @@ sub request ( $method, $url, $port, $ua, %args ) {
     return $msg;
 }
 
-sub arr2hash ($array,$primary_key) {
+sub arr2hash ($array,$primary_key,$callback='') {
     my $inside_out = {};
-    @$inside_out{map { $_->{$primary_key} } @$array} = @$array;
+    @$inside_out{map { $callback ? $callback->($_->{$primary_key}) : $_->{$primary_key} } @$array} = @$array;
     return $inside_out;
 }
 

+ 1 - 1
package.json

@@ -6,7 +6,7 @@
   "private": true,
   "dependencies": {
     "express": "^4.17",
-    "playwright": "^1.19.1",
+    "playwright": "^1.21.1",
     "uuid": "^8.3"
   }
 }