Skip to content

Commit

Permalink
Merge remote-tracking branch 'cbio/master' into fix-10375
Browse files Browse the repository at this point in the history
  • Loading branch information
kalletlak committed Oct 8, 2024
2 parents df1a285 + c0bf914 commit f442cc4
Show file tree
Hide file tree
Showing 134 changed files with 9,593 additions and 5,628 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ e2e-localdb-workspace/
junit.xml
.nvim.lua
.luarc.json
.vs/
17 changes: 17 additions & 0 deletions OPEN-SOURCE-DOCUMENTATION
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,20 @@ Available under license:
5. Products derived from this software may not be called
"ColorBrewer", nor may "ColorBrewer" appear in their name, without
prior written permission of Cynthia Brewer.

* JavaScript/CSS Font Detector

JavaScript/CSS Font Detector
----------------------------
Available under license:

JavaScript code to detect available availability of a
particular font in a browser using JavaScript and CSS.

Author : Lalit Patel
Website: http://www.lalit.org/lab/javascript-css-font-detect/
License: Apache Software License 2.0
http://www.apache.org/licenses/LICENSE-2.0



30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ Note: you can check the frontend version of the live instance by checking `windo
Make sure you have installed the node version and yarn version specified in
[package.json](https://github.com/cBioPortal/cbioportal-frontend/blob/master/package.json).

> **Tip:** We recommend that you use [nvm: Node Version Manager](https://github.com/nvm-sh/nvm) and [yvm: Yarn Version Manager](https://yvm.js.org/docs/overview) to switch between versions more easily.
> **Tip:** For node, we recommend that you use [nvm: Node Version Manager](https://github.com/nvm-sh/nvm) to switch between versions easily.
> **Tip:** For yarn, you can use [yarn set version](https://yarnpkg.com/cli/set/version) or `npm install yarn@(version)`.
> **Windows Tip:** If you are developing on Windows, we recommend that you use [Ubuntu / Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
Expand Down Expand Up @@ -52,6 +54,8 @@ export BRANCH_ENV=master # or rc if branching from rc
yarn run start
```

> **Tip:** BRANCH_ENV should be set to `master` or `rc`, and not to your local branch name. You can set this in your ~/.bashrc if you don't intend to change it often.
Example pages:
- http://localhost:3000/
- http://localhost:3000/patient?studyId=lgg_ucsf_2014&caseId=P04
Expand All @@ -71,8 +75,6 @@ GREP=example.spec.js yarn run testModules
```

> **Windows Tip:** There is a known solved hiccup running the tests on Ubuntu via Windows Subsystem for Linux (WSL): [#7096](https://github.com/cBioPortal/cbioportal/issues/7096)
To run unit/integration tests in watch mode
```
yarn run test:watch
Expand Down Expand Up @@ -139,6 +141,12 @@ or clear entire local storage
```
localStorage.clear()
```
You can also add a bookmarklet to quickly switch to your local frontend server. Set the URL to the following:

```
javascript:(function()%7BlocalStorage.setItem%28%60localdev%60,true%29%3Bwindow.location.reload()%3B %7D)()
```

You can also use a netlify deployed cbioportal-frontend pull request for serving the JS:
1. Create the following bookmarklet:
```
Expand All @@ -147,6 +155,8 @@ javascript:(function()%7Bvar pr %3D prompt("Please enter PR%23")%3Bif (pr %26%26
2. Navigate to the cBioPortal installation that you want to test.
3. Click the bookmarklet and enter your pull request number.



## Run e2e-tests

End-to-end tests can be run against public cbioportal instances or against a local dockerized backend. These two e2e-tests types are referred to as `remote` and `local` types of e2e-tests.
Expand All @@ -161,6 +171,7 @@ cd end-to-end-test
// install deps
yarn --ignore-engines
cd ..
```

```
Expand Down Expand Up @@ -349,3 +360,16 @@ Please make sure to not introduce any dependencies from `cbioportal-frontend` wo
### react-mutation-mapper

[react-mutation-mapper](https://www.npmjs.com/package/react-mutation-mapper/) is a separate public npm library that contains the Mutation Mapper and related components.

## WSL Tips

When running on a Windows environment, use [WSL: Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10). You will be able to run a linux shell, which is necessary for many of the scripts used. You will also be able to use it concurrently with Windows applications.

Make sure the git repo is cloned under the WSL file system (under your home directory). If you instead clone it to the Windows file system (e.g. `/mnt/c/...` from WSL), then all scripts will be extremely slow.

If you may be working with the git repo via the Windows system, then make sure your line returns are set to `lf` as opposed to the Windows default `crlf`.

```
# from the repo folder
git config core.autocrlf false
```
2 changes: 2 additions & 0 deletions end-to-end-test/local/runtime-config/portal.properties
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ session.service.url=
# session.service.user=user
# session.service.password=pass

session.endpoint.publisher-api-key=SECRETKEY

# disabled tabs, | delimited
# possible values: cancer_types_summary, mutual_exclusivity, plots, mutations, co_expression, enrichments, survival, network, download, bookmark, IGV
disabled_tabs=
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
171 changes: 171 additions & 0 deletions end-to-end-test/local/specs/virtual-study.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
var assert = require('assert');
var goToUrlAndSetLocalStorage = require('../../shared/specUtils')
.goToUrlAndSetLocalStorage;

const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');
const studyEs0Summary = CBIOPORTAL_URL + '/study/summary?id=study_es_0';

describe('Virtual Study life cycle', function() {
const vsTitle = 'Test VS ' + Date.now();
let link;
let vsId;
const X_PUBLISHER_API_KEY = 'SECRETKEY';

it('Login and navigate to the study_es_0 study summary page', function() {
goToUrlAndSetLocalStorage(studyEs0Summary, true);
});
it('Click Share Virtual Study button', function() {
const studyView = $('.studyView');
const shareVSBtn = studyView.$(
'button[data-tour="action-button-bookmark"]'
);
shareVSBtn.waitForClickable();
shareVSBtn.click();
});
it('Provide the title and save', function() {
const modalDialog = $('.modal-dialog');
modalDialog.waitForDisplayed();
const titleInput = modalDialog.$('input#sniglet');
titleInput.setValue(vsTitle);
const saveBtn = modalDialog.$(
'[data-tour="virtual-study-summary-save-btn"]'
);
saveBtn.click();
modalDialog.$('.text-success').waitForDisplayed();
const linkInput = modalDialog.$('input[type="text"]');
link = linkInput.getValue();
assert.ok(
link.startsWith('http'),
'The value should be link, but was ' + link
);
vsId = link
.split('?')[1]
.split('&')
.map(paramEqValue => paramEqValue.split('='))
.find(([key, value]) => key === 'id')[1];
assert.ok(vsId, 'Virtual Study ID has not to be empty');
});
it('See the VS in My Virtual Studies section on the landing page', function() {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL, true);
const vsSection = $(`//*[text()="${vsTitle}"]/ancestor::ul[1]`);
vsSection.waitForDisplayed();
const sectionTitle = vsSection.$('li label span');
assert.equal(sectionTitle.getText(), 'My Virtual Studies');
});
it('Publish the VS', function() {
const result = browser.executeAsync(
function(cbioUrl, vsId, key, done) {
const url = cbioUrl + '/api/public_virtual_studies/' + vsId;
const headers = new Headers();
headers.append('X-PUBLISHER-API-KEY', key);
fetch(url, {
method: 'POST',
headers: headers,
})
.then(response => {
done({
success: response.ok,
message: 'HTTP Status: ' + response.status,
});
})
.catch(error => {
done({ success: false, message: error.message });
});
},
CBIOPORTAL_URL,
vsId,
X_PUBLISHER_API_KEY
);
assert.ok(result.success, result.message);
});
it('See the VS in Public Virtual Studies section on the landing page', function() {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL, true);
const vsSection = $(`//*[text()="${vsTitle}"]/ancestor::ul[1]`);
vsSection.waitForDisplayed();
const sectionTitle = vsSection.$('li label span');
assert.equal(sectionTitle.getText(), 'Public Virtual Studies');
});
it('Re-publish the VS specifying PubMed ID and type of cancer', function() {
const result = browser.executeAsync(
function(cbioUrl, vsId, key, done) {
const headers = new Headers();
headers.append('X-PUBLISHER-API-KEY', key);
fetch(
cbioUrl +
'/api/public_virtual_studies/' +
vsId +
'?pmid=28783718&typeOfCancerId=aca',
{
method: 'POST',
headers: headers,
}
)
.then(response => {
done({
success: response.ok,
message: 'HTTP Status: ' + response.status,
});
})
.catch(error => {
done({ success: false, message: error.message });
});
},
CBIOPORTAL_URL,
vsId,
X_PUBLISHER_API_KEY
);
assert.ok(result.success, result.message);
});
it('See the VS in the Adrenocortical Adenoma section with PubMed link', function() {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL, true);
const vsRow = $(`//*[text()="${vsTitle}"]/ancestor::li[1]`);
const vsSection = vsRow.parentElement();
vsSection.waitForDisplayed();
const sectionTitle = vsSection.$('li label span');
assert.equal(sectionTitle.getText(), 'Adrenocortical Adenoma');
//has PubMed link
assert.ok(vsRow.$('.fa-book').isExisting());
});
it('Un-publish the VS', function() {
const result = browser.executeAsync(
function(cbioUrl, vsId, key, done) {
const headers = new Headers();
headers.append('X-PUBLISHER-API-KEY', key);
fetch(cbioUrl + '/api/public_virtual_studies/' + vsId, {
method: 'DELETE',
headers: headers,
})
.then(response => {
done({
success: response.ok,
message: 'HTTP Status: ' + response.status,
});
})
.catch(error => {
done({ success: false, message: error.message });
});
},
CBIOPORTAL_URL,
vsId,
X_PUBLISHER_API_KEY
);
assert.ok(result.success, result.message);
});

it('Removing the VS', function() {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL, true);
const vsRow = $(`//*[text()="${vsTitle}"]/ancestor::li[1]`);
vsRow.waitForDisplayed();

const removeBtn = vsRow.$('.fa-trash');
removeBtn.click();
});

it('The VS disappears from the landing page', function() {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL, true);
$('[data-test="cancerTypeListContainer"]').waitForDisplayed();
const vsRowTitle = $(`//*[text()="${vsTitle}"]`);
browser.pause(100);
assert.ok(!vsRowTitle.isExisting());
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f442cc4

Please sign in to comment.