Skip to content

Commit

Permalink
feat(integration-testing): Integration Testing | 009 - Added integrat…
Browse files Browse the repository at this point in the history
…ion testing
  • Loading branch information
poly-glot committed Mar 15, 2020
1 parent f2eff97 commit a01426c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
Binary file added cypress/fixtures/adult-1868750_1920.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 51 additions & 1 deletion cypress/integration/application.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,58 @@
/// <reference types="cypress" />

describe('Application', () => {
const messages = {
READY: 'Application is ready to use',
PROCESS_STARTED: 'Processing your image.',
PROCESS_FINISHED: 'Image has been processed.'
}

describe('BackgroundRemove Application', () => {
it('As a User I should be able to visit application', function () {
cy.visit(Cypress.env('CYPRESS_BASE_URL'))
cy.percySnapshot()
})

it('Should inform me when application is ready to use', function () {
cy.contains(messages.READY)
cy.percySnapshot()
})

it('As a User I should be able to select an image from my machine to remove Background', function () {
cy.get('#js-image-picker').attachFile('adult-1868750_1920.jpg')

cy.contains(messages.PROCESS_STARTED)
cy.contains(messages.PROCESS_FINISHED)
cy.percySnapshot()
})

it('Should be able to pick suggested image from provided options', function () {
cy.get('.suggestions__option').eq(2).click()

cy.contains(messages.PROCESS_FINISHED)
cy.percySnapshot()
})

it('Should be able to interact with advance options', function () {
cy.get('#internalResolution').should('not.be.visible')
cy.get('[aria-controls="advance-options"]').click()
cy.get('#internalResolution').should('be.visible')
cy.percySnapshot()

cy.get('[aria-controls="advance-options"]').click()
cy.get('#internalResolution').should('not.be.visible')
cy.percySnapshot()
})

it('Should be able to specify background colour for processed image', function () {
cy.get('[aria-controls="advance-options"]').click()
cy.get('#backgroundColour').invoke('val', '#ff0000').trigger('change')

cy.contains(messages.PROCESS_FINISHED)
cy.percySnapshot()
})

it('Should be able to download processed image', function () {
cy.get('#js-download-link').click()
cy.percySnapshot()
})
})

0 comments on commit a01426c

Please sign in to comment.