Skip to content

Commit a0f421e

Browse files
authoredApr 8, 2024··
Merge pull request #27 from gemini-testing/rebranding
chore: hermione -> testplane
2 parents 17e8f02 + 2b203ee commit a0f421e

File tree

8 files changed

+84
-83
lines changed

8 files changed

+84
-83
lines changed
 

‎AUTHORS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The following authors have created the source code of "hermione-safari-commands"
1+
The following authors have created the source code of "@testplane/safari-commands"
22
published and distributed by YANDEX LLC as the owner:
33

44
Dmitriy Dudkevich <dudkevich@yandex-team.ru>

‎CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ New contributions are welcomed. Follow this guide if you want to make one.
66

77
Follow [Github guide](https://help.github.com/articles/creating-a-pull-request) to fork a repo and create a pull request.
88

9-
All bug fixes and new features should go to the [`master`](https://github.com/gemini-testing/hermione-safari-commands/tree/master) branch.
9+
All bug fixes and new features should go to the [`master`](https://github.com/gemini-testing/testplane-safari-commands/tree/master) branch.
1010

1111
## Commit messages
1212

@@ -36,7 +36,7 @@ If you are fixing the bug, add a test that fails without your patch and passes w
3636

3737
When submitting an issue please do following:
3838

39-
1. [Search](https://github.com/gemini-testing/hermione-safari-commands/issues) for same issues on github in order to prevent duplicates
39+
1. [Search](https://github.com/gemini-testing/testplane-safari-commands/issues) for same issues on github in order to prevent duplicates
4040
2. Provide the most detailed issue description so we will additional info to work with
4141

4242
Note that if no response for contributors questions will be provided in 1 week then issue may be considered as irrelevant/resolved and may be closed.

‎README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# hermione-safari-commands
1+
# @testplane/safari-commands
22

3-
[![NPM version](https://img.shields.io/npm/v/hermione-safari-commands.svg?style=flat)](https://www.npmjs.org/package/hermione-safari-commands)
4-
[![Build Status](https://travis-ci.org/gemini-testing/hermione-safari-commands.svg?branch=master)](https://travis-ci.org/gemini-testing/hermione-safari-commands)
3+
[![NPM version](https://img.shields.io/npm/v/@testplane/safari-commands.svg?style=flat)](https://www.npmjs.org/package/@testplane/safari-commands)
4+
[![Build Status](https://travis-ci.org/gemini-testing/testplane-safari-commands.svg?branch=master)](https://travis-ci.org/gemini-testing/testplane-safari-commands)
55

6-
Plugin for [hermione](https://github.com/gemini-testing/hermione) which is intended to add/wrap browser commands in order to work properly with the iOS safari browser.
6+
Plugin for [Testplane](https://github.com/gemini-testing/testplane) which is intended to add/wrap browser commands in order to work properly with the iOS safari browser.
77

8-
You can read more about hermione plugins [here](https://github.com/gemini-testing/hermione#plugins).
8+
You can read more about Testplane plugins [here](https://github.com/gemini-testing/testplane#plugins).
99

1010
## Installation
1111

1212
```bash
13-
npm install hermione-safari-commands
13+
npm install @testplane/safari-commands
1414
```
1515

1616
## Usage
@@ -34,16 +34,16 @@ Plugin has following configuration:
3434

3535
Also there is ability to override plugin parameters by CLI options or environment variables
3636
(see [configparser](https://github.com/gemini-testing/configparser)).
37-
Use `hermione_safari_commands_` prefix for the environment variables and `--hermione-safari-commands-` for the cli options.
37+
Use `testplane_safari_commands_` prefix for the environment variables and `--testplane-safari-commands-` for the cli options.
3838

39-
Add plugin to your `hermione` config file:
39+
Add plugin to your `testplane` config file:
4040

4141
```js
4242
module.exports = {
4343
// ...
4444
system: {
4545
plugins: {
46-
'hermione-safari-commands': {
46+
'@testplane/safari-commands': {
4747
enabled: true,
4848
browsers: {
4949
safari13: {
@@ -82,9 +82,9 @@ module.exports = {
8282
### Existing safari commands:
8383

8484
Wrappers over existing commands:
85-
* **url** - wrapper over wdio "url" in order to wait until the page is completely open (used timeout from [`hermione.pageLoadTimeout`](https://github.com/gemini-testing/hermione#pageloadtimeout) or `30000` ms). In [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver) page is open with using the `xcrun` utility - `xcrun simctl openurl` which just tells the simulator to open the page and does not wait anything;
85+
* **url** - wrapper over wdio "url" in order to wait until the page is completely open (used timeout from [`testplane.pageLoadTimeout`](https://github.com/gemini-testing/testplane#pageloadtimeout) or `30000` ms). In [appium-xcuitest-driver](https://github.com/appium/appium-xcuitest-driver) page is open with using the `xcrun` utility - `xcrun simctl openurl` which just tells the simulator to open the page and does not wait anything;
8686
* **click** - replaces wdio "click" in order to perform real touch click (by default it emits only events on passed element). Should be used with **touch** command;
87-
* **screenshot** - wrapper of wdio "screenshot" in order to cut the native elements from the final image ([calibration](https://github.com/gemini-testing/hermione#calibrate) must be turned off);
87+
* **screenshot** - wrapper of wdio "screenshot" in order to cut the native elements from the final image ([calibration](https://github.com/gemini-testing/testplane#calibrate) must be turned off);
8888
* **orientation** - wrapper of wdio "orientation" in order to recalculate size of native elements for "screenshot" command (turns on automatically when you specify a screenshot command);
8989
* **swipe** - replaces wdio "swipe" in order to perform swipe by coordinates in native context;
9090
* **touch** - replaces wdio "touch" in order to perform touch click by coordinates in native context;

‎lib/config/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const thr = (str) => {
1010

1111
const {root, map, section, option} = configParser;
1212

13-
const ENV_PREFIX = 'hermione_safari_commands_';
14-
const CLI_PREFIX = '--hermione-safari-commands-';
13+
const ENV_PREFIX = 'testplane_safari_commands_';
14+
const CLI_PREFIX = '--testplane-safari-commands-';
1515

1616
const assertType = (name, validationFn, type) => {
1717
return (v) => !validationFn(v) && thr(`"${name}" option must be ${type}, but got ${typeof v}`);

‎lib/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ const {WEB_VIEW_CTX} = require('./command-helpers/test-context');
77
const {getNativeLocators} = require('./native-locators');
88
const {getElementUtils} = require('./command-helpers/element-utils');
99

10-
module.exports = (hermione, opts) => {
10+
module.exports = (testplane, opts) => {
1111
const pluginConfig = parseConfig(opts);
1212

1313
if (!pluginConfig.enabled) {
1414
return;
1515
}
1616

17-
if (!hermione.isWorker()) {
18-
hermione.on(hermione.events.SESSION_START, async (browser, {browserId}) => {
17+
if (!testplane.isWorker()) {
18+
testplane.on(testplane.events.SESSION_START, async (browser, {browserId}) => {
1919
if (_.isEmpty(getBrowserPluginCfg(pluginConfig, browserId))) {
2020
return;
2121
}
@@ -37,14 +37,14 @@ module.exports = (hermione, opts) => {
3737
return;
3838
}
3939

40-
hermione.on(hermione.events.NEW_BROWSER, (browser, {browserId}) => {
40+
testplane.on(testplane.events.NEW_BROWSER, (browser, {browserId}) => {
4141
const {commands = [], nativeElementsSize} = getBrowserPluginCfg(pluginConfig, browserId);
4242

4343
if (_.isEmpty(commands)) {
4444
return;
4545
}
4646

47-
const broConfig = hermione.config.forBrowser(browserId);
47+
const broConfig = testplane.config.forBrowser(browserId);
4848

4949
if (commands.includes('screenshot') && !commands.includes('orientation')) {
5050
commands.push('orientation');
@@ -61,13 +61,13 @@ module.exports = (hermione, opts) => {
6161
});
6262
});
6363

64-
hermione.on(hermione.events.AFTER_TESTS_READ, (collection) => {
64+
testplane.on(testplane.events.AFTER_TESTS_READ, (collection) => {
6565
collection.eachRootSuite((root, browserId) => {
6666
if (_.isEmpty(getBrowserPluginCfg(pluginConfig, browserId))) {
6767
return;
6868
}
6969

70-
const {testsPerSession} = hermione.config.forBrowser(browserId);
70+
const {testsPerSession} = testplane.config.forBrowser(browserId);
7171
const isTestRunsInOneSession = testsPerSession === 1;
7272

7373
if (isTestRunsInOneSession) {

‎package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "hermione-safari-commands",
3-
"version": "2.1.0",
4-
"description": "Plugin for hermione to add/wrap browser commands for iOS safari",
2+
"name": "@testplane/safari-commands",
3+
"version": "0.0.1",
4+
"description": "Plugin for Testplane to add/wrap browser commands for iOS safari",
55
"main": "lib/index.js",
66
"scripts": {
77
"lint": "eslint .",
@@ -14,9 +14,10 @@
1414
},
1515
"repository": {
1616
"type": "git",
17-
"url": "git+https://github.com/gemini-testing/hermione-safari-commands.git"
17+
"url": "git+https://github.com/gemini-testing/testplane-safari-commands.git"
1818
},
1919
"keywords": [
20+
"testplane",
2021
"hermione",
2122
"plugin",
2223
"safari",
@@ -25,9 +26,9 @@
2526
"author": "Dmitriy Dudkevich <dudkevich@yandex-team.ru>",
2627
"license": "MIT",
2728
"bugs": {
28-
"url": "https://github.com/gemini-testing/hermione-safari-commands/issues"
29+
"url": "https://github.com/gemini-testing/testplane-safari-commands/issues"
2930
},
30-
"homepage": "https://github.com/gemini-testing/hermione-safari-commands#readme",
31+
"homepage": "https://github.com/gemini-testing/testplant-safari-commands#readme",
3132
"dependencies": {
3233
"gemini-configparser": "^1.3.0",
3334
"lodash": "^4.17.15",

‎test/lib/index.js

+50-50
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ const {mkConfig_, mkBrowser_} = require('../utils');
1212
describe('plugin', () => {
1313
let initialDocument, plugin, getElementUtils, getNativeLocators;
1414

15-
const mkHermione_ = (opts = {}) => {
15+
const mkTestplane_ = (opts = {}) => {
1616
opts = _.defaults(opts, {
1717
proc: 'master',
1818
browsers: {}
1919
});
2020

21-
const hermione = new EventEmitter2();
21+
const testplane = new EventEmitter2();
2222

23-
hermione.events = {
23+
testplane.events = {
2424
NEW_BROWSER: 'newBrowser',
2525
SESSION_START: 'sessionStart',
2626
AFTER_TESTS_READ: 'afterTestsRead'
2727
};
28-
hermione.isWorker = sinon.stub().returns(opts.proc === 'worker');
29-
hermione.config = {
28+
testplane.isWorker = sinon.stub().returns(opts.proc === 'worker');
29+
testplane.config = {
3030
forBrowser: (id) => opts.browsers[id] || {desiredCapabilities: {}}
3131
};
3232

33-
return hermione;
33+
return testplane;
3434
};
3535

3636
beforeEach(() => {
@@ -62,20 +62,20 @@ describe('plugin', () => {
6262
});
6363

6464
it('should do nothing if plugin is disabled', () => {
65-
const hermione = mkHermione_();
66-
sinon.spy(hermione, 'on');
65+
const testplane = mkTestplane_();
66+
sinon.spy(testplane, 'on');
6767

68-
plugin(hermione, mkConfig_({enabled: false}));
68+
plugin(testplane, mkConfig_({enabled: false}));
6969

70-
assert.notCalled(hermione.on);
70+
assert.notCalled(testplane.on);
7171
});
7272

7373
describe('master process', () => {
7474
describe('"SESSION_START" event', () => {
7575
it('should do nothing if browser does not exist in plugin config', async () => {
76-
const hermione = mkHermione_({proc: 'master'});
76+
const testplane = mkTestplane_({proc: 'master'});
7777

78-
plugin(hermione, mkConfig_({
78+
plugin(testplane, mkConfig_({
7979
browsers: {
8080
b1: {
8181
commands: []
@@ -84,15 +84,15 @@ describe('plugin', () => {
8484
}));
8585
const browser = mkBrowser_();
8686

87-
await hermione.emitAsync(hermione.events.SESSION_START, browser, {browserId: 'b2'});
87+
await testplane.emitAsync(testplane.events.SESSION_START, browser, {browserId: 'b2'});
8888

8989
assert.notCalled(browser.execute);
9090
});
9191

9292
it('should create fake input and focus on it for plugin browsers', async () => {
93-
const hermione = mkHermione_({proc: 'master'});
93+
const testplane = mkTestplane_({proc: 'master'});
9494

95-
plugin(hermione, mkConfig_({
95+
plugin(testplane, mkConfig_({
9696
browsers: {
9797
b1: {
9898
commands: []
@@ -111,7 +111,7 @@ describe('plugin', () => {
111111
browser.execute.firstCall.args[0]();
112112
});
113113

114-
await hermione.emitAsync(hermione.events.SESSION_START, browser, {browserId: 'b1'});
114+
await testplane.emitAsync(testplane.events.SESSION_START, browser, {browserId: 'b1'});
115115

116116
assert.calledWith(document.createElement, 'input');
117117
assert.calledWith(fakeInput.setAttribute, 'type', 'text');
@@ -120,9 +120,9 @@ describe('plugin', () => {
120120
});
121121

122122
it('should save web view context in session options', async () => {
123-
const hermione = mkHermione_({proc: 'master'});
123+
const testplane = mkTestplane_({proc: 'master'});
124124

125-
plugin(hermione, mkConfig_({
125+
plugin(testplane, mkConfig_({
126126
browsers: {
127127
b1: {
128128
commands: []
@@ -133,7 +133,7 @@ describe('plugin', () => {
133133
const browser = mkBrowser_();
134134
browser.getContexts.resolves([NATIVE_CONTEXT, 'WEBVIEW_12345']);
135135

136-
await hermione.emitAsync(hermione.events.SESSION_START, browser, {browserId: 'b1'});
136+
await testplane.emitAsync(testplane.events.SESSION_START, browser, {browserId: 'b1'});
137137

138138
assert.calledOnceWith(browser.extendOptions, {[WEB_VIEW_CTX]: 'WEBVIEW_12345'});
139139
});
@@ -142,25 +142,25 @@ describe('plugin', () => {
142142

143143
describe('worker process', () => {
144144
it('should not subscribe on "SESSION_START" event', () => {
145-
const hermione = mkHermione_({proc: 'worker'});
146-
sinon.spy(hermione, 'on');
145+
const testplane = mkTestplane_({proc: 'worker'});
146+
sinon.spy(testplane, 'on');
147147

148-
plugin(hermione, mkConfig_({
148+
plugin(testplane, mkConfig_({
149149
browsers: {
150150
b1: {
151151
commands: []
152152
}
153153
}
154154
}));
155155

156-
assert.isTrue(hermione.on.neverCalledWith(hermione.events.SESSION_START));
156+
assert.isTrue(testplane.on.neverCalledWith(testplane.events.SESSION_START));
157157
});
158158

159159
describe('"NEW_BROWSER" event', () => {
160160
it('should throws if passed command is not implemented', () => {
161-
const hermione = mkHermione_({proc: 'worker'});
161+
const testplane = mkTestplane_({proc: 'worker'});
162162

163-
plugin(hermione, mkConfig_({
163+
plugin(testplane, mkConfig_({
164164
browsers: {
165165
b1: {
166166
commands: ['non_existent_cmd']
@@ -169,14 +169,14 @@ describe('plugin', () => {
169169
}));
170170

171171
assert.throws(() => {
172-
hermione.emit(hermione.events.NEW_BROWSER, {}, {browserId: 'b1'});
172+
testplane.emit(testplane.events.NEW_BROWSER, {}, {browserId: 'b1'});
173173
}, TypeError, 'Can not find "non_existent_cmd" command');
174174
});
175175

176176
it('should not throw if created browser is not specified in config', () => {
177-
const hermione = mkHermione_({proc: 'worker'});
177+
const testplane = mkTestplane_({proc: 'worker'});
178178

179-
plugin(hermione, mkConfig_({
179+
plugin(testplane, mkConfig_({
180180
browsers: {
181181
b1: {
182182
commands: ['some-command']
@@ -185,21 +185,21 @@ describe('plugin', () => {
185185
}));
186186

187187
assert.doesNotThrow(() => {
188-
hermione.emit(hermione.events.NEW_BROWSER, {}, {browserId: 'non-wrapped-bro'});
188+
testplane.emit(testplane.events.NEW_BROWSER, {}, {browserId: 'non-wrapped-bro'});
189189
});
190190
});
191191

192192
it('should call passed command', () => {
193193
const browser = mkBrowser_();
194194
const browserConfig = {foo: 'bar', desiredCapabilities: {}};
195-
const hermione = mkHermione_({
195+
const testplane = mkTestplane_({
196196
proc: 'worker',
197197
browsers: {
198198
b1: browserConfig
199199
}
200200
});
201201

202-
plugin(hermione, mkConfig_({
202+
plugin(testplane, mkConfig_({
203203
browsers: {
204204
b1: {
205205
commands: ['swipe']
@@ -210,7 +210,7 @@ describe('plugin', () => {
210210
getNativeLocators.returns({some: 'locators'});
211211
getElementUtils.returns({some: 'utils'});
212212

213-
hermione.emit(hermione.events.NEW_BROWSER, browser, {browserId: 'b1'});
213+
testplane.emit(testplane.events.NEW_BROWSER, browser, {browserId: 'b1'});
214214

215215
assert.calledOnceWith(commands.swipe, browser,
216216
{config: browserConfig, elementUtils: {some: 'utils'}, nativeLocators: {some: 'locators'}});
@@ -219,37 +219,37 @@ describe('plugin', () => {
219219
describe('"orientation" command is not specified in config', () => {
220220
it('should not wrap "orientation" if "screenshot" command is not specified', () => {
221221
const browser = mkBrowser_();
222-
const hermione = mkHermione_({
222+
const testplane = mkTestplane_({
223223
proc: 'worker',
224224
browsers: {
225225
b1: {}
226226
}
227227
});
228228

229-
plugin(hermione, mkConfig_({
229+
plugin(testplane, mkConfig_({
230230
browsers: {
231231
b1: {
232232
commands: ['swipe']
233233
}
234234
}
235235
}));
236236

237-
hermione.emit(hermione.events.NEW_BROWSER, browser, {browserId: 'b1'});
237+
testplane.emit(testplane.events.NEW_BROWSER, browser, {browserId: 'b1'});
238238

239239
assert.notCalled(commands.orientation);
240240
});
241241

242242
it('should wrap "orientation" if "screenshot" command is specified', () => {
243243
const browser = mkBrowser_();
244244
const browserConfig = {foo: 'bar'};
245-
const hermione = mkHermione_({
245+
const testplane = mkTestplane_({
246246
proc: 'worker',
247247
browsers: {
248248
b1: browserConfig
249249
}
250250
});
251251

252-
plugin(hermione, mkConfig_({
252+
plugin(testplane, mkConfig_({
253253
browsers: {
254254
b1: {
255255
commands: ['screenshot']
@@ -259,7 +259,7 @@ describe('plugin', () => {
259259
getNativeLocators.returns({some: 'locators'});
260260
getElementUtils.returns({some: 'utils'});
261261

262-
hermione.emit(hermione.events.NEW_BROWSER, browser, {browserId: 'b1'});
262+
testplane.emit(testplane.events.NEW_BROWSER, browser, {browserId: 'b1'});
263263

264264
assert.calledOnceWith(commands.orientation, browser, {config: browserConfig,
265265
nativeLocators: {some: 'locators'}, elementUtils: {some: 'utils'}});
@@ -269,22 +269,22 @@ describe('plugin', () => {
269269
describe('"orientation" command is specified in config', () => {
270270
it('should not wrap "orientation" again even if "screenshot" command is specified', () => {
271271
const browser = mkBrowser_();
272-
const hermione = mkHermione_({
272+
const testplane = mkTestplane_({
273273
proc: 'worker',
274274
browsers: {
275275
b1: {}
276276
}
277277
});
278278

279-
plugin(hermione, mkConfig_({
279+
plugin(testplane, mkConfig_({
280280
browsers: {
281281
b1: {
282282
commands: ['orientation', 'screenshot']
283283
}
284284
}
285285
}));
286286

287-
hermione.emit(hermione.events.NEW_BROWSER, browser, {browserId: 'b1'});
287+
testplane.emit(testplane.events.NEW_BROWSER, browser, {browserId: 'b1'});
288288

289289
assert.calledOnce(commands.orientation);
290290
});
@@ -300,30 +300,30 @@ describe('plugin', () => {
300300
});
301301

302302
it('for browsers that not specified in plugin config', () => {
303-
const hermione = mkHermione_({proc: 'worker'});
304-
plugin(hermione, mkConfig_({
303+
const testplane = mkTestplane_({proc: 'worker'});
304+
plugin(testplane, mkConfig_({
305305
browsers: {b1: {}}
306306
}));
307307

308-
hermione.emit(hermione.events.AFTER_TESTS_READ, {
308+
testplane.emit(testplane.events.AFTER_TESTS_READ, {
309309
eachRootSuite: (cb) => cb(rootSuite, 'b2')
310310
});
311311

312312
assert.notCalled(rootSuite.beforeEach);
313313
});
314314

315315
it('if test runs in one session', () => {
316-
const hermione = mkHermione_({
316+
const testplane = mkTestplane_({
317317
proc: 'worker',
318318
browsers: {
319319
b1: {testsPerSession: 1}
320320
}
321321
});
322-
plugin(hermione, mkConfig_({
322+
plugin(testplane, mkConfig_({
323323
browsers: {b1: {}}
324324
}));
325325

326-
hermione.emit(hermione.events.AFTER_TESTS_READ, {
326+
testplane.emit(testplane.events.AFTER_TESTS_READ, {
327327
eachRootSuite: (cb) => cb(rootSuite, 'b1')
328328
});
329329

@@ -332,18 +332,18 @@ describe('plugin', () => {
332332
});
333333

334334
it('should change web view context in "beforeEach" hook', async () => {
335-
const hermione = mkHermione_({
335+
const testplane = mkTestplane_({
336336
proc: 'worker',
337337
browsers: {
338338
b1: {testsPerSession: 2}
339339
}
340340
});
341-
plugin(hermione, mkConfig_({
341+
plugin(testplane, mkConfig_({
342342
browsers: {b1: {}}
343343
}));
344344

345345
const rootSuite = {beforeEach: sinon.spy().named('beforeEach')};
346-
hermione.emit(hermione.events.AFTER_TESTS_READ, {
346+
testplane.emit(testplane.events.AFTER_TESTS_READ, {
347347
eachRootSuite: (cb) => cb(rootSuite, 'b1')
348348
});
349349

0 commit comments

Comments
 (0)
Please sign in to comment.