Closed bjowes closed 3 years ago
Hi,
When you do cy.ntlm(ntlmHost, username, password)
, you have replaced the variables with your actual site? In the error message in cypress, is that the same site responding with 401 that you configured in the cy.ntlm call?
Also, and alternative to cy.ntlm is cy.ntlmSso, which might be easier to get started, if you can access your test site with the same account that is executing cypress.
Hi Bjorn,
Thanks for your prompt response. I would love to use cypress but this hurdle getting past 401 is in my way.
Yes, I have replaced with the values. cy.ntlm("https://doe.gov", "username", "mypassword")
Thanks, Sarita
On Mon, Jun 29, 2020 at 2:25 AM Björn Weström notifications@github.com wrote:
Hi,
When you do cy.ntlm(ntlmHost, username, password), you have replaced the variables with your actual site? In the error message in cypress, is that the same site responding with 401 that you configured in the cy.ntlm call?
Also, and alternative to cy.ntlm is cy.ntlmSso, which might be easier to get started, if you can access your test site with the same account that is executing cypress.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-650948159, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIEDYI5BIEBP7A3VAW3RZAXU5ANCNFSM4OK6GLLA .
-- Thanks, sarita
Please let me know if we can do screenshare using skype for business?
On Mon, Jun 29, 2020 at 2:25 AM Björn Weström notifications@github.com wrote:
Hi,
When you do cy.ntlm(ntlmHost, username, password), you have replaced the variables with your actual site? In the error message in cypress, is that the same site responding with 401 that you configured in the cy.ntlm call?
Also, and alternative to cy.ntlm is cy.ntlmSso, which might be easier to get started, if you can access your test site with the same account that is executing cypress.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-650948159, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIEDYI5BIEBP7A3VAW3RZAXU5ANCNFSM4OK6GLLA .
-- Thanks, sarita
From the screenshot it seems that the host name should be eeredocman.ee.doe.gov. You need to specify full host name with cy.ntlm
With SSO you could try cy.ntlmSso(['*.doe.gov'])
Hi Bjorn,
Tried with cy.ntlmSso(["*.ee.doe.gov"]) gives 200 but when I try to access the application link I get 401. Please take a look at the screenshots. Also, where do I pass user and password with Sso function?
On Mon, Jun 29, 2020 at 2:01 PM Sarita S emailsarita2@gmail.com wrote:
Hi Bjorn,
Yes, I did exactly the steps you mentioned. Please take a look at the screenshots and would appreciate if you could help me out here.
On Mon, Jun 29, 2020 at 10:40 AM Björn Weström notifications@github.com wrote:
With SSO you could try cy.ntlmSso(['*.doe.gov'])
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651164871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIGSHLDKK2K7EYHOYJ3RZCRULANCNFSM4OK6GLLA .
-- Thanks, sarita
-- Thanks, sarita
here are the screenshots when ran with cy.ntlmSso
On Mon, Jun 29, 2020 at 2:10 PM Sarita S emailsarita2@gmail.com wrote:
Hi Bjorn,
Tried with cy.ntlmSso(["*.ee.doe.gov"]) gives 200 but when I try to access the application link I get 401. Please take a look at the screenshots. Also, where do I pass user and password with Sso function?
On Mon, Jun 29, 2020 at 2:01 PM Sarita S emailsarita2@gmail.com wrote:
Hi Bjorn,
Yes, I did exactly the steps you mentioned. Please take a look at the screenshots and would appreciate if you could help me out here.
On Mon, Jun 29, 2020 at 10:40 AM Björn Weström notifications@github.com wrote:
With SSO you could try cy.ntlmSso(['*.doe.gov'])
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651164871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIGSHLDKK2K7EYHOYJ3RZCRULANCNFSM4OK6GLLA .
-- Thanks, sarita
-- Thanks, sarita
-- Thanks, sarita
Can't see any screenshots. For cy.ntlmSso, no username or password are needed. The plugin will automatically use the current windows user account that is starting up cypress. So that user must have access to the site you want to test for this approach to work. If you need to use another account, cy.ntlm is the way to go.
Trying to send again the screenshots.
this is the code i'm trying to run:
describe('MyTestSuite', function() { it('Verify title of the page', function() {
cy.ntlmSso(["*.ee.doe.gov"])
cy.visit("https://eeredocman.ee.doe.gov"
})
})
On Mon, Jun 29, 2020 at 5:20 PM Björn Weström notifications@github.com wrote:
Can't see any screenshots. For cy.ntlmSso, no username or password are needed. The plugin will automatically use the current windows user account that is starting up cypress. So that user must have access to the site you want to test for this approach to work. If you need to use another account, cy.ntlm is the way to go.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651373466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIH4IXQ2RPY3ZTF4SLDRZEAQBANCNFSM4OK6GLLA .
-- Thanks, sarita
I would appreciate if you get a chance to join me on skype to resolve this issue:
https://join.skype.com/invite/xwsEdt4KlCZc
On Mon, Jun 29, 2020 at 5:26 PM Sarita S emailsarita2@gmail.com wrote:
Trying to send again the screenshots.
this is the code i'm trying to run:
describe('MyTestSuite', function() { it('Verify title of the page', function() {
cy.ntlmSso(["*.ee.doe.gov"]) cy.visit("https://eeredocman.ee.doe.gov"
})
})
On Mon, Jun 29, 2020 at 5:20 PM Björn Weström notifications@github.com wrote:
Can't see any screenshots. For cy.ntlmSso, no username or password are needed. The plugin will automatically use the current windows user account that is starting up cypress. So that user must have access to the site you want to test for this approach to work. If you need to use another account, cy.ntlm is the way to go.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651373466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIH4IXQ2RPY3ZTF4SLDRZEAQBANCNFSM4OK6GLLA .
-- Thanks, sarita
-- Thanks, sarita
this is the actual error i'm receiving for ntlmSso when i run cy.ntlmSso(["*.ee.doe.gov"]) cy.visit("https://eeredocman.ee.doe.gov" https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Feeredocman.ee.doe.gov%2F&data=02%7C01%7Cs.thangellapally%40accenturefederal.com%7C4272d4a96dfc44223afc08d81c72d4c2%7C0ee6c63b4eab4748b74ad1dc22fc1a24%7C0%7C0%7C637290626817462178&sdata=NYVSuFEMQiAEOM7w6GxV49w%2FW0gsxiKUGCdSCLaOJnw%3D&reserved=0%22 );:
CypressError: cy.request() timed out waiting 30000ms for a response from your server.
The request we sent was:
No response was received within the timeout.
On Mon, Jun 29, 2020 at 5:26 PM Sarita S emailsarita2@gmail.com wrote:
Trying to send again the screenshots.
this is the code i'm trying to run:
describe('MyTestSuite', function() { it('Verify title of the page', function() {
cy.ntlmSso(["*.ee.doe.gov"]) cy.visit("https://eeredocman.ee.doe.gov"
})
})
On Mon, Jun 29, 2020 at 5:20 PM Björn Weström notifications@github.com wrote:
Can't see any screenshots. For cy.ntlmSso, no username or password are needed. The plugin will automatically use the current windows user account that is starting up cypress. So that user must have access to the site you want to test for this approach to work. If you need to use another account, cy.ntlm is the way to go.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651373466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIH4IXQ2RPY3ZTF4SLDRZEAQBANCNFSM4OK6GLLA .
-- Thanks, sarita
-- Thanks, sarita
CypressError: cy.request() timed out waiting 30000ms for a response from your server.
The request we sent was:
Method: POST URL: http://127.0.0.2.1345/ntlm-sso
No response was received within the timeout.
On Mon, Jun 29, 2020 at 5:38 PM Sarita S emailsarita2@gmail.com wrote:
this is the actual error i'm receiving for ntlmSso when i run cy.ntlmSso(["*.ee.doe.gov"]) cy.visit("https://eeredocman.ee.doe.gov" https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Feeredocman.ee.doe.gov%2F&data=02%7C01%7Cs.thangellapally%40accenturefederal.com%7C4272d4a96dfc44223afc08d81c72d4c2%7C0ee6c63b4eab4748b74ad1dc22fc1a24%7C0%7C0%7C637290626817462178&sdata=NYVSuFEMQiAEOM7w6GxV49w%2FW0gsxiKUGCdSCLaOJnw%3D&reserved=0%22 );:
Error
CypressError: cy.request() timed out waiting 30000ms for a response from your server.
The request we sent was:
No response was received within the timeout.
On Mon, Jun 29, 2020 at 5:26 PM Sarita S emailsarita2@gmail.com wrote:
Trying to send again the screenshots.
this is the code i'm trying to run:
describe('MyTestSuite', function() { it('Verify title of the page', function() {
cy.ntlmSso(["*.ee.doe.gov"]) cy.visit("https://eeredocman.ee.doe.gov"
})
})
On Mon, Jun 29, 2020 at 5:20 PM Björn Weström notifications@github.com wrote:
Can't see any screenshots. For cy.ntlmSso, no username or password are needed. The plugin will automatically use the current windows user account that is starting up cypress. So that user must have access to the site you want to test for this approach to work. If you need to use another account, cy.ntlm is the way to go.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-651373466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIH4IXQ2RPY3ZTF4SLDRZEAQBANCNFSM4OK6GLLA .
-- Thanks, sarita
-- Thanks, sarita
-- Thanks, sarita
The problem is that you are replying to this thread via email. There seems to be some limitations in your email client in what you can send. I would recommend that you open the issue directly in a web browser and type your reply there - that would also make it easier for you to attach screenshots. https://github.com/bjowes/cypress-ntlm-auth/issues/120
I might be able to do some live troubleshooting, just be aware that this is a hobby project of mine done in my spare time, so I won't be able to spend a lot of time solving a specific user setup issue. There are likely other developers closer to you that could give you support faster. What timezone are you in? It is nearly midnight for me now so I will be shutting down soon.
Your latest attempt, that you are not getting a response from the cy.ntlmSso call, indicates that Cypress cannot communicate with the plugin. Double check the installation (plugins/index,js file and support/index.js file) and ensure that you started up with npm run cypress-ntlm.
Here are my screenshots for the test i ran for cy.ntlmSso.
I'm EST time zone. Currently its 6:00 PM
I'm EST time zone. Currently its 6:00 PM
I see now my tests are passing for both ntmlSso and ntlm but the screen is blank. Application is not loaded or not sure if login happened. We are using aspx technology built on sharepoint. Attaching screenshots
Please let me know if anything missing
Well, that the test passed is a good sign. But you need to add some assertion after the cy.visit call, otherwise the test terminates when visit has been called - which is likely why you don't see the page rendered. Can't tell from the screenshot is auth occured, you need to look at the ntlm-proxy debug logs for that. But add an assertion first, when the page is rendered I guess you can tell i login occured (maybe the username is shown somewhere)
Here is the log:
I added validation seems failing on 401
This is really odd. cy.visit would normally fail the test if a 401 is returned. However, if the resource returning a 401 is loaded in the background (AJAX request) it won't fail the test.
If yes on both - ntlmSso should work. Please send the debug logs from ntlm-proxy (you sent them earlier, where each line starts with cypress:plugin:ntlm-auth
If no, ntlmSso won't work. You have to use the ntlm method and specify an account that has access.
The tests are executed on a virtual machine through a remote desktop connection. I do log in to my account using PIV and can access this application manually using credentials to windows security. The application itself does not require any login once I'm on my PIV account.
Here is the whole log when I run this script:
GET // 200 2.291 ms - - GET /cypress/runner/cypress_runner.css 200 7.246 ms - - GET /cypress/runner/cypress_runner.js 200 6.543 ms - - GET /cypress/iframes/integration/examples/firTest.js 200 3.507 ms - 751 GET /cypress/runner/fonts/fa-solid-900.woff2 200 2.878 ms - 76120 GET /cypress/tests?p=cypress%5Csupport%5Cindex.js-597 200 24.357 ms - - GET /cypress/tests?p=cypress%5Cintegration%5Cexamples%5CfirTest.js-659 200 223.947 ms - - GET // 200 2.588 ms - - GET /cypress/runner/cypress_runner.css 200 2.977 ms - - GET /cypress/runner/cypress_runner.js 200 3.580 ms - - GET /cypress/iframes/integration/examples/firTest.js 200 3.591 ms - 749 GET /cypress/runner/fonts/fa-solid-900.woff2 200 2.709 ms - 76120 GET /cypress/tests?p=cypress%5Cintegration%5Cexamples%5CfirTest.js-608 200 7.336 ms - - GET /cypress/tests?p=cypress%5Csupport%5Cindex.js-041 200 7.331 ms - - GET /_layouts/15/fbacustomlogin/TransparentLogin.aspx?ReturnUrl=%2fbusiness%2fAwards%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252Fbusiness%252FAwards%252FSitePages%252FAwardsHome%252Easpx&Source=%2Fbusiness%2FAwards%2FSitePages%2FAwardsHome%2Easpx 200 12.253 ms - - GET /_layouts/15/fbacustomlogin/jquery-1.12.4.min.js 200 47.138 ms - - GET /_windows/default.aspx?ReturnUrl=%2fbusiness%2fAwards%2f_layouts%2f15%2fAuthenticate.aspx%3fSource%3d%252Fbusiness%252FAwards%252FSitePages%252FAwardsHome%252Easpx&Source=%2Fbusiness%2FAwards%2FSitePages%2FAwardsHome%2Easpx 401 87.815 ms - -
On Thu, Jul 2, 2020 at 5:35 PM Björn Weström notifications@github.com wrote:
This is really odd. cy.visit would normally fail the test if a 401 is returned. However, if the resource returning a 401 is loaded in the background (AJAX request) it won't fail the test.
- Are the tests executed on your own machine using your own account?
- Do you have access to the site with your windows account (when you log in manually)
If yes on both - ntlmSso should work. Please send the debug logs from ntlm-proxy (you sent them earlier, where each line starts with cypress:plugin:ntlm-auth
If no, ntlmSso won't work. You have to use the ntlm method and specify an account that has access.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-653230383, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIHJDUCOKBKPCNGPL3DRZT4RPANCNFSM4OK6GLLA .
-- Thanks, sarita
Ok, thanks for clarifying. I'm still missing the debug log from ntlm-proxy though. Set the environment variable DEBUG=cypress:plugin:ntlm-auth
and run the tests, then grab the logs from the console window of ntlm-proxy.
I'll be away on vacation next week so I won't be available much during that time.
@sarita555 - one thought from another issue: Could it be that the site you are accessing uses delegation (Impersonates the client and calls another service on another server)? I have noticed that the cy.ntlmSso currently does not support delegation. Also cy.ntlm likely won't work in that scenario.
Sorry i got busy. I have other issue on different project where I get logged out after couple test though I login @Before hook? How stay logged in throughout the test within single describe block?
On Mon, Jun 29, 2020 at 2:25 AM Björn Weström notifications@github.com wrote:
Hi,
When you do cy.ntlm(ntlmHost, username, password), you have replaced the variables with your actual site? In the error message in cypress, is that the same site responding with 401 that you configured in the cy.ntlm call?
Also, and alternative to cy.ntlm is cy.ntlmSso, which might be easier to get started, if you can access your test site with the same account that is executing cypress.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-650948159, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIEDYI5BIEBP7A3VAW3RZAXU5ANCNFSM4OK6GLLA .
-- Thanks, sarita
What do you mean that you get logged out? The plugin should handle authentication transparently, your shouldn't need to go to a login page or anything. If the page you visit requires authentication, the plugin will do it. Authentication only stays alive as long as the network connection. The browser handles network connections, so depending on timing re-authentication will occur during tests, but as stated this should be handled automatically.
This is a different issue. I'm not using NTLM. I login in before hook and after couple of it (tests) i'm getting logged out. Usually when you login in Before hook the session should maintain from one page to another correct?
Ex:
describe('Add Car, Charger, and Supplier to Electric Miles', function(){
var num;
before(() => {
num = 6;
cy.login("emCustomer@gmail.com", "************");
// cy.saveLocalStorage();
})
beforeEach(() => {
//cy.restoreLocalStorage();
Cypress.Cookies.preserveOnce('tildauid', 'authToken') //This is not working still i'm being logged out every test below
});
it('Add Car', function(){
// cy.get('[class^="ProfileConnection_title"]:contains("Your Car")').should('have.text', 'Your Car') cy.get('[class^="ProfileConnection_title"]') .should(($h3) => { expect($h3.eq(0).text().trim()).contains('Your car'); });
cy.get('a[href="/connect_car"] span').should('have.text', 'Add')
cy.get('a[href="/connect_car"]').click({force: true });
cy.get('[class^="Select_selected"]').contains('Manufacturer'
).click({force:true}); cy.get('[class^="Option_main"]:contains("BMW")').click({multiple: true}); cy.contains("Model").click({force:true}) cy.contains("i3").click({force:true}) cy.get('button[type=submit]').click({force:true});
})
it('Verify Car Added', function(){
cy.get('[class^="CarCard_grid"] div')
.should(($div) => {
expect($div.eq(2)).to.contain('i3')
})
cy.contains("Continue", { matchCase: false }).click({force:true})
})
//Getting logged out here
it('Add Charger', function(){
// cy.get('[class^="ProfileConnection_title"]:contains("Your Car")').should('have.text', 'Your Car') }
On Fri, Aug 14, 2020 at 2:57 PM Björn Weström notifications@github.com wrote:
What do you mean that you get logged out? The plugin should handle authentication transparently, your shouldn't need to go to a login page or anything. If the page you visit requires authentication, the plugin will do it. Authentication only stays alive as long as the network connection. The browser handles network connections, so depending on timing re-authentication will occur during tests, but as stated this should be handled automatically.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-674225512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFICDJ5NYWS7UABV5LHDSAWCLJANCNFSM4OK6GLLA .
-- Thanks, sarita
It sounds like it should work if you are keeping the auth alive with a cookie. However, I have very limited experience in other login methods than NTLM/Negotiate with cypress, so please use the regular cypress issues for support on this.
Hi Bjorn, Could you please help me on how to connect to mysql through secure tunneling?
my SSL connection to mysql is not working. Please let me know what i need to add or update to connect to database with SSL tunnel below
"env":{ "db":{ "host": "127.0.0.1", "user": "", "password": "**", "database": "charger_db"
} },
plugin:
const mysql = require('mysql')function queryTestDb(query, config) {// creates a new mysql connection using credentials from cypress.json env'sconst connection = mysql.createConnection(config.env.db)// start connection to dbconnection.connect()// exec query + disconnect to db as a Promisereturn new Promise((resolve, reject) => {connection.query(query, (error, results) => {if (error) reject(error)else {connection.end()// console.log(results)return resolve(results)}})})} module.exports = (on, config) => {// Usage: cy.task('queryDb', query)on('task', {queryDb: query => {return queryTestDb(query, config)},})}
mySQL:
[image: image] https://user-images.githubusercontent.com/7041696/91500511-aa1ab380-e891-11ea-830e-7dc98ff589db.png
Leave
On Sat, Aug 15, 2020 at 4:59 PM Björn Weström notifications@github.com wrote:
It sounds like it should work if you are keeping the auth alive with a cookie. However, I have very limited experience in other login methods than NTLM/Negotiate with cypress, so please use the regular cypress issues for support on this.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/120#issuecomment-674446635, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVXFIEGKQJXJGZQLZLWSCDSA3ZJJANCNFSM4OK6GLLA .
-- Thanks, sarita
Hi @sarita555 - sorry but I won't be able to provide support on anything outside the scope of the plugin. Do you have any new input on the original issue? Or could we close this?
Closing due to lack of activity - please reopen if more support is needed
Move to new issue from #117
I'm new to cypress and currently big hurdle is i'm unable to access our url due to Windows Security login. I followed steps for ntlm as below but no success i get either 401 or 301:
npm install --save-dev cypress-ntlm-auth
Added cypress/plugins/index.js
const ntlmAuth = require("cypress-ntlm-auth/dist/plugin"); module.exports = (on, config) => { config = ntlmAuth.initNtlmAuth(config); return config; };
Added below cypress/support/index.js import "cypress-ntlm-auth/dist/commands";
package.json "ntlm-proxy": "start /min \"ntlm-proxy\" cmd /c node_modules\.bin\ntlm-proxy", "cypress-ntlm": "npm run ntlm-proxy && (cypress-ntlm open & ntlm-proxy-exit)"
Startup npm run cypress-ntlm
cy.ntlm(ntlmHost, username, password)
When I manually access the url I get Windows Security pop up which is not visible in cypress.
Originally posted by @sarita555 in https://github.com/bjowes/cypress-ntlm-auth/issues/117#issuecomment-650505304