summaryrefslogtreecommitdiffstats
path: root/cucumber/features/step_definitions/git.rb
blob: bd8fcf7db21b84a5d8b9e62e1ac558d7ff62d112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
When /^I clone the Git repository "([\S]+)" in GNOME Terminal$/ do |repo|
  repo_directory = /[\S]+\/([\S]+)(\.git)?$/.match(repo)[1]
  assert(!$vm.directory_exist?("/home/#{LIVE_USER}/#{repo_directory}"))

  recovery_proc = Proc.new do
    $vm.execute("rm -rf /home/#{LIVE_USER}/#{repo_directory}",
                             :user => LIVE_USER)
    step 'I kill the process "git"'
    @screen.type('clear' + Sikuli::Key.ENTER)
  end

  retry_tor(recovery_proc) do
    step "I run \"git clone #{repo}\" in GNOME Terminal"
    m = /^(https?|git):\/\//.match(repo)
    unless m
      step 'I verify the SSH fingerprint for the Git repository'
    end
    try_for(180, :msg => 'Git process took too long') {
      !$vm.has_process?('/usr/bin/git')
    }
    Dogtail::Application.new('gnome-terminal-server')
      .child('Terminal', roleName: 'terminal')
      .text['Unpacking objects: 100%']
  end
end

Then /^the Git repository "([\S]+)" has been cloned successfully$/ do |repo|
  assert($vm.directory_exist?("/home/#{LIVE_USER}/#{repo}/.git"))
  assert($vm.file_exist?("/home/#{LIVE_USER}/#{repo}/.git/config"))
  $vm.execute_successfully("cd '/home/#{LIVE_USER}/#{repo}/' && git status",
                           :user => LIVE_USER)
end