Skip to content

Commit 23db311

Browse files
author
kaptron
committed
update EditingCover cypress test for new modal
1 parent d772087 commit 23db311

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

app/javascript/ui/global/CheckboxWithLabel.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import _ from 'lodash'
12
import PropTypes from 'prop-types'
23

34
import { Checkbox, LabelContainer } from '~/ui/global/styled/forms'
45

56
const CheckboxWithLabel = ({ onChange, checked, label }) => (
67
<LabelContainer
78
labelPlacement={'end'}
8-
control={<Checkbox onChange={onChange} checked={checked} />}
9+
control={
10+
<Checkbox
11+
// this class is really just for cypress purposes
12+
classes={{ root: _.kebabCase(`checkbox-${label}`) }}
13+
onChange={onChange}
14+
checked={checked}
15+
/>
16+
}
917
label={<div style={{ maxWidth: '582px', paddingTop: '9px' }}>{label}</div>}
1018
></LabelContainer>
1119
)

bin/cypress

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pkill -F tmp/pids/test.pid
2+
rake db:test:prepare
23
CYPRESS=true bin/rails server -d -e test -p 3001 -P tmp/pids/test.pid
34
yarn cypress

cypress/integration/collections/EditingCover.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Feature: Editing Cover
1212

1313
When I click the "CardAction-edit cover"
1414
Then I should see a 'EditCoverOptions'
15-
And I click the ".PrivateSwitchBase-input"
15+
And I click the "input" located in ".checkbox-hide-subtitle"
1616
And I click the 'ModalClose'
1717
Then I should not see a collection card with subtitle "Subtitle"

cypress/support/step_definitions/when.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ When('I click the {string}', el => {
292292
.click({ force: true })
293293
})
294294

295+
When('I click the {string} located in {string}', (selector, el) => {
296+
cy.get(`${el} ${selector}`)
297+
.first()
298+
.click({ force: true })
299+
})
300+
295301
When('I click the last {string}', el => {
296302
cy.locateDataOrClass(el)
297303
.last()

0 commit comments

Comments
 (0)