Sha256: db4d6b0464ea09f7d8b58854c6814a859cc02d295bed7929ac3e7df6f5c7d725

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

require 'selenium-webdriver'

%x[rm -r 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(1024, 768)
end

After do
	if (@ScenarioTags.include?('@screenshot') && @ScenarioTags.include?('@javascript')) && !page.driver.browser.nil?
		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.41 lib/screenshot.rb