codeceptjs 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/pause.js CHANGED
@@ -6,7 +6,7 @@ const debug = require('debug')('codeceptjs:pause');
6
6
  const container = require('./container');
7
7
  const history = require('./history');
8
8
  const store = require('./store');
9
- const AiAssistant = require('./ai');
9
+ const aiAssistant = require('./ai');
10
10
  const recorder = require('./recorder');
11
11
  const event = require('./event');
12
12
  const output = require('./output');
@@ -18,7 +18,6 @@ let nextStep;
18
18
  let finish;
19
19
  let next;
20
20
  let registeredVariables = {};
21
- let aiAssistant;
22
21
  /**
23
22
  * Pauses test execution and starts interactive shell
24
23
  * @param {Object<string, *>} [passedObject]
@@ -44,8 +43,6 @@ function pauseSession(passedObject = {}) {
44
43
  let vars = Object.keys(registeredVariables).join(', ');
45
44
  if (vars) vars = `(vars: ${vars})`;
46
45
 
47
- aiAssistant = AiAssistant.getInstance();
48
-
49
46
  output.print(colors.yellow(' Interactive shell started'));
50
47
  output.print(colors.yellow(' Use JavaScript syntax to try steps in action'));
51
48
  output.print(colors.yellow(` - Press ${colors.bold('ENTER')} to run the next step`));
@@ -54,11 +51,9 @@ function pauseSession(passedObject = {}) {
54
51
  output.print(colors.yellow(` - Prefix ${colors.bold('=>')} to run js commands ${colors.bold(vars)}`));
55
52
 
56
53
  if (aiAssistant.isEnabled) {
57
- output.print(colors.blue(` ${colors.bold('OpenAI is enabled! (experimental)')} Write what you want and make OpenAI run it`));
58
- output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to OpenAI'));
54
+ output.print(colors.blue(` ${colors.bold('AI is enabled! (experimental)')} Write what you want and make AI run it`));
55
+ output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to AI provider'));
59
56
  output.print(colors.blue(' Ideas: ask it to fill forms for you or to click'));
60
- } else {
61
- output.print(colors.blue(` Enable OpenAI assistant by setting ${colors.bold('OPENAI_API_KEY')} env variable`));
62
57
  }
63
58
  }
64
59
  rl = readline.createInterface(process.stdin, process.stdout, completer);
@@ -125,7 +120,7 @@ async function parseInput(cmd) {
125
120
  } finally {
126
121
  output.level(currentOutputLevel);
127
122
  }
128
- // aiAssistant.mockResponse("```js\nI.click('Sign in');\n```");
123
+
129
124
  const spinner = ora("Processing OpenAI request...").start();
130
125
  cmd = await aiAssistant.writeSteps(cmd);
131
126
  spinner.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@codeceptjs/configure": "1.0.1",
72
- "@codeceptjs/helper": "2.0.1",
72
+ "@codeceptjs/helper": "2.0.4",
73
73
  "@cucumber/cucumber-expressions": "17",
74
74
  "@cucumber/gherkin": "26",
75
75
  "@cucumber/messages": "24.1.0",
@@ -12377,14 +12377,14 @@ declare namespace CodeceptJS {
12377
12377
  * Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
12378
12378
  *
12379
12379
  * Detox plays quite differently from Appium. To establish detox testing you need to build a mobile application in a special way to inject Detox code.
12380
- * This why **Detox is grey box testing** solution, so you need access to application source code, and a way to build and execute it on emulator.
12380
+ * This why **Detox is grey box testing** solution, so you need an access to application source code, and a way to build and execute it on emulator.
12381
12381
  *
12382
12382
  * Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.
12383
12383
  *
12384
12384
  * ### Setup
12385
12385
  *
12386
- * 1. [Install and configure Detox](https://wix.github.io/Detox/docs/introduction/project-setup)
12387
- * 2. [Build an application](https://wix.github.io/Detox/docs/introduction/project-setup#step-5-build-the-app) using `detox build` command.
12386
+ * 1. [Install and configure Detox for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
12387
+ * 2. [Build an application](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-4-build-your-app-and-run-detox-tests) using `detox build` command.
12388
12388
  * 3. Install [CodeceptJS](https://codecept.io) and detox-helper:
12389
12389
  *
12390
12390
  * ```
@@ -12397,28 +12397,15 @@ declare namespace CodeceptJS {
12397
12397
  *
12398
12398
  * ```js
12399
12399
  * "detox": {
12400
- * "configurations": {
12401
- * "ios.sim.debug": {
12402
- * "device": "simulator",
12403
- * "app": "ios.debug"
12404
- * }
12405
- * },
12406
- * "apps": {
12407
- * "ios.debug": {
12408
- * "type": "ios.app",
12409
- * "binaryPath": "../test/ios/build/Build/Products/Debug-iphonesimulator/MyTestApp.app",
12410
- * "build": "xcodebuild -workspace ../test/ios/MyTestApp.xcworkspace -scheme MyTestApp -configuration Debug -sdk iphonesimulator -derivedDataPath ../test/ios/build"
12411
- * }
12412
- * },
12413
- * "devices": {
12414
- * "simulator": {
12415
- * "type": "ios.simulator",
12416
- * "device": {
12417
- * "type": "iPhone 15"
12418
- * }
12419
- * }
12420
- * }
12421
- * }
12400
+ * "configurations": {
12401
+ * "ios.sim.debug": {
12402
+ * "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
12403
+ * "build": "xcodebuild -project ios/example.xcodeproj -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
12404
+ * "type": "ios.simulator",
12405
+ * "name": "iPhone 7"
12406
+ * }
12407
+ * }
12408
+ * }
12422
12409
  * ```
12423
12410
  *
12424
12411
  *
@@ -12513,14 +12500,6 @@ declare namespace CodeceptJS {
12513
12500
  * ```
12514
12501
  */
12515
12502
  setPortraitOrientation(): void;
12516
- /**
12517
- * Grab the device platform
12518
- *
12519
- * ```js
12520
- * const platform = await I.grabPlatform();
12521
- * ```
12522
- */
12523
- grabPlatform(): void;
12524
12503
  /**
12525
12504
  * Execute code only on iOS
12526
12505
  *
@@ -12610,19 +12589,6 @@ declare namespace CodeceptJS {
12610
12589
  * ```
12611
12590
  */
12612
12591
  click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
12613
- /**
12614
- * Clicks on an element.
12615
- * Element can be located by its label
12616
- *
12617
- * The second parameter is a context (id | type | accessibility id) to narrow the search.
12618
- *
12619
- *
12620
- * ```js
12621
- * I.tapByLabel('Login'); // locate by text
12622
- * I.tapByLabel('Login', '#nav'); // locate by text inside #nav
12623
- * ```
12624
- */
12625
- tapByLabel(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
12626
12592
  /**
12627
12593
  * Performs click on element with horizontal and vertical offset.
12628
12594
  * An element is located by text, id, accessibility id.
@@ -12673,17 +12639,6 @@ declare namespace CodeceptJS {
12673
12639
  * @param [context = null] - context element
12674
12640
  */
12675
12641
  seeElement(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
12676
- /**
12677
- * Checks if an element exists.
12678
- *
12679
- * ```js
12680
- * I.checkIfElementExists('~edit'); // located by accessibility id
12681
- * I.checkIfElementExists('~edit', '#menu'); // element inside #menu
12682
- * ```
12683
- * @param locator - element to locate
12684
- * @param [context = null] - context element
12685
- */
12686
- checkIfElementExists(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
12687
12642
  /**
12688
12643
  * Checks that element is not visible.
12689
12644
  * Use second parameter to narrow down the search.
@@ -12733,18 +12688,6 @@ declare namespace CodeceptJS {
12733
12688
  * @param value - value to fill
12734
12689
  */
12735
12690
  fillField(field: CodeceptJS.LocatorOrString, value: string): void;
12736
- /**
12737
- * Taps return key.
12738
- * A field can be located by text, accessibility id, id.
12739
- *
12740
- * ```js
12741
- * I.tapReturnKey('Username');
12742
- * I.tapReturnKey('~name');
12743
- * I.tapReturnKey({ android: 'NAME', ios: 'name' });
12744
- * ```
12745
- * @param field - an input element to fill in
12746
- */
12747
- tapReturnKey(field: CodeceptJS.LocatorOrString): void;
12748
12691
  /**
12749
12692
  * Clears a text field.
12750
12693
  * A field can be located by text, accessibility id, id.
@@ -12870,7 +12813,7 @@ declare namespace CodeceptJS {
12870
12813
  */
12871
12814
  waitForElementVisible(locator: CodeceptJS.LocatorOrString, sec?: number): void;
12872
12815
  /**
12873
- * Waits an elmenet to become not visible.
12816
+ * Waits an elment to become not visible.
12874
12817
  *
12875
12818
  * ```js
12876
12819
  * I.waitToHide('#message', 2); // wait for 2 seconds
@@ -12879,14 +12822,6 @@ declare namespace CodeceptJS {
12879
12822
  * @param [sec = 5] - number of seconds to wait
12880
12823
  */
12881
12824
  waitToHide(locator: CodeceptJS.LocatorOrString, sec?: number): void;
12882
- /**
12883
- * Scrolls within a scrollable container to an element.
12884
- * @param targetLocator - Locator of the element to scroll to
12885
- * @param containerLocator - Locator of the scrollable container
12886
- * @param direction - 'up' or 'down'
12887
- * @param [offset = 100] - Offset for scroll, can be adjusted based on need
12888
- */
12889
- scrollToElement(targetLocator: CodeceptJS.LocatorOrString, containerLocator: CodeceptJS.LocatorOrString, direction?: string, offset?: number): void;
12890
12825
  }
12891
12826
  /**
12892
12827
  * Abstract class.