Skip to content

Commit 8f7a1cb

Browse files
committed
key component bug
1 parent 38d054f commit 8f7a1cb

File tree

3 files changed

+38
-24
lines changed

3 files changed

+38
-24
lines changed

packages/tdb-dashboard/cypress/e2e/dashboard/document_ui.cy.js

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const teamName = Cypress.env('TEAM_NAME')
44
const dataProduct="nuclear"
55
const email = Cypress.env('COLLABORATOR_USER')
66
const crName=`CR_${Date.now()}`
7-
let documentID="", nuclearPowerPlantData={}, branchID={}
7+
let documentID="", nuclearPowerPlantData={}
88

99
describe(`Test document explorer UI (Edit/delete/create)`, () => {
1010
const dashboard = Cypress.config().baseUrl
@@ -40,38 +40,25 @@ describe(`Test document explorer UI (Edit/delete/create)`, () => {
4040
cy.wait('@cloaning')
4141
})*/
4242

43+
// set CR Inactive
44+
it("Set Change Request Inactive", () => {
45+
cy.visit(`/CYPRESS_TEST_TEAM/nuclear`)
46+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_INACTIVE}]`).should('exist').click();
47+
})
48+
4349
// Go to Document Explorer
4450
it("Go to Document Explorer", () => {
45-
cy.visit(`/CYPRESS_TEST_TEAM/nuclear`)
4651
cy.get(`a[data-cy=${IconBarConfig.documentExplorer.key}]`).should('exist').click();
4752
})
4853

4954
// Click on add a new NuclearPowerPlant
50-
/*it("Click on add a new NuclearPowerPlant", () => {
55+
it("Click on add a new NuclearPowerPlant", () => {
5156
cy.get(`button[data-cy=${CONST.NEW_DOCUMENT_BUTTON_ID}_NuclearPowerPlant]`).should('exist').click();
5257
cy.get(2000)
53-
// the CR modal should pop up on click of create document
54-
cy.get('.modal-dialog').should('exist')
55-
})*/
56-
57-
// Create a CR
58-
it("Create a CR ", () => {
59-
let url = `/api/changes/${teamName}/${dataProduct}`
60-
cy.intercept({
61-
method: 'POST',
62-
path: url,
63-
}).as('getBranchName')
64-
cy.createCR(crName, "NuclearPowerPlant")
65-
// create CR
66-
cy.get(`button[data-cy=${CONST.CREATE_CHANGE_REQUEST_BUTTON}]`).should('exist').click();
67-
cy.get(2000)
68-
cy.wait('@getBranchName').then((interception) => {
69-
assert.isNotNull(interception.response.body, 'Intercepting create CR API ')
70-
//console.log("interception.response.body", interception.response.body)
71-
branchID = interception.response.body.branchName
72-
})
7358
})
7459

60+
61+
7562
// Check if Frame Viewer of NuclearPowerPlant is loaded
7663
it("Check if Frame Viewer of NuclearPowerPlant is loaded", () => {
7764
// check if frame viewer loaded
@@ -147,7 +134,7 @@ describe(`Test document explorer UI (Edit/delete/create)`, () => {
147134

148135
// Create new Nuclear Power Plant
149136
it("Create new Nuclear Power Plant", () => {
150-
const url = `/${teamName}/api/document/${teamName}/${dataProduct}/local/branch/${branchID}?author=${email}&message=add%20a%20new%20document`
137+
const url = `/${teamName}/api/document/${teamName}/${dataProduct}/local/branch/main?author=${email}&message=add%20a%20new%20document`
151138
cy.intercept({
152139
method: 'POST',
153140
path: url,
@@ -175,4 +162,29 @@ describe(`Test document explorer UI (Edit/delete/create)`, () => {
175162
cy.get(2000)
176163
})
177164

165+
// Check if Frame Viewer of NuclearPowerPlant is loaded
166+
it("Check if Frame Viewer of NuclearPowerPlant is loaded", () => {
167+
// check if frame viewer loaded
168+
cy.get(`div[data-cy=${CONST.FRAME_VIEWER}]`).should('exist');
169+
cy.wait(1000)
170+
})
171+
172+
// Check if Frame Viewer of NuclearPowerPlant is loaded
173+
it("Check if Frame Viewer of NuclearPowerPlant is loaded", () => {
174+
// check if frame viewer loaded
175+
cy.get(`div[data-cy=${CONST.FRAME_VIEWER}]`).should('exist');
176+
cy.wait(1000)
177+
})
178+
179+
// test document traversing
180+
it("Click linked Country to test Document traversing", () => {
181+
// check if frame viewer loaded
182+
cy.get(`div[data-cy=${`Country/${nuclearPowerPlantData.country}`}]`).should('exist').click();
183+
cy.wait(1000)
184+
cy.get('.modal-dialog').should('exist')
185+
cy.get(`div[id="traverse__document__links"]`).should('exist')
186+
187+
})
188+
189+
178190
})

packages/tdb-documents-ui/src/components/SearchExistingLink.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const LinkedDocument = ({ selected, onTraverse, className }) => {
2828
<div className={`text-break text-decoration-underline ${className} bg-transparent`}
2929
onClick={(e) => handleClick(e, selected.id)}
3030
style={ {cursor: "pointer"} }
31+
data-cy={selected.id}
3132
id={selected.id}>
3233
{selected.label ? selected.label : selected.id}
3334
</div>

packages/tdb-react-components/src/treeGraphComponent/MainGraphObject.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ export const MainGraphObject = (mainGraphDataProvider,dbName)=>{
613613

614614
// new functions
615615
const getClassKey=()=>{
616+
if(!_currentNode) return {type:'Lexical',fields:[]}
616617
if(_currentNode.schema['@key']){
617618
const keyObj= _currentNode.schema['@key'];
618619
return {type : keyObj["@type"],fields: keyObj['@fields'] || []}

0 commit comments

Comments
 (0)