asked    Bella     2018-10-22       android       99 view        1 Answer

[SOLVED] How do I import espresso withID on android studio?

I am trying to write a unit test with espresso for my application, but whenever I try to use withId, it cannot be found. How do I fix this?

onView works fine, but when I try onView(withId) it doesn't work.

Here is my code:

package com.example.webowner.authenticate;

import android.content.Context;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.espresso.Espresso;
import android.support.test.rule.ActivityTestRule;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.;


import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.junit.Assert.*;

public class MainActivityTest {

    @Rule
    public ActivityTestRule<MainActivity> mainActivityActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class);

    @Test
    public void testLoginButton_shouldBeDisplayed()
    {
        //
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }
}

  1 Answer  

        answered    Jeremy     2018-10-22      

You should import following:

import static android.support.test.espresso.matcher.ViewMatchers.withId;

Hope this works!





Your Answer





 2018-10-22         Iris

Session is not maintaining on node js

I'm having one home ,login page if user get successfully login it should redirects him to dashboard . This part is working fine but if i try to open that link like http://localhost:9090/dashboard it get opens.I Want if user is not logged in he should never be able to open dashboard pagemodule.exports = function(app, passport){app.get('/', function(req, res){ res.render('index.ejs');});app.get('/login', function(req, res){ res.render('login.ejs', { message: req.flash('loginMessage') });});app.post('/login', passport.authenticate('local-login', { successRedirect: ...
 node.js                     1 answers                     77 view
 2018-10-22         Ethel

which authentiation to use

Our application is currently written in .NET Framework + Razor, and traditional Membership authentication.I am trying to modernize it, so I stawted to work on a .net core + react solution, but it has to cooperate with the existing application.So currently, we have the old monolit, and an other .net core apis, called by react. The react is embedded inside the Razor.Now I need to choose what authentication to use. I guess membership and other session based authentications can't be used, because there are multiple apps in multiple domains. So I need tokens.I am not really sure...
 security                     1 answers                     80 view
 2018-10-22         Dana

ASP.Net application switch between login types (ADFS, Username/Password)

We have an web application written in .net 3.5 that we deploy for various clients and that uses a regular Forms login username/password.We have a requirement to make it work with ADFS also. The issue is that we would like to be able to keep both login methods, and have one for some clients, and one for others, so we would like to keep most of it at a config level.Exactly what would be the correct method to achieve this result? You can change it at the config level and choose your preferred localAuthenticationTypes.In Windows Explorer, browse to C:\inetpub\adfs\ls (assumi...
 asp.net                     1 answers                     82 view