|
1 | 1 | /// <reference types="cypress" /> |
2 | 2 |
|
3 | | -describe('Application', () => { |
| 3 | +const messages = { |
| 4 | + READY: 'Application is ready to use', |
| 5 | + PROCESS_STARTED: 'Processing your image.', |
| 6 | + PROCESS_FINISHED: 'Image has been processed.' |
| 7 | +} |
| 8 | + |
| 9 | +describe('BackgroundRemove Application', () => { |
4 | 10 | it('As a User I should be able to visit application', function () { |
5 | 11 | cy.visit(Cypress.env('CYPRESS_BASE_URL')) |
6 | 12 | cy.percySnapshot() |
7 | 13 | }) |
| 14 | + |
| 15 | + it('Should inform me when application is ready to use', function () { |
| 16 | + cy.contains(messages.READY) |
| 17 | + cy.percySnapshot() |
| 18 | + }) |
| 19 | + |
| 20 | + it('As a User I should be able to select an image from my machine to remove Background', function () { |
| 21 | + cy.get('#js-image-picker').attachFile('adult-1868750_1920.jpg') |
| 22 | + |
| 23 | + cy.contains(messages.PROCESS_STARTED) |
| 24 | + cy.contains(messages.PROCESS_FINISHED) |
| 25 | + cy.percySnapshot() |
| 26 | + }) |
| 27 | + |
| 28 | + it('Should be able to pick suggested image from provided options', function () { |
| 29 | + cy.get('.suggestions__option').eq(2).click() |
| 30 | + |
| 31 | + cy.contains(messages.PROCESS_FINISHED) |
| 32 | + cy.percySnapshot() |
| 33 | + }) |
| 34 | + |
| 35 | + it('Should be able to interact with advance options', function () { |
| 36 | + cy.get('#internalResolution').should('not.be.visible') |
| 37 | + cy.get('[aria-controls="advance-options"]').click() |
| 38 | + cy.get('#internalResolution').should('be.visible') |
| 39 | + cy.percySnapshot() |
| 40 | + |
| 41 | + cy.get('[aria-controls="advance-options"]').click() |
| 42 | + cy.get('#internalResolution').should('not.be.visible') |
| 43 | + cy.percySnapshot() |
| 44 | + }) |
| 45 | + |
| 46 | + it('Should be able to specify background colour for processed image', function () { |
| 47 | + cy.get('[aria-controls="advance-options"]').click() |
| 48 | + cy.get('#backgroundColour').invoke('val', '#ff0000').trigger('change') |
| 49 | + |
| 50 | + cy.contains(messages.PROCESS_FINISHED) |
| 51 | + cy.percySnapshot() |
| 52 | + }) |
| 53 | + |
| 54 | + it('Should be able to download processed image', function () { |
| 55 | + cy.get('#js-download-link').click() |
| 56 | + cy.percySnapshot() |
| 57 | + }) |
8 | 58 | }) |
0 commit comments