@testspectra/react-native 1.3.3 → 1.3.4

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1460,7 +1460,14 @@ function createElementActions(selector, index) {
1460
1460
  if (options?.clearFirst) {
1461
1461
  await clearValue();
1462
1462
  }
1463
- await setValue(value);
1463
+ const d = driver();
1464
+ if (typeof d.typeText !== "function") {
1465
+ await setValue(value);
1466
+ return;
1467
+ }
1468
+ return trackStep("action", { type: "action", key: "type", target: selector, args: [value] }, async () => {
1469
+ await d.typeText(selector, value, index);
1470
+ });
1464
1471
  }
1465
1472
  async function clearValue() {
1466
1473
  return trackStep("action", { type: "action", key: "clear", target: selector, args: [] }, async () => {
@@ -1681,8 +1688,9 @@ function createMockHandle(rule, release) {
1681
1688
  respondWith: async (newFixture, newOptions = {}) => {
1682
1689
  const newObj = newFixture;
1683
1690
  rule.response = newObj && newObj.body !== void 0 ? newObj.body : newFixture;
1684
- if (newOptions.statusCode || newObj && (newObj.statusCode || newObj.status)) {
1685
- rule.statusCode = newOptions.statusCode || newObj?.statusCode || newObj?.status || 200;
1691
+ const envelopeStatus = readMockEnvelope(newObj)?.statusCode;
1692
+ if (newOptions.statusCode || newObj && newObj.statusCode || envelopeStatus) {
1693
+ rule.statusCode = newOptions.statusCode || newObj?.statusCode || envelopeStatus || 200;
1686
1694
  }
1687
1695
  if (newOptions.headers || newObj && newObj.headers) {
1688
1696
  rule.headers = newOptions.headers || newObj?.headers;
@@ -1695,7 +1703,7 @@ function createMockHandle(rule, release) {
1695
1703
  respondOnce: async (newFixture, newOptions = {}) => {
1696
1704
  const newObj = newFixture;
1697
1705
  const resp = newObj && newObj.body !== void 0 ? newObj.body : newFixture;
1698
- const statusCode = newOptions.statusCode || newObj && (newObj.statusCode || newObj.status) || rule.statusCode || 200;
1706
+ const statusCode = newOptions.statusCode || newObj && newObj.statusCode || readMockEnvelope(newObj)?.statusCode || rule.statusCode || 200;
1699
1707
  const headers = newOptions.headers || newObj && newObj.headers || rule.headers;
1700
1708
  const delayMs = newOptions.delayMs ?? (newObj && newObj.delayMs) ?? rule.delayMs;
1701
1709
  rule.respondOnceQueue.push({ response: resp, statusCode, headers, delayMs });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/react-native",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Native Android & iOS component test runner for React Native with TestSpectra Spectra.* DSL",
5
5
  "keywords": [
6
6
  "testspectra",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "cross-spawn": "^7.0.6",
34
34
  "esbuild": "^0.28.2",
35
- "@testspectra/matchers": "1.3.3"
35
+ "@testspectra/matchers": "1.3.4"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=18.0.0",