Question

Has anyone been able to export Angular E2E test results to a file using Angular test runner. I would like to avoid using Karma and export the results to a file. Is this possible?

Thanks for any help!

Était-ce utile?

La solution

Perhaps you're willing to use selenium to hit your tests? You can easily generate the html reports with python, for example.

#!/usr/bin/python
from selenium import webdriver
import codecs

driver = webdriver.Chrome()
driver.get('testrunner.html')

wait = webdriver.support.ui.WebDriverWait(driver, 10, 10)
wait.until(lambda driver: driver.find_element_by_id('tests-complete'), "Timed out!")

report = driver.find_element_by_tag_name('html')
report_string  = report.get_attribute('outerHTML'))

with codecs.open('e2e-report.html', 'w', 'utf-8') as html_report:
    html_report.write(report_string)

Add this line to angular-scenario.js (at the end of the main closure) to expose the runner

angular.scenario.$runner = $runner;

then add something like this to your runner.html file

<script type="text/javascript">
  angular.scenario.$runner.on('RunnerEnd', function() {
    angular.element('#application').after('<span id="tests-complete"></span>');
  });
</script>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top