diff --git a/cypress/fixtures/adult-1868750_1920.jpg b/cypress/fixtures/adult-1868750_1920.jpg new file mode 100644 index 0000000..32acabf Binary files /dev/null and b/cypress/fixtures/adult-1868750_1920.jpg differ diff --git a/cypress/integration/application.spec.js b/cypress/integration/application.spec.js index 8b0a600..4dc8afa 100644 --- a/cypress/integration/application.spec.js +++ b/cypress/integration/application.spec.js @@ -1,8 +1,58 @@ /// -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() + }) })