-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend should consume postData written to JSP #2933
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var assert = require('assert'); | ||
var goToUrlAndSetLocalStorage = require('../../../shared/specUtils').goToUrlAndSetLocalStorage; | ||
var postDataToUrl = require('../../../shared/specUtils').postDataToUrl; | ||
var parse = require('url-parse'); | ||
var _ = require('lodash'); | ||
|
||
var useExternalFrontend = require('../../../shared/specUtils').useExternalFrontend; | ||
|
||
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ""); | ||
|
||
describe('study select page', function() { | ||
|
||
if (useExternalFrontend) { | ||
|
||
describe('error messaging for invalid study id(s)', function(){ | ||
|
||
it('show error alert and query form for single invalid study id',function(){ | ||
var url = `${CBIOPORTAL_URL}/results?localdist=true`; | ||
|
||
const query = {"gene_list":"KRAS NRAS BRAF" | ||
,"cancer_study_list":"coadread_tcga_pub", | ||
"case_ids":"","case_set_id":"coadread_tcga_pub_nonhypermut", | ||
"Z_SCORE_THRESHOLD":"2.0", | ||
"genetic_profile_ids_PROFILE_MUTATION_EXTENDED":"coadread_tcga_pub_mutations", | ||
"genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION":"coadread_tcga_pub_gistic" | ||
}; | ||
|
||
postDataToUrl(url, query); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. data is posted to page here |
||
|
||
browser.waitUntil(()=>{ | ||
var url = browser.getUrl(); | ||
|
||
// make sure param in query is passed to url | ||
return _.every(query,(item,key)=>{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pvannierop here we check that every posted parameter key has made it into the url. this could only happen as a result of our code transferring the postData variable into the URL. |
||
return url.includes(key); | ||
}); | ||
}); | ||
|
||
const postData = browser.execute(()=>{ | ||
return window.postData; | ||
}).value; | ||
|
||
assert(postData === null, "postData has been set to null after read"); | ||
|
||
}); | ||
}); | ||
|
||
} | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ import setWindowVariable from 'shared/lib/setWindowVariable'; | |
import LoadingIndicator from "shared/components/loadingIndicator/LoadingIndicator"; | ||
import onMobxPromise from "shared/lib/onMobxPromise"; | ||
import {createQueryStore} from "shared/lib/createQueryStore"; | ||
import {handleLegacySubmission} from "shared/lib/redirectHelpers"; | ||
import {handleLegacySubmission, handlePostedSubmission} from "shared/lib/redirectHelpers"; | ||
|
||
function initStore(appStore: AppStore, urlWrapper: ResultsViewURLWrapper) { | ||
const resultsViewPageStore = new ResultsViewPageStore( | ||
|
@@ -103,6 +103,8 @@ export default class ResultsViewPage extends React.Component< | |
|
||
handleLegacySubmission(this.urlWrapper); | ||
|
||
handlePostedSubmission(this.urlWrapper); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if I understand this correctly, only the ResultsViewPage can handle POST requests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's correct. the server writes the post data in all cases though so any page can in theory access it. |
||
|
||
setWindowVariable('urlWrapper', this.urlWrapper); | ||
|
||
if (this.urlWrapper.hasSessionId) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am lost here. This file
resutspage.spec.js
has describestudy select page
which belongs to Query Page. So, what does this test actually test? Is there also a test that checks for correct working of the POST method? It is not apparent from the test titles. It seems to only deal with checking of error messages.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
achhh. terrible, i forgot to update these descriptions. they are totally wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will make PR to correct these.