Cypress: Testing on jira cloud website hangs trying to load page

Created on 31 Jul 2020  Â·  13Comments  Â·  Source: cypress-io/cypress

Current behavior:

Trying to test any addon for jira cloud.
A lot of errors visible in console, check screenshots below.
Errors may be connected to @jennifer-shehane issue: https://github.com/cypress-io/cypress/issues/1436, I found the same fn of undefined visible in logs.

Jira Cloud is using iframes to display addons, so there may be the source of errors. I had to disable web security and use ignore x headers plugin for log in.
In sources I found potential fixes https://github.com/cypress-io/cypress/blob/6960f7cd78c9d730ed2d595faf5dc0a06d524270/packages/proxy/lib/http/util/regex-rewriter.ts#L8.
result
console

Desired behavior:

Jira cloud renders addons.

Test code to reproduce

Ready to use example in https://github.com/galczo5/cypress-jira-cloud


Versions

Cypress: 4.11.0
Chromium: 83
Tested on Pop OS and MacOS, same result

needs investigating bug

Most helpful comment

I have an issue that appears similar, trying to test a jira cloud addon.
Disabled web security to try to bypass cross origin redirect and ended up with errors.
I'm not using an ignore headers plugin

Watching :)

All 13 comments

I can recreate this from the provided repo https://github.com/galczo5/cypress-jira-cloud Basically after logging in, the page gets stuck on a loading spinner and has a lot of errors displayed in the console.

I have an issue that appears similar, trying to test a jira cloud addon.
Disabled web security to try to bypass cross origin redirect and ended up with errors.
I'm not using an ignore headers plugin

Watching :)

Highly interested in having it fixed!

I'm looking forward for fix that

@jennifer-shehane do you need more details from me?

Any news? I really need this to be fixed

We have the same issue and would like a resolution promptly.
This defect renders Cypress inoperable for the Jira stack.

I am able to get the example provided in the original comment working, with a few extra steps.

  1. Visiting the Jira website encounters this bug: https://github.com/cypress-io/cypress/issues/8679. You will need to downgrade Cypress to version 4.11.0 until this is fixed (this should be prioritized soon).
  2. Visiting the Jira website encounters this bug: https://github.com/cypress-io/cypress/issues/4220. You will need to include the current workaround to ignore xframe headers in Jira. You can see an example of linking to a locally installed version of the plugin here: https://github.com/galczo5/cypress-jira-cloud/blob/master/cypress/plugins/index.js
  3. You'll need to pass --browser chrome during cypress run - as the ignore-xframe-headers plugin workaround will not apply in Electron.
  4. You'll need to add an uncaught:exception handler to avoid failing tests - since there are some errors being thrown from the application under test.
  5. You'll need to pass "chromeWebSecurity": false to your cypress.json

The previous example had a userAgent defined in its cypress.json. This would cause an error in Jira saying third party cookies need to be accepted. Removing the userAgent configuration fixed this. May be related to this.

  • There is still a remaining issue after all of this with reloading the tests during cypress open - where it will go to a dead link.

Screen Shot 2020-10-22 at 11 27 32 AM

Notice: At the end of the day, their website is doing a lot of things that prevent it from running well within the Cypress Test Runner. This is big reason that we advise you to not test websites that are not under your direct control. Atlassian could change their site tomorrow and none of our workarounds above will work anymore, so there's no guarantee.

Working example

spec.js

Cypress.on('uncaught:exception', (err, runnable) => {
    return false // this is required!
})

it('Jira cloud', () => {
    cy.visit('https://cypress-testing.atlassian.net/')
    cy.get('#username').type('[email protected]')
    cy.get('#login-submit').click()
    cy.get('#password').type('sdAA3@sd!@;')
    cy.get('#login-submit').click()
    // the code below here is outdated, 
    // so I'm not sure what was meant to be tested after login
})

cypress/plugins/index.js

const path = require('path');
// this should point to a local version of the ignore-x-frame-headers plugin
// https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe
const extensionUnZipped = path.join(__dirname, '../../IgnoreXFramesPlugin');

module.exports = (on, config) => {
    on('before:browser:launch', (browser = {}, launchOptions) => {
        // this only works in Chrome, not Electron.
        // pass '--browser chrome' during 'cypress run'
        launchOptions.extensions.push(extensionUnZipped);
        return launchOptions;
    });
}

cypress.json

{
  "chromeWebSecurity": false,
  "defaultCommandTimeout": 30000
}

Hi Jennifer:

Thank you for responding.
We cannot ignore xframe headers – It is a security requirement and part of the Jira authentication that we must have them.
No xframe headers = no app. They shut down the app for non-compliance within 24 hours.
Atlassian makes the rules and they do not compromise on this.

Milan – please will you provide some examples of the snippets of code for Jennifer ASAP.

Regards,
Becci


Becci Watson
m: 0412 029 903
Int: +61-412 029 903
email: [email protected]becci@becciwatson.com.au
blog: BecciWatson.com.au
linkedIn: www.linkedin.com/in/becciwatsonhttp://www.linkedin.com/in/becciwatson

From: Jennifer Shehane notifications@github.com
Sent: Thursday, 22 October 2020 4:20 PM
To: cypress-io/cypress cypress@noreply.github.com
Cc: Becci Watson becci@telewebica.com.au; Manual manual@noreply.github.com
Subject: Re: [cypress-io/cypress] Testing on jira cloud website hangs trying to load page (#8146)

I am able to get the example provided in the original comment working, with a few extra steps.

  1. Visiting the Jira website encounters this bug: #8679https://github.com/cypress-io/cypress/issues/8679. You will need to downgrade Cypress to version 4.11.0 until this is fixed (this should be prioritized soon).
  2. Visiting the Jira website encounters this bug: #4220https://github.com/cypress-io/cypress/issues/4220. You will need to include the current workaroundhttps://github.com/cypress-io/cypress/issues/4220#issuecomment-649264985 to ignore xframe headers in Jira. You can see an example of linking to a locally installed version of the plugin here: https://github.com/galczo5/cypress-jira-cloud/blob/master/cypress/plugins/index.js
  3. You'll need to pass --browser chrome during cypress run - as the ignore-xframe-headers plugin workaround will not apply in Electron.
  4. You'll need to add an uncaught:exception handler to avoid failing tests - since there are some errors being thrown from the application under test.
  5. You'll need to pass "chromeWebSecurity": false to your cypress.json

The previous example had a userAgent defined in its cypress.json. This would cause an error in Jira saying third party cookies need to be accepted. Removing the userAgent configuration fixed this. May be related to thishttps://community.atlassian.com/t5/Jira-questions/how-to-resolve-Please-make-sure-your-browser-has-third-party/qaq-p/591612.

  • There is still a remaining issue after all of this with reloading the tests during cypress open - where it will go to a dead link.

[Screen Shot 2020-10-22 at 11 27 32 AM]https://user-images.githubusercontent.com/1271364/96826568-9b97e500-1459-11eb-8317-68da4514c5a7.png

Notice: At the end of the day, their website is doing a lot of things that prevent it from running well within the Cypress Test Runner. This is big reason that we advise you to not test websites that are not under your direct control. Atlassian could change their site tomorrow and none of our workarounds above will work anymore, so there's no guarantee.

Working example

spec.js

Cypress.on('uncaught:exception', (err, runnable) => {

return false // this is required!

})

it('Jira cloud', () => {

cy.visit('https://cypress-testing.atlassian.net/')

cy.get('#username').type('[email protected]')

cy.get('#login-submit').click()

cy.get('#password').type('sdAA3@sd!@;')

cy.get('#login-submit').click()

// the code below here is outdated,

// so I'm not sure what was meant to be tested after login

})

cypress/plugins/index.js

const path = require('path');

// this should point to a local version of the ignore-x-frame-headers plugin

// https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe

const extensionUnZipped = path.join(__dirname, '../../IgnoreXFramesPlugin');

module.exports = (on, config) => {

on('before:browser:launch', (browser = {}, launchOptions) => {

    // this only works in Chrome, not Electron.

    // pass '--browser chrome' during 'cypress run'

    launchOptions.extensions.push(extensionUnZipped);

    return launchOptions;

});

}

cypress.json

{

"chromeWebSecurity": false,

"defaultCommandTimeout": 30000

}

[https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966]https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/8146#issuecomment-714234881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMWRHXZH6NMYGYPUSVDBDUTSL66IPANCNFSM4PQOUCLA.

Milan:

Please provide details of this bug to Jennifer directly.
Do not put any details of our code on public websites.

Cypress should know better than this to make all bugs public.

Regards,
Becci


Becci Watson
m: 0412 029 903
Int: +61-412 029 903
email: [email protected]becci@becciwatson.com.au
blog: BecciWatson.com.au
linkedIn: www.linkedin.com/in/becciwatsonhttp://www.linkedin.com/in/becciwatson

From: Jennifer Shehane notifications@github.com
Sent: Thursday, 22 October 2020 4:20 PM
To: cypress-io/cypress cypress@noreply.github.com
Cc: Becci Watson becci@telewebica.com.au; Manual manual@noreply.github.com
Subject: Re: [cypress-io/cypress] Testing on jira cloud website hangs trying to load page (#8146)

I am able to get the example provided in the original comment working, with a few extra steps.

  1. Visiting the Jira website encounters this bug: #8679https://github.com/cypress-io/cypress/issues/8679. You will need to downgrade Cypress to version 4.11.0 until this is fixed (this should be prioritized soon).
  2. Visiting the Jira website encounters this bug: #4220https://github.com/cypress-io/cypress/issues/4220. You will need to include the current workaroundhttps://github.com/cypress-io/cypress/issues/4220#issuecomment-649264985 to ignore xframe headers in Jira. You can see an example of linking to a locally installed version of the plugin here: https://github.com/galczo5/cypress-jira-cloud/blob/master/cypress/plugins/index.js
  3. You'll need to pass --browser chrome during cypress run - as the ignore-xframe-headers plugin workaround will not apply in Electron.
  4. You'll need to add an uncaught:exception handler to avoid failing tests - since there are some errors being thrown from the application under test.
  5. You'll need to pass "chromeWebSecurity": false to your cypress.json

The previous example had a userAgent defined in its cypress.json. This would cause an error in Jira saying third party cookies need to be accepted. Removing the userAgent configuration fixed this. May be related to thishttps://community.atlassian.com/t5/Jira-questions/how-to-resolve-Please-make-sure-your-browser-has-third-party/qaq-p/591612.

  • There is still a remaining issue after all of this with reloading the tests during cypress open - where it will go to a dead link.

[Screen Shot 2020-10-22 at 11 27 32 AM]https://user-images.githubusercontent.com/1271364/96826568-9b97e500-1459-11eb-8317-68da4514c5a7.png

Notice: At the end of the day, their website is doing a lot of things that prevent it from running well within the Cypress Test Runner. This is big reason that we advise you to not test websites that are not under your direct control. Atlassian could change their site tomorrow and none of our workarounds above will work anymore, so there's no guarantee.

Working example

spec.js

Cypress.on('uncaught:exception', (err, runnable) => {

return false // this is required!

})

it('Jira cloud', () => {

cy.visit('https://cypress-testing.atlassian.net/')

cy.get('#username').type('[email protected]')

cy.get('#login-submit').click()

cy.get('#password').type('sdAA3@sd!@;')

cy.get('#login-submit').click()

// the code below here is outdated,

// so I'm not sure what was meant to be tested after login

})

cypress/plugins/index.js

const path = require('path');

// this should point to a local version of the ignore-x-frame-headers plugin

// https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe

const extensionUnZipped = path.join(__dirname, '../../IgnoreXFramesPlugin');

module.exports = (on, config) => {

on('before:browser:launch', (browser = {}, launchOptions) => {

    // this only works in Chrome, not Electron.

    // pass '--browser chrome' during 'cypress run'

    launchOptions.extensions.push(extensionUnZipped);

    return launchOptions;

});

}

cypress.json

{

"chromeWebSecurity": false,

"defaultCommandTimeout": 30000

}

[https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966]https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/8146#issuecomment-714234881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMWRHXZH6NMYGYPUSVDBDUTSL66IPANCNFSM4PQOUCLA.

@becciwatson try to set window.name to @atlassian/spa-iframe before you load Jira page. Somehow it works, but there is no information what is it and how long it will be supported.

Hi Jenifer,

As we agreed, here is the bug for Jira add-on loading:

https://github.com/cypress-io/cypress/issues/8958

I hope it will be fixed soon.

Kind Regards,

Milan Suka

From: Becci Watson notifications@github.com
Sent: Thursday, October 22, 2020 7:58 AM
To: cypress-io/cypress cypress@noreply.github.com
Cc: Milan Å uka milan@becciwatson.com.au; Manual manual@noreply.github.com
Subject: Re: [cypress-io/cypress] Testing on jira cloud website hangs trying to load page (#8146)

Hi Jennifer:

Thank you for responding.
We cannot ignore xframe headers – It is a security requirement and part of the Jira authentication that we must have them.
No xframe headers = no app. They shut down the app for non-compliance within 24 hours.
Atlassian makes the rules and they do not compromise on this.

Milan – please will you provide some examples of the snippets of code for Jennifer ASAP.

Regards,
Becci


Becci Watson
m: 0412 029 903
Int: +61-412 029 903
email: [email protected] becci@becciwatson.com.au
blog: BecciWatson.com.au
linkedIn: www.linkedin.com/in/becciwatson http://www.linkedin.com/in/becciwatson%3chttp:/www.linkedin.com/in/becciwatson http://www.linkedin.com/in/becciwatson

From: Jennifer Shehane <[email protected] notifications@github.com >
Sent: Thursday, 22 October 2020 4:20 PM
To: cypress-io/cypress <[email protected] cypress@noreply.github.com >
Cc: Becci Watson <[email protected] becci@telewebica.com.au >; Manual <[email protected] manual@noreply.github.com >
Subject: Re: [cypress-io/cypress] Testing on jira cloud website hangs trying to load page (#8146)

I am able to get the example provided in the original comment working, with a few extra steps.

  1. Visiting the Jira website encounters this bug: #8679https://github.com/cypress-io/cypress/issues/8679. You will need to downgrade Cypress to version 4.11.0 until this is fixed (this should be prioritized soon).
  2. Visiting the Jira website encounters this bug: #4220https://github.com/cypress-io/cypress/issues/4220. You will need to include the current workaroundhttps://github.com/cypress-io/cypress/issues/4220#issuecomment-649264985 to ignore xframe headers in Jira. You can see an example of linking to a locally installed version of the plugin here: https://github.com/galczo5/cypress-jira-cloud/blob/master/cypress/plugins/index.js
  3. You'll need to pass --browser chrome during cypress run - as the ignore-xframe-headers plugin workaround will not apply in Electron.
  4. You'll need to add an uncaught:exception handler to avoid failing tests - since there are some errors being thrown from the application under test.
  5. You'll need to pass "chromeWebSecurity": false to your cypress.json

The previous example had a userAgent defined in its cypress.json. This would cause an error in Jira saying third party cookies need to be accepted. Removing the userAgent configuration fixed this. May be related to thishttps://community.atlassian.com/t5/Jira-questions/how-to-resolve-Please-make-sure-your-browser-has-third-party/qaq-p/591612.

  • There is still a remaining issue after all of this with reloading the tests during cypress open - where it will go to a dead link.

[Screen Shot 2020-10-22 at 11 27 32 AM]https://user-images.githubusercontent.com/1271364/96826568-9b97e500-1459-11eb-8317-68da4514c5a7.png

Notice: At the end of the day, their website is doing a lot of things that prevent it from running well within the Cypress Test Runner. This is big reason that we advise you to not test websites that are not under your direct control. Atlassian could change their site tomorrow and none of our workarounds above will work anymore, so there's no guarantee.

Working example

spec.js

Cypress.on('uncaught:exception', (err, runnable) => {

return false // this is required!

})

it('Jira cloud', () => {

cy.visit('https://cypress-testing.atlassian.net/')

cy.get('#username').type('[email protected]')

cy.get('#login-submit').click()

cy.get('#password').type('sdAA3@sd!@;')

cy.get('#login-submit').click()

// the code below here is outdated,

// so I'm not sure what was meant to be tested after login

})

cypress/plugins/index.js

const path = require('path');

// this should point to a local version of the ignore-x-frame-headers plugin

// https://chrome.google.com/webstore/detail/ignore-x-frame-headers/gleekbfjekiniecknbkamfmkohkpodhe

const extensionUnZipped = path.join(__dirname, '../../IgnoreXFramesPlugin');

module.exports = (on, config) => {

on('before:browser:launch', (browser = {}, launchOptions) => {

// this only works in Chrome, not Electron.

// pass '--browser chrome' during 'cypress run'

launchOptions.extensions.push(extensionUnZipped);

return launchOptions;

});

}

cypress.json

{

"chromeWebSecurity": false,

"defaultCommandTimeout": 30000

}

[https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966]https://camo.githubusercontent.com/ed011e82c8c502c8803f84b1eb5fbd9b0d4b2095/687474703a2f2f672e7265636f726469742e636f2f4c456547775459514d392e676966

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/8146#issuecomment-714234881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMWRHXZH6NMYGYPUSVDBDUTSL66IPANCNFSM4PQOUCLA.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/cypress-io/cypress/issues/8146#issuecomment-714249249 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQLXZ3AEXDOD6744NJOUJ33SL7CW7ANCNFSM4PQOUCLA . https://github.com/notifications/beacon/AQLXZ3G6C43COEHAWXRQLVDSL7CW7A5CNFSM4PQOUCLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFKJJIII.gif

Hi @jennifer-shehane Jennifer: this workaround has not resolved the problem. Please can we have an update on this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheWanderingWalnut picture TheWanderingWalnut  Â·  109Comments

verheyenkoen picture verheyenkoen  Â·  84Comments

cameronc56 picture cameronc56  Â·  77Comments

bahmutov picture bahmutov  Â·  69Comments

jukefr picture jukefr  Â·  168Comments