|  | 
|  | 1 | +Quand("l'analyste entre") do  | 
|  | 2 | +  visit "/memo/" | 
|  | 3 | +end | 
|  | 4 | + | 
|  | 5 | +Quand("l'analyste clique sur {string}") do |lien| | 
|  | 6 | +  click_on lien | 
|  | 7 | +end | 
|  | 8 | + | 
|  | 9 | +Quand("l'analyste souhaite s'identifier en tant que {string} avec le mot de passe {string}") do |login, password| | 
|  | 10 | +  click_on "S'identifier" | 
|  | 11 | +  expect(page).to have_content("S'identifier") | 
|  | 12 | +  fill_in placeholder: 'Identifiant', with: login | 
|  | 13 | +  fill_in placeholder: 'Mot de passe', with: password | 
|  | 14 | +  click_on "S'identifier" | 
|  | 15 | +end | 
|  | 16 | + | 
|  | 17 | +Quand("{string} souhaite créer un compte en tant que {string} avec le mot de passe {string}") do |fullname, login, password| | 
|  | 18 | +  click_on "Créer un compte" | 
|  | 19 | +  expect(page).to have_content("Je ne fais pas partie de l'université de Liège") | 
|  | 20 | +  find("#newaccount").click | 
|  | 21 | +  expect(page).to have_content("Nom complet (prénom et nom de famille)") | 
|  | 22 | +  range = [*'0'..'9',*'A'..'F'] | 
|  | 23 | +  hash = Array.new(36){ range.sample }.join | 
|  | 24 | +  fill_in placeholder: 'Jack London', with: 'test'+ hash + fullname  | 
|  | 25 | +  fill_in placeholder: '[email protected]', with : login  + hash | 
|  | 26 | +  fill_in "password", with: password | 
|  | 27 | +  fill_in "confirm", with: password | 
|  | 28 | +  click_on "Créer un compte" | 
|  | 29 | +  click_on "Journaux de bord" | 
|  | 30 | +end | 
|  | 31 | + | 
|  | 32 | + | 
|  | 33 | +Quand("l'analyste crée un journal") do | 
|  | 34 | +  visit "/memo/" | 
|  | 35 | +  numbers = [*'0'..'9'] | 
|  | 36 | +  cardinal = Array.new(3){ numbers.sample }.join | 
|  | 37 | +  today_date = Date.today.strftime('%Y-%m-%d') | 
|  | 38 | +  diary_name = 'essai ' + today_date + cardinal | 
|  | 39 | +  fill_in placeholder: 'Mon journal de bord', with: diary_name | 
|  | 40 | +  click_on "Créer..." | 
|  | 41 | +  click_on "Enregistrer" | 
|  | 42 | +  expect(page).to have_content("Ajouter un ancrage") | 
|  | 43 | +  visit "/memo/" | 
|  | 44 | +  expect(page).to have_content(diary_name) | 
|  | 45 | +end | 
|  | 46 | + | 
0 commit comments