Skip to content

Commit 9370ad2

Browse files
authored
Merge pull request #297 from terminusdb/leafletFix
Leaflet fix and schema update
2 parents 2654d53 + f75e3c0 commit 9370ad2

File tree

277 files changed

+11250
-15757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+11250
-15757
lines changed

package-lock.json

Lines changed: 4733 additions & 1638 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tdb-dashboard/cypress.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"viewportWidth"; 1440,
33
"viewportHeight"; 900,
44
//"baseUrl";"http://localhost:3030/",
5-
"responseTimeout";120000,
5+
//"responseTimeout";120000,
6+
"responseTimeout";5000,
67
"chromeWebSecurity"; false,
78

89
"env"; {
910
"password"; "root"
10-
}
11+
}
1112
}
1213

1314
//"baseUrl":"https://dashboard-dev.terminusdb.com/",
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
import * as CONST from "../../../src/cypress.constants"
2+
import { IconBarConfig } from "../../../src/components/constants"
3+
const teamName = Cypress.env('TEAM_NAME')
4+
const dataProduct="star_wars"
5+
const branchName=`branch__${Date.now()}`
6+
const crName=`CR__${branchName}`
7+
const email = Cypress.env('COLLABORATOR_USER')
8+
let planetData = {}, documentID="", branchID=""
9+
10+
describe(`Test to check Branch Management workflow`, () => {
11+
const dashboard = Cypress.config().baseUrl
12+
13+
/** add this statement to stop cypress form complaining
14+
* about react-leaflet being used in terminusdb-document-ui */
15+
Cypress.on('uncaught:exception', (err, runnable) => {
16+
return false;
17+
});
18+
19+
// visit dashboard-dev at the start
20+
before(function () {
21+
cy.visit(dashboard)
22+
cy.fixture('starWarsPlanet.json').then(function (data) {
23+
planetData = data;
24+
})
25+
});
26+
27+
// login to terminusdb
28+
it('Check to see that you can login with an exists user', () => {
29+
cy.userLogin()
30+
})
31+
32+
// select Terminusdb_demo team
33+
it('Select Team', () => {
34+
cy.selectTeam(teamName)
35+
})
36+
37+
//Clone Starwars team
38+
it('Clone Starwars team', () => {
39+
cy.intercept(`/${teamName}/${dataProduct}`).as('cloaning')
40+
cy.get(`button[data-cy=${CONST.CLONE_BUTTON}_${dataProduct}]`).should('exist').click();
41+
cy.wait('@cloaning')
42+
})
43+
44+
45+
// Create New Branch
46+
it('Create New Branch', () => {
47+
48+
cy.visit(`/CYPRESS_TEST_TEAM/star_wars`)
49+
50+
// Activate Change Request
51+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_ACTIVE}]`).should('exist').click();
52+
cy.get(`button[data-cy=${CONST.BRANCH_MANAGEMENT_BUTTON_ID}]`).should('exist').click();
53+
// create
54+
cy.get(`button[data-cy=${CONST.NEW_BRANCH_BUTTON_ID}]`).should('exist').click();
55+
// the Branch modal should pop up
56+
cy.get('.modal-dialog').should('exist')
57+
// Input branch ID
58+
cy.get(`input[data-cy=${CONST.BRANCH_ID_INPUT}]`).should('exist').type(branchName);
59+
// force click here on modal since branch id input change is an onBlur()
60+
cy.get(`.modal-body`).should('exist').click();
61+
// create new branch
62+
cy.get(`button[data-cy=${CONST.CREATE_BRANCH_BUTTON_ID}]`).should('exist').click();
63+
})
64+
65+
it('Check if Branch created', () => {
66+
// check if data product is set to new branch id
67+
cy.get(`span[data-cy=${CONST.CURRENT_BRANCH_BADGE}]`).should('have.text', branchName)
68+
})
69+
70+
// Go to Document Explorer
71+
it("Go to Document Explorer", () => {
72+
cy.get(`a[data-cy=${IconBarConfig.documentExplorer.key}]`).should('exist').click();
73+
})
74+
75+
// Create a new CR
76+
it("Create a new CR", () => {
77+
const url = `/api/changes/${teamName}/${dataProduct}`
78+
cy.intercept({
79+
method: 'POST',
80+
path: url,
81+
}).as('getBranchName')
82+
cy.createCR(crName, "Planet")
83+
// create CR
84+
cy.get(`button[data-cy=${CONST.CREATE_CHANGE_REQUEST_BUTTON}]`).should('exist').click();
85+
cy.get(2000)
86+
cy.wait('@getBranchName').then((interception) => {
87+
assert.isNotNull(interception.response.body, 'intercepting create CR API')
88+
//console.log("interception.response.body", interception.response.body)
89+
branchID = interception.response.body.branchName
90+
})
91+
})
92+
93+
// Click on add a new Planet
94+
it("Add new Planet", () => {
95+
const url = `/${teamName}/api/document/${teamName}/${dataProduct}/local/branch/${branchID}?author=${email}&message=add%20a%20new%20document`
96+
cy.intercept({
97+
method: 'POST',
98+
path: url,
99+
}).as('addDocument')
100+
101+
// check if frame viewer loaded
102+
cy.get(`div[data-cy=${CONST.FRAME_VIEWER}]`).should('exist');
103+
104+
// add label as markdown
105+
cy.get('textarea[data-cy="root_label"]').focus().type(planetData.label)
106+
// add orbital_period
107+
cy.get('input[data-cy="root_orbital_period"]').focus().type(planetData.orbital_period)
108+
// add diameter
109+
cy.get('input[data-cy="root_diameter"]').focus().type(planetData.diameter)
110+
// add gravity
111+
cy.get('textarea[data-cy="root_gravity"]').focus().type(planetData.gravity)
112+
// add climate
113+
cy.get('textarea[data-cy="root_climate"]').focus().type(planetData.climate)
114+
115+
// click on submit button to create document
116+
cy.get('.btn').contains('Submit').should('exist').click();
117+
cy.wait(1000)
118+
119+
cy.wait('@addDocument').then((interception) => {
120+
assert.isNotNull(interception.response.body, 'intercepting Add Document API')
121+
//console.log("interception.response.body", interception.response.body)
122+
documentID = interception.response.body.branchName
123+
})
124+
125+
})
126+
127+
// Submit CR for Review
128+
it("Submit CR for Review", () => {
129+
cy.visit(`${teamName}/${dataProduct}/change_requests`)
130+
cy.get(`button[data-cy=${CONST.CR_READY_FOR_REVIEW}]`).should('exist').click();
131+
// CR Modal for review should pop up
132+
cy.get(`.modal-body`).should('exist').click();
133+
// add CR review message
134+
cy.get(`textarea[data-cy=${CONST.CHANGE_REQUEST_MESSAGE_FOR_REVIEW}]`).focus().type(`${crName}__REVIEW__MESSAGE`)
135+
// submit CR
136+
cy.get(`button[data-cy=${CONST.CHANGE_REQUEST_SUBMIT_REVIEW}]`).should('exist').click();
137+
})
138+
139+
// Review CR
140+
it("Review CR", () => {
141+
//cy.isCorrectURL(`${teamName}/${dataProduct}/change_requests`)
142+
cy.get(`button[data-cy=${CONST.CHANGE_REQUEST_SUBMIT_REVIEW_FOR_DIFF}]`).should('exist').click();
143+
cy.wait(1000)
144+
// Aprove CR
145+
cy.get(`button[data-cy=Approve]`).should('exist').click();
146+
//cy.isCorrectURL(`${teamName}/${dataProduct}/change_requests?status=Merged`)
147+
})
148+
149+
// Get newly created Planet
150+
it("Get newly created Planet", () => {
151+
cy.visit(`${teamName}/${dataProduct}/documents/Planet/${documentID}`)
152+
})
153+
154+
// Switch to main branch
155+
it("Switch to main branch", () => {
156+
cy.visit(`/${teamName}/${dataProduct}`)
157+
// click on branches
158+
cy.get(`button[data-cy=${CONST.BRANCH_MANAGEMENT_BUTTON_ID}]`).should('exist').click();
159+
// switch to main
160+
cy.get(`span[data-cy=${CONST.SWITCH_BRANCH_ID}__main]`).should('exist').click();
161+
cy.get(`span[data-cy=${CONST.CURRENT_BRANCH_BADGE}]`).should('have.text', "main")
162+
})
163+
164+
// Check if newly created Planet exists in main branch - api call should result in 404
165+
it("Check if newly created Planet exists in main branch", () => {
166+
cy.visit(`${teamName}/${dataProduct}/documents/Planet/${documentID}`)
167+
const url = `/${teamName}/api/document/${teamName}/${dataProduct}/local/branch/main?id=${documentID}`
168+
cy.intercept({
169+
method: 'GET',
170+
path: url,
171+
}).as('getDocument')
172+
173+
cy.wait('@getDocument').its('response.statusCode').should('eq', 404)
174+
})
175+
176+
177+
// delete dataProduct
178+
it('Delete dataProduct', ()=>{
179+
cy.visit(`/${teamName}/${dataProduct}`)
180+
cy.deleteDataProduct(dataProduct)
181+
})
182+
183+
it('Logout', () => {
184+
cy.logout()
185+
})
186+
187+
188+
189+
})
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/**
2+
* This test checks the Change Request Inactive Mode
3+
* checks included -
4+
* 1) Login
5+
* 2) Select a Team & Clone star_wars data product
6+
* 3) Select star_wars data product and turn Change Request Mode off
7+
* 4) Go to Document Explorer, Click on Create new Film
8+
* 5) Make sure CR modal does not appear & create a new film from starWarsFilm.json (see fixtures)
9+
* 6) Return to Data Product Home page & switch on Change Request Mode
10+
* 7) Go to Team select page and choose star_wars again - make sure Change Request Mode is switched on itself
11+
* 8) Go to Document Explorer and click on create new Film
12+
* 9) Make sure CR modal appears
13+
* 8) Go to Data Product Home page, delete data product & logout
14+
*/
15+
import * as CONST from "../../../src/cypress.constants"
16+
import { IconBarConfig } from "../../../src/components/constants"
17+
const teamName = Cypress.env('TEAM_NAME')
18+
const dataProduct="star_wars"
19+
20+
21+
describe(`Test to check Change Request Mode Inactive`, () => {
22+
const dashboard = Cypress.config().baseUrl
23+
let filmData = {}
24+
25+
/** add this statement to stop cypress form complaining
26+
* about react-leaflet being used in terminusdb-document-ui */
27+
Cypress.on('uncaught:exception', (err, runnable) => {
28+
return false;
29+
});
30+
31+
// visit dashboard-dev at the start
32+
before(function () {
33+
cy.visit(dashboard)
34+
cy.fixture('starWarsFilm.json').then(function (data) {
35+
filmData = data;
36+
})
37+
});
38+
39+
// login to terminusdb
40+
it('Check to see that you can login with an exists user', () => {
41+
cy.userLogin()
42+
})
43+
44+
// select Terminusdb_demo team
45+
it('Select Team', () => {
46+
cy.selectTeam(teamName)
47+
})
48+
49+
//Clone Starwars team
50+
it('Clone Starwars team', () => {
51+
cy.intercept(`/${teamName}/${dataProduct}`).as('cloaning')
52+
cy.get(`button[data-cy=${CONST.CLONE_BUTTON}_${dataProduct}]`).should('exist').click();
53+
cy.wait('@cloaning')
54+
})
55+
56+
// set CR Inactive
57+
it("Set Change Request Inactive", () => {
58+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_INACTIVE}]`).should('exist').click();
59+
})
60+
61+
// Go to Document Explorer
62+
it("Go to Document Explorer", () => {
63+
cy.get(`a[data-cy=${IconBarConfig.documentExplorer.key}]`).should('exist').click();
64+
})
65+
66+
// Click on add a new Film
67+
it("Add new Film", () => {
68+
cy.get(`button[data-cy=${CONST.NEW_DOCUMENT_BUTTON_ID}_Film]`).should('exist').click();
69+
cy.get(2000)
70+
// the CR modal should not pop up on click of create document
71+
cy.get('.modal-dialog').should('not.exist')
72+
// check if frame viewer loaded
73+
cy.get(`div[data-cy=${CONST.FRAME_VIEWER}]`).should('exist');
74+
75+
// add opening_crawl as markdown
76+
cy.get('.w-md-editor-text-input').focus().type(filmData.opening_crawl)
77+
// add director
78+
cy.get('textarea[data-cy="root_director"]').focus().type(filmData.director)
79+
// add producer
80+
cy.get('textarea[data-cy="root_producer"]').focus().type(filmData.producer)
81+
// add episode_id
82+
cy.get('input[data-cy="root_episode_id"]').focus().type(filmData.episode_id)
83+
84+
// click on submit button to create document
85+
cy.get('.btn').contains('Submit').should('exist').click();
86+
cy.get(2000)
87+
})
88+
89+
// Go to DataProduct Home Page
90+
it("Go to DataProduct Home Page", () => {
91+
cy.visit(`/${teamName}/${dataProduct}`)
92+
})
93+
94+
// Activate Change Request
95+
it("Activate Change Request", () => {
96+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_ACTIVE}]`).should('exist').click();
97+
})
98+
99+
// Activate Change Request
100+
it("Activate Change Request", () => {
101+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_ACTIVE}]`).should('exist').click();
102+
})
103+
104+
// Return to Team selection Page
105+
it("Return to Team selection Page & Reselect data product", () => {
106+
cy.visit(`/`)
107+
cy.selectTeam(teamName)
108+
// select starwars data product
109+
cy.visit(`/${teamName}/${dataProduct}`)
110+
})
111+
112+
// Check if Change Request is Active
113+
it("Check if Change Request is Active", () => {
114+
cy.get(`label[data-cy=${CONST.CHANGE_REQUEST_MODE_ACTIVE}]`)
115+
.parent().find('input').should('be.checked')
116+
})
117+
118+
// Go to Document Explorer
119+
it("Go to Document Explorer", () => {
120+
cy.get(`a[data-cy=${IconBarConfig.documentExplorer.key}]`).should('exist').click();
121+
})
122+
123+
// Click on add a new Film
124+
it("Add new Film", () => {
125+
cy.get(`button[data-cy=${CONST.NEW_DOCUMENT_BUTTON_ID}_Film]`).should('exist').click();
126+
cy.get(2000)
127+
// the CR modal should pop up on click of create document
128+
cy.get('.modal-dialog').should('exist')
129+
})
130+
131+
// delete dataProduct
132+
it('Delete dataProduct', ()=>{
133+
cy.visit(`/${teamName}/${dataProduct}`)
134+
cy.deleteDataProduct(dataProduct)
135+
})
136+
137+
it('Logout', () => {
138+
cy.logout()
139+
})
140+
141+
})

0 commit comments

Comments
 (0)