Skip to content

Commit

Permalink
ajouts premiers jets tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliettejns committed Jul 1, 2024
1 parent eaf0822 commit 797d484
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
33 changes: 30 additions & 3 deletions tests/test_selenium/test_corpus_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import url_for
from app.models import Corpus, WordToken, AllowedLemma, AllowedMorph, AllowedPOS, ControlLists
from app.models import Corpus, WordToken, AllowedLemma, AllowedMorph, AllowedPOS, ControlLists, ControlListsUser,User
from app import db
from tests.test_selenium.base import TestBase
from tests.fixtures import PLAINTEXT_CORPORA
Expand Down Expand Up @@ -27,11 +27,9 @@ def test_registration(self):
self.driver_find_element_by_id("corpusName").send_keys(PLAINTEXT_CORPORA["Wauchier"]["name"])
self.writeMultiline(self.driver_find_element_by_id("tokens"), PLAINTEXT_CORPORA["Wauchier"]["data"])
self.driver_find_element_by_id("label_checkbox_create").click()
self.driver.save_screenshot("./test_registration.png")
self.driver_find_element_by_id("submit").click()

self.driver.implicitly_wait(15)
self.driver.save_screenshot("./test_registration1.png")
self.assertIn(
url_for('main.corpus_get', corpus_id=1), self.driver.current_url,
"Result page is the corpus new page"
Expand Down Expand Up @@ -63,6 +61,7 @@ def test_registration(self):
self.assertEqual(oir.POS, "VERinf", "It should be correctly saved with POS")
self.assertEqual(oir.morph, None, "It should be correctly saved with morph")


def test_registration_with_full_allowed_lemma(self):
"""
Test that a user can create a corpus wit allowed lemmas and that this corpus has its data well recorded
Expand Down Expand Up @@ -721,3 +720,31 @@ def lemmatizing():
second_app.join(2)
finally:
second_app.close()

def test_registration_filters(self):
self.add_control_lists()
target_cl = db.session.query(ControlLists). \
filter(ControlLists.name == "Ancien Français - École des Chartes").first()

# Click register menu link
self.driver_find_element_by_id("new_corpus_link").click()
self.driver.implicitly_wait(15)

# Fill in registration form
self.driver_find_element_by_id("corpusName").send_keys(PLAINTEXT_CORPORA["Wauchier"]["name"])
self.writeMultiline(self.driver_find_element_by_id("tokens"), PLAINTEXT_CORPORA["Wauchier"]["data"])
self.driver_find_element_by_id("label_checkbox_reuse").click()
self.driver_find_element_by_id("control_list_select").click()
self.driver_find_element_by_id("cl_opt_" + str(target_cl.id)).click()
self.driver_find_element_by_id("punct").click()

self.driver_find_element_by_id("submit").click
self.driver.save_screenshot("./test_registration_filter.png")
self.driver.implicitly_wait(15)

#ne fonctionne pas, aller voir direct dans control list ignore si les cases sont cochées

CL = db.session.query(ControlLists).filter(ControlLists.name == "Ancien Français - École des Chartes").first()
CLUser = db.session.query(ControlListsUser).filter(ControlListsUser.control_lists_id == CL.id).first()
self.assertEqual(CLUser.filter_punct, True)
self.assertEqual(CLUser.filter_numeral, False)
14 changes: 14 additions & 0 deletions tests/test_selenium/test_manage_control_lists_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,17 @@ def test_corpus_creator_is_owner(self):

el = self.get_ownership_table()
self.assertTrue(len([e for e in el if e.get_property("checked")]) == 1)

def test_change_filter(self):
self.addControlLists("wauchier")
self.driver.save_screenshot("./test_registration_filter1.png")
self.go_to_control_lists_management("Wauchier")
self.driver.save_screenshot("./test_registration_filter2.png")
self.driver_find_element_by_link_text("Ignore values").click()
self.driver_find_element_by_id("punct").click()

self.driver_find_element_by_id("submit").click
self.driver.save_screenshot("./test_registration_filter3.png")
self.driver.implicitly_wait(15)

### tester si punct est toujours cliqué

0 comments on commit 797d484

Please sign in to comment.