Skip to content
Permalink
Browse files

- added tests for ActionOpen

- fixed ActionOpen to have proper opening a new page with loading extra libraries

:goose:
  • Loading branch information...
maZahaca committed Dec 8, 2018
1 parent 84fafe7 commit 6383c7bd558f04eac544d20abe1732b69dc7eb14
Showing with 33 additions and 3 deletions.
  1. +2 −3 lib/actions/ActionOpen.js
  2. +31 −0 test/integration/actions/actions.test.js
@@ -8,9 +8,8 @@ const Action = require('./Action');

class ActionOpen extends Action {
perform() {
return this._env.evaluateJs(this._options.url, /* istanbul ignore next */function (url) {
window.location = url;
});
const { url } = this._options;
return this._env.goto(url);
}
}

@@ -1117,6 +1117,37 @@ describe('Actions', () => {
});
});

describe('ActionOpen', () => {
test('perform', async () => {
setServerResponse([
{
route: '/',
html: `<a href="/test">test</a>`
},
{
route: '/test',
html: `<a href="#">nothing</a>`,
}
]);
const parser = new Parser({
environment: new ChromeEnvironment({ url }),
});
const result = await parser.parse({
actions: [
{
type: 'open',
url: `${url}test`,
},
],
rules: {
scope: 'a'
},
});

expect(result).toEqual('nothing');
});
});

// describe('ActionSnapshot', () => {
// test('making page snapshot', async () => {
// setServerResponse({

0 comments on commit 6383c7b

Please sign in to comment.
You can’t perform that action at this time.