|
1 |
| -const isOctez = (data) => data.settingsNode.activeNode.type === 'octez'; |
| 1 | +import { testForTezedge } from '../../support'; |
2 | 2 |
|
3 | 3 | context('GITHUB VERSION', () => {
|
4 |
| - it('[GITHUB VERSION] display the Node release tag in the UI', () => { |
5 |
| - cy.intercept('GET', '/dev/version/').as('getNodeTagRequest'); |
6 |
| - cy.visit(Cypress.config().baseUrl); |
7 |
| - let nodeTag; |
8 |
| - cy.wait(2000).then(() => { |
9 |
| - cy.window() |
10 |
| - .its('store') |
11 |
| - .then((store) => { |
12 |
| - store.subscribe(state => { |
13 |
| - if (nodeTag) { |
14 |
| - return false; |
15 |
| - } |
| 4 | + beforeEach(() => { |
| 5 | + cy.intercept('GET', '/dev/version/').as('getNodeTagRequest') |
| 6 | + .intercept('GET', '/monitor/commit_hash/').as('getNodeLastCommitRequest') |
| 7 | + .intercept('GET', '/v2/version/').as('getDebuggerLastCommitRequest') |
| 8 | + .visit(Cypress.config().baseUrl); |
| 9 | + }); |
16 | 10 |
|
17 |
| - if (!isOctez(state)) { |
18 |
| - nodeTag = state.githubVersion.nodeTag.trim(); |
19 |
| - } |
20 |
| - }); |
| 11 | + it('[GITHUB VERSION] display the Node release tag in the UI', () => testForTezedge(() => { |
| 12 | + let nodeTag; |
| 13 | + cy.wait(2000) |
| 14 | + .window() |
| 15 | + .its('store') |
| 16 | + .then(store => { |
| 17 | + store.subscribe(state => { |
| 18 | + nodeTag = state.githubVersion.nodeTag.trim(); |
21 | 19 | });
|
22 |
| - }); |
23 |
| - |
24 |
| - cy.wait(3000).then(() => { |
25 |
| - cy.get('.settings-node-select mat-select-trigger span').then(nodeName => { |
| 20 | + }) |
| 21 | + .wait(3000) |
| 22 | + .get('.settings-node-select mat-select-trigger span') |
| 23 | + .then(nodeName => { |
26 | 24 | if (!nodeName.text().includes('octez')) {
|
27 | 25 | cy.get('@getNodeTagRequest').its('response.statusCode').should('eq', 200)
|
28 |
| - .then(() => { |
29 |
| - cy.get('.node-tag-number .pointer-none') |
30 |
| - .should(($element) => { |
31 |
| - expect($element.text().trim()).to.equal(nodeTag); |
32 |
| - }); |
| 26 | + .get('.node-tag-number .pointer-none') |
| 27 | + .then(element => { |
| 28 | + expect(element.text().trim()).to.equal(nodeTag); |
33 | 29 | });
|
34 | 30 | }
|
35 | 31 | });
|
36 |
| - }); |
37 |
| - }); |
| 32 | + })); |
38 | 33 |
|
39 |
| - it('[GITHUB VERSION] display Node anchor with an url to the last commit, when click on the Node Tag', () => { |
40 |
| - cy.intercept('GET', '/monitor/commit_hash/').as('getNodeLastCommitRequest'); |
41 |
| - cy.visit(Cypress.config().baseUrl); |
42 |
| - cy.wait(2000).then(() => { |
43 |
| - cy.window() |
44 |
| - .its('store') |
45 |
| - .then((store) => { |
46 |
| - store.subscribe(data => { |
47 |
| - if (!isOctez(data)) { |
48 |
| - cy.get('@getNodeLastCommitRequest').its('response.statusCode').should('eq', 200).then(() => { |
49 |
| - cy.wait(2000).then(() => { |
50 |
| - store.select('githubVersion').subscribe((githubVersion) => { |
51 |
| - cy.get('app-github-version') |
52 |
| - .trigger('click') |
53 |
| - .then(() => { |
54 |
| - cy.wait(1000).then(() => { |
55 |
| - cy.get('#nodeCommit') |
56 |
| - .find('a') |
57 |
| - .should('have.attr', 'href', 'https://github.com/tezedge/tezedge/commit/' + githubVersion.nodeCommit); |
58 |
| - }); |
59 |
| - }); |
60 |
| - }); |
61 |
| - }); |
62 |
| - }); |
63 |
| - } |
64 |
| - }); |
| 34 | + it('[GITHUB VERSION] display Node anchor with an url to the last commit, when click on the Node Tag', () => testForTezedge(() => { |
| 35 | + cy.wait(2000) |
| 36 | + .get('@getNodeLastCommitRequest').its('response.statusCode').should('eq', 200) |
| 37 | + .window() |
| 38 | + .its('store') |
| 39 | + .then(store => { |
| 40 | + store.select('githubVersion').subscribe((githubVersion) => { |
| 41 | + cy.get('app-github-version') |
| 42 | + .trigger('click') |
| 43 | + .wait(1000) |
| 44 | + .get('#nodeCommit') |
| 45 | + .find('a') |
| 46 | + .should('have.attr', 'href', 'https://github.com/tezedge/tezedge/commit/' + githubVersion.nodeCommit); |
65 | 47 | });
|
66 |
| - }); |
67 |
| - }); |
68 |
| - |
69 |
| - it('[GITHUB VERSION] perform Debugger last commit request successfully', () => { |
70 |
| - cy.intercept('GET', '/v2/version/').as('getDebuggerLastCommitRequest'); |
71 |
| - cy.visit(Cypress.config().baseUrl); |
72 |
| - |
73 |
| - cy.wait(1000).then(() => { |
74 |
| - cy.get('.settings-node-select mat-select-trigger span').then(nodeName => { |
75 |
| - if (!nodeName.text().includes('octez')) { |
76 |
| - cy.wait('@getDebuggerLastCommitRequest') |
77 |
| - .its('response.statusCode') |
78 |
| - .should('eq', 200); |
79 |
| - } |
80 | 48 | });
|
81 |
| - }); |
82 |
| - }); |
| 49 | + })); |
| 50 | + |
| 51 | + it('[GITHUB VERSION] perform Debugger last commit request successfully', () => testForTezedge(() => { |
| 52 | + cy.wait('@getDebuggerLastCommitRequest') |
| 53 | + .its('response.statusCode') |
| 54 | + .should('eq', 200); |
| 55 | + })); |
83 | 56 |
|
84 |
| - it('[GITHUB VERSION] display Debugger anchor with an url to the last commit, when click on the Node Tag', () => { |
85 |
| - cy.visit(Cypress.config().baseUrl); |
| 57 | + it('[GITHUB VERSION] display Debugger anchor with an url to the last commit, when click on the Node Tag', () => testForTezedge(() => { |
86 | 58 | let nodeDebuggerCommit;
|
87 |
| - cy.wait(1000).then(() => { |
88 |
| - cy.window() |
89 |
| - .its('store') |
90 |
| - .then((store) => { |
91 |
| - store.subscribe(data => { |
92 |
| - if (!isOctez(data)) { |
93 |
| - nodeDebuggerCommit = data.githubVersion.debuggerCommit; |
94 |
| - } |
95 |
| - }); |
| 59 | + cy.wait(1000) |
| 60 | + .window() |
| 61 | + .its('store') |
| 62 | + .then(store => { |
| 63 | + store.subscribe(data => { |
| 64 | + nodeDebuggerCommit = data.githubVersion.debuggerCommit; |
96 | 65 | });
|
97 |
| - }); |
98 |
| - |
99 |
| - cy.wait(2000).then(() => { |
100 |
| - cy.get('.settings-node-select mat-select-trigger span').then(nodeName => { |
101 |
| - if (!nodeName.text().includes('octez')) { |
102 |
| - cy.get('app-github-version .node-tag-number') |
103 |
| - .click() |
104 |
| - .then(() => { |
105 |
| - cy.wait(1500).then(() => { |
106 |
| - if (nodeDebuggerCommit) { |
107 |
| - cy.get('#debuggerCommit') |
108 |
| - .find('a') |
109 |
| - .should('have.attr', 'href', 'https://github.com/tezedge/tezedge-debugger/commit/' + nodeDebuggerCommit); |
110 |
| - } |
111 |
| - }); |
112 |
| - }); |
| 66 | + }) |
| 67 | + .wait(2000) |
| 68 | + .get('app-github-version .node-tag-number') |
| 69 | + .click() |
| 70 | + .wait(1500) |
| 71 | + .then(() => { |
| 72 | + if (nodeDebuggerCommit) { |
| 73 | + cy.get('#debuggerCommit') |
| 74 | + .find('a') |
| 75 | + .should('have.attr', 'href', 'https://github.com/tezedge/tezedge-debugger/commit/' + nodeDebuggerCommit); |
113 | 76 | }
|
114 | 77 | });
|
115 |
| - }); |
116 |
| - }); |
| 78 | + })); |
117 | 79 |
|
118 |
| - it('[GITHUB VERSION] display the Explorer last commit number in the UI', () => { |
119 |
| - cy.visit(Cypress.config().baseUrl); |
| 80 | + it('[GITHUB VERSION] display the Explorer last commit number in the UI', () => testForTezedge(() => { |
120 | 81 | let explorerCommit;
|
121 |
| - cy.wait(1000).then(() => { |
122 |
| - cy.window() |
123 |
| - .its('store') |
124 |
| - .then((store) => { |
125 |
| - store.subscribe(data => { |
126 |
| - if (!isOctez(data)) { |
127 |
| - if (data.githubVersion.explorerCommit.length) { |
128 |
| - explorerCommit = data.githubVersion.explorerCommit; |
129 |
| - } |
130 |
| - } else { |
131 |
| - return false; |
132 |
| - } |
133 |
| - }); |
| 82 | + cy.wait(1000) |
| 83 | + .window() |
| 84 | + .its('store') |
| 85 | + .then(store => { |
| 86 | + store.subscribe(data => { |
| 87 | + if (data.githubVersion.explorerCommit.length) { |
| 88 | + explorerCommit = data.githubVersion.explorerCommit; |
| 89 | + } |
134 | 90 | });
|
135 |
| - }); |
136 |
| - |
137 |
| - cy.wait(2000).then(() => { |
138 |
| - cy.get('.settings-node-select mat-select-trigger span').then(nodeName => { |
139 |
| - if (!nodeName.text().includes('octez') && explorerCommit) { |
| 91 | + }) |
| 92 | + .wait(2000) |
| 93 | + .get('.settings-node-select mat-select-trigger span') |
| 94 | + .then(() => { |
| 95 | + if (explorerCommit) { |
140 | 96 | cy.get('app-github-version')
|
141 | 97 | .trigger('click')
|
142 |
| - .then(() => { |
143 |
| - cy.wait(1000).then(() => { |
144 |
| - cy.get('#explorerCommit') |
145 |
| - .find('a') |
146 |
| - .should('have.attr', 'href', 'https://github.com/tezedge/tezedge-explorer/commit/' + explorerCommit); |
147 |
| - }); |
148 |
| - }); |
| 98 | + .wait(1000) |
| 99 | + .get('#explorerCommit') |
| 100 | + .find('a') |
| 101 | + .should('have.attr', 'href', 'https://github.com/tezedge/tezedge-explorer/commit/' + explorerCommit); |
149 | 102 | }
|
150 | 103 | });
|
151 |
| - }); |
152 |
| - }); |
| 104 | + })); |
153 | 105 | });
|
0 commit comments