-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathevent.rb
More file actions
132 lines (111 loc) · 4.34 KB
/
event.rb
File metadata and controls
132 lines (111 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Quand("on sélectionne la rubrique {string}") do |topic|
click_on topic
end
Quand("on change en sélection négative la sélection de la rubrique {string}") do |topic|
click_on topic
end
Quand("on désélectionne la rubrique {string}") do |topic|
click_on topic
click_on topic
end
Quand("on choisit l'attribut {string}") do |attribute|
click_on attribute
end
Quand ("l'utilisateur crée un item {string} dans le corpus {string}") do |name, corpus|
click_on corpus
expect(page).to have_content("undefined")
within '.Attributes' do
fill_in placeholder: 'Ajouter un attribut et une valeur...', with: "name:#{name}"
click_on class: 'ValidateButton'
end
end
Quand ("l'utilisateur change l'opérateur entre la rubrique {string} et la rubrique {string}") do |topic1, topic2|
within('.Status') do
find(:xpath, "//span[contains(., #{topic1})]/following-sibling::button", match: :first).click
end
end
Quand("on choisit la rubrique {string}") do |topic|
click_on topic
end
Quand("l'utilisateur indique {string} comme valeur de l'attribut {string}") do |value, attribute|
within '.Attributes' do
fill_in placeholder: 'Ajouter un attribut et une valeur...', with: "#{attribute}:#{value}"
click_on class: 'ValidateButton'
end
end
Quand("l'utilisateur indique {string} comme nouvelle rubrique du point de vue {string}") do |topic, viewpoint|
within '.Viewpoint', text: viewpoint do
fill_in placeholder: 'Ajouter une rubrique...', with: topic
click_on class: 'ValidateButton'
click_on class: 'ValidateButton'
end
end
Quand("l'utilisateur indique {string} pour la rubrique {string} du point de vue {string}") do |pattern, topic, viewpoint|
within '.Viewpoint', text: viewpoint do
find('input').send_keys pattern
click_link(topic, href: nil)
click_on class: 'ValidateButton'
end
end
Quand("l'utilisateur recherche {string} puis choisit {string}") do |pattern, attribute|
find('input[type="search"]').send_keys pattern
click_link(attribute, href: nil)
end
Quand("l'utilisateur choisit l'item {string} dans le bloc Items ayant le même nom") do |item|
within '.Item' do
click_on item
end
end
Quand("l'utilisateur choisit l'item {string} parmi les items affichés") do |item|
within '.Items' do
click_on item
end
end
Quand("{string} souhaite s'enregistrer comme contributeur en tant que {string} avec le mot de passe {string}") do |mail, login, password|
click_on "S'inscrire..."
expect(page).to have_content("Formulaire d'inscription")
range = [*'0'..'9',*'A'..'F']
hash = Array.new(36){ range.sample }.join
fill_in "email", with: hash + mail
fill_in "pseudo", with: login + hash
fill_in "password", with: password
click_on "Inscription"
end
Quand("l'utilisateur renseigne l'attribut {string} préexistant avec une nouvelle valeur {string} en recherchant {string}") do |attribute, value, pattern|
find('#new-attribute').send_keys pattern
click_link(attribute, href: nil)
find("#new-attribute").send_keys :end, value
click_on class: 'ValidateButton'
end
Quand("l'utilisateur renseigne l'attribut {string} préexistant avec la valeur {string} proposée parmi les valeurs existantes en recherchant {string} et {string}") do |attribute, value, patternAttribute, patternValue|
find('#new-attribute').send_keys patternAttribute
click_link(attribute, href: nil)
find('#new-attribute').send_keys :end, patternValue
find("a", text: "#{attribute} : #{value}").click
click_on class: 'ValidateButton'
end
Quand("l'utilisateur crée la rubrique {string} à la racine du point de vue") do |topic|
find('.node').click.send_keys(:return)
fill_in class:'editedNode', with: topic
end
Quand("l'utilisateur supprime le point de vue") do
accept_confirm do
click_on "Supprimer ce point de vue..."
end
end
Quand("on sélectionne la valeur d'attribut {string} en tant que {string}") do |value, attribute|
within '.AttributesSearch' do
select value, from: attribute
end
end
Quand("l'utilisateur dépose {string} comme ressource") do |string|
attach_file(File.expand_path("public/favicon.ico")) do
click_button("Ajouter une ressource")
end
end
Quand("l'utilisateur sélectionne un intervalle entre {int} et {int} pour l'attribut {string}") do |min, max, attribute|
within '.' + attribute do
find_all('input[type="range"]')[0].set(min)
find_all('input[type="range"]')[1].set(max)
end
end