1
0
Fork 0
mirror of synced 2024-06-15 17:05:11 +12:00

adds some data-cy properties to a number of elements and starts work on workflow tests

This commit is contained in:
kevmodrome 2020-06-11 16:40:07 +02:00
parent 0ab7b99f41
commit 5140069ed6
8 changed files with 63 additions and 9 deletions

View file

@ -1,6 +1,7 @@
context('Create a Model', () => {
before(() => {
Cypress.Cookies.preserveOnce('builder:token')
cy.visit('localhost:4001/_builder')
// https://on.cypress.io/type
cy.createApp('Model App', 'Model App Description')
@ -15,9 +16,6 @@ context('Create a Model', () => {
cy.get('.title').should('have.text', 'dog')
})
it('should add a record', () => {
// Page needs to be reloaded for some reason, cookie might be remove between tests?
cy.reload()
cy.addRecord('bob', '15')
cy.contains('bob').should('have.text', 'bob')

View file

@ -0,0 +1,39 @@
context('Create a workflow', () => {
before(() => {
Cypress.Cookies.preserveOnce('builder:token')
cy.visit('localhost:4001/_builder')
// https://on.cypress.io/type
cy.createApp('Workflow Test App', 'This app is used to test that workflows do in fact work!')
})
// https://on.cypress.io/interacting-with-elements
it('should create a workflow', () => {
cy.createModel('dog', 'name', 'age')
cy.createUser('bbuser', 'test', 'ADMIN')
cy.contains('workflow').click()
cy.get('.new-workflow-button').click()
cy.get('input').type('Add Record')
cy.contains('Save').click()
cy.get('[data-cy=add-workflow-component]').click()
cy.contains('Actions').click()
cy.get('[data-cy=SAVE_RECORD]').click()
cy.get(':nth-child(2) > .budibase__input').type('goodboy')
cy.get(':nth-child(3) > .budibase__input').type('11')
// Save
cy.get('[data-cy=save-workflow-setup]').click()
cy.get('.workflow-button').click()
})
it('should be able to run', () => {
cy.contains('frontend').click()
cy.addButtonComponent()
})
})

View file

@ -84,13 +84,17 @@ Cypress.Commands.add("createUser", (username, password, level) => {
})
Cypress.Commands.add("addHeadlineComponent", (text) => {
// Create User
cy.get('.switcher > :nth-child(2)').click()
cy.contains('Text').click()
cy.contains('Headline').click()
cy.get('[data-cy=Text]').click()
cy.get('[data-cy=Headline]').click()
cy.get('.tabs > :nth-child(2)').click()
cy.get('input[type="text"]')
.type(text)
cy.contains('Design').click()
})
Cypress.Commands.add("addButtonComponent", (text) => {
cy.get('.switcher > :nth-child(2)').click()
cy.get('[data-cy=Button]').click()
})

View file

@ -7,6 +7,7 @@
<div class="tabs">
{#each categories as category}
<li
data-cy={category.name}
on:click={() => onClick(category)}
class:active={selectedCategory === category}>
{category.name}

View file

@ -3,7 +3,11 @@
export let item
</script>
<div class="item-item" in:fly={{ y: 100, duration: 1000 }} on:click>
<div
data-cy={item.name}
class="item-item"
in:fly={{ y: 100, duration: 1000 }}
on:click>
<div class="item-icon">
<i class={item.icon} />
</div>

View file

@ -96,7 +96,10 @@
{#if workflowBlock}
<WorkflowBlockSetup {workflowBlock} />
<div class="buttons">
<button class="workflow-button hoverable" on:click={saveWorkflow}>
<button
data-cy="save-workflow-setup"
class="workflow-button hoverable"
on:click={saveWorkflow}>
Save Workflow
</button>
<button

View file

@ -15,7 +15,10 @@
}
</script>
<div class="workflow-block hoverable" on:click={addBlockToWorkflow}>
<div
class="workflow-block hoverable"
on:click={addBlockToWorkflow}
data-cy={actionId}>
<div>
<i class={blockDefinition.icon} />
</div>

View file

@ -11,6 +11,7 @@
<header>
<span
data-cy="workflow-list"
class="hoverable workflow-header"
class:selected={selectedTab === 'WORKFLOWS'}
on:click={() => (selectedTab = 'WORKFLOWS')}>
@ -18,6 +19,7 @@
</span>
{#if $workflowStore.currentWorkflow}
<span
data-cy="add-workflow-component"
class="hoverable"
class:selected={selectedTab === 'ADD'}
on:click={() => (selectedTab = 'ADD')}>