chromeless icon indicating copy to clipboard operation
chromeless copied to clipboard

Interacting with an Auth0 Login

Open export-mike opened this issue 6 years ago • 3 comments

Hi I'm at the beginning stages of adding e2e tests to a project with chromeless.

My app uses Auth0 and navigates to their hosted login page if login check fails on first load of the application.

So this happens at the start of my e2e test.

I have the following snippet I'm using:


const { Chromeless } = require('chromeless')

async function run() {
  const chromeless = new Chromeless()

  const screenshot = await chromeless
    .goto('MyApp.com')
    .wait('input')
    .type('[email protected], 'input[type="email"]')
    .type('pass', 'input[type="password"]')
    .click('.auth0-label-submit')
    .screenshot()

  console.log(screenshot) // prints local file path or S3 url

  await chromeless.end()
}

run().catch(console.error.bind(console))

I'm getting an error from chrome-remote-interface:

   { Error: Element is not focusable
    at /Users/mikejames/projects/company/myApp/node_modules/chrome-remote-interface/lib/chrome.js:90:30
    at Chrome.handleMessage (/Users/mikejames/projects/company/myApp/node_modules/chrome-remote-interface/lib/chrome.js:289:13)
    at WebSocket.<anonymous> (/Users/mikejames/projects/company/myApp/node_modules/chrome-remote-interface/lib/chrome.js:266:27)
    at emitTwo (events.js:125:13)
    at WebSocket.emit (events.js:213:7)
    at Receiver._receiver.onmessage (/Users/mikejames/projects/company/myApp/node_modules/ws/lib/WebSocket.js:143:54)
    at Receiver.dataMessage (/Users/mikejames/projects/company/myApp/node_modules/ws/lib/Receiver.js:385:14)
    at extension.decompress (/Users/mikejames/projects/company/myApp/node_modules/ws/lib/Receiver.js:354:40)
    at _inflate.flush (/Users/mikejames/projects/company/myApp/node_modules/ws/lib/PerMessageDeflate.js:279:12)
    at afterWrite (_stream_writable.js:438:3)
    at onwrite (_stream_writable.js:429:7)
  response: { code: -32000, message: 'Element is not focusable' } }
Component Version
Operating system OSX 10.13.1
Node.js 8.1.3
Chrome/Chromium/... Chrome
chrome-remote-interface 0.24.5

Is Chrome running in a container? NO

export-mike avatar Nov 16 '17 06:11 export-mike

Not sure if this help but instead of .click(..) can you try .press(13) ?

From error message its not 100% certain which element is not focusable. It could be there is some disabling of the email control after page has loaded OR the password input control when an email has been filled in.

rippo avatar Nov 16 '17 07:11 rippo

It seems to be failing on interacting with the auth0 input[type="email"]

"Element is not focusable"

export-mike avatar Nov 16 '17 22:11 export-mike

Also are you sure you're waiting for the right thing? input is pretty generic and you may have an input load before the inputs of interest.

dan-kez avatar Apr 14 '18 22:04 dan-kez