Open dotherightthing opened 6 years ago
Tenon runs on HTML pages or a website URL. Could it integrate with the Unit Testing environment?
Tenon.io December webinar is now online
The Tenon website is a client of the Tenon API.
The defaults which are inherited by all projects. These can be overridden in Project-Level API settings.
Settings can also be stored in .tenonrc
.
Snippets can also be tested on the website.
Tenon > Dashboard > Settings > API Settings > Certainty
100
is suitable for CIs - i.e. we want to be 100% sure that a problem is real before we will allow it to fail the build (to avoid false positives)
80+
= error
80-
= warning
Tenon > Dashboard > Settings > API Settings > Priority
Ranks issues on ease of repair, impact on user etc
100
: high impact on user, easy to repair
60
-80
: to capture more issues
Tenon > Dashboard > Settings > API Settings > Fragment Whole page or part of a page / partial
Tenon > Dashboard > Settings > API Settings > Store Results? Archive test results
Tenon > Dashboard > Settings > API Settings > User-Agent String Only for developer's own usage
Tenon > Dashboard > Settings > API Settings > Viewport Height/Width Runs in a headless (JS) DOM-aware browser, so can be passed responsive breakpoints, but the defaults are setup for low vision users
Tenon > Dashboard > Settings > API Settings > Delay Useful if JS takes some time to kick in, specify in milliseconds
Projects > Add a new project
Project results:
Duplicate issues Highlights issues in components which are used in multiple places
Issues by WCAG Success Criteria Greyed out rows indicate which items require non-automated human testing
I need to integrate Travis with WPUnit so that mock WordPress pages can be tested in Travis. In the future I'd like to use Selenium to change the page state prior to testing.
Karl ran grunt-tenon-demo
through Travis:
// travis.yml
before_script
- grunt
Selenium example - https://blog.tenon.io/does-tenon-integrate-with-selenium/
https://codeception.com/11-12-2013/working-with-phpunit-and-selenium-webdriver.html
There is PHPUnit_Selenium extension you may use. We will use php-webdriver instead because this implementation is modern and its API is more clean and looks much the same way as original Java Selenium API. That’s why it is easier to learn, and much powerful, then the PHPUnit’s one. For example, it allows you use send native touch events, which is important in era of mobile-ready web applications.
However note that this example uses a local testing browser.
Starting a Selenium Server inside TravisCI
TL;DR: To start a Selenium Server, namely a Chrome Driver, inside TravisCI builds you have to install and run a Google Chrome instance using your .travis.yml configuration, like in this working example:
https://github.com/yandod/travis-ci-selenium-php
PHP Test Club How to know if Selenium Server is ready?
In our continuous integration at Travis we start the selenium server this way:
#!/bin/sh
# wait4selenium.sh
# Loop until selenium server is available
printf 'Waiting Selenium Server to load\n'
until $(curl --output /dev/null --silent --head --fail http://localhost:4444/wd/hub); do
printf '.'
sleep 1
done
printf '\n'
// travis.yml
# Selenium server
- "wget http://selenium-release.storage.googleapis.com/2.43/selenium-server-standalone-2.43.1.jar"
- "java -jar selenium-server-standalone-2.43.1.jar > /dev/null 2>/dev/null &"
- .travis/wait4selenium.sh
and
Switched current acceptance tests to Chromedriver and Ubuntu Trusty
https://github.com/joedolson/access-monitor/blob/master/src/access-monitor.php
$tenon = new tenon( TENON_API_URL, $opts );
$tenon->submit( AM_DEBUG );
https://github.com/joedolson/access-monitor/blob/master/src/t/class-tenon.php
$args = array(
'method' => 'POST',
'body' => $this->opts,
'headers' => '',
'timeout' => 60,
);
$result = wp_remote_post( $this->url, $args );
if ( is_wp_error( $result ) ) {
$this->tenon_response = $result->errors;
} else {
// the test results.
$this->tenon_response = $result;
}
However note that if testing WordPress Admin pages, the entire page would be tested, rather than just the rendered DTRT plugin partial.
I've set up a test on wpdtrt-gallery
as follows:
TENON_AUTH
# travis.yml
before_script:
- export TENON_AUTH="$TENON_AUTH"
Added function tenon
to test-wpdtrt-gallery.php
. This is used inside an assertion to test that Tenon's response resultSet
is empty (no failing tests). PHP gets the value of TENON_AUTH
using getenv
.
The Tenon API can only access publicly available URLs. In late 2015 the developers said that Tenon Tunnel was on the roadmap, but there's no mention of this on the tenon.io website or blog so I have asked for clarification.
A workaround is to post HTML/CSS/JS $src
instead of a $url
. This will likely require using a headless browser to scrape the page. This could dovetail with the work to set up Selenium to change the page state prior to testing it.
None - working.
The request fails on local dev (MAMP Pro 4.1.1).
wp_remote_post
returns the error:
cURL error 56: SSLRead() return error -9806
This appears to be caused by the wrong SSL application being used - SecureTransport
instead of OpenSSL
(https://www.codesd.com/item/osx-10-10-curl-post-to-https-url-gives-sslread-error.html)
php -i | grep "SSL Version"
SSL Version => SecureTransport
OpenSSL 1.0.2j
(https://www.mamp.info/en/documentation/ > Version History)Added Proof of Concept to wpdtrt-gallery:1.7.15