By using Cypress cy.task
Simply define your aws-sdk command in plugins/index.js
on task and make sure to include
AWS.config.update({region: *REGIONNAME*})
And set your cy.task(doSomething)
in your browser test.
Plugin/index.js
on('task', {
getOrg(orgid) {
var AWS = require("aws-sdk");
AWS.config.update({region: *REGIONNAME*}
//e.g AWS SDK command to get a organisation id from dynamodb
Return *null or value or true etc*
}
}
Cypress test example test.js
orgid = 123;
cy.task ("getOrg",orgid)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…