Skip to content

Commit

Permalink
TEST: Duplicate a portfolio (closes #190)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinLallier authored and AxelRagobert committed Jun 13, 2019
1 parent 2b6c57b commit 7f4f2b6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ source "https://rubygems.org"

gem "cucumber"
gem "cuprite"
gem "rspec"
17 changes: 17 additions & 0 deletions features/duplicate_portfolio.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#language: fr

Fonctionnalité: Dupliquer un portfolio pour un usage privé

Contexte:

Soit "vitraux" le portfolio ouvert
Soit le point de vue "Histoire des religions" rattaché au portfolio "vitraux"
Soit le corpus "Vitraux - Dr. Krieger" rattaché au portfolio "vitraux"

Scénario: Dupliquer un portfolio

Soit l'utilisateur est connecté
Quand on créé une copie du portfolio appelée "dupp-vitraux" avec le corpus "Vitraux - Dr. Krieger" et le point de vue "Histoire des religions"
Alors le titre affiché est "DUPP-VITRAUX"
Et un des corpus affichés est "Vitraux - Dr. Krieger"
Et un des points de vue affichés est "Histoire des religions"
24 changes: 22 additions & 2 deletions features/step_definitions/portfolio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Capybara.run_server = false
Capybara.default_driver = :cuprite
Capybara.javascript_driver = :cuprite
Capybara.app_host = "http://localhost:3000"
Capybara.app_host = "http://vitraux.local:3000"
Capybara.default_max_wait_time = 10

def getUUID(itemName)
Expand Down Expand Up @@ -48,6 +48,13 @@ def getUUID(itemName)
# On the remote servers
end

Soit("l'utilisateur est connecté") do
find_link(href: '#login').click
fill_in("Nom d'utilisateur", with: "alice")
fill_in("Mot de passe", with: "whiterabbit")
click_on('Confirmer')
end

Soit("{string} le portfolio spécifié dans la configuration") do |portfolio|
case portfolio
when "vitraux"
Expand Down Expand Up @@ -110,6 +117,20 @@ def getUUID(itemName)
click_on item
end

def in_modal()
f = find('.modal-content')
end

Quand("on créé une copie du portfolio appelée {string} avec le corpus {string} et le point de vue {string}") do |name, corpus, viewpoint|
click_button('alice')
click_link('Dupliquer')
in_modal.fill_in('copyName', with: name)
in_modal.check(corpus)
in_modal.check(viewpoint)
in_modal.click_on('Valider')
in_modal.click_on('Confirmer')
end

# Outcomes

Alors("le titre affiché est {string}") do |portfolio|
Expand Down Expand Up @@ -139,4 +160,3 @@ def getUUID(itemName)
Alors ("l'item {string} n'est pas affiché") do |item|
expect(page).not_to have_content item
end

1 change: 1 addition & 0 deletions reverse-proxy/launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo sed -i '/^127.0.0.1 localhost/ s/$/ vitraux.local dupp-vitraux.local/' /etc/hosts
18 changes: 9 additions & 9 deletions src/components/Duplication/Duplicator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class Duplicator extends Component {
this.closeToast = this.closeToast.bind(this)
this.addUserToEntity = this.addUserToEntity.bind(this)
}

handleClose() {
this.setState({ showModal: false, showModalConfirmation: false });
}

handleShow() {
this.setState({ showModal: true });
}
Expand Down Expand Up @@ -133,22 +133,22 @@ class Duplicator extends Component {
})
}

render() {
render() {
let name = this.props.userConnected + '-' + this.props.portfolio
let corpora = this.props.corpora.map((v, i) =>
<div className='Modal-Group' key={v.id}>
<input className='Modal-CheckBox Corpus' value={v.id} onChange={this.onChangeCheckBox} type="checkbox"/>
<input name={v.id} className='Modal-CheckBox Corpus' value={v.id} onChange={this.onChangeCheckBox} type="checkbox"/>
{v.id}
</div>
);

let viewpoints = this.props.viewpoints.map((v, i) =>
<div className='Modal-Group' key={v.id}>
<input className='Modal-CheckBox ViewPoint' value={v.id} onChange={this.onChangeCheckBox} type="checkbox"/>
<input name={v.name} className='Modal-CheckBox ViewPoint' value={v.id} onChange={this.onChangeCheckBox} type="checkbox"/>
{v.name}
</div>
);


return (
<div>
Expand All @@ -175,7 +175,7 @@ class Duplicator extends Component {
<Modal show={this.state.showModal}>
<Modal.Body>
<h3>Nom du portfolio</h3>
<input type='text' className='Modal-Input form-control' defaultValue={name} placeholder='Nom du nouveau portfolio' id="portfolioDuplicatedName"/>
<input type='text' name="copyName" className='Modal-Input form-control' defaultValue={name} placeholder='Nom du nouveau portfolio' id="portfolioDuplicatedName"/>
<div className='Modal-Group Modal-Title'>
<h3>Corpus</h3>
<div className='Modal-Group'><input className='Modal-CheckBox checkCorpora' type="checkbox" onChange={this.onChangeCheckBox}/>Tout</div>
Expand All @@ -187,7 +187,7 @@ class Duplicator extends Component {
<br/>
<div className='Modal-Group Modal-Title'>
<h3>Points de vue</h3>
<div className='Modal-Group'><input className='Modal-CheckBox checkViewPoints' type="checkbox" onChange={this.onChangeCheckBox}/>Tout</div>
<div className='Modal-Group'><input className='Modal-CheckBox checkViewPoints' name={name} type="checkbox" onChange={this.onChangeCheckBox}/>Tout</div>
</div>
<hr/>
<div id="viewPointsList">
Expand All @@ -205,7 +205,7 @@ class Duplicator extends Component {
</Modal>
<Dropdown.Item eventKey="2" onClick={this.handleShow}>Dupliquer</Dropdown.Item>
</div>

)
}
}
Expand Down

0 comments on commit 7f4f2b6

Please sign in to comment.