Skip to content

Instantly share code, notes, and snippets.

@ivan-hilckov
Created October 25, 2018 15:17
Show Gist options
  • Select an option

  • Save ivan-hilckov/f09066664d8316dfa07e9eb35449d4d3 to your computer and use it in GitHub Desktop.

Select an option

Save ivan-hilckov/f09066664d8316dfa07e9eb35449d4d3 to your computer and use it in GitHub Desktop.
Спека для страницы /project/:projectId/layer
/// <reference types="Cypress" />
import { URLS, PATH_NAME } from '../../src/constants/path'
const projectId = 3
const notExistProjectId = 9999
const ids = {
close: 'close',
title: 'form-title',
subtitle: 'form-subtitle',
image: 'layer-image-add',
vector: 'layer-vector-add',
cad: 'layer-cad-add',
xyz: 'layer-xyz-add',
wms: 'layer-wms-add',
notFound: 'not-found',
}
describe('Layer', () => {
beforeEach(() => {
cy.signin().layer(projectId)
})
it('Layer has title subtitle and cards (image, vector, cad, xyz, wms)', () => {
cy.getByTestId(ids.title).should('be.visible')
cy.getByTestId(ids.subtitle).should('be.visible')
cy.getByTestId(ids.image).should('be.visible')
cy.getByTestId(ids.vector).should('be.visible')
cy.getByTestId(ids.cad).should('be.visible')
cy.getByTestId(ids.xyz).should('be.visible')
cy.getByTestId(ids.wms).should('be.visible')
})
it('Layer page has XYZ card and card is work', () => {
cy.getByTestId(ids.xyz)
.should('not.disabled')
.click()
cy.url().should('include', URLS[PATH_NAME.xyz]({ projectId }))
})
it('Layer page has WMS card and card is work', () => {
cy.getByTestId(ids.wms)
.should('not.disabled')
.click()
cy.url().should('include', URLS[PATH_NAME.wms]({ projectId }))
})
it('Can close Layer page', () => {
cy.getByTestId(ids.close)
.should('be.visible')
.click()
cy.url().should('include', URLS[PATH_NAME.project]({ projectId }))
})
})
describe('Project add layer', () => {
it('If project not find show 404', () => {
cy.signin()
.server()
.route('/api/project/*/')
.as('getProject')
cy.visit(URLS[PATH_NAME.layer]({ projectId: notExistProjectId }))
cy.wait('@getProject')
.getByTestId(ids.notFound)
.should('be.visible')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment