Skip to content

Commit

Permalink
Rewrite API
Browse files Browse the repository at this point in the history
  • Loading branch information
chge committed May 11, 2017
1 parent 58d98cd commit 94ab73a
Show file tree
Hide file tree
Showing 49 changed files with 2,746 additions and 1,890 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ node_modules
slimer.log
tmp
*.info
*.log
*.png
.travis.yml
npm-debug.log
167 changes: 122 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,127 @@
language: node_js

node_js:
- "node"
- "7.0"
- "6.9"
- "6.8"
- "6.7"
- "6.6"
- "6.5"
- "6.4"
- "6.3"
- "6.2"
- "6.1"
- "6.0"
- "5.12"
- "5.11"
- "5.10"
- "5.9"
- "5.8"
- "5.7"
- "5.6"
- "5.5"
- "5.4"
- "5.3"
- "5.2"
- "5.1"
- "5.0"
- "4.6"
- "4.5"
- "4.4"
- "4.3"
dist: trusty
sudo: false

addons:
firefox: "latest"
sauce_connect:
username: "tasty"
direct_domains: all
no_ssl_bump_domains: all
tunnel_domains: localhost
jwt:
secure: "aXO1EoblOPDTFdmCwAnhA6kvUu53Ra26fVtyKRTLhdkKIVJ4XOEXundiSGESff7FgM7kGkQkGiP4peK7Dvqe7ED/C3+wR8py1dLMvzn8rFzWqIyvGhIU1rsn5jNebAbnj+8KECmRM9ioRRCZhWG0emkHhlcrlt1JHB5Hg8V5WA6J/2bM9h+GShyD5kgJ+KYaoWs4gRZWDOuTNfWW2+P7mW4AsRpfGLLhfcPav2yDauCNEu6JYS77SKrcDY9pamL49NHEXs7D+I/x6Lg1Dl2TkNnZtCK9czwJp6dPq+Yb8f2TX3sJlPFiGsUcnh9igqWKaDNZ7UsFk2JCxXLXD6Lx2c1JNEx7SzHkw70kWHZfyqCnzPMVpTBL1xSTpzCMIr0x0arKYU08ezU/vb/L7ntfPum3BtxaOiDPZEMSKQhwpuvYDSOUpOWy2JbQ+VTFP91371OnTa4Q88qaZ16o4B6ZAccjz23oELYeBJtop5qpedWKt/8fsFYNZSmFL/pva6kbblfKx9dLLc/FHUgKsuFONCogUxu7VSbZyh8MFhKrxNTqT7ORHg/1Ef/rkNnZ+Eyfo7Qx9BkG1gm7xZ3bm2e46yWx3aAb6D36xLzVwRGdG+j5bGCTVszJdFoyShah7+ndzWif3PQLXp0lUCwd6f8hiJVL3DeLPoDgRZJkay4ohBw="
language: node_js

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "sleep 3" # give xvfb some time to start
matrix:
fast_finish: true
include:
- node_js: "node"
addons: &firefox
firefox: "52.0"
script: &test
- phantomjs --version
- export DISPLAY=:99.0 && sh -e /etc/init.d/xvfb start && sleep 3
- npm test
- { node_js: "7.10", addons: *firefox, script: *test }
- { node_js: "7.9", addons: *firefox, script: *test }
- { node_js: "7.1", addons: *firefox, script: *test }
- { node_js: "7.0", addons: *firefox, script: *test }
- { node_js: "6.10", addons: *firefox, script: *test }
- { node_js: "6.9", addons: *firefox, script: *test }
- { node_js: "6.1", addons: *firefox, script: *test }
- { node_js: "6.0", addons: *firefox, script: *test }
- { node_js: "5.12", addons: *firefox, script: *test }
- { node_js: "5.11", addons: *firefox, script: *test }
- { node_js: "5.1", addons: *firefox, script: *test }
- { node_js: "5.0", addons: *firefox, script: *test }
- { node_js: "4.8", addons: *firefox, script: *test }
- { node_js: "4.7", addons: *firefox, script: *test }
- { node_js: "4.4", addons: *firefox, script: *test }
- { node_js: "4.3", addons: *firefox, script: *test }
- node_js: "node"
addons: &sauceconnect
jwt:
secure: xKrWkJu58y5lmkZzpPr5bGt0TAkFo2053Pw4BPU9x8vAFINGeUAvj8VEIyQn5MMstntG1xO96ih/WAq0OhHCxwZgWLpUNxmzC1kJC93eyMHIlxttPL90lQIBOTtGzGLTkQe3HuGRwDmXZPehURkElPwWPUvPVyQHgyxLX78T2/ktBkElm/wp7MTSe2j0Adzo4Wt3Aga3WzTRde9gW5IH+/U/JXtpj247/AQCvMH2wmQSRP2XqrqAPF1y6jA3CECiTLpX0zVPnup62/S3QL5WTQspB37E7qNutruewlItxqy+vWJ40zredXIiZKDoXq6IA6h8SYktzXNPGMo/5fBP1gEEBKkgPG0A6vT/CaUvSyShx3zwMMT8WnPNyOVpNDxXw2JAP3ru9kj717cJxswIWvzLfc+MEX5kdOwHtB/zTz3xBYbgpjJ/SbJ3l0XdVQ5owxU1OCBVgwarYFXRFpORctGtE9BIgns5r8ukmQCvZGGG3UUCQxiOKwdIYZh1YZ4JJpvdQMHs0RESoRSWQoQiwWwfkbseCC7uSROtojgQp05x6qUHPA4VdoN9MGx+PDLItlhb/VB7T6YuVPPnkB2a6rfrw3XC7eZidCgXK9mKG2k4cnfPQ9KfaS5zefo39ghgFAsKc1xbPk/ldGfKVoNkNTSTLA0gYnLn5o2ALJJS8u4=
sauce_connect:
username: tasty
direct_domains: all
no_ssl_bump_domains: all
tunnel_domains: localhost
script: &support
- npm run support
- { node_js: "node", addons: *sauceconnect, script: *support }
- { node_js: "7.10.0", addons: *sauceconnect, script: *support }
- { node_js: "7.10.0", addons: *sauceconnect, script: *support }
- { node_js: "7.9.0", addons: *sauceconnect, script: *support }
- { node_js: "7.9.0", addons: *sauceconnect, script: *support }
- { node_js: "7.8.0", addons: *sauceconnect, script: *support }
- { node_js: "7.8.0", addons: *sauceconnect, script: *support }
- { node_js: "7.7.4", addons: *sauceconnect, script: *support }
- { node_js: "7.7.4", addons: *sauceconnect, script: *support }
- { node_js: "7.7.3", addons: *sauceconnect, script: *support }
- { node_js: "7.7.3", addons: *sauceconnect, script: *support }
- { node_js: "7.7.2", addons: *sauceconnect, script: *support }
- { node_js: "7.7.2", addons: *sauceconnect, script: *support }
- { node_js: "7.7.1", addons: *sauceconnect, script: *support }
- { node_js: "7.7.1", addons: *sauceconnect, script: *support }
- { node_js: "7.7.0", addons: *sauceconnect, script: *support }
- { node_js: "7.7.0", addons: *sauceconnect, script: *support }
- { node_js: "7.6.0", addons: *sauceconnect, script: *support }
- { node_js: "7.6.0", addons: *sauceconnect, script: *support }
- { node_js: "7.5.0", addons: *sauceconnect, script: *support }
- { node_js: "7.5.0", addons: *sauceconnect, script: *support }
- { node_js: "7.4.0", addons: *sauceconnect, script: *support }
- { node_js: "7.4.0", addons: *sauceconnect, script: *support }
- { node_js: "7.3.0", addons: *sauceconnect, script: *support }
- { node_js: "7.3.0", addons: *sauceconnect, script: *support }
- { node_js: "7.2.1", addons: *sauceconnect, script: *support }
- { node_js: "7.2.1", addons: *sauceconnect, script: *support }
- { node_js: "7.2.0", addons: *sauceconnect, script: *support }
- { node_js: "7.2.0", addons: *sauceconnect, script: *support }
- { node_js: "7.1.0", addons: *sauceconnect, script: *support }
- { node_js: "7.1.0", addons: *sauceconnect, script: *support }
- { node_js: "7.0.0", addons: *sauceconnect, script: *support }
- { node_js: "7.0.0", addons: *sauceconnect, script: *support }
- { node_js: "6.10.3", addons: *sauceconnect, script: *support }
- { node_js: "6.10.3", addons: *sauceconnect, script: *support }
- { node_js: "6.10.2", addons: *sauceconnect, script: *support }
- { node_js: "6.10.2", addons: *sauceconnect, script: *support }
- { node_js: "6.10.1", addons: *sauceconnect, script: *support }
- { node_js: "6.10.1", addons: *sauceconnect, script: *support }
- { node_js: "6.10.0", addons: *sauceconnect, script: *support }
- { node_js: "6.10.0", addons: *sauceconnect, script: *support }
- { node_js: "6.9.5", addons: *sauceconnect, script: *support }
- { node_js: "6.9.5", addons: *sauceconnect, script: *support }
- { node_js: "6.9.4", addons: *sauceconnect, script: *support }
- { node_js: "6.9.4", addons: *sauceconnect, script: *support }
- { node_js: "6.9.3", addons: *sauceconnect, script: *support }
- { node_js: "6.9.3", addons: *sauceconnect, script: *support }
- { node_js: "6.9.2", addons: *sauceconnect, script: *support }
- { node_js: "6.9.2", addons: *sauceconnect, script: *support }
- { node_js: "6.9.1", addons: *sauceconnect, script: *support }
- { node_js: "6.9.1", addons: *sauceconnect, script: *support }
- { node_js: "6.9.0", addons: *sauceconnect, script: *support }
- { node_js: "6.9.0", addons: *sauceconnect, script: *support }
- { node_js: "6.8.1", addons: *sauceconnect, script: *support }
- { node_js: "6.8.1", addons: *sauceconnect, script: *support }
- { node_js: "6.8.0", addons: *sauceconnect, script: *support }
- { node_js: "6.8.0", addons: *sauceconnect, script: *support }
- { node_js: "6.7.0", addons: *sauceconnect, script: *support }
- { node_js: "6.7.0", addons: *sauceconnect, script: *support }
- { node_js: "6.6.0", addons: *sauceconnect, script: *support }
- { node_js: "6.6.0", addons: *sauceconnect, script: *support }
- { node_js: "6.5.0", addons: *sauceconnect, script: *support }
- { node_js: "6.5.0", addons: *sauceconnect, script: *support }
- { node_js: "6.4.0", addons: *sauceconnect, script: *support }
- { node_js: "6.4.0", addons: *sauceconnect, script: *support }
- { node_js: "6.3.1", addons: *sauceconnect, script: *support }
- { node_js: "6.3.1", addons: *sauceconnect, script: *support }
- { node_js: "6.3.0", addons: *sauceconnect, script: *support }
- { node_js: "6.3.0", addons: *sauceconnect, script: *support }
- { node_js: "6.2.2", addons: *sauceconnect, script: *support }
- { node_js: "6.2.2", addons: *sauceconnect, script: *support }
- { node_js: "6.2.1", addons: *sauceconnect, script: *support }
- { node_js: "6.2.1", addons: *sauceconnect, script: *support }
- { node_js: "6.2.0", addons: *sauceconnect, script: *support }
- { node_js: "6.2.0", addons: *sauceconnect, script: *support }
- { node_js: "6.1.0", addons: *sauceconnect, script: *support }
- { node_js: "6.1.0", addons: *sauceconnect, script: *support }
- { node_js: "6.0.0", addons: *sauceconnect, script: *support }
- { node_js: "6.0.0", addons: *sauceconnect, script: *support }
# selenium-webdriver doesn't work below 6.*
allow_failures:
- script: *support

notifications:
email: false
100 changes: 29 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Write a test (this one uses [Mocha](https://mochajs.org/)).
```javascript
describe('login form', function() {
it('logs user in', function() {
text('Welcome!');
click('Username');
is(text('Welcome!'));
click(text('Username'));
type(tasty.config.username);
click('Password');
click(text('Password'));
type(tasty.config.password);
click('Log in');
location('/dashboard');
click(text('Log in'));
is(location('/dashboard'));

return now();
});
Expand Down Expand Up @@ -175,6 +175,12 @@ Currently Tasty can't find text `+1 123 456-78-90` in the following case:

In other words, it's too hard to join text fragments of `textContent`, `value/placeholder`, `:before/:after` etc.

### Images

Work is in progress.

Search cannot detect text from `alt` attribute yet.

### Auto-focus elements

When using auto-focus elements (such as `input`), you could encounter `cannot type into active node <body />` error when window loses its focus, which causes `type` and `paste` tools to fail.
Expand All @@ -184,6 +190,14 @@ For WebDriver clients you could [maximize window](https://www.w3.org/TR/webdrive

Additionally, [Chrome DevTools](https://developer.chrome.com/devtools) could force current tab to lose focus, with the same results.

### Shadow DOM

Not supported yet.

### Browser UI

Some elements of browser itself, such as tooltips from `title` attribute or HTML5 Form validation messages, could be potentially detected, but currently aren't supported.

# Tools

### Queue
Expand Down Expand Up @@ -288,75 +302,14 @@ ready(

Note that built-in methods cannot be combined.

### Data from client

Some tools could be called without arguments to get data from client.

```javascript
it('reads', function() {
text(
title(),
'h1'
);

return now();
});
```

```javascript
it('remembers', function() {
push(
read('h1')
);
click('Edit');
click('Save');
text(
pop(),
'h1'
);

return now();
});
```

```javascript
it('remembers', function() {
set(
'title',
read('h1')
);
set(
'subtitle',
read('h2')
);
click('Edit');
click('Title');
type('blah');
click('Save');
text(
get('title')
.then(
(value) => value + 'blah'
),
'h1'
);
text(
get('subtitle'),
'h2'
);

return now();
});
```

### Custom logic

The `now(...)` call with function(s) allows you to add some custom logic into test, but you should use `now.*` namespace for tools.

```javascript
it('chooses', function() {
now(
() => now.text('Welcome back')
() => now.is(text('Welcome back'))
.then(
() => now.click('Log in'),
() => now.click('Sign up')
Expand All @@ -373,7 +326,7 @@ The `now.smth()` is the same as just `smth()`, but runs immediately. You should
it('searches', function() {
until(
now(
() => now.text('Chapter 42', 'h1')
() => now.is(text('Chapter 42', 'h1'))
.catch(
() => now.click('Next')
)
Expand Down Expand Up @@ -441,10 +394,15 @@ npm run prepublish
npm test
```

Main tests use [SlimerJS](https://slimerjs.org/) which requires [Firefox](https://www.mozilla.org/firefox) to be installed.
Main tests use [SlimerJS](https://slimerjs.org/) and [PhantomJS](http://phantomjs.org/). SlimerJS itself requires [Firefox](https://www.mozilla.org/firefox) to be installed. PhantomJS suite requires `phantomjs` to be available via command prompt.

### Browser support

```shell
npm run support
```

Real-browser support tests are automated for [SauceLabs](https://saucelabs.com/) environment
and require `TRAVIS_JOB_NUMBER`, `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables,
Real-browser support tests are made possible by [SauceLabs](https://saucelabs.com/). Automation requires `SAUCE_USERNAME`, `SAUCE_ACCESS_KEY` and `TRAVIS_JOB_NUMBER` environment variables,
which are kindly provided by [TravisCI](https://docs.travis-ci.com/user/sauce-connect).

# Windows
Expand Down
26 changes: 7 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
environment:
matrix:
- nodejs_version: "7.9"
- nodejs_version: "7.8"
- nodejs_version: "7.1"
- nodejs_version: "7.0"
- nodejs_version: "6.10"
- nodejs_version: "6.9"
- nodejs_version: "6.8"
- nodejs_version: "6.7"
- nodejs_version: "6.6"
- nodejs_version: "6.5"
- nodejs_version: "6.4"
- nodejs_version: "6.3"
- nodejs_version: "6.2"
- nodejs_version: "6.1"
- nodejs_version: "6.0"
- nodejs_version: "5.12"
- nodejs_version: "5.11"
- nodejs_version: "5.10"
- nodejs_version: "5.9"
- nodejs_version: "5.8"
- nodejs_version: "5.7"
- nodejs_version: "5.6"
- nodejs_version: "5.5"
- nodejs_version: "5.4"
- nodejs_version: "5.3"
- nodejs_version: "5.2"
- nodejs_version: "5.1"
- nodejs_version: "5.0"
- nodejs_version: "4.6"
- nodejs_version: "4.5"
- nodejs_version: "4.8"
- nodejs_version: "4.7"
- nodejs_version: "4.4"
- nodejs_version: "4.3"

Expand All @@ -41,6 +29,6 @@ install:
test_script:
- node --version
- npm --version
- npm run test:windows
- npm run appveyor

build: off
2 changes: 2 additions & 0 deletions docma.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
"server": [
"lib/**/*.js",
"!lib/runner.js",
"!lib/thing.js",
"!lib/tool.js"
],
"test": [
"lib/runner.js",
"lib/thing.js",
"lib/tool.js"
]
},
Expand Down

0 comments on commit 94ab73a

Please sign in to comment.