|
| 1 | +var assertScreenShotMatch = require('../../../shared/lib/testUtils') |
| 2 | + .assertScreenShotMatch; |
| 3 | +var assert = require('assert'); |
| 4 | +var waitForOncoprint = require('../../../shared/specUtils').waitForOncoprint; |
| 5 | +var goToUrlAndSetLocalStorage = require('../../../shared/specUtils') |
| 6 | + .goToUrlAndSetLocalStorage; |
| 7 | +var getNthOncoprintTrackOptionsElements = require('../../../shared/specUtils') |
| 8 | + .getNthOncoprintTrackOptionsElements; |
| 9 | +var { |
| 10 | + checkOncoprintElement, |
| 11 | + getElementByTestHandle, |
| 12 | +} = require('../../../shared/specUtils.js'); |
| 13 | + |
| 14 | +const TIMEOUT = 6000; |
| 15 | + |
| 16 | +const ONCOPRINT_TIMEOUT = 60000; |
| 17 | + |
| 18 | +const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ''); |
| 19 | + |
| 20 | +describe('oncoprinter clinical example data, color configuration', () => { |
| 21 | + it('oncoprinter color configuration modal reflects user selected colors', function() { |
| 22 | + goToUrlAndSetLocalStorage(`${CBIOPORTAL_URL}/oncoprinter`); |
| 23 | + $('.oncoprinterClinicalExampleData').waitForExist(); |
| 24 | + $('.oncoprinterClinicalExampleData').click(); |
| 25 | + $('.oncoprinterSubmit').click(); |
| 26 | + waitForOncoprint(TIMEOUT); |
| 27 | + |
| 28 | + var trackOptionsElts = getNthOncoprintTrackOptionsElements(2); |
| 29 | + // open menu |
| 30 | + $(trackOptionsElts.button_selector).click(); |
| 31 | + $(trackOptionsElts.dropdown_selector).waitForDisplayed({ |
| 32 | + timeout: 1000, |
| 33 | + }); |
| 34 | + // click "Edit Colors" to open modal |
| 35 | + $(trackOptionsElts.dropdown_selector + ' li:nth-child(11)').click(); |
| 36 | + browser.pause(1000); |
| 37 | + |
| 38 | + // select new colors for track values |
| 39 | + getElementByTestHandle('color-picker-icon').click(); |
| 40 | + $('.circle-picker').waitForDisplayed({ timeout: 1000 }); |
| 41 | + $('.circle-picker [title="#990099"]').click(); |
| 42 | + waitForOncoprint(ONCOPRINT_TIMEOUT); |
| 43 | + getElementByTestHandle('color-picker-icon').waitForDisplayed(); |
| 44 | + getElementByTestHandle('color-picker-icon').click(); |
| 45 | + $('.circle-picker').waitForDisplayed({ reverse: true }); |
| 46 | + |
| 47 | + $$('[data-test="color-picker-icon"]')[1].click(); |
| 48 | + $('.circle-picker').waitForDisplayed({ timeout: 1000 }); |
| 49 | + $('.circle-picker [title="#109618"]').click(); |
| 50 | + waitForOncoprint(ONCOPRINT_TIMEOUT); |
| 51 | + getElementByTestHandle('color-picker-icon').waitForDisplayed(); |
| 52 | + $$('[data-test="color-picker-icon"]')[1].click(); |
| 53 | + $('.circle-picker').waitForDisplayed({ reverse: true }); |
| 54 | + |
| 55 | + $$('[data-test="color-picker-icon"]')[2].click(); |
| 56 | + $('.circle-picker').waitForDisplayed({ timeout: 1000 }); |
| 57 | + $('.circle-picker [title="#8b0707"]').click(); |
| 58 | + waitForOncoprint(ONCOPRINT_TIMEOUT); |
| 59 | + |
| 60 | + assert.strictEqual( |
| 61 | + $('[data-test="color-picker-icon"] rect').getAttribute('fill'), |
| 62 | + '#990099' |
| 63 | + ); |
| 64 | + assert.strictEqual( |
| 65 | + $$('[data-test="color-picker-icon"] rect')[1].getAttribute('fill'), |
| 66 | + '#109618' |
| 67 | + ); |
| 68 | + assert.strictEqual( |
| 69 | + $$('[data-test="color-picker-icon"] rect')[2].getAttribute('fill'), |
| 70 | + '#8b0707' |
| 71 | + ); |
| 72 | + }); |
| 73 | + |
| 74 | + it('oncoprinter reflects user selected colors', () => { |
| 75 | + // close modal |
| 76 | + $('a.tabAnchor_oncoprint').click(); |
| 77 | + var res = checkOncoprintElement(); |
| 78 | + assertScreenShotMatch(res); |
| 79 | + }); |
| 80 | + |
| 81 | + it('oncoprinter reset colors button is visible when default colors not used', () => { |
| 82 | + // click "Edit Colors" to open modal and check "Reset Colors" button in modal |
| 83 | + var trackOptionsElts = getNthOncoprintTrackOptionsElements(2); |
| 84 | + $(trackOptionsElts.button_selector).click(); |
| 85 | + $(trackOptionsElts.dropdown_selector).waitForDisplayed({ |
| 86 | + timeout: 1000, |
| 87 | + }); |
| 88 | + $(trackOptionsElts.dropdown_selector + ' li:nth-child(11)').click(); |
| 89 | + getElementByTestHandle('resetColors').waitForDisplayed(); |
| 90 | + }); |
| 91 | + |
| 92 | + it('oncoprinter color configuration modal reflects default colors', () => { |
| 93 | + // click "Reset Colors" track |
| 94 | + getElementByTestHandle('resetColors').click(); |
| 95 | + waitForOncoprint(ONCOPRINT_TIMEOUT); |
| 96 | + |
| 97 | + assert.strictEqual( |
| 98 | + $('[data-test="color-picker-icon"] rect').getAttribute('fill'), |
| 99 | + '#dc3912' |
| 100 | + ); |
| 101 | + assert.strictEqual( |
| 102 | + $$('[data-test="color-picker-icon"] rect')[1].getAttribute('fill'), |
| 103 | + '#3366cc' |
| 104 | + ); |
| 105 | + assert.strictEqual( |
| 106 | + $$('[data-test="color-picker-icon"] rect')[2].getAttribute('fill'), |
| 107 | + '#ff9900' |
| 108 | + ); |
| 109 | + }); |
| 110 | + |
| 111 | + it('oncoprinter reflects default colors', () => { |
| 112 | + // close modal |
| 113 | + $('a.tabAnchor_oncoprint').click(); |
| 114 | + var res = checkOncoprintElement(); |
| 115 | + assertScreenShotMatch(res); |
| 116 | + }); |
| 117 | + |
| 118 | + it('oncoprinter reset colors button is hidden when default colors are used', () => { |
| 119 | + // click "Edit Colors" to open modal and check "Reset Colors" button in modal |
| 120 | + var trackOptionsElts = getNthOncoprintTrackOptionsElements(2); |
| 121 | + $(trackOptionsElts.button_selector).click(); |
| 122 | + $(trackOptionsElts.dropdown_selector).waitForDisplayed({ |
| 123 | + timeout: 1000, |
| 124 | + }); |
| 125 | + $(trackOptionsElts.dropdown_selector + ' li:nth-child(11)').click(); |
| 126 | + getElementByTestHandle('resetColors').waitForDisplayed({ |
| 127 | + reverse: true, |
| 128 | + }); |
| 129 | + }); |
| 130 | +}); |
0 commit comments