Esempio n. 1
0
 def test_graph_export_csv(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {self.browser.cookies.all()[0]["name"]: self.browser.cookies.all()[0]["value"], self.browser.cookies.all()[1]["name"]: self.browser.cookies.all()[1]["value"]}
     result = requests.get(self.live_server_url + '/tools/bobs-graph/export/csv/', cookies=cookies)
     spin_assert(lambda: self.assertEqual(
         result.headers['content-type'], 'application/zip'))
     spin_assert(lambda: self.assertEqual(
         self.browser.status_code.is_success(), True))
     test_file = StringIO(result.content)
     csv_zip = ZipFile(test_file)
     for name in csv_zip.namelist():
         fw = open('sylva/sylva/tests/files/' + name, 'w')
         fw.write(csv_zip.read(name))
         fw.close()
     for name in csv_zip.namelist():
         f = open('sylva/sylva/tests/files/' + name)
         csvFile = ""
         for line in f:
             csvFile += line
         f.close()
         spin_assert(lambda: self.assertEqual(csv_zip.read(name), csvFile))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 2
0
 def test_data_delete_with_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     add_permission(self, 'alice', DATA_CHANGE)
     add_permission(self, 'alice', DATA_DELETE)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath("//a[@id='dataMenu']").first.click()
     self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first.click()
     self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[text()='Remove']").first.click()
     self.browser.choose('confirm', '1')
     self.browser.find_by_xpath("//input[@type='submit']").first.click()
     text = self.browser.find_by_xpath(
         "//div[@id='content2']/div[@class='indent']").first.value
     self.assertNotEqual(text.find('Nodes: 0'), -1)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 3
0
 def test_data_change_with_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     add_permission(self, 'alice', DATA_CHANGE)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath("//a[@id='dataMenu']").first.click()
     self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first.click()
     self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
     self.browser.find_by_xpath(
         "//input[@id='id_Name']").first.fill("Alice's node")
     self.browser.find_by_xpath("//input[@type='submit']").first.click()
     text = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[1].value
     self.assertEqual(text, "Alice's node")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 4
0
 def test_schema_change_with_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', SCHEMA_VIEW)
     add_permission(self, 'alice', SCHEMA_CHANGE)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath(
         "//nav[@class='menu']/ul/li[3]/a").first.click()
     self.browser.find_by_xpath("//fieldset[@class='module aligned wide model']/h2/a").first.click()
     self.browser.find_by_xpath(
         "//input[@id='id_name']").first.fill("Alice's type")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input[@type='submit']").first.click()
     text = self.browser.find_by_xpath(
         "//fieldset[@class='module aligned wide model']/h2/a").first.value
     self.assertEqual(text, "Alice's type")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 5
0
 def test_new_advanced_type_number_string(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     spin_assert(lambda: self.assertEqual(text, 'Type'))
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Number name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Basic']/option[@value='n']").first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     spin_assert(lambda: self.assertEqual(text, "Number name"))
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption new']").first.click()
     self.browser.find_by_name('Number name').first.fill('number')
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_css('input:invalid').first.outer_html
     spin_assert(lambda: self.assertEqual(
         text,
         '<input id="id_Number name" name="Number name" type="number">'))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 6
0
 def test_new_advanced_type_time_string(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Time name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Advanced']/option[@value='t']").first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "Time name")
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption new']").first.click()
     self.browser.find_by_name('Time name').first.fill('0123456789')
     self.browser.find_by_xpath("//button[@class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all']").first.click()
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
     self.assertEqual(text, 'Enter a valid time.')
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 7
0
 def test_data_delete_without_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     add_permission(self, 'alice', DATA_CHANGE)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     spin_click(
         self.browser.find_by_xpath("//a[@id='dataMenu']").first,
         self.browser.find_by_xpath(
             "//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']"
         ).first)
     self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkRight']/a[text()='Remove']"
     ).first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='heading']/h1").first.value
     spin_assert(lambda: self.assertNotEqual(text.find("403"), -1))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 8
0
 def test_new_advanced_type_string_empty(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('String name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath(
         "//select[@id='id_properties-0-datatype']/optgroup[@label='Basic']/option[@value='s']"
     ).first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "String name")
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption new']"
     ).first.click()
     self.browser.find_by_name('String name').first.fill('')
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_xpath(
         "//ul[@class='errorlist']/li").first.text
     self.assertEqual(text, 'This field is required.')
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 9
0
 def test_graph_export_gexf(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {
         self.browser.cookies.all()[0]["name"]:
         self.browser.cookies.all()[0]["value"],
         self.browser.cookies.all()[1]["name"]:
         self.browser.cookies.all()[1]["value"]
     }
     result = requests.get(self.live_server_url +
                           '/tools/bobs-graph/export/gexf/',
                           cookies=cookies)
     self.assertEqual(result.headers['content-type'], 'application/xml')
     self.assertEqual(self.browser.status_code.is_success(), True)
     fw = open('sylva/base/tests/files/bobs-graph.gexf', 'w')
     fw.write(result.content)
     fw.close()
     f = open('sylva/base/tests/files/bobs-graph.gexf')
     xmlFile = ""
     for line in f:
         xmlFile += line
     f.close()
     self.assertEqual(xmlFile, result.content)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 10
0
 def test_graph_export_csv(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {
         self.browser.cookies.all()[0]["name"]:
         self.browser.cookies.all()[0]["value"],
         self.browser.cookies.all()[1]["name"]:
         self.browser.cookies.all()[1]["value"]
     }
     result = requests.get(self.live_server_url +
                           '/tools/bobs-graph/export/csv/',
                           cookies=cookies)
     self.assertEqual(result.headers['content-type'], 'application/zip')
     self.assertEqual(self.browser.status_code.is_success(), True)
     test_file = StringIO(result.content)
     csv_zip = ZipFile(test_file)
     for name in csv_zip.namelist():
         fw = open('sylva/base/tests/files/' + name, 'w')
         fw.write(csv_zip.read(name))
         fw.close()
     for name in csv_zip.namelist():
         f = open('sylva/base/tests/files/' + name)
         csvFile = ""
         for line in f:
             csvFile += line
         f.close()
         self.assertEqual(csv_zip.read(name), csvFile)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 11
0
 def test_query_list_view(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     self.browser.find_by_id('queriesMenu').first.click()
     button_text = self.browser.find_by_id('create-query').first.value
     spin_assert(lambda: self.assertEqual(button_text, "New Query"))
Esempio n. 12
0
 def test_new_advanced_type_time_string(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     spin_assert(lambda: self.assertEqual(text, 'Type'))
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Time name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Advanced']/option[@value='t']").first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     spin_assert(lambda: self.assertEqual(text, "Time name"))
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption new']").first.click()
     self.browser.find_by_name('Time name').first.fill('0123456789')
     sleep(5)  # Wating to the datepicker to open
     self.browser.find_by_xpath("//button[@class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all']").first.click()
     sleep(5)  # Waiting to the datepicker to close
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
     spin_assert(lambda: self.assertEqual(text, 'Enter a valid time.'))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 13
0
 def test_new_advanced_type_choices(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     spin_assert(lambda: self.assertEqual(text, 'Type'))
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill(
         'Choices name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath(
         "//select[@id='id_properties-0-datatype']/optgroup[@label='Advanced']/option[@value='c']"
     ).first.click()
     self.browser.find_by_name('properties-0-default').first.fill(
         'Bob, Alice')
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     spin_assert(lambda: self.assertEqual(text, "Choices name"))
Esempio n. 14
0
 def test_new_advanced_type_number_string(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     spin_assert(lambda: self.assertEqual(text, 'Type'))
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Number name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath(
         "//select[@id='id_properties-0-datatype']/optgroup[@label='Basic']/option[@value='n']"
     ).first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     spin_assert(lambda: self.assertEqual(text, "Number name"))
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption new']"
     ).first.click()
     self.browser.find_by_name('Number name').first.fill('number')
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_css('input:invalid').first.outer_html
     spin_assert(lambda: self.assertEqual(
         text,
         '<input id="id_Number name" name="Number name" type="number">'))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 15
0
 def test_new_advanced_type_string_empty(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('String name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Basic']/option[@value='s']").first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "String name")
     # Testing data
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption new']").first.click()
     self.browser.find_by_name('String name').first.fill('')
     self.browser.find_by_value("Save Bob's type").first.click()
     text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
     self.assertEqual(text, 'This field is required.')
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 16
0
 def test_schema_allowed_rel_addition_deletion(self):
     create_graph(self)
     spin_assert(lambda: self.assertEqual(self.browser.title,
                                          'SylvaDB - Dashboard'))
     create_schema(self)
     create_type(self)
     spin_assert(lambda: self.assertEqual(self.browser.title,
                                          "SylvaDB - Bob's graph"))
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         "This the allowed relationship for Bob's graph")
     self.browser.find_by_value('Save Type').first.click()
     spin_assert(lambda: self.assertEqual(self.browser.title,
                                          "SylvaDB - Bob's graph"))
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     spin_assert(lambda: self.assertNotEqual(text.find("Bob's rel"), -1))
     self.browser.find_by_xpath(
         "//div[@class='form-row indent']/div[@class='form-row indent']/a"
     ).first.click()
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkRight']/a[@class='delete']"
     ).first.click()
     self.browser.choose('confirm', '1')
     self.browser.find_by_value('Continue').first.click()
     notExists = self.browser.is_element_not_present_by_xpath(
         "//div[@class='form-row indent']/label")
     spin_assert(lambda: self.assertEqual(notExists, True))
Esempio n. 17
0
 def test_data_node_addition_rel_add_del(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_node(self, "Bob")
     create_node(self, "Alice")
     # We create a allowed relation
     js_code = "$('a#schema-link')[0].click();"
     self.browser.execute_script(js_code)
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill("This the allowed relationship for Bob's graph")
     self.browser.find_by_value('Save Type').first.click()
     spin_assert(lambda: self.assertEqual(
         self.browser.title, "SylvaDB - Bob's graph"))
     # We create the link between the nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption list']").first.click()
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", 5)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     self.browser.find_by_value("Save Bob's type").first.click()
     # Delete the relationship
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath("//span[@class='all-relationships incoming-relationships i_bobs_rel1-relationships']//a[@class='delete-row initial-form floating']").first.click()
     self.browser.find_by_value("Save Bob's type").first.click()
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-relationships']").first.value
     spin_assert(lambda: self.assertEqual(text, "0 relationships"))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 18
0
 def test_node_type_deletion_keeping_nodes(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     # Adding relationship to the type
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'The loved relationship')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     spin_assert(lambda: self.assertNotEqual(text.find("Bob's rel"), -1))
     # Creating nodes
     create_node(self, 'Bob')
     create_node(self, 'Alice')
     # Creating relationship between nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption list']").first.click()
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", wait_time=5)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     self.browser.find_by_value("Save Bob's type").first.click()
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-relationships']").first.value
     spin_assert(lambda: self.assertEqual(text, "1 relationships"))
     # Deleting type
     js_code = "$('a#schema-link')[0].click();"
     self.browser.execute_script(js_code)
     self.browser.find_by_xpath("//fieldset[@class='module aligned wide model']/h2/a").first.click()
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[@class='delete']").first.click()
     text = self.browser.find_by_xpath(
         "//p/label[@for='id_option_0']").first.value
     spin_assert(lambda: self.assertNotEqual(text.find(
         "We found some elements of this type"), -1))
     # Keeping nodes
     self.browser.choose('option', 'no')
     self.browser.find_by_value('Continue').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='body-inside']/p").first.value
     spin_assert(lambda: self.assertEqual(
         text, 'There are no types defined yet.'))
     # Checking
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-nodes']").first.value
     spin_assert(lambda: self.assertEqual(text, "2 nodes"))
     text = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-relationships']").first.value
     spin_assert(lambda: self.assertEqual(text, "1 relationships"))
     text = self.browser.find_by_xpath(
         "//div[@class='graph-empty-message']").first.value
     spin_assert(lambda: self.assertNotEqual(
         text.find("Your Schema is empty."), -1))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 19
0
 def test_export_schema(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {self.browser.cookies.all()[0]["name"]: self.browser.cookies.all()[0]["value"], self.browser.cookies.all()[1]["name"]: self.browser.cookies.all()[1]["value"]}
     result = requests.get(self.live_server_url + '/schemas/bobs-graph/export/', cookies=cookies)
     self.assertEqual(result.headers['content-type'], 'application/json')
     self.assertEqual(self.browser.status_code.is_success(), True)
     f = open('sylva/base/tests/files/bobs-graph_schema.json')
     self.assertEqual(f.read().split("\n")[0], result.content)
Esempio n. 20
0
 def test_import_schema(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_by_id('schemaImport').first.click()
     file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                              'files/bobs-graph_schema.json')
     self.browser.attach_file('file', file_path)
     self.browser.find_by_value('Continue').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "Name")
Esempio n. 21
0
 def test_data_node_addition_rel_add_del(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_node(self, "Bob")
     create_node(self, "Alice")
     # We create a allowed relation
     js_code = "$('a#schema-link')[0].click();"
     self.browser.execute_script(js_code)
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('Bob\'s rel')
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'This the allowed relationship for Bob\'s graph')
     self.browser.find_by_value('Save Type').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     # We create the link between the nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption list']"
     ).first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", 5)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     self.browser.find_by_value('Save Bob\'s type').first.click()
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-relationships']"
     ).first.value
     self.assertEqual(text, "1 relationships")
     # Delete the relationship
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption list']"
     ).first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath(
         "//span[@class='all-relationships incoming-relationships i_bobs_rel1-relationships']//a[@class='delete-row initial-form floating']"
     ).first.click()
     self.browser.find_by_value('Save Bob\'s type').first.click()
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-relationships']"
     ).first.value
     self.assertEqual(text, "0 relationships")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 22
0
 def test_import_schema(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_by_id('schemaImport').first.click()
     file_path = os.path.join(
         os.path.abspath(os.path.dirname(__file__)),
         'files/bobs-graph_schema.json'
     )
     self.browser.attach_file('file', file_path)
     self.browser.find_by_value('Continue').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     text = self.browser.find_by_id('diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "Name")
Esempio n. 23
0
 def test_export_schema(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {self.browser.cookies.all()[0]["name"]: self.browser.cookies.all()[0]["value"], self.browser.cookies.all()[1]["name"]: self.browser.cookies.all()[1]["value"]}
     result = requests.get(self.live_server_url + '/schemas/bobs-graph/export/', cookies=cookies)
     spin_assert(lambda: self.assertEqual(
         result.headers['content-type'], 'application/json'))
     spin_assert(lambda: self.assertEqual(
         self.browser.status_code.is_success(), True))
     f = open('sylva/sylva/tests/files/bobs-graph_schema.json')
     spin_assert(lambda: self.assertEqual(
         f.read().split("\n")[0], result.content))
Esempio n. 24
0
 def test_sigma_visualization_in_node_view(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     # Adding relationship to the type
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'The loved relationship')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find("Bob's rel"), -1)
     # Creating nodes
     create_node(self, 'Bob')
     create_node(self, 'Alice')
     # Creating relationship between nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption list']"
     ).first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", wait_time=5)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     self.browser.find_by_value('Save Bob\'s type').first.click()
     # Checking
     self.browser.find_by_xpath(
         "//table[@id='content_table']/tbody/tr/td/p/a[@title='View node' and text()='Alice']"
     ).first.click()
     self.browser.is_element_present_by_id('wait_for_js', 3)
     js_code = '''
         var instanceId = '0';
         for (key in sigma.instances) {
             instanceId = key;
             break;
         }
         var instance = sigma.instances[instanceId];
         sigma.test_node_count = instance.getNodesCount();
         '''
     self.browser.execute_script(js_code)
     text = self.browser.evaluate_script('sigma.test_node_count')
     self.assertEqual(text, 2)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 25
0
 def test_new_type(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_xpath(
         "//div[@class='content2-first']/p/textarea[@name='description']").first.fill('The loved type')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@id='diagramBox_bobs-type']/div[@class='title']").first.value
     self.assertNotEqual(text.find("Bob's type"), -1)
Esempio n. 26
0
 def test_data_node_addition(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     # Check the node name
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     text = self.browser.find_by_id('propertiesTitle').first.value
     spin_assert(lambda: self.assertEqual(text, 'Properties'))
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a").first.click()
     self.browser.choose('confirm', '1')
     self.browser.find_by_value('Continue').first.click()
     text = self.browser.find_by_xpath("//div[@class='indent']/div").first.value
     Graph.objects.get(name="Bob's graph").destroy()
     spin_assert(lambda: self.assertEqual(text, 'Nodes: 0'))
Esempio n. 27
0
 def test_query_builder_view(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     self.browser.find_by_id('queriesMenu').first.click()
     new_query_button = self.browser.find_by_id('create-query').first
     button_text = new_query_button.value
     spin_assert(lambda: self.assertEqual(button_text, "New Query"))
     new_query_button.click()
     diagram_title = self.browser.find_by_id('diagramTitle').first.value
     spin_assert(lambda: self.assertEqual(diagram_title, "Diagram"))
     node_type_text = self.browser.find_by_xpath(
         "//table[@id='node-types']/tbody/tr/td/a").first.value
     # This node type name is the name that we use in the create_type method
     spin_assert(lambda: self.assertEqual(node_type_text, "Bob's type"))
Esempio n. 28
0
 def test_new_type(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     spin_assert(lambda: self.assertEqual(text, 'Type'))
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_xpath(
         "//div[@class='content2-first']/p/textarea[@name='description']").first.fill('The loved type')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@id='diagramBox_bobs-type']/div[@class='title']").first.value
     spin_assert(lambda: self.assertNotEqual(text.find("Bob's type"), -1))
Esempio n. 29
0
 def test_schema_allowed_rel_addition(self):
     create_graph(self)
     self.assertEqual(self.browser.title, 'SylvaDB - Dashboard')
     create_schema(self)
     create_type(self)
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('Bob\'s rel')
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill('This the allowed relationship for Bob\'s graph')
     self.browser.find_by_value('Save Type').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find('Bob\'s rel'), -1)
Esempio n. 30
0
 def test_data_node_clone(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     original_name = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[1].value
     # Clone the node
     self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td/a[@class='edit']").first.click()
     self.browser.find_by_name('Name').first.fill(original_name + " clone")
     self.browser.find_by_name("as-new").first.click()
     # Check that two nodes exist
     original_name = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[1].value
     clone_name = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[4].value
     spin_assert(lambda: self.assertEqual(original_name, "Bob's node"))
     spin_assert(lambda: self.assertEqual(clone_name, "Bob's node clone"))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 31
0
 def test_schema_allowed_rel_addition(self):
     create_graph(self)
     self.assertEqual(self.browser.title, 'SylvaDB - Dashboard')
     create_schema(self)
     create_type(self)
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('Bob\'s rel')
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'This the allowed relationship for Bob\'s graph')
     self.browser.find_by_value('Save Type').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find('Bob\'s rel'), -1)
Esempio n. 32
0
 def test_data_node_addition(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     # Check the node name
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     text = self.browser.find_by_id('propertiesTitle').first.value
     self.assertEqual(text, 'Properties')
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkRight']/a").first.click(
         )
     self.browser.choose('confirm', '1')
     self.browser.find_by_value('Continue').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='indent']/div").first.value
     Graph.objects.get(name="Bob's graph").destroy()
     self.assertEqual(text, 'Nodes: 0')
Esempio n. 33
0
 def test_schema_view_without_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath(
         "//nav[@class='menu']/ul/li[3]/a").first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='heading']/h1").first.value
     self.assertNotEqual(text.find("403"), -1)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 34
0
 def test_sigma_visualization_in_node_view(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     # Adding relationship to the type
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'The loved relationship')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find("Bob's rel"), -1)
     # Creating nodes
     create_node(self, 'Bob')
     create_node(self, 'Alice')
     # Creating relationship between nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption list']").first.click()
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", wait_time=5)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     self.browser.find_by_value('Save Bob\'s type').first.click()
     # Checking
     self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td/p/a[@title='View node' and text()='Alice']").first.click()
     self.browser.is_element_present_by_id('wait_for_js', 3)
     js_code = '''
         var instanceId = '0';
         for (key in sigma.instances) {
             instanceId = key;
             break;
         }
         var instance = sigma.instances[instanceId];
         sigma.test_node_count = instance.getNodesCount();
         '''
     self.browser.execute_script(js_code)
     text = self.browser.evaluate_script('sigma.test_node_count')
     self.assertEqual(text, 2)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 35
0
 def test_schema_view_with_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', SCHEMA_VIEW)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath(
         "//nav[@class='menu']/ul/li[3]/a").first.click()
     text = self.browser.find_by_xpath(
         "//fieldset[@class='module aligned wide model']/h2/a").first.value
     self.assertEqual(text, "Bob's type")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 36
0
 def test_data_view_with_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     spin_click(self.browser.find_by_xpath("//a[@id='dataMenu']").first,
                                           self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first)
     text = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[1].value
     spin_assert(lambda: self.assertEqual(text, "Bob's node"))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 37
0
 def test_graph_export_gexf(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     self.browser.find_by_id('toolsMenu').first.click()
     cookies = {self.browser.cookies.all()[0]["name"]: self.browser.cookies.all()[0]["value"], self.browser.cookies.all()[1]["name"]: self.browser.cookies.all()[1]["value"]}
     result = requests.get(self.live_server_url + '/tools/bobs-graph/export/gexf/', cookies=cookies)
     self.assertEqual(result.headers['content-type'], 'application/xml')
     self.assertEqual(self.browser.status_code.is_success(), True)
     fw = open('sylva/base/tests/files/bobs-graph.gexf', 'w')
     fw.write(result.content)
     fw.close()
     f = open('sylva/base/tests/files/bobs-graph.gexf')
     xmlFile = ""
     for line in f:
         xmlFile += line
     f.close()
     self.assertEqual(xmlFile, result.content)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 38
0
 def test_data_add_without_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     self.browser.find_by_xpath("//a[@id='dataMenu']").first.click()
     self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption new']").first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='heading']/h1").first.value
     self.assertNotEqual(text.find("403"), -1)
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 39
0
 def test_new_advanced_type_auto_user(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('auto user name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Auto']/option[@value='e']").first.click()
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "auto user name")
Esempio n. 40
0
 def test_data_node_clone(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     original_name = self.browser.find_by_xpath(
         "//table[@id='content_table']/tbody/tr/td")[1].value
     # Clone the node
     self.browser.find_by_xpath(
         "//table[@id='content_table']/tbody/tr/td/a[@class='edit']"
     ).first.click()
     self.browser.find_by_name('Name').first.fill(original_name + " clone")
     self.browser.find_by_name("as-new").first.click()
     # Check that two nodes exist
     original_name = self.browser.find_by_xpath(
         "//table[@id='content_table']/tbody/tr/td")[1].value
     clone_name = self.browser.find_by_xpath(
         "//table[@id='content_table']/tbody/tr/td")[4].value
     self.assertEqual(original_name, "Bob's node")
     self.assertEqual(clone_name, "Bob's node clone")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 41
0
 def test_new_advanced_type(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_name('properties-0-default').first.fill(
         "Bob's node default name")
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "Name")
Esempio n. 42
0
 def test_new_advanced_type(self):
     create_graph(self)
     create_schema(self)
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='content2-first']/h2").first.value
     self.assertEqual(text, 'Type')
     self.browser.find_by_name('name').first.fill("Bob's type")
     self.browser.find_by_id('advancedModeButton').first.click()
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_name('properties-0-required').first.check()
     self.browser.find_by_name('properties-0-default').first.fill(
         "Bob's node default name")
     self.browser.find_by_name('properties-0-order').first.fill('1')
     self.browser.find_by_name('properties-0-description').first.fill(
         "The name of this Bob's node")
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_id(
         'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
     self.assertEqual(text, "Name")
Esempio n. 43
0
 def test_schema_allowed_rel_addition_deletion(self):
     create_graph(self)
     self.assertEqual(self.browser.title, 'SylvaDB - Dashboard')
     create_schema(self)
     create_type(self)
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('Bob\'s rel')
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill('This the allowed relationship for Bob\'s graph')
     self.browser.find_by_value('Save Type').first.click()
     self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find('Bob\'s rel'), -1)
     self.browser.find_by_xpath("//div[@class='form-row indent']/div[@class='form-row indent']/a").first.click()
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[@class='delete']").first.click()
     self.browser.choose('confirm', '1')
     self.browser.find_by_value('Continue').first.click()
     notExists = self.browser.is_element_not_present_by_xpath(
         "//div[@class='form-row indent']/label")
     self.assertEqual(notExists, True)
Esempio n. 44
0
 def test_data_delete_without_permissions(self):
     signup(self, 'alice', '*****@*****.**', 'alice_secret')
     signin(self, 'alice', 'alice_secret')
     logout(self)
     signup(self, 'bob', '*****@*****.**', 'bob_secret')
     signin(self, 'bob', 'bob_secret')
     create_graph(self)
     create_schema(self)
     create_type(self)
     create_data(self)
     add_permission(self, 'alice', CREATE_COLLAB)
     add_permission(self, 'alice', DATA_VIEW)
     add_permission(self, 'alice', DATA_CHANGE)
     logout(self)
     signin(self, 'alice', 'alice_secret')
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     spin_click(self.browser.find_by_xpath("//a[@id='dataMenu']").first,
                                           self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first)
     self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[text()='Remove']").first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='heading']/h1").first.value
     spin_assert(lambda: self.assertNotEqual(text.find("403"), -1))
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 45
0
 def test_node_type_deletion_deleting_nodes(self):
     create_graph(self)
     create_schema(self)
     create_type(self)
     # Adding relationship to the type
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill("Bob's rel")
     self.browser.select('target', '1')
     self.browser.find_by_id('id_description').fill(
         'The loved relationship')
     self.browser.find_by_value('Save Type').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='form-row indent']/label").first.value
     self.assertNotEqual(text.find("Bob's rel"), -1)
     # Creating nodes
     create_node(self, 'Bob')
     create_node(self, 'Alice')
     # Creating relationship between nodes
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataActions']/a[@class='dataOption list']"
     ).first.click()
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input").first.fill('Alice')
     self.browser.is_element_present_by_id("id_user_wait", wait_time=5)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     self.browser.find_by_value('Save Bob\'s type').first.click()
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-relationships']"
     ).first.value
     self.assertEqual(text, "1 relationships")
     # Deleting type
     js_code = "$('a#schema-link')[0].click();"
     self.browser.execute_script(js_code)
     self.browser.find_by_xpath(
         "//fieldset[@class='module aligned wide model']/h2/a").first.click(
         )
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkRight']/a[@class='delete']"
     ).first.click()
     text = self.browser.find_by_xpath(
         "//p/label[@for='id_option_0']").first.value
     self.assertNotEqual(text.find("We found some elements of this type"),
                         -1)
     # Deleting nodes
     self.browser.choose('option', 'de')
     self.browser.find_by_value('Continue').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='body-inside']/p").first.value
     self.assertEqual(text, 'There are no types defined yet.')
     # Checking
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     text = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-nodes']"
     ).first.value
     self.assertEqual(text, "0 nodes")
     text = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-relationships']"
     ).first.value
     self.assertEqual(text, "0 relationships")
     Graph.objects.get(name="Bob's graph").destroy()
Esempio n. 46
0
 def test_node_rel_count_four(self):
     '''
     This test show that when there are reflexive incoming `relationships`
     only count those.
     '''
     real_nodes = 0
     real_rels = 0
     create_graph(self)
     create_schema(self)
     # Creating a nodetype: "First"
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     self.browser.find_by_name('name').first.fill("First")
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_value('Save Type').first.click()
     # Creating another nodetype: "Second"
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     self.browser.find_by_name('name').first.fill("Second")
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_value('Save Type').first.click()
     self.browser.find_by_id('dataMenu').first.click()
     # Creating an allowed relationship: "First -> First"
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('FirstToFirst')
     self.browser.select('target', '1')
     self.browser.find_by_value('Save Type').first.click()
     # Creating an allowed relationship: "First -> Second"
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('FirstToSecond')
     self.browser.select('target', '2')
     self.browser.find_by_value('Save Type').first.click()
     # Creating a node of the "First" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First1")
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Creating another node of the "First" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First2")
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Creating a node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second1")
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Creating another node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second2")
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Creating another node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second3")
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Editing the "First1" node
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption list']")[0].click()
     self.browser.find_by_xpath(
         "//td[@class='dataList']/a[@class='edit']").first.click()
     # Adding more "FirstToSecond" relationship forms
     self.browser.find_by_xpath(
         "//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath(
         "//a[@class='addButton inFormsets']")[1].click()
     # Adding the relationships
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[0].fill('First2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[1].fill('Second1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[2].fill('Second2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[3].fill('Second3')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     # Saving "First1"
     self.browser.find_by_value('Save First').first.click()
     # Creating another node of the "First" type with relationships
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First3")
     # Adding more "FirstToSecond" relationship forms
     self.browser.find_by_xpath(
         "//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath(
         "//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath(
         "//a[@class='addButton inFormsets']")[2].click()
     # Adding the relationships
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[1].fill('Second1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[2].fill('Second2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[3].fill('Second3')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[4].fill('First1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     self.browser.find_by_xpath(
         "//li[@class='token-input-input-token']/input")[5].fill('First2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath(
         "//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b"
     ).first.click()
     real_rels += 1
     # Saving "First3"
     self.browser.find_by_xpath(
         "//span[@class='buttonLinkOption buttonLinkLeft']/input"
     ).first.click()
     real_nodes += 1
     # Checking the counts
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     nodes = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-nodes']"
     ).first.value
     rels = self.browser.find_by_xpath(
         "//div[@class='flags-block']/span[@class='graph-relationships']"
     ).first.value
     spin_assert(
         lambda: self.assertEqual(str(real_nodes) + " nodes", nodes))
     spin_assert(
         lambda: self.assertEqual(str(real_rels) + " relationships", rels))
Esempio n. 47
0
 def test_node_rel_count_four(self):
     '''
     This test show that when there are reflexive incoming `relationships`
     only count those.
     '''
     real_nodes = 0
     real_rels = 0
     create_graph(self)
     create_schema(self)
     # Creating a nodetype: "First"
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     self.browser.find_by_name('name').first.fill("First")
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_value('Save Type').first.click()
     # Creating another nodetype: "Second"
     self.browser.find_link_by_href(
         '/schemas/bobs-graph/types/create/').first.click()
     self.browser.find_by_name('name').first.fill("Second")
     self.browser.find_by_name('properties-0-key').first.fill('Name')
     self.browser.find_by_name('properties-0-display').first.check()
     self.browser.find_by_value('Save Type').first.click()
     self.browser.find_by_id('dataMenu').first.click()
     # Creating an allowed relationship: "First -> First"
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('FirstToFirst')
     self.browser.select('target', '1')
     self.browser.find_by_value('Save Type').first.click()
     # Creating an allowed relationship: "First -> Second"
     self.browser.find_by_id('allowedRelations').first.click()
     self.browser.select('source', '1')
     self.browser.find_by_name('name').fill('FirstToSecond')
     self.browser.select('target', '2')
     self.browser.find_by_value('Save Type').first.click()
     # Creating a node of the "First" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First1")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Creating another node of the "First" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First2")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Creating a node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second1")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Creating another node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second2")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Creating another node of the "Second" type
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[1].click()
     self.browser.find_by_name('Name').first.fill("Second3")
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Editing the "First1" node
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption list']")[0].click()
     self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
     # Adding more "FirstToSecond" relationship forms
     self.browser.find_by_xpath("//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath("//a[@class='addButton inFormsets']")[1].click()
     # Adding the relationships
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[0].fill('First2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[1].fill('Second1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[2].fill('Second2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[3].fill('Second3')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     # Saving "First1"
     self.browser.find_by_value('Save First').first.click()
     # Creating another node of the "First" type with relationships
     self.browser.find_by_id('dataMenu').first.click()
     self.browser.find_by_xpath("//a[@class='dataOption new']")[0].click()
     self.browser.find_by_name('Name').first.fill("First3")
     # Adding more "FirstToSecond" relationship forms
     self.browser.find_by_xpath("//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath("//a[@class='addButton inFormsets']")[1].click()
     self.browser.find_by_xpath("//a[@class='addButton inFormsets']")[2].click()
     # Adding the relationships
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[1].fill('Second1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[2].fill('Second2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[3].fill('Second3')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[4].fill('First1')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     self.browser.find_by_xpath("//li[@class='token-input-input-token']/input")[5].fill('First2')
     self.browser.is_element_present_by_id("id_user_wait", 3)
     self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
     real_rels += 1
     # Saving "First3"
     self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input").first.click()
     real_nodes += 1
     # Checking the counts
     self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
     nodes = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-nodes']").first.value
     rels = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-relationships']").first.value
     spin_assert(lambda: self.assertEqual(
         str(real_nodes) + " nodes", nodes))
     spin_assert(lambda: self.assertEqual(
         str(real_rels) + " relationships", rels))