Hi Team! Can someone help me, I need to execute th...
# e2e-testing
l
Hi Team! Can someone help me, I need to execute this code inside a cypress automation, this code is in a .js file and if I copy and paste it inside the describe that contains the spec.cy.js. I get errors and the test fails. // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 var awsIot = require('aws-iot-device-sdk'); // // Replace the values of '' and '' // with a unique client identifier and custom host endpoint provided in AWS IoT. // NOTE: client identifiers must be unique within your AWS account; if a client attempts // to connect with a client identifier which is already in use, the existing // connection will be terminated. // var device = awsIot.device({ keyPath: '88888888.pem.key' certPath: '99999999.pem.crt', caPath: 'RXTTT.pem', clientId: 'test', host: 'vfrgtyuhhhh.amazonaws.com' }); // // Device is an instance returned by mqtt.Client(), see mqtt.js for full // documentation. // device .on('connect', function() { console.log('connect'); /* device.subscribe('topic_1'); */ device.publish('topic_2', 'Message'); console.log('Message send Succesfully .......'); }); device .on('message', function(topic, payload) { console.log('message', topic, payload.toString()); });