Sha256: 0d89328d03aaa36943c93092652dd38fa0891ed4fcb10915d159abc687a62bf5

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

require 'selenium-webdriver'

%x[rm -fr aipim/screenshots/*]

Before do |scenario|
	@ScenarioTitle = scenario.title
	@ScenarioDescription = scenario.description
	@FeatureFile = scenario.file.to_s.split('/')
	@FeatureFile.delete_at(0)
	@FeatureFile = @FeatureFile.join('/')
	@FeatureName = scenario.feature.title
	@ScenarioTags = scenario.source_tag_names

	page.driver.browser.manage.window.maximize
	page.driver.browser.manage.window.resize_to(SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT)
end

After do
	config = YAML.load_file("config/aipim.yml")
	
	if (@ScenarioTags.include?('@screenshot') && @ScenarioTags.include?('@javascript') && !page.driver.browser.nil? && config['screenshot'])
		path = "aipim/screenshots/#{@FeatureFile}"
		system("mkdir -p #{path}")

		sleep(1.0)
		page.driver.save_screenshot("#{path}/#{Time.now.to_i}.png")
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aipim-rails-0.0.181 lib/webdriver/screenshot.rb