-
Notifications
You must be signed in to change notification settings - Fork 2
/
ExploreGDC.js
158 lines (135 loc) · 4.99 KB
/
ExploreGDC.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
* Tests the explore dialog
*/
describe('Explore GDC', function() {
before(function() {
cy.visit('http://localhost:3000/?loc=1%3A1..248956422')
cy
.server()
cy
.route({
method: 'POST',
url: 'v0/graphql/GenesTable',
response: 'fixture:ExploreGDC/GeneTrack.json'
}).as('getGeneTrack')
cy
.route({
method: 'POST',
url: 'v0/graphql/SsmsTable',
response: 'fixture:ExploreGDC/SSMTrack.json'
}).as('getMutationTrack')
cy
.route({
method: 'POST',
url: 'v0/graphql/CNVsTable',
response: 'fixture:ExploreGDC/CNVTrack.json'
}).as('getCNVTrack')
cy.wait(1000) // Wait for load
openExploreDialog()
})
/**
* Opens the explore dialog
*/
var openExploreDialog = function () {
cy.get('#dropdownbutton_gdc').type('{enter}')
cy.contains('Exploration').click()
cy.contains('Explore cases, genes and mutations').click()
}
/**
* Selects a facet tab, an accordion in that tab, and an option in that accordion
* @param {number} tabIndex tab index (0-2)
* @param {number} accordionIndex accordionIndex(0-n)
* @param {number} optionIndex optionIndex (0-m)
*/
var selectFacetTab = function (tabIndex, accordionIndex, optionIndex) {
cy.get('.dijitTabListWrapper').eq(0).within(() => {
cy.get('.dijitTab').eq(tabIndex).click()
})
cy.get('.dijitTabContainerTopChildWrapper.dijitVisible').eq(0).within(() => {
cy.get('.dijitAccordionTitle').eq(accordionIndex).click()
cy.get('.dijitAccordionChildWrapper').eq(accordionIndex).within(() => {
cy.get('.dijitCheckBox').eq(optionIndex).click()
})
})
}
/**
* Close the popup window
*/
var closePopup = function() {
cy.contains('GDC Browser').parent().within(() => {
cy.get('.dijitDialogCloseIcon').click()
})
}
/**
* Select a results tab
* @param {number} tabIndex index of tab (0-2)
*/
var selectResultsTab = function (tabIndex) {
cy.get('.dijitTabListWrapper').eq(1).within(() => {
cy.get('.dijitTab').eq(tabIndex).click()
})
}
/**
* Checks the tab container for the existance of the given text
* @param {Array<String>} textValues array of text
*/
var checkResultsTab = function (textValues) {
cy.get('.dijitTabContainer').eq(1).within(() => {
for (var text of textValues) {
cy.contains(text)
}
})
}
/**
* Checks that each results tab has the expected information
* Assumes case tab is already selected
* @param {*} caseArray array of strings to check for on case tab
* @param {*} geneArray array of strings to check for on gene tab
* @param {*} mutationArray array of strings to check for on mutation tab
*/
var checkAllResultsTab = function(caseArray, geneArray, mutationArray) {
cy.wait(3000) // wait a few seconds for results to load
// Validate case results
checkResultsTab(caseArray)
// Validate gene results
selectResultsTab(1)
checkResultsTab(geneArray)
// Validate mutation results
selectResultsTab(2)
checkResultsTab(mutationArray)
}
it('Should be able to explore and apply facets', function() {
// Select ethnicity -> hispanic or latino
cy.get('.dijitDialog').within(() => {
cy.contains('Explore data available on the GDC Data Portal')
selectFacetTab(0, 0, 2)
})
checkAllResultsTab(
['Showing 1 to 20 of 3,134', 'TCGA-A5-A1OF', 'TCGA-AJ-A3EK'],
['Showing 1 to 20 of 21,361', 'TTN', 'TP53'],
['Showing 1 to 20 of 139,827', 'chr7:g.140753336A>T', 'chr2:g.208248388C>T']
)
// Select is cancer gene census - 1
cy.get('.dijitDialog').within(() => {
selectFacetTab(1, 1, 0)
})
checkAllResultsTab(
['Showing 1 to 20 of 509', 'TCGA-A5-A1OF', 'TCGA-AJ-A3EK'],
['Showing 1 to 20 of 575', 'TP53', 'BRAF'],
['Showing 1 to 20 of 6,962', 'chr7:g.140753336A>T', 'chr2:g.208248388C>T']
)
selectResultsTab(0)
// Add tracks and check that they were added
cy.get('.dijitTabContainer').eq(1).within(() => {
cy.contains('All Genes').eq(0).click()
cy.contains('All Mutations').eq(0).click()
cy.contains('All CNVs').eq(0).click()
})
closePopup()
cy.wait(['@getMutationTrack.all', '@getGeneTrack.all', '@getCNVTrack.all'])
// Check that tracks are added
cy.contains('GDC_Genes_TCGA-A5-A1OF')
cy.contains('GDC_SimpleSomaticMutations_TCGA-A5-A1OF')
cy.contains('GDC_CNVs_TCGA-A5-A1OF')
})
})