在Espresso中单击具有相同ID的许多视图的一个视图

时间:2018-02-01 07:46:58

标签: android android-espresso

我有一个布局(A),包括多次另一个布局(B)。布局B包含一个ID为R.id.my_button的按钮。因此,布局A包含许多具有相同ID的按钮。

如何使用浓缩咖啡测试这些按钮中的任何一个?

我唯一的一个独特信息是我知道布局A中布局B的位置(例如布局中的布局为my_layout1。)

与此不同,我没有独特的信息。 Clicking on one of many views with same id in Espresso 我试过这个, onChildView and hasSiblings with Espresso

1 个答案:

答案 0 :(得分:1)

暂时,我每次添加视图时都会标记按钮,而使用es module.exports.update = function(req, res) { var body = _.pick(req.body, 'email', 'first_name', 'last_name', 'role', 'clinic_id', 'profile_id'); if (!_.isString(body.email) || !_.isString(body.first_name) || body.email.length == 0 || body.first_name.length == 0) { res.status(404).send(); } else { var userUpdate = req.body; var selector = { email: userUpdate.email }; userUpdate.updatedAt = new Date().getTime(); //*********req object and userUpdate have data till this point**************// db.user.update(userUpdate, { where: selector }) .then(function(result) { // ****req object and userUpdate are not defined here. WHY?? mailer.sendActivateEmail(result); // sending response to front end res.json(result); }).catch(function(e) { res.status(500).json(e); console.log("error updating user:", e); }); } };