Pārlūkot izejas kodu

gem prep

master
anonymous pirms 1 gada
vecāks
revīzija
ae7daee482
16 mainītis faili ar 95 papildinājumiem un 73 dzēšanām
  1. +2
    -2
      Makefile
  2. +0
    -62
      app.rb
  3. +69
    -0
      bin/poke
  4. +0
    -0
      lib/client.rb
  5. +0
    -0
      lib/fx.rb
  6. +4
    -0
      lib/routes.rb
  7. +7
    -8
      lib/server.rb
  8. +12
    -0
      poke.gemspec
  9. +0
    -0
      pokes/.keep
  10. +1
    -1
      pokes/tests/basic.rb
  11. +0
    -0
      pokes/tests/example.txt
  12. +0
    -0
      pokes/views/.keep
  13. +0
    -0
      pokes/views/page.haml
  14. +0
    -0
      pokes/views/proxied.haml
  15. +0
    -0
      pokes/views/upload.haml
  16. +0
    -0
      pokes/views/uploads.haml

+ 2
- 2
Makefile Parādīt failu

@@ -1,6 +1,6 @@
#!make

test:
ruby app.rb
bin/poke
test-visible:
ruby app.rb visible
bin/poke visible

+ 0
- 62
app.rb Parādīt failu

@@ -1,62 +0,0 @@
#!/usr/bin/ruby
require 'watir'
require 'watir-scroll'
require 'zeitwerk'

loader = Zeitwerk::Loader.new
loader.push_dir __dir__
loader.setup

# @brief main
#
# @param argv: Array
# @param argc: Integer
#
# @return ?
# @since 0.1
#
# @todo let the developer provide the list of tests that are ran
def main argv = [], argc

if argv.include? '--server'
Server.run!
return false
end
Thread.new {
Server.run!
}

Thread.new {
Fx::pipe({ headless: ARGV.first != 'visible',
options: {
args: [ 'start-fullscreen' ]
}
},
-> (opts) {
Watir::Browser.new :chrome,
opts
},
-> (b) {

Watir.default_timeout = 10
b.window.resize_to 1366, 768
[
Tests::ProjectNameHere::Basic
].each do |c|
c.methods(false).sort.each do |m|
if "assert" != m[0..5]
next
end
Fx::perform c.method(m), b, "#{c}::#{m}"
end
end
Server.stop!
})
}.join
end

main ARGV, ARGV.count

+ 69
- 0
bin/poke Parādīt failu

@@ -0,0 +1,69 @@
#!/usr/bin/ruby
require 'watir'
require 'watir-scroll'
require 'zeitwerk'

loader = Zeitwerk::Loader.new
loader.push_dir __dir__.concat '/../lib'
loader.push_dir Dir.pwd.concat '/pokes'
loader.setup

# @brief main
#
# @param argv: Array
# @param argc: Integer
#
# @return ?
# @since 0.1
#
# @todo let the developer provide the list of tests that are ran
def main argv = [], argc

if argv.include? '--server'
Server.run!
return false
end
Thread.new {
Server.run!
}

Thread.new {
Fx::pipe(
{ headless: ARGV.first != 'visible',
options: {
args: [ 'start-fullscreen' ]
}
},
-> (opts) {
Watir::Browser.new :firefox,
opts
},
-> (b) {
Watir.default_timeout = 10
b.window.resize_to 1366, 768
Tests.constants.each do |c|
k = Tests.const_get(c)

if !(k.is_a? Class)
next
end
k.methods(false).sort.each do |m|
if "assert" != m[0..5]
next
end
Fx::perform k.method(m), b, "#{c}::#{m}"
end
end

# todo: if Server.running?
Server.stop!
})
}.join
end

main ARGV, ARGV.count

client.rb → lib/client.rb Parādīt failu


fx.rb → lib/fx.rb Parādīt failu


routes.rb → lib/routes.rb Parādīt failu

@@ -3,6 +3,10 @@ require 'haml'

class Routes < Sinatra::Base

set :views, Proc.new{
File.join root, '/../', 'pokes', 'views'
}
get 'custom/routes' do
return 'hello world'
end

server.rb → lib/server.rb Parādīt failu

@@ -18,7 +18,7 @@ class Server < Routes
'http://localhost:4567/proxied',
{ 'Accept' => 'text/html' }
end
get '/api/json/masked' do
puts request.env['HTTP_AUTHORIZATION']
return '{"result":"masked"}'
@@ -41,7 +41,7 @@ class Server < Routes
}
})
end
get '/upload' do
haml :upload
end
@@ -59,11 +59,10 @@ class Server < Routes
-> (t) {
t.each { |f| File.delete f }
haml :uploads, {
locals: {
data: t
}
}
locals: {
data: t
}
}
})
end
end
end

+ 12
- 0
poke.gemspec Parādīt failu

@@ -0,0 +1,12 @@
Gem::Specification.new do |s|
s.name = 'pokes'
s.version = '0.0.1'
s.platform = Gem::Platform:RUBY
s.summary = 'e2e tests, API-first'
s.description = 'FP browser automation, pessimistic testing, HAML proxies'
s.authors = ['Luka Licina']
s.email = ['licina.luka@outlook.com']
s.license = 'MIT'
s.files = Dir.glob('{lib,bin}/**/*')
s.require_path = 'lib'
end

tests/.keep → pokes/.keep Parādīt failu


tests/project_name_here/basic.rb → pokes/tests/basic.rb Parādīt failu

@@ -1,4 +1,4 @@
module Tests::ProjectNameHere
module Tests
class Basic
# @return bool

tests/project_name_here/example.txt → pokes/tests/example.txt Parādīt failu


views/.keep → pokes/views/.keep Parādīt failu


views/page.haml → pokes/views/page.haml Parādīt failu


views/proxied.haml → pokes/views/proxied.haml Parādīt failu


views/upload.haml → pokes/views/upload.haml Parādīt failu


views/uploads.haml → pokes/views/uploads.haml Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt