Skip to content

Commit a15f69e

Browse files
authored
Merge pull request #303 from terminusdb/leafletFix
Leaflet fix
2 parents aa47b3b + 9ae3a37 commit a15f69e

39 files changed

+897
-858
lines changed

package-lock.json

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

packages/tdb-access-control-component/src/roles/NewMemberModal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const NewMemberModal = ({show, setShow, team, accessControlDashboard,opti
6060
<Form.Control
6161
ref={emailInput}
6262
{...value}
63+
id={"invite__email__input"}
6364
type="text"
6465
placeholder="Email"
6566
aria-describedby="inputGroupPrepend"

packages/tdb-access-control-component/src/roles/RoleList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const RoleListModal = (props)=>{
5454
size="lg"
5555
onHide={(e) => props.setShow(false)}>
5656
<Modal.Header closeButton>
57-
<h5 className="text-success mt-3 mb-3">{props.title}</h5>
57+
<h5 className="text-light fw-bold mt-3 mb-3">{props.title}</h5>
5858
</Modal.Header>
5959
<Modal.Body>
6060
{props.successMessage &&

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,15 @@ describe(`Test Advanced Filters in document explorer`, () => {
249249
});*/
250250
})
251251

252+
// delete dataProduct
253+
it('Delete dataProduct', ()=>{
254+
cy.visit(`/${teamName}/${dataProduct}`)
255+
cy.deleteDataProduct(dataProduct)
256+
})
257+
258+
it('Logout', () => {
259+
cy.logout()
260+
})
261+
252262

253263
})
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
import './branch_management.cy'
2-
import './cr_inactive.cy'
3-
import './document_ui.cy'
1+
import "./advanced_filter.cy"
2+
import "./branch_management.cy"
3+
import "./cr_diff_workflow.cy"
4+
import "./cr_inactive.cy"
5+
import "./document_history.cy"
6+
import "./graphQL.cy"
7+
import "./update_dataProduct_details.cy"
8+
import "./woql.cy"
9+
import "./workflow.cy"
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import * as CONST from "../../../src/cypress.constants"
2+
import { IconBarConfig } from "../../../src/components/constants"
3+
import { EXAMPLES_PRODUCTS } from "../../../src/routing/constants"
4+
const teamName = Cypress.env('TEAM_NAME')
5+
const email = Cypress.env('COLLABORATOR_USER')
6+
const dataProduct="star_wars"
7+
let inboxIdOwner="", emailAddressOwner=""
8+
9+
describe(`Test Team Management`, () => {
10+
const dashboard = Cypress.config().baseUrl
11+
12+
/** add this statement to stop cypress form complaining
13+
* about react-leaflet being used in terminusdb-document-ui */
14+
Cypress.on('uncaught:exception', (err, runnable) => {
15+
return false;
16+
});
17+
18+
// visit dashboard-dev at the start
19+
before(function () {
20+
cy.visit(dashboard)
21+
return cy.mailslurp().then(mailslurp => mailslurp.createInbox())
22+
.then(inbox => {
23+
// save inbox id and email address to this (make sure you use function and not arrow syntax)
24+
inboxIdOwner = inbox.id
25+
emailAddressOwner = inbox.emailAddress
26+
//console.log(inboxIdOwner,emailAddressOwner)
27+
})
28+
});
29+
30+
// login to terminusdb
31+
it('Check to see that you can login with an exists user', () => {
32+
cy.userLogin()
33+
})
34+
35+
// select Terminusdb_demo team
36+
it('Select Team', () => {
37+
cy.selectTeam(teamName)
38+
})
39+
40+
// Go to administrator page
41+
it('Go to administrator page', () => {
42+
cy.get(`button[id="profile_menu_arrow"]`).should('exist').click();
43+
cy.get(`a[id="team_members"]`).should('exist').click();
44+
cy.wait(1000)
45+
cy.isCorrectURL(`/${teamName}/administrator`)
46+
})
47+
48+
// Send an Invitation to join team
49+
it('Send an Invitation to join team', () => {
50+
cy.get(`button`).contains(`Invite a Member`).should('exist').click();
51+
cy.get(`input[id="invite__email__input"]`).focus().type(emailAddressOwner);
52+
cy.get(`input[id="Role/admin"]`).should('exist').click();
53+
cy.get(`button[id="add_element_button"]`).should('exist').click();
54+
})
55+
56+
// Logout
57+
it('Logout', () => {
58+
cy.logout()
59+
})
60+
61+
it('Open the email box and check for the invitation email and accept Invitation', ()=>{
62+
cy.mailslurp().then(mailslurp => mailslurp.waitForLatestEmail(inboxIdOwner, 30000, true))
63+
.then(email => { expect(email.subject).to.contain(`Invitation from ${email} to collaborate on a team ${teamName}`)
64+
// get the verification link
65+
const link = email.body.match(/href="([^"]*)/)[1];
66+
// cy.origin('terminusdb.com', { args: { link } }, ({ link }) => {
67+
cy.visit(link);
68+
cy.wait(3000)
69+
cy.get('h5').contains('You have been invited').should('exist')
70+
cy.get('h5').contains(`to join the ${teamName} team.`).should('exist')
71+
cy.get('h5').contains(`To accept this invite please confirm`).should('exist')
72+
cy.get('button').contains(`REJECT`).should('exist')
73+
cy.get('button').contains(`ACCEPT`).should('exist').click()
74+
})
75+
76+
//cy.get("._pendo-close-guide").click()
77+
})
78+
79+
80+
81+
82+
})
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
import * as CONST from "../../../src/cypress.constants"
2+
const dataProduct = `test__${Date.now()}`
3+
import { IconBarConfig } from "../../../src/components/constants"
4+
const teamName = Cypress.env('TEAM_NAME')
5+
const branchName=`branch__${Date.now()}`
6+
const crName=`CR__${branchName}`
7+
const email = Cypress.env('COLLABORATOR_USER')
8+
const documentName = `test__document`, propertyName = `test__document__name`
9+
const schemaSaveCommitMessage=`Update from model builder`
10+
let branchID=""
11+
12+
describe(`Test time travel widget`, () => {
13+
const dashboard = Cypress.config().baseUrl
14+
15+
/** add this statement to stop cypress form complaining
16+
* about react-leaflet being used in terminusdb-document-ui */
17+
Cypress.on('uncaught:exception', (err, runnable) => {
18+
return false;
19+
});
20+
21+
// visit dashboard-dev at the start
22+
before(function () {
23+
cy.visit(dashboard)
24+
});
25+
26+
// login to terminusdb
27+
it('Check to see that you can login with an exists user', () => {
28+
cy.userLogin()
29+
})
30+
31+
// select a team
32+
it('Select Team', () => {
33+
cy.selectTeam(teamName)
34+
})
35+
36+
// Create a new data product
37+
it('Create a new dataProduct', ()=>{
38+
cy.newDataProduct(teamName, dataProduct)
39+
})
40+
41+
// Go to Product Model Page
42+
it("Go to Product Model Page", () => {
43+
cy.get(`a[data-cy=${IconBarConfig.dataProductModal.key}]`).should('exist').click();
44+
cy.wait(2000)
45+
})
46+
47+
// Add a new document
48+
it("Add a new document", () => {
49+
cy.get(`button[id="add_new_to_schema_button"]`).should('exist').click();
50+
cy.get(`a[data-cy="add_new_document"]`).should('exist').click();
51+
cy.get(`.RRT__container`).should('exist')
52+
53+
cy.get(`input[id="id"]`).focus().type(documentName)
54+
})
55+
56+
// Add a string property to document
57+
it("Add a string property to document", () => {
58+
cy.get(`div[id="tab-2"]`).should('exist').click();
59+
cy.get(`button[id="add_property"]`).should('exist').click();
60+
cy.get(`a[id="StringProperty"]`).should('exist').click();
61+
cy.get(`.tdb__panel__box--edit`).should('exist')
62+
cy.get(`input[id="id"]`).focus().type(propertyName)
63+
})
64+
65+
//Add a commit message and save document
66+
it("Add a commit message and save document", () => {
67+
cy.get(`input[data-cy="schema_save_description"]`).should('exist')
68+
69+
70+
const url = `/${teamName}/api/document/${teamName}/${dataProduct}/local/branch/main?graph_type=schema&full_replace=true&author=${email}&message=Update%20from%20model%20builder`
71+
cy.intercept({
72+
method: 'POST',
73+
path: url,
74+
}).as('saveSchema')
75+
76+
cy.get(`button[data-cy="schema_save_button"]`).should('exist').click();
77+
78+
cy.wait('@saveSchema')
79+
})
80+
81+
// Click on time travel widget to see the first commit
82+
it("Click on time travel widget to see the first commit", () => {
83+
const url = `/${teamName}/api/woql/${teamName}/${dataProduct}/local/branch/main`
84+
cy.intercept({
85+
method: 'POST',
86+
path: url,
87+
}).as('getCommit')
88+
89+
90+
cy.get(`button[data-cy="time_travel_widget_id"]`).should('exist').click();
91+
cy.wait('@getCommit')
92+
//cy.get('h6').contains(schemaSaveCommitMessage)
93+
})
94+
95+
// Go to Document Explorer
96+
it("Go to Document Explorer", () => {
97+
cy.get(`a[data-cy=${IconBarConfig.documentExplorer.key}]`).should('exist').click();
98+
})
99+
100+
// Create a CR
101+
it("Create a CR ", () => {
102+
let url = `/api/changes/${teamName}/${dataProduct}`
103+
cy.intercept({
104+
method: 'POST',
105+
path: url,
106+
}).as('getBranchName')
107+
cy.createCR(crName, documentName)
108+
// create CR
109+
cy.get(`button[data-cy=${CONST.CREATE_CHANGE_REQUEST_BUTTON}]`).should('exist').click();
110+
cy.get(2000)
111+
cy.wait('@getBranchName').then((interception) => {
112+
assert.isNotNull(interception.response.body, 'Intercepting create CR API ')
113+
//console.log("interception.response.body", interception.response.body)
114+
branchID = interception.response.body.branchName
115+
})
116+
})
117+
118+
// Check if Frame Viewer is loaded and add 3 new documents
119+
it("Check if Frame Viewer is loaded and add 3 new documents", () => {
120+
// check if frame viewer loaded
121+
cy.get(`div[data-cy=${CONST.FRAME_VIEWER}]`).should('exist');
122+
cy.wait(1000)
123+
124+
// first entry
125+
cy.get(`textarea[data-cy="root_${propertyName}"]`).focus().type(`${propertyName}__1`)
126+
cy.get('.btn').contains('Submit').should('exist').click();
127+
cy.wait(1000)
128+
129+
// second entry
130+
cy.get(`button[data-cy="new_document_${documentName}"]`).should('exist').click();
131+
cy.get(`textarea[data-cy="root_${propertyName}"]`).focus().type(`${propertyName}__2`)
132+
cy.get('.btn').contains('Submit').should('exist').click();
133+
cy.wait(1000)
134+
135+
// third entry
136+
cy.get(`button[data-cy="new_document_${documentName}"]`).should('exist').click();
137+
cy.get(`textarea[data-cy="root_${propertyName}"]`).focus().type(`${propertyName}__3`)
138+
cy.get('.btn').contains('Submit').should('exist').click();
139+
cy.wait(1000)
140+
141+
})
142+
143+
// Click on time travel widget to see 3 commits where new documents were added
144+
it("Click on time travel widget to see 3 commits where new documents were added", () => {
145+
cy.get(`button[data-cy="time_travel_widget_id"]`).should('exist').click();
146+
cy.wait(2000)
147+
cy.get('.time-travel-card').find('h6').contains(`add a new document`).should('exist')
148+
cy.get(`button[data-cy="close__time__travel__widget"]`).should('exist').click({force: true});
149+
})
150+
151+
// Check if Document Table has three entries as well
152+
it("Check if Document Table has three entries as well", () => {
153+
cy.get("table tbody").find("tr").then((row) => {
154+
expect(row.length).eq(3)
155+
});
156+
})
157+
158+
// Click on time travel widget and jump to a commit where no instances of document were created
159+
it("Click on time travel widget and jump to a commit where no instances of document were created", () => {
160+
cy.get(`button[data-cy="time_travel_widget_id"]`).should('exist').click();
161+
cy.wait(5000)
162+
cy.get(`button[id="time_travel_to_${schemaSaveCommitMessage}"]`).should('exist').click();
163+
cy.wait(5000)
164+
cy.get(`button[id="time_travel_to_${schemaSaveCommitMessage}"]`).should('not.exist')
165+
cy.get('h6').contains(`You are at this point in time`).should('exist')
166+
// Check if Document Table has 0 entry
167+
cy.get("table tbody").find("tr").should("not.exist")
168+
})
169+
170+
// Select reset button of time travel widget
171+
it("Select reset button of time travel widget", () => {
172+
cy.get(`button[data-cy="roll_back_to_head"]`).should('exist').click({force: true});
173+
cy.wait(4000)
174+
})
175+
176+
// Check if Document Table has three entries and has been reset to the head of the branch
177+
it("Check if Document Table has three entries and has been reset to the head of the branch", () => {
178+
cy.get("table tbody").find("tr").then((row) => {
179+
expect(row.length).eq(3)
180+
});
181+
})
182+
183+
// delete dataProduct
184+
it('Delete dataProduct', ()=>{
185+
cy.visit(`/${teamName}/${dataProduct}`)
186+
cy.deleteDataProduct(dataProduct)
187+
})
188+
189+
it('Logout', () => {
190+
cy.logout()
191+
})
192+
193+
})

packages/tdb-dashboard/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@apollo/client": "^3.7.1",
4949
"@auth0/auth0-spa-js": "^1.19.3",
5050
"@codemirror/highlight": "^0.19.8",
51+
"@cypress/webpack-preprocessor": "^5.17.1",
5152
"@fortawesome/fontawesome-free": "^6.3.0",
5253
"@fortawesome/fontawesome-svg-core": "^6.3.0",
5354
"@fortawesome/free-solid-svg-icons": "^6.3.0",
@@ -56,6 +57,8 @@
5657
"@stripe/react-stripe-js": "^1.16.4",
5758
"@stripe/stripe-js": "^1.46.0",
5859
"@terminusdb/terminusdb-client": "^10.0.31",
60+
"@uiw/react-markdown-preview": "^4.1.15",
61+
"@uiw/react-md-editor": "^3.23.5",
5962
"allotment": "^1.19.0",
6063
"axios": "^0.21.1",
6164
"classnames": "^2.2.5",

0 commit comments

Comments
 (0)