Browse Source

fix cypress test

master
Maurits Lourens 5 years ago
parent
commit
101ca5f01e
  1. 3
      packages/bbui/src/Form/Core/Switch.svelte
  2. 3
      packages/bbui/src/Form/Toggle.svelte
  3. 6
      packages/builder/cypress/integration/createAutomation.spec.js
  4. 2
      packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte

3
packages/bbui/src/Form/Core/Switch.svelte

@ -6,15 +6,18 @@
export let id = null export let id = null
export let text = null export let text = null
export let disabled = false export let disabled = false
export let dataCy = null
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = event => { const onChange = event => {
dispatch("change", event.target.checked) dispatch("change", event.target.checked)
} }
</script> </script>
<div class="spectrum-Switch spectrum-Switch--emphasized"> <div class="spectrum-Switch spectrum-Switch--emphasized">
<input <input
data-cy={dataCy}
checked={value} checked={value}
{disabled} {disabled}
on:change={onChange} on:change={onChange}

3
packages/bbui/src/Form/Toggle.svelte

@ -9,6 +9,7 @@
export let text = null export let text = null
export let disabled = false export let disabled = false
export let error = null export let error = null
export let dataCy = null
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => { const onChange = e => {
@ -18,5 +19,5 @@
</script> </script>
<Field {label} {labelPosition} {error}> <Field {label} {labelPosition} {error}>
<Switch {error} {disabled} {text} {value} on:change={onChange} /> <Switch {dataCy} {error} {disabled} {text} {value} on:change={onChange} />
</Field> </Field>

6
packages/builder/cypress/integration/createAutomation.spec.js

@ -29,10 +29,10 @@ context("Create a automation", () => {
cy.get(".setup").within(() => { cy.get(".setup").within(() => {
cy.get(".spectrum-Picker-label").click() cy.get(".spectrum-Picker-label").click()
cy.contains("dog").click() cy.contains("dog").click()
cy.get("input") cy.get(".spectrum-Textfield-input")
.first() .first()
.type("goodboy") .type("goodboy")
cy.get("input") cy.get(".spectrum-Textfield-input")
.eq(1) .eq(1)
.type("11") .type("11")
}) })
@ -41,7 +41,7 @@ context("Create a automation", () => {
cy.contains("Save Automation").click() cy.contains("Save Automation").click()
// Activate Automation // Activate Automation
cy.get("[aria-label=PlayCircle]").click() cy.get("[data-cy=activate-automation]").click()
}) })
it("should add row when a new row is added", () => { it("should add row when a new row is added", () => {

2
packages/builder/src/components/automation/SetupPanel/SetupPanel.svelte

@ -51,7 +51,7 @@
<Toggle <Toggle
value={automationLive} value={automationLive}
on:change={() => setAutomationLive(!automationLive)} on:change={() => setAutomationLive(!automationLive)}
data-cy="activate-automation" dataCy="activate-automation"
text="Live" text="Live"
/> />
</div> </div>

Loading…
Cancel
Save