Best JavaScript code snippet using devicefarmer-stf
all.test.ts
Source:all.test.ts
...97 id: user?.id.toString(),98 username: user?.username,99 createdAt: user?.createdAt.toJSON(),100 isConfirmed: false,101 token: createAccessToken(user!),102 },103 error: null,104 },105 },106 });107 });108 test("should me query", async () => {109 const user = await getRepository(User).findOne(1);110 const response = await graphqlCall({111 source: ME_QUERY,112 token: createAccessToken(user!),113 });114 expect(response).toMatchObject({115 data: {116 me: {117 id: user?.id.toString(),118 username: user?.username,119 createdAt: user?.createdAt.toJSON(),120 isConfirmed: false,121 },122 },123 });124 });125 test("should forgot password", async () => {126 const user = await getRepository(User).findOne(1);127 const response = await graphqlCall({128 source: FORGOT_PASSWORD_MUTATION,129 variableValues: {130 email: user?.email,131 },132 });133 expect(response).toMatchObject({134 data: {135 forgotPassword: {136 successMessage: `A verification message has been sent to email ${user?.email}.`,137 error: null,138 },139 },140 });141 });142 test("should reset password", async () => {143 const user = await getRepository(User).findOne(1);144 const newTestPassword = "#@$@ASFjasdklf3u49iqjriajisjfmiansf";145 const response = await graphqlCall({146 source: RESET_PASSWORD_MUTATION,147 variableValues: {148 payload: {149 token: createRefreshToken(user!),150 password: newTestPassword,151 confirmPassword: newTestPassword,152 },153 },154 });155 const updatedUser = await getRepository(User).findOne(1);156 const token = response.data?.resetPassword.user.token;157 expect(response).toMatchObject({158 data: {159 resetPassword: {160 user: {161 id: user?.id.toString(),162 username: user?.username,163 createdAt: user?.createdAt.toJSON(),164 isConfirmed: false,165 token,166 },167 },168 },169 });170 expect(compare(updatedUser!.password, newTestPassword)).toBeTruthy();171 });172 test("should update username", async () => {173 const user = await getRepository(User).findOne(1);174 const newUsername = name.firstName();175 const response = await graphqlCall({176 source: UPDATE_USERNAME_MUTATION,177 variableValues: {178 username: newUsername,179 },180 token: createAccessToken(user!),181 });182 const updatedUser = await getRepository(User).findOne(1);183 expect(response).toMatchObject({184 data: {185 updateUsername: {186 successMessage: "Username has been successfully updated.",187 error: null,188 },189 },190 });191 expect(updatedUser?.username).toBe(newUsername);192 });193 test("should update password", async () => {194 const user = await getRepository(User).findOne(1);195 const password = "#@$@ASFjasdklf3u49iqjriajisjfmiansf";196 const newPassword = "AF#$@#AFkjfdje3294829";197 const response = await graphqlCall({198 source: UPDATE_PASSWORD_MUTATION,199 variableValues: {200 password,201 newPassword,202 confirmPassword: newPassword,203 },204 token: createAccessToken(user!),205 });206 const updatedUser = await getRepository(User).findOne(1);207 expect(response).toMatchObject({208 data: {209 updatePassword: {210 successMessage: "Password has been successfully updated.",211 error: null,212 },213 },214 });215 expect(compare(newPassword, updatedUser!.password)).toBeTruthy();216 });217 test("should send confirmation email", async () => {218 const user = await getRepository(User).findOne(1);219 const response = await graphqlCall({220 source: SEND_CONFIRMATION_EMAIL_MUTATION,221 token: createAccessToken(user!),222 });223 expect(response).toMatchObject({224 data: {225 sendConfirmationEmail: true,226 },227 });228 });229 test("should confirm user", async () => {230 const user = await getRepository(User).findOne(1);231 const response = await graphqlCall({232 source: CONFIRM_USER_MUTATION,233 variableValues: {234 token: createRefreshToken(user!),235 },236 });237 const confirmedUser = await getRepository(User).findOne(1);238 expect(response).toMatchObject({239 data: {240 confirmUser: true,241 },242 });243 expect(confirmedUser?.isConfirmed).toBeTruthy();244 });245});246// ------------------PostResolver----------------------247describe("post resolvers", () => {248 test("should posts", async () => {249 const posts = await getRepository(Post).find();250 const response = await graphqlCall({251 source: POSTS_QUERY,252 variableValues: {253 limit: 15,254 cursor: null,255 },256 });257 expect(response).toMatchObject({258 data: {259 posts: {260 hasMore: false,261 posts: [],262 },263 },264 });265 expect(posts.length).toBe(0);266 });267 test("should get a post", async () => {});268 test("should create a post", async () => {269 const post = {270 title: "My first post",271 body: "adjfkladsjfkladsjflkjewalrkje",272 } as CreatePostInput;273 const user = await getRepository(User).findOne(1);274 const response = await graphqlCall({275 variableValues: {276 post,277 },278 source: CREATE_POST_MUTATION,279 token: createAccessToken(user!),280 });281 const newPost = response.data?.createPost.post;282 expect(response).toMatchObject({283 data: {284 createPost: {285 post: {286 id: newPost?.id.toString(),287 title: newPost?.title,288 body: newPost?.body,289 createdAt: newPost?.createdAt,290 creator: {291 id: user!.id.toString(),292 username: user!.username,293 },294 },295 error: null,296 },297 },298 });299 });300 test("should edit a post", async () => {301 const user = await getRepository(User).findOne(1);302 const updatedPostInput = {303 id: "1",304 title: "My first updated post",305 body: "ddajskluoqj34lkmdsafklkadsfmaklsj3qkl4jqkwl3jrlkasdjfajl",306 } as EditPostInput;307 const response = await graphqlCall({308 source: EDIT_POST_MUTATION,309 variableValues: {310 post: updatedPostInput,311 },312 token: createAccessToken(user!),313 });314 const updatedPost = await getRepository(Post).findOne(1);315 expect(response).toMatchObject({316 data: {317 editPost: {318 post: {319 id: updatedPost?.id.toString(),320 title: updatedPost?.title,321 body: updatedPost?.body,322 createdAt: updatedPost?.createdAt.toJSON(),323 creator: {324 id: user!.id.toString(),325 username: user!.username,326 },327 },328 error: null,329 },330 },331 });332 });333});334// ------------------CommentResolver----------------------335describe("comment resolvers", () => {336 test("should create a comment", async () => {337 const user = await getRepository(User).findOne(1);338 const payload = {339 postId: "1",340 body: "ajskldfjewklrjalskfjladsjflkasjrlkaewjrlkj",341 } as CreateCommentInput;342 const response = await graphqlCall({343 source: CREATE_COMMENT_MUTATION,344 variableValues: {345 payload,346 },347 token: createAccessToken(user!),348 });349 const res = await graphqlCall({350 source: POST_QUERY,351 variableValues: {352 id: "1",353 },354 });355 const comment = await getRepository(Comment).findOne(1);356 const post = res.data?.post;357 const expectedComment = {358 id: comment?.id.toString(),359 body: comment?.body,360 createdAt: comment?.createdAt.toJSON(),361 commentator: {362 id: user?.id.toString(),363 username: user?.username,364 },365 };366 expect(response).toMatchObject({367 data: {368 createComment: {369 comment: expectedComment,370 error: null,371 },372 },373 });374 expect(post?.comments).toEqual([{ ...expectedComment }]);375 });376 test("should edit a comment", async () => {377 const payload = {378 commentId: "1",379 body: "sdklfjaskldfjakljrio3u4adfkljadklfj",380 } as EditCommentInput;381 const user = await getRepository(User).findOne(1);382 const response = await graphqlCall({383 source: EDIT_COMMENT_MUTATION,384 variableValues: {385 payload,386 },387 token: createAccessToken(user!),388 });389 const comment = await getRepository(Comment).findOne(1);390 const expectedComment = {391 id: comment?.id.toString(),392 body: payload.body,393 createdAt: comment?.createdAt.toJSON(),394 commentator: {395 id: user?.id.toString(),396 username: user?.username,397 },398 };399 const postResponse = await graphqlCall({400 source: POST_QUERY,401 variableValues: { id: "1" },402 });403 const post = postResponse.data?.post;404 expect(response).toMatchObject({405 data: {406 editComment: {407 comment: { ...expectedComment },408 error: null,409 },410 },411 });412 expect(post?.comments).toEqual([413 {414 ...expectedComment,415 },416 ]);417 expect(post?.comments.length).toBe(1);418 });419 test("should delete a comment", async () => {420 const user = await getRepository(User).findOne(1);421 const response = await graphqlCall({422 source: DELETE_COMMENT_MUTATION,423 variableValues: {424 id: "1",425 },426 token: createAccessToken(user!),427 });428 const postResponse = await graphqlCall({429 source: POST_QUERY,430 variableValues: {431 id: "1",432 },433 });434 const post = postResponse.data?.post;435 const deletedComment = await getRepository(Comment).findOne(1);436 expect(response).toMatchObject({437 data: {438 deleteComment: true,439 },440 });441 expect(deletedComment).toBeUndefined();442 expect(post?.comments.length).toBe(0);443 });444});445// -----------------------VoteResolver------------------446describe("vote resolver", () => {447 test("should upvote a post", async () => {448 const user = await getRepository(User).findOne(1);449 const response = await graphqlCall({450 source: VOTE_MUTATION,451 variableValues: {452 postId: "1",453 point: 1,454 },455 token: createAccessToken(user!),456 });457 const res = await graphqlCall({458 source: POST_QUERY,459 variableValues: {460 id: "1",461 },462 });463 const post = res.data?.post;464 expect(response).toMatchObject({465 data: {466 vote: true,467 },468 });469 expect(post?.votes).toEqual([470 {471 postId: post?.id.toString(),472 userId: user?.id.toString(),473 point: 1,474 },475 ]);476 expect(post?.points).toBe(1);477 });478 test("should downvote a post", async () => {479 const user = await getRepository(User).findOne(1);480 const response = await graphqlCall({481 source: VOTE_MUTATION,482 variableValues: {483 postId: "1",484 point: -1,485 },486 token: createAccessToken(user!),487 });488 const res = await graphqlCall({489 source: POST_QUERY,490 variableValues: {491 id: "1",492 },493 });494 const post = res.data?.post;495 expect(response).toMatchObject({496 data: {497 vote: true,498 },499 });500 expect(post?.votes).toEqual([501 {502 postId: post?.id.toString(),503 userId: user?.id.toString(),504 point: -1,505 },506 ]);507 expect(post?.points).toBe(-1);508 });509 test("should cancel a vote", async () => {510 const user = await getRepository(User).findOne(1);511 const response = await graphqlCall({512 source: VOTE_MUTATION,513 variableValues: {514 postId: "1",515 point: 0,516 },517 token: createAccessToken(user!),518 });519 const res = await graphqlCall({520 source: POST_QUERY,521 variableValues: {522 id: "1",523 },524 });525 const post = res.data?.post;526 expect(response).toMatchObject({527 data: {528 vote: true,529 },530 });531 expect(post?.votes).toEqual([]);532 expect(post?.points).toBe(0);533 });534});535// -----------------------CommunityResolver------------------536describe("community resolvers", () => {537 test("should create a community", async () => {538 const user = await getRepository(User).findOne(1);539 const response = await graphqlCall({540 source: CREATE_COMMUNITY_MUTATION,541 variableValues: {542 name: "fullstack",543 },544 token: createAccessToken(user!),545 });546 const community = await getRepository(Community).findOne(1);547 expect(response).toMatchObject({548 data: {549 createCommunity: {550 community: {551 id: community?.id.toString(),552 name: community?.name,553 description: null,554 numberOfMembers: 0,555 members: [],556 posts: [],557 },558 error: null,559 },560 },561 });562 });563 test("should return a community", async () => {564 const response = await graphqlCall({565 source: COMMUNITY_QUERY,566 variableValues: {567 name: "fullstack",568 },569 });570 expect(response).toMatchObject({571 data: {572 community: {573 id: "1",574 name: "fullstack",575 description: null,576 numberOfMembers: 0,577 members: [],578 posts: [],579 },580 },581 });582 });583 test("should join in a community", async () => {584 const user = await getRepository(User).findOne(1);585 const response = await graphqlCall({586 source: JOIN_COMMUNITY_MUTATION,587 variableValues: {588 commId: "1",589 },590 token: createAccessToken(user!),591 });592 const { data } = await graphqlCall({593 source: COMMUNITY_QUERY,594 variableValues: {595 name: "fullstack",596 },597 });598 const community = data?.community;599 expect(response).toMatchObject({600 data: {601 joinCommunity: true,602 },603 });604 expect(community?.members).toEqual([605 {606 id: user?.id.toString(),607 username: user?.username,608 },609 ]);610 expect(community?.numberOfMembers).toBe(1);611 });612 test("should leave a community", async () => {613 const user = await getRepository(User).findOne(1);614 const response = await graphqlCall({615 source: LEAVE_COMMUNITY_MUTATION,616 variableValues: {617 commId: "1",618 },619 token: createAccessToken(user!),620 });621 const { data } = await graphqlCall({622 source: COMMUNITY_QUERY,623 variableValues: {624 name: "fullstack",625 },626 });627 const community = data?.community;628 expect(response).toMatchObject({629 data: {630 leaveCommunity: true,631 },632 });633 expect(community?.members).toEqual([]);634 expect(community?.numberOfMembers).toBe(0);635 });636 test("should add a description", async () => {637 const community = {638 id: "1",639 description: "fjaslfkjadslkfjaslfjaksldfj",640 };641 const user = await getRepository(User).findOne(1);642 const response = await graphqlCall({643 source: ADD_DESCRIPTION_MUTATION,644 variableValues: community,645 token: createAccessToken(user!),646 });647 const updatedCommunity = await getRepository(Community).findOne(1);648 expect(response).toMatchObject({649 data: {650 addDescription: {651 community: {652 id: updatedCommunity?.id.toString(),653 name: updatedCommunity?.name,654 description: community.description,655 numberOfMembers: 0,656 members: [],657 posts: [],658 },659 error: null,660 },661 },662 });663 });664});665describe("delete mutations", () => {666 test("should delete a post", async () => {667 const user = await getRepository(User).findOne(1);668 const response = await graphqlCall({669 source: DELETE_POST_MUTATION,670 variableValues: {671 id: "1",672 },673 token: createAccessToken(user!),674 });675 const posts = await getRepository(Post).find();676 const deletedPost = await getRepository(Post).findOne(1);677 expect(response).toMatchObject({678 data: {679 deletePost: true,680 },681 });682 expect(deletedPost).toBeUndefined();683 expect(posts.length).toBe(0);684 });685 test("should delete user", async () => {686 const user = await getRepository(User).findOne(1);687 const response = await graphqlCall({688 source: DELETE_USER_MUTATION,689 token: createAccessToken(user!),690 });691 const deletedUser = await getRepository(User).findOne(1);692 expect(response).toMatchObject({693 data: {694 deleteUser: true,695 },696 });697 expect(deletedUser).toBeUndefined();698 });...
test.att.dhs.oauth.js
Source:test.att.dhs.oauth.js
...76 dhs_name: 'dhs'77 }78 };79 });80 oauth.createAccessToken({81 app_scope: 'ACCOUNT_ID',82 success: function () {},83 error: function () {}84 });85 expect(getAppConfigurationStub.called).to.equal(true);86 getAppConfigurationStub.restore();87 });88 it('should throw an error if configuration does not have app_key and app_secret', function () {89 var getAppConfigurationStub = sinon.stub(config, 'getAppConfiguration', function () {90 return {};91 });92 expect(oauth.createAccessToken).to.throw('DHS configuration error. app_key and app_secret are mandatory');93 getAppConfigurationStub.restore();94 });95 describe('app_key and app_secret are configured', function () {96 var appConfig,97 getAppConfigurationStub;98 beforeEach(function () {99 appConfig = {100 app_key: 'appkey',101 app_secret: 'appsecret',102 api_endpoint: 'api_endpoint',103 authorize_uri: 'authorize_uri',104 info: {105 dhs_name: 'dhs_name'106 }107 };108 getAppConfigurationStub = sinon.stub(config, 'getAppConfiguration', function () {109 return appConfig;110 });111 });112 afterEach(function () {113 getAppConfigurationStub.restore();114 });115 it('Should throw error for invalid arguments', function () {116 expect(oauth.createAccessToken.bind(null)).to.throw('No app_scope provided');117 expect(oauth.createAccessToken.bind(null, {})).to.throw('No app_scope provided');118 expect(oauth.createAccessToken.bind(null, {119 app_scope: 'INVALID'120 })).to.throw('app_scope should be one of MOBILE_NUMBER, VIRTUAL_NUMBER, ACCOUNT_ID or E911');121 expect(oauth.createAccessToken.bind(null, {122 app_scope: 'MOBILE_NUMBER'123 })).to.throw('No auth_code provided');124 expect(oauth.createAccessToken.bind(null, {125 app_scope: 'MOBILE_NUMBER',126 auth_code: 'auth_code'127 })).to.throw('No success callback provided');128 expect(oauth.createAccessToken.bind(null, {129 app_scope: 'MOBILE_NUMBER',130 auth_code: 'auth_code',131 success: function () {}132 })).to.throw('No error callback provided');133 expect(oauth.createAccessToken.bind(null, {134 app_scope: 'MOBILE_NUMBER',135 auth_code: 'auth_code',136 success: function () {},137 error: function () {}138 })).to.not.throw();139 expect(oauth.createAccessToken.bind(null, {140 app_scope: 'VIRTUAL_NUMBER',141 success: function () {},142 error: function () {}143 })).to.not.throw();144 expect(oauth.createAccessToken.bind(null, {145 app_scope: 'ACCOUNT_ID',146 success: function () {},147 error: function () {}148 })).to.not.throw();149 expect(oauth.createAccessToken.bind(null, {150 app_scope: 'E911',151 success: function () {},152 error: function () {}153 })).to.not.throw();154 });155 it('should execute `restify.createStringClient` with correct params', function () {156 oauth.createAccessToken({157 app_scope: 'ACCOUNT_ID',158 success: function () {},159 error: function () {}160 });161 expect(createStringClientStub.called).to.equal(true);162 expect(createStringClientStub.getCall(0).args[0]).to.be.an('object');163 expect(createStringClientStub.getCall(0).args[0].url).to.equal(appConfig.api_endpoint);164 expect(createStringClientStub.getCall(0).args[0].userAgent).to.equal(appConfig.info.dhs_name);165 expect(createStringClientStub.getCall(0).args[0].accept).to.equal('application/json');166 expect(createStringClientStub.getCall(0).args[0].rejectUnauthorized).to.equal(false);167 });168 it('should invoke `post` with correct params for MOBILE_NUMBER', function () {169 restClientPostSpy = sinon.spy(restClientStub, 'post');170 oauth.createAccessToken({171 app_scope: 'MOBILE_NUMBER',172 auth_code: 'auth_code',173 success: function () {},174 error: function () {}175 });176 expect(restClientPostSpy.called).to.equal(true);177 expect(restClientPostSpy.getCall(0).args[0]).to.equal(appConfig.token_uri);178 expect(restClientPostSpy.getCall(0).args[1]).to.be.an('object');179 expect(restClientPostSpy.getCall(0).args[1].client_id).to.equal(appConfig.app_key);180 expect(restClientPostSpy.getCall(0).args[1].client_secret).to.equal(appConfig.app_secret);181 expect(restClientPostSpy.getCall(0).args[1].grant_type).to.equal('authorization_code');182 expect(restClientPostSpy.getCall(0).args[1].scope).to.equal('WEBRTCMOBILE');183 expect(restClientPostSpy.getCall(0).args[1].code).to.equal('auth_code');184 expect(restClientPostSpy.getCall(0).args[2]).to.be.a('function');185 restClientPostSpy.restore();186 });187 it('should invoke `post` with correct params for VIRTUAL_NUMBER', function () {188 restClientPostSpy = sinon.spy(restClientStub, 'post');189 oauth.createAccessToken({190 app_scope: 'VIRTUAL_NUMBER',191 success: function () {},192 error: function () {}193 });194 expect(restClientPostSpy.called).to.equal(true);195 expect(restClientPostSpy.getCall(0).args[0]).to.equal(appConfig.token_uri);196 expect(restClientPostSpy.getCall(0).args[1]).to.be.an('object');197 expect(restClientPostSpy.getCall(0).args[1].client_id).to.equal(appConfig.app_key);198 expect(restClientPostSpy.getCall(0).args[1].client_secret).to.equal(appConfig.app_secret);199 expect(restClientPostSpy.getCall(0).args[1].grant_type).to.equal('client_credentials');200 expect(restClientPostSpy.getCall(0).args[1].scope).to.equal('WEBRTC');201 expect(restClientPostSpy.getCall(0).args[2]).to.be.a('function');202 restClientPostSpy.restore();203 });204 it('should invoke `post` with correct params for ACCOUNT_ID', function () {205 restClientPostSpy = sinon.spy(restClientStub, 'post');206 oauth.createAccessToken({207 app_scope: 'ACCOUNT_ID',208 success: function () {},209 error: function () {}210 });211 expect(restClientPostSpy.called).to.equal(true);212 expect(restClientPostSpy.getCall(0).args[0]).to.equal(appConfig.token_uri);213 expect(restClientPostSpy.getCall(0).args[1]).to.be.an('object');214 expect(restClientPostSpy.getCall(0).args[1].client_id).to.equal(appConfig.app_key);215 expect(restClientPostSpy.getCall(0).args[1].client_secret).to.equal(appConfig.app_secret);216 expect(restClientPostSpy.getCall(0).args[1].grant_type).to.equal('client_credentials');217 expect(restClientPostSpy.getCall(0).args[1].scope).to.equal('WEBRTC');218 expect(restClientPostSpy.getCall(0).args[2]).to.be.a('function');219 restClientPostSpy.restore();220 });221 describe('resclient /POST : callback with error', function () {222 var restClientPostStub,223 errorSpy,224 error;225 beforeEach(function () {226 error = {227 error: 'error'228 };229 errorSpy = sinon.spy();230 restClientPostStub = sinon.stub(restClientStub, 'post', function (url, payload, callback) {231 callback(error, {}, {}, {});232 });233 });234 afterEach(function () {235 restClientPostStub.restore();236 });237 it('Should call the error callback if post returns with an error', function () {238 oauth.createAccessToken({239 app_scope: 'ACCOUNT_ID',240 success: function () {},241 error: errorSpy242 });243 expect(errorSpy.calledWith(error)).to.equal(true);244 });245 });246 describe('resclient /POST : callback with success', function () {247 var restClientPostStub,248 successSpy,249 result;250 beforeEach(function () {251 result = '{"result": "result"}';252 successSpy = sinon.spy();253 restClientPostStub = sinon.stub(restClientStub, 'post', function (url, payload, callback) {254 callback(null, {}, {}, result);255 });256 });257 afterEach(function () {258 restClientPostStub.restore();259 });260 it('Should call the success callback if post returns with a success', function () {261 oauth.createAccessToken({262 app_scope: 'ACCOUNT_ID',263 success: successSpy,264 error: function () {}265 });266 expect(successSpy.calledWith(JSON.parse(result))).to.equal(true);267 });268 });269 });270 });271 });...
Using AI Code Generation
1var Client = require('devicefarmer-stf-client');2var client = new Client();3client.createAccessToken('device-id')4var Client = require('devicefarmer-stf-client');5var client = new Client();6client.createAccessToken('device-id')7var Client = require('devicefarmer-stf-client');8var client = new Client();9client.createAccessToken('device-id')10var Client = require('devicefarmer-stf-client');11var client = new Client();12client.createAccessToken('device-id')13var Client = require('devicefarmer-stf-client');14var client = new Client();15client.createAccessToken('device-id')16var Client = require('devicefarmer-stf-client');17var client = new Client();18client.createAccessToken('device-id')19var Client = require('devicefarmer-stf-client');20var client = new Client();21client.createAccessToken('device-id')22var Client = require('devicefarmer-stf-client');23var client = new Client();24client.createAccessToken('device-id')25var Client = require('devicefarmer-stf-client');26var client = new Client();27client.createAccessToken('device-id')28var Client = require('devicefarmer-stf-client');29var client = new Client();30client.createAccessToken('device-id')31var Client = require('devicefarmer-stf-client');32var client = new Client();33client.createAccessToken('device-id')34var Client = require('devicefarmer-stf-client');35var client = new Client();36client.createAccessToken('device-id')37var Client = require('devicefarmer-stf-client');
Using AI Code Generation
1var stf = require('devicefarmer-stf-client');2var device = new stf.Device(stfClient, '3a2e4c5b');3device.createAccessToken().then(function(token) {4 console.log(token);5}).catch(function(err) {6 console.error(err);7});8var stf = require('devicefarmer-stf-client');9var device = new stf.Device(stfClient, '3a2e4c5b');10device.createAccessToken().then(function(token) {11 console.log(token);12 return device.connect(token);13}).then(function() {14 console.log('Connected');15}).catch(function(err) {16 console.error(err);17});18var stf = require('devicefarmer-stf-client');19var device = new stf.Device(stfClient, '3a2e4c5b');20device.createAccessToken().then(function(token) {21 console.log(token);22 return device.connect(token);23}).then(function
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!