How to use readResource method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

resource_links.js

Source:resource_links.js Github

copy

Full Screen

1const {2  buildConfig,3  buildRunner,4  buildPlayer,5  seralizeId, // :NOTE: needed due to mixing of direct API and GraphQL in same test6  mockAgentId,7  mockIdentifier,8  mockAddress,9} = require('../init')10const runner = buildRunner()11const config = buildConfig()12const testEventProps = {13  provider: mockAgentId(false),14  receiver: mockAgentId(false),15  hasPointInTime: '2019-11-19T04:29:55.056Z',16  resourceClassifiedAs: ['todo-this-shouldnt-be-needed'],17  resourceQuantity: { hasNumericalValue: 1, hasUnit: mockIdentifier(false) },18}19runner.registerScenario('EconomicResource composition / containment functionality', async (s, t) => {20  const { graphQL, cells: [alice] } = await buildPlayer(s, config, ['observation'])21  // SCENARIO: write initial records22  const resourceSpecificationId = mockAddress(false)23  const inputEvent = {24    note: 'container resource instantiation event',25    action: 'raise',26    ...testEventProps,27  }28  const inputResource = {29    note: 'container resource',30    conformsTo: resourceSpecificationId,31  }32  const cResp1 = await alice.call('economic_event', 'create_economic_event', { event: inputEvent, newInventoriedResource: inputResource })33  await s.consistency()34  const event1 = cResp1.economicEvent35  const resource1 = cResp1.economicResource36  t.ok(event1.id, 'event created successfully')37  t.ok(resource1.id, 'resource created successfully')38  // const eventId1 = event1.id39  const resourceId1 = resource1.id40  const inputEvent2 = {41    note: 'contained resource instantiation event',42    action: 'raise',43    ...testEventProps,44  }45  const inputResource2 = {46    containedIn: resourceId1,47    conformsTo: resourceSpecificationId,48    note: 'internal resource',49  }50  const cResp2 = await alice.call('economic_event', 'create_economic_event', { event: inputEvent2, newInventoriedResource: inputResource2 })51  await s.consistency()52  t.ok(cResp2.economicResource, 'internal resource created successfully')53  const resource2 = cResp2.economicResource54  const resourceId2 = resource2.id55  let readResp = await alice.call('economic_resource', 'get_economic_resource', { address: resourceId1 })56  let readResource = readResp.economicResource57  t.ok(readResource.id, 'container resource retrieval OK')58  t.equal(readResource.contains && readResource.contains.length, 1, 'container resource reference inserted')59  t.deepEqual(readResource.contains && readResource.contains[0], resourceId2, 'container resource reference OK')60  readResp = await alice.call('economic_resource', 'get_economic_resource', { address: resourceId2 })61  readResource = readResp.economicResource62  t.ok(readResource.id, 'contained resource retrieval OK')63  t.deepEqual(readResource.containedIn, resourceId1, 'contained resource reference OK')64  // SCENARIO: add more internal resources65  const inputEvent3 = {66    note: 'contained resource instantiation event 2',67    action: 'raise',68    ...testEventProps,69  }70  const inputResource3 = {71    containedIn: resourceId1,72    conformsTo: resourceSpecificationId,73    note: 'another internal resource',74  }75  const cResp3 = await alice.call('economic_event', 'create_economic_event', { event: inputEvent3, newInventoriedResource: inputResource3 })76  await s.consistency()77  t.ok(cResp3.economicResource, 'additional internal resource created successfully')78  const resource3 = cResp3.economicResource79  const resourceId3 = resource3.id80  readResp = await alice.call('economic_resource', 'get_economic_resource', { address: resourceId1 })81  readResource = readResp.economicResource82  t.deepEqual(readResource.id, resourceId1, 'container resource re-retrieval OK')83  console.log(readResource)84  t.equal(readResource.contains && readResource.contains.length, 2, 'container resource reference appended')85  t.deepEqual(readResource.contains && readResource.contains[0], resourceId2, 'container resource reference B OK')86  t.deepEqual(readResource.contains && readResource.contains[1], resourceId3, 'container resource reference A OK')87  // SCENARIO: update to remove links88  const updateResource3 = {89    revisionId: resource3.revisionId,90    containedIn: null,91    note: 'standalone resource',92  }93  const uResp3 = await alice.call('economic_resource', 'update_economic_resource', { resource: updateResource3 })94  await s.consistency()95  t.ok(uResp3.economicResource, 'internal resource updated successfully')96  readResp = await alice.call('economic_resource', 'get_economic_resource', { address: resourceId1 })97  readResource = readResp.economicResource98  t.ok(readResource.id, 'container resource re-retrieval OK')99  console.log(readResource)100  t.equal(readResource.contains && readResource.contains.length, 1, 'container resource reference removed after update')101  t.deepEqual(readResource.contains && readResource.contains[0], resourceId2, 'container resource remaining reference OK')102  // ASSERT: load records via GraphQL layer to test query endpoints103  await s.consistency()104  readResp = await graphQL(`105  {106    container: economicResource(id: "${seralizeId(resourceId1)}") {107      contains {108        id109      }110    }111    contained: economicResource(id: "${seralizeId(resourceId2)}") {112      containedIn {113        id114      }115    }116  }`)117  t.equal(readResp.data.container.contains.length, 1, 'contains ref present in GraphQL API')118  t.equal(readResp.data.container.contains[0].id, seralizeId(resourceId2), 'contains ref OK in GraphQL API')119  t.equal(readResp.data.contained.containedIn.id, seralizeId(resourceId1), 'containedIn ref OK in GraphQL API')120  // SCENARIO: delete resource, check links are removed121  // :TODO: needs some thought; resources should only be deleted via last linked EconomicEvent's deletion122  // const dResp = await alice.call('economic_resource', 'delete_resource', { address: resourceId3 })123  // await s.consistency()124  // t.ok(dResp.economicResource, 'resource deleted successfully')125  // readResp = await alice.call('economic_resource', 'get_resource', { address: resourceId1 })126  // readResource = readResp.economicResource127  // t.ok(readResource.id, 'container resource re-retrieval OK')128  // t.equal(readResource.contains && readResource.contains.length, 0, 'container resource reference removed after deletion')129})...

Full Screen

Full Screen

process-setup.js

Source:process-setup.js Github

copy

Full Screen

...9      operation('deployment', 'create', [{10        deploymentName:  'user-tasks',11        files: [{12          name: 'user-tasks.bpmn',13          content: readResource('user-tasks.bpmn')14        }]15      }]),16      operation('process-definition', 'start', [{17        key: 'user-tasks',18        businessKey: 'Instance1',19        variables: {20          test: {21            value: 1.5,22            type: 'Double'23          },24          myString : {25            value: '123 dfg',26            type: 'String'27          },28          extraLong : {29            value: '1234567890987654321',30            type: 'Long'31          }32        }33      },34      {35        key: 'user-tasks',36        businessKey: 'Instance2',37        variables: {38          test : {39            value: 1.5,40            type: 'Double'41          },42          myString : {43              value: 'abc dfg',44              type: 'String'45          }46        }47      },48      {49        key: 'user-tasks',50        businessKey: 'myBusinessKey',51        variables: {52          test : {53            value: 1.49,54            type: 'Double'55          },56          myString : {57              value: 'abc dfg',58              type: 'String'59          },60          myDate : {61              value: '2011-11-11T11:11:11',62              type: 'Date'63          }64        }65      }])66    ),67  setup2:68    combine(69      operation('deployment', 'create', [{70        deploymentName:  'mi-incident',71        files: [{72          name: 'mi-incident.bpmn',73          content: readResource('mi-incident.bpmn')74        }]75      }]),76      operation('process-definition', 'start', [{77        key: 'mi-incident',78        businessKey: 'MultiInstance'79      }])80    ),81  setup3:82    combine(83      operation('deployment', 'create', [{84        deploymentName:  'bulk-retry',85        files: [{86          name: 'mi-incident.bpmn',87          content: readResource('mi-incident.bpmn')88        }]89      }]),90      operation('deployment', 'create', [{91        deploymentName:  'four-fails',92        files: [{93          name: '4-failed-service-tasks.bpmn',94          content: readResource('4-failed-service-tasks.bpmn')95        }]96      }]),97      operation('deployment', 'create', [{98        deploymentName:  'seven-fails',99        files: [{100          name: '7-failed-service-tasks.bpmn',101          content: readResource('7-failed-service-tasks.bpmn')102        }]103      }]),104      operation('process-definition', 'start', [{105        key: 'mi-incident'106      },107      {108        key: 'fourFailingServiceTasks'109      },110      {111        key: 'sevenFailingServiceTasks'112      }])113    ),114    multiTenancySetup:115        combine(116        		operation('deployment', 'create', [{117              deploymentName:  'user-tasks',118              tenantId: 'tenant1',119              files: [{120                name: 'user-tasks.bpmn',121                content: readResource('user-tasks.bpmn')122              }]123            }]),124            operation('deployment', 'create', [{125              deploymentName:  'user-tasks',126              files: [{127                name: 'user-tasks.bpmn',128                content: readResource('user-tasks.bpmn')129              }]130            }]),131            operation('process-definition', 'start', [{132              key: 'user-tasks',133              tenantId: 'tenant1',134              variables: {135                test: {136                  value: 1.5,137                  type: 'Double'138                },139                myString : {140                  value: '123 dfg',141                  type: 'String'142                },143                extraLong : {144                  value: '1234567890987654321',145                  type: 'Long'146                }147              }148            }]),149            operation('process-definition', 'start', [{150              key: 'user-tasks',151              variables: {152                test: {153                  value: 3.0,154                  type: 'Double'155                },156                myString : {157                  value: '50 dfg',158                  type: 'String'159                },160                extraLong : {161                  value: '42',162                  type: 'Long'163                }164              }165            }])166        ),167    versionTagSetup:168        combine(169          operation('deployment', 'create', [{170            deploymentName:  'user-tasks',171            files: [{172              name: 'user-tasks.bpmn',173              content: readResource('user-tasks.bpmn')174            }]175          }]),176          operation('deployment', 'create', [{177            deploymentName:  'invoice-deployment-binding',178            files: [{179              name: 'invoice-deployment-binding.bpmn',180              content: readResource('invoice-deployment-binding.bpmn')181            }]182          }])183        )...

Full Screen

Full Screen

public_default.test.js

Source:public_default.test.js Github

copy

Full Screen

1const doRequest = require('./utils');2const CONFIG = require('../config');3const adminAuth = CONFIG.JENA_USER + ':' + CONFIG.JENA_PASSWORD;4async function readResource(user, resource) {5  return doRequest({6    endpoint: 'query',7    auth: adminAuth,8    user,9    sparql: 'SELECT ?predicate ?object WHERE { ' + resource + ' ?predicate ?object }'10  });11}12async function insertResource(user, resource) {13  return doRequest({14    endpoint: 'update',15    auth: adminAuth,16    user,17    sparql: 'INSERT DATA { ' + resource + ' <http://test/ns/property1> "ok" }'18  });19}20async function deleteResource(user, resource, predicate, object) {21  return doRequest({22    endpoint: 'update',23    auth: adminAuth,24    user,25    sparql: 'DELETE DATA { ' + resource + ' ' + predicate + ' ' + object + ' }'26  });27}28describe('fuseki ACL public anonymous user, default container access', () => {29  /////// ***** READ30  test('Ensure READ fails when no Authorization exists for the container', async () => {31    const { body, statusCode } = await readResource(32      'anon',33      '<https://data.virtual-assembly.org/organizations/manufabrick>'34    );35    expect(body.results.bindings.length).toBe(0);36  });37  // <http://test/acl/#acl28>38  test('Ensure READ fails when Authorization exists for this container, but for anyUser', async () => {39    const { body, statusCode } = await readResource(40      'anon',41      '<https://data.virtual-assembly.org/organizations/collectif_des_associations_citoyennes>'42    );43    expect(body.results.bindings.length).toBe(0);44  });45  // <http://test/acl/#acl29>46  test('Ensure READ fails when Authorization exists for this resource, but for another user', async () => {47    const { body, statusCode } = await readResource(48      'anon',49      '<https://data.virtual-assembly.org/organizations/sciences_citoyennes>'50    );51    expect(body.results.bindings.length).toBe(0);52  });53  // <http://test/acl/#acl30>54  test('Ensure READ fails when Authorization exists for this container and for this user, but for mode:Append instead of mode:Read', async () => {55    const { body, statusCode } = await readResource(56      'anon',57      '<https://data.virtual-assembly.org/organizations/territoires_zero_chomeurs_longue_duree>'58    );59    expect(body.results.bindings.length).toBe(0);60  });61  // <http://test/acl/#acl27>62  test('Ensure READ succeeds when Authorization exists for this container and for this user, with a mode.Read', async () => {63    const { body, statusCode } = await readResource(64      'anon',65      '<https://data.virtual-assembly.org/organizations/la_coalition>'66    );67    expect(body.results.bindings.length).toBe(10);68  });69  // <http://test/acl/#acl31>70  test('Ensure READ succeeds when Authorization exists for this container and for this user, with a mode.Write', async () => {71    const { body, statusCode } = await readResource(72      'anon',73      '<https://data.virtual-assembly.org/organizations/poles_en_pomme>'74    );75    expect(body.results.bindings.length).toBeGreaterThanOrEqual(10);76  });77  // <http://test/acl/#acl32>78  test('Ensure READ succeeds when Authorization exists and has several perms for this container and for this user, with a mode.Read', async () => {79    const { body, statusCode } = await readResource(80      'anon',81      '<https://data.virtual-assembly.org/organizations/open_opale>'82    );83    expect(body.results.bindings.length).toBeGreaterThanOrEqual(10);84  });85  // <http://test/acl/#acl33>86  test('Ensure READ succeeds when Authorization exists and has several perms for several containers and for this user, with a mode.Read', async () => {87    const { body, statusCode } = await readResource(88      'anon',89      '<https://data.virtual-assembly.org/organizations/officience>'90    );91    expect(body.results.bindings.length).toBeGreaterThanOrEqual(14);92  });93  // <http://test/acl/#acl33>94  test('Ensure READ succeeds when Authorization exists and has several perms for several containers and for this user, with a mode.Read', async () => {95    const { body, statusCode } = await readResource(96      'anon',97      '<https://data.virtual-assembly.org/organizations/cheznous_mareuil>'98    );99    expect(body.results.bindings.length).toBeGreaterThanOrEqual(11);100  });101  // <http://test/acl/#acl34>102  test('Ensure READ succeeds when Authorization exists and has several perms for several containers and for several users, with a mode.Read', async () => {103    const { body, statusCode } = await readResource(104      'anon',105      '<https://data.virtual-assembly.org/organizations/cheznous_mareuil>'106    );107    expect(body.results.bindings.length).toBeGreaterThanOrEqual(11);108  });...

Full Screen

Full Screen

decision-setup.js

Source:decision-setup.js Github

copy

Full Screen

...7operation('deployment', 'create', [{8  deploymentName: 'assign-approver',9  files: [{10    name: 'assign-approver-groups.dmn',11    content: readResource('assign-approver-groups.dmn')12  },13  {14    name: 'invoice.bpmn',15    content: readResource('invoice.bpmn')16  }]17}18]),19operation('process-definition', 'start', [{20  key: 'invoice',21  businessKey: 'invoice1',22  variables: {23    amount: { value: 100 },24    invoiceCategory: { value: 'travelExpenses' }25  }26}])27);28var deploySecond = operation('deployment', 'create', [{29  deploymentName: 'assign-approver',30  files: [{31    name: 'assign-approver-groups-changed.dmn',32    content: readResource('assign-approver-groups-changed.dmn')33  }]34}]);35var deployThird = combine(36operation('deployment', 'create', [{37  deploymentName: 'assign-approver-without-clause-name',38  files: [{39    name: 'assign-approver-groups-clauses-without-name.dmn',40    content: readResource('assign-approver-groups-clauses-without-name.dmn')41  },42  {43    name: 'invoice.bpmn',44    content: readResource('invoice.bpmn')45  }]46}47]),48operation('process-definition', 'start', [{49  key: 'invoice',50  businessKey: 'invoice1',51  variables: {52    amount: { value: 100 },53    invoiceCategory: { value: 'travelExpenses' }54  }55}])56);57var deploy4 = combine(58operation('deployment', 'create', [{59  deploymentName: 'assign-approver',60  files: [{61    name: 'assign-approver-groups.dmn',62    content: readResource('assign-approver-groups.dmn')63  }]64}]),65operation('decision-definition', 'evaluate', [{66  key: 'invoice-assign-approver',67  variables: {68    amount: { value: 100 },69    invoiceCategory: { value: 'travelExpenses' }70  }71}])72);73var multiTenancyDeployment = combine(74		75    operation('deployment', 'create', [{76      deploymentName:  'processTenantOne',77      tenantId: 'tenant1', 78      files: [{79        name: 'invoice.bpmn',80        filename: 'invoice-deployment-binding.bpmn',81        content: readResource('invoice-deployment-binding.bpmn')82      },83      {84        name: 'assign-approver-groups.dmn',85        content: readResource('assign-approver-groups.dmn')86      }]87    }]),88      89    operation('deployment', 'create', [{90      deploymentName:  'processNoTenant',91      files: [{92        name: 'invoice.bpmn',93        filename: 'invoice-deployment-binding.bpmn',94        content: readResource('invoice-deployment-binding.bpmn')95      },96      {97        name: 'assign-approver-groups.dmn',98        content: readResource('assign-approver-groups.dmn')99      }]100    }]),101    102    operation('process-definition', 'start', [{103      key: 'invoice',104      tenantId: 'tenant1',105      variables: {106        creditor: {107          value: 'test',108          type: 'String'109        },110        amount : {111          value: 20.5,112          type: 'Double'...

Full Screen

Full Screen

dashboard-setup.js

Source:dashboard-setup.js Github

copy

Full Screen

...7  operation('deployment', 'create', [{8    deploymentName: 'failing-process',9    files: [{10      name: 'failing-process.bpmn',11      content: readResource('failing-process.bpmn')12    }]13  }])14);15var fragment2 = combine(16  operation('process-definition', 'start', [{17    key: 'failing-process',18    businessKey: 'Instance1',19    variables: {20      test : {21        value: 1,22        type: 'Integer'23      }24    }25  }])26);27var fragment3 = combine(28  operation('deployment', 'create', [{29    deploymentName:  'process-with-subprocess',30    files:           [{31      name: 'process-with-sub-process.bpmn',32      content: readResource('process-with-sub-process.bpmn')33    }]34  }]),35  operation('process-definition', 'start', [{36    key: 'processWithSubProcess',37    businessKey: 'Instance1',38    variables: {39      test : {40        value: 1,41        type: 'Integer'42      }43    }44  }])45);46var dmnFragment1 = operation('deployment', 'create', [{47  deploymentName: 'assign-approver',48  files: [{49    name: 'assign-approver-groups.dmn',50    content: readResource('assign-approver-groups.dmn')51  }]52  },{53  deploymentName: 'assign-approver',54  files: [{55    name: 'assign-approver-groups-changed.dmn',56    content: readResource('assign-approver-groups-changed.dmn')57  }]58}]);59var dmnFragment2 = operation('deployment', 'create', [{60  deploymentName: 'dmn-without-name',61  files: [{62    name: 'dmn-without-name.dmn',63    content: readResource('dmn-without-name.dmn')64  }]65}]);66var multiTenancyDeployment = combine(67		68    operation('deployment', 'create', [{69      deploymentName:  'processTenantOne',70      tenantId: 'tenant1', 71      files: [{72        name: 'invoice.bpmn',73        filename: 'invoice-deployment-binding.bpmn',74        content: readResource('invoice-deployment-binding.bpmn')75      },76      {77        name: 'assign-approver-groups.dmn',78        content: readResource('assign-approver-groups.dmn')79      }]80    }]),81      82    operation('deployment', 'create', [{83      deploymentName:  'processNoTenant',84      files: [{85        name: 'invoice.bpmn',86        filename: 'invoice-deployment-binding.bpmn',87        content: readResource('invoice-deployment-binding.bpmn')88      },89      {90        name: 'assign-approver-groups.dmn',91        content: readResource('assign-approver-groups.dmn')92      }]93    }]),94    95    operation('process-definition', 'start', [{96      key: 'invoice',97      tenantId: 'tenant1',98      variables: {99        creditor: {100          value: 'test',101          type: 'String'102        },103        amount : {104          value: 20.5,105          type: 'Double'...

Full Screen

Full Screen

repository-setup.js

Source:repository-setup.js Github

copy

Full Screen

...10        deploymentName:  'first-deployment',11        deploymentSource: 'process application',12        files: [{13          name: 'user-tasks.bpmn',14          content: readResource('user-tasks.bpmn')15        }]16      },17      {18        deploymentName:  'second-deployment',19        files: [{20          name: 'suspension-process.bpmn',21          content: readResource('suspension-process.bpmn')22        }]23      },24      {25        deploymentName:  'third-deployment',26        deploymentSource: 'cockpit',27        files: [{28          name: 'failing-process.bpmn',29          content: readResource('failing-process.bpmn')30        }]31      }]),32    operation('process-definition', 'start', [{33      key: 'user-tasks'34    },35    {36      key: 'suspension-process'37    },38    {39      key: 'failing-process'40    }])41  ),42  setup2:43    combine(44      operation('deployment', 'create', [{45        deploymentName: 'bpmn',46        files: [{47          name: 'user-tasks.bpmn',48          content: readResource('user-tasks.bpmn')49        }]50      },51      {52        deploymentName: 'cmmn',53        files: [{54          name: 'loan-application.cmmn',55          content: readResource('loan-application.cmmn')56        }]57      },58      {59        deploymentName: 'dmn',60        files: [{61          name: 'assign-approver-groups.dmn',62          content: readResource('assign-approver-groups.dmn')63        }]64      },65      {66        deploymentName: 'image',67        files: [{68          name: 'diagram.svg',69          content: readResource('diagram.svg')70        }]71      },72      {73        deploymentName: 'script',74        files: [{75          name: 'my-script.groovy',76          content: readResource('my-script.groovy')77        }]78      }]),79      operation('process-definition', 'start', [{80        key: 'user-tasks'81      },82      {83        key: 'user-tasks'84      }]),85      operation('case-definition', 'create', [{86        key: 'loanApplicationCase'87      },88      {89        key: 'loanApplicationCase'90      },91      {92        key: 'loanApplicationCase'93      }])94    ),95    96  multiTenancySetup: combine(97  		98      operation('deployment', 'create', [{99        deploymentName:  'processTenantOne',100        tenantId: 'tenant1', 101        files: [{102          name: 'user-tasks.bpmn',103          content: readResource('user-tasks.bpmn')104        }]105      }]),106        107      operation('deployment', 'create', [{108        deploymentName:  'processNoTenant',109        files: [{110          name: 'user-tasks.bpmn',111          content: readResource('user-tasks.bpmn')112        }]113      }])114  )115  ...

Full Screen

Full Screen

clinical-objects-resources-spec.js

Source:clinical-objects-resources-spec.js Github

copy

Full Screen

1'use strict';2var clinicalObjectsResources = require('./clinical-objects-resources');3describe('Unit tests for write-back clinical object resources', function() {4    var resources = clinicalObjectsResources.getResourceConfig();5    it('should show that getResourceConfig() is functioning correctly', function() {6        expect(resources.length).to.equal(5);7        var findResource = resources[0];8        var getListResource = resources[1];9        var createResource = resources[2];10        var updateResource = resources[3];11        var readResource = resources[4];12        expect(findResource.name).to.be('clinical-object-find');13        expect(findResource.path).to.be('/find-clinical-object');14        expect(findResource.interceptors).to.eql({15            operationalDataCheck: false,16            synchronize: false17        });18        expect(findResource.requiredPermissions).to.be.an.array();19        expect(findResource.requiredPermissions).to.be.empty();20        expect(findResource.post).not.to.be.undefined();21        expect(getListResource.name).to.be('clinical-object-list-get');22        expect(getListResource.path).to.be('/get-clinical-object-list');23        expect(getListResource.interceptors).to.eql({24            operationalDataCheck: false,25            synchronize: false26        });27        expect(getListResource.requiredPermissions).to.be.an.array();28        expect(getListResource.requiredPermissions).to.be.empty();29        expect(getListResource.get).not.to.be.undefined();30        expect(createResource.name).to.be('clinical-object-add');31        expect(createResource.path).to.be.empty();32        expect(createResource.interceptors).to.eql({33            operationalDataCheck: false,34            synchronize: false35        });36        expect(createResource.requiredPermissions).to.be.an.array();37        expect(createResource.requiredPermissions).to.be.empty();38        expect(createResource.post).not.to.be.undefined();39        expect(readResource.name).to.be('clinical-object-read');40        expect(readResource.path).to.be('/:resourceId');41        expect(readResource.interceptors).to.eql({42            operationalDataCheck: false,43            synchronize: false44        });45        expect(readResource.requiredPermissions).to.be.an.array();46        expect(readResource.requiredPermissions).to.be.empty();47        expect(readResource.get).not.to.be.undefined();48    });...

Full Screen

Full Screen

PostTestFactory.js

Source:PostTestFactory.js Github

copy

Full Screen

...3import readResource from "./readResource";4jest.mock("../../lib/api");5export default class PostTestFactory {6  createTests(postId) {7    const body = readResource("blog", `${postId}.md`);8    const snapshots = JSON.parse(readResource("snapshots", `${postId}.json`));9    describe(`${postId}: ${body.split("\n")[0]}`, () => {10      new FileInterpreter()11        .beforeTest(context => {12          const { set } = context;13          const { container, debug } = renderApp();14          set("container", container);15          set("debug", debug);16        })17        .configure(({ set }) => set("snapshots", snapshots))18        .interpretFile(body);19    });20  }21}22process.on("uncaughtException", function(err) {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3    const browser = await remote({4        capabilities: {5        }6    });7    const data = await browser.execute('mobile: readResource', {

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.init({2}).then(function() {3  return driver.readResource("test.html");4}).then(function(resourceContent) {5  console.log(resourceContent);6});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const fs = require('fs');3(async () => {4    const browser = await remote({5        capabilities: {6        }7    });8    const resource = await browser.readResource('path/to/resource');9    fs.writeFileSync('path/to/save', resource);10    await browser.deleteSession();11})();12const { remote } = require('webdriverio');13const fs = require('fs');14(async () => {15    const browser = await remote({16        capabilities: {17        }18    });19    const resource = await browser.readResource('path/to/resource');20    fs.writeFileSync('path/to/save', resource);21    await browser.deleteSession();22})();23const { remote } = require('webdriverio');24const fs = require('fs');25(async () => {26    const browser = await remote({27        capabilities: {28        }29    });30    const resource = await browser.readResource('

Full Screen

Using AI Code Generation

copy

Full Screen

1const fs = require('fs');2const path = require('path');3const { remote } = require('webdriverio');4const { readResource } = require('appium-xcuitest-driver');5(async () => {6    const browser = await remote({7        capabilities: {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2async function test() {3  const browser = await remote({4    capabilities: {5      appium: {6      },7    },8  });9  console.log(resource);10}11test();

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = new iosDriver();2driver.readResource("test.txt", function(err, data) {3    if (err) {4        console.log(err);5    } else {6        console.log(data);7    }8});9var driver = new iosDriver();10driver.writeResource("test.txt", "This is a test", function(err) {11    if (err) {12        console.log(err);13    } else {14        console.log("File written successfully");15    }16});17var driver = new iosDriver();18driver.deleteResource("test.txt", function(err) {19    if (err) {20        console.log(err);21    } else {22        console.log("File deleted successfully");23    }24});25var driver = new iosDriver();26driver.pullFolder("/path/to/folder", function(err, zipData) {27    if (err) {28        console.log(err);29    } else {30        console.log(zipData);31    }32});33var driver = new iosDriver();34driver.pushFile("/path/to/file", "file content", function(err) {35    if (err) {36        console.log(err);37    } else {38        console.log("File pushed successfully");39    }40});41var driver = new iosDriver();42driver.pullFile("/path/to/file", function(err, data) {43    if (err) {44        console.log(err);45    } else {46        console.log(data);47    }48});49var driver = new iosDriver();50driver.pullFileFromSandbox("filename", function(err, data) {51    if (err) {52        console.log(err);53    } else {54        console.log(data);55    }56});57var driver = new iosDriver();58driver.pushFileToSandbox("filename", "file content", function(err) {59    if (err) {60        console.log(err);61    } else {62        console.log("File pushed successfully");63    }64});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var fs = require('fs');4var path = require('path');5var os = require('os');6var app = require(path.resolve(__dirname, './app.json'));7var serverConfig = {8};9var driver = wd.promiseChainRemote(serverConfig);10var desired = {11};12  .init(desired)13  .then(function () {14    return driver.readResource('en.lproj/Localizable.strings');15  })16  .then(function (res) {17    console.log(res);18    return driver.quit();19  })20  .catch(function (err) {21    console.error('Error: ' + err);22  });23{24}25appium.txt (1.3 MB)

Full Screen

Using AI Code Generation

copy

Full Screen

1const XCUITestDriver = require('appium-xcuitest-driver');2const driver = new XCUITestDriver();3driver.readResource('path/to/file', function(err, contents) {4  if (err) {5  }6});

Full Screen

Using AI Code Generation

copy

Full Screen

1const xcuitest = require('appium-xcuitest-driver');2const fs = require('fs');3const driver = new xcuitest.XCUITestDriver();4const filePathOnDevice = '/var/mobile/Containers/Data/Application/9B9B9B9B-9B9B-9B9B-9B9B-9B9B9B9B9B9B/Documents/myFile.txt';5const fileContent = driver.readResource(filePathOnDevice);6console.log('file content: ' + fileContent);7const xcuitest = require('appium-xcuitest-driver');8const fs = require('fs');9const driver = new xcuitest.XCUITestDriver();10const filePathOnDevice = '/var/mobile/Containers/Data/Application/9B9B9B9B-9B9B-9B9B-9B9B-9B9B9B9B9B9B/Documents/myFile.txt';11const fileContent = driver.readResource(filePathOnDevice);12console.log('file content: ' + fileContent);13const xcuitest = require('appium-xcuitest-driver');14const fs = require('fs');15const driver = new xcuitest.XCUITestDriver();16const filePathOnDevice = '/var/mobile/Containers/Data/Application/9B9B9B9B-9B9B-9B9B-9B9B-9B9B9B9B9B9B/Documents/myFile.txt';17const fileContent = driver.readResource(filePathOnDevice);18console.log('file content: ' + fileContent);19const xcuitest = require('appium-xc

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful