Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/646 how to button disable on save and edit test #682

Merged
merged 6 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions cypress/integration/bugs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,81 +111,4 @@ describe('[Bugs]', () => {
.should('include', Page.HOME_PAGE)
})

it.skip('[646]', () => {
cy.deleteDocuments('v2_howtos', 'title', '==', 'Create a how-to test')

cy.visit('/how-to')
cy.login('howto_creator@test.com', 'test1234')
cy.get('[data-cy=create]').click()

cy.step('Fill up the intro')
cy.get('[data-cy=intro-title').type('Create a how-to test')
cy.get('[data-cy=tag-select]').click()
cy.get('.data-cy__menu')
.contains('howto_testing')
.click()

cy.get('[data-cy=time-select]').click()
cy.get('.data-cy__menu')
.contains('1-2 weeks')
.click()

cy.get('[data-cy=difficulty-select]').click()
cy.get('.data-cy__menu')
.contains('Medium')
.click()
cy.get('[data-cy=intro-description]').type(
'After creating, the how-to will be deleted',
)
cy.get('[data-cy=intro-caption]').type('Intro caption goes here ...')

cy.step('Upload a cover for the intro')
cy.get('[data-cy=intro-cover]')
.find(':file')
.uploadFiles('images/howto-intro.jpg')

cy.step('Add steps')
cy.get('[data-cy^=step_]')
.its('length')
.should('be.eq', 3)
cy.get('button[data-cy=add-step]').click()
cy.get('[data-cy^=step_]')
.its('length')
.should('be.eq', 4)

cy.get('[data-cy=delete-step]').each($el => {
$el.trigger('click')
cy.get('[data-cy=confirm]:visible').click()
})
cy.get('[data-cy^=step_]:visible')
.its('length')
.should('be.eq', 1)

cy.step('Fill up a step info')
cy.get('[data-cy=step_0]').within($firstStep => {
cy.wrap($firstStep)
.contains('Step 1')
.should('be.exist')
cy.get('[data-cy=step-title]').type('First step is easy')
cy.get('[data-cy=step-description]').type(
'Description for the first step',
)
cy.get('[data-cy=step-caption]').type('What a step caption')
cy.get('[data-cy=delete-step]').should('not.exist')
})
cy.step('Upload pics for a step')
cy.get(':file')
.uploadFiles(['images/howto-step-pic1.jpg', 'images/howto-step-pic2.jpg'])

cy.get('[data-cy=submit]').click()
cy.step(`Wait till it's done and click View How-to button`)
cy.get('[data-cy=view-howto]')
.click()
.url()
.should('include', '/how-to/create-a-howto-test')
cy.get('[data-cy=how-to-basis]')
.contains('Create a how-to test')
.its('length')
.should('be.eq', 1)
})
})
7 changes: 3 additions & 4 deletions cypress/integration/howto/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ describe('[How To]', () => {
cy.screenClick()
cy.get('[data-cy=submit]').click()

cy.wait(6000)
cy.get('[data-cy=view-howto]')
cy.get('[data-cy=view-howto]:enabled')
.click()
.url()
.should('include', `/how-to/create-a-howto-test`)
Expand Down Expand Up @@ -267,8 +266,8 @@ describe('[How To]', () => {
cy.get('[data-cy=submit]').click()

cy.step('Open the updated how-to')
cy.wait(6000)
cy.get('[data-cy=view-howto]').click()

cy.get('[data-cy=view-howto]:enabled').click()
.url().should('include', '/how-to/this-is-an-edit-test')
cy.get('[data-cy=how-to-basis]').contains('This is an edit test')
cy.queryDocuments('v2_howtos', 'title', '==', 'This is an edit test').should('eqHowto', expected)
Expand Down
Loading