Commit 1dce2259 authored by Gleb Bahmutov's avatar Gleb Bahmutov

generated build files

parent 091f0a82
Pipeline #3579975 failed with stages
in 33 minutes and 8 seconds
......@@ -35,6 +35,72 @@ build-specs:
script:
- cypress ci --spec "cypress/integration/$CI_BUILD_NAME.js"
example_spec:
actions_spec:
<<: *e2e_test_definition
aliasing_spec:
<<: *e2e_test_definition
assertions_spec:
<<: *e2e_test_definition
basic_spec:
<<: *e2e_test_definition
config_spec:
<<: *e2e_test_definition
connectors_spec:
<<: *e2e_test_definition
cookies_spec:
<<: *e2e_test_definition
cookies2_spec:
<<: *e2e_test_definition
dom_spec:
<<: *e2e_test_definition
env_spec:
<<: *e2e_test_definition
fixtures_spec:
<<: *e2e_test_definition
local-storage_spec:
<<: *e2e_test_definition
location_spec:
<<: *e2e_test_definition
misc_spec:
<<: *e2e_test_definition
navigation_spec:
<<: *e2e_test_definition
network_spec:
<<: *e2e_test_definition
querying_spec:
<<: *e2e_test_definition
server_spec:
<<: *e2e_test_definition
traversal_spec:
<<: *e2e_test_definition
utilities_spec:
<<: *e2e_test_definition
viewport_spec:
<<: *e2e_test_definition
waiting_spec:
<<: *e2e_test_definition
window_spec:
<<: *e2e_test_definition
context('Actions', function(){
beforeEach(function(){
cy.visit('http://localhost:8080/commands/actions')
})
// **** Actions ****
//
// Let's perform some actions on DOM elements
// Move of these involve filling in form elements
// But some actions, like click, will often be
// used throughout an application
it('cy.type() - type into a DOM element', function(){
// https://on.cypress.io/api/type
cy
.get('.action-email')
.type('[email protected]').should('have.value', '[email protected]')
// cy.type() may include special character sequences
.type('{leftarrow}{rightarrow}{uparrow}{downarrow}{del}{selectall}{backspace}')
// **** Type Options ****
//
// cy.type() accepts options that control typing
//
// Delay each keypress by 0.1 sec
// You may want to set the delay which
// causes the keystrokes to happen much slower
// in some situations if the application under
// test is not able to handle rapid firing events.
// (generally due to the app not properly throttling events)
.type('[email protected]', {delay: 100}).should('have.value', '[email protected]')
.get('.action-disabled')
// Ignore error checking prior to type
// like whether the input is visible or disabled
.type('disabled error checking', {force: true})
.should('have.value', 'disabled error checking')
})
it('cy.focus() - focus on a DOM element', function(){
// https://on.cypress.io/api/focus
cy
.get('.action-focus').focus()
.should('have.class', 'focus')
.prev().should('have.attr', 'style', 'color: orange;')
})
it('cy.blur() - blur off a DOM element', function(){
// https://on.cypress.io/api/blur
cy
.get('.action-blur').type('I\'m about to blur').blur()
.should('have.class', 'error')
.prev().should('have.attr', 'style', 'color: red;')
})
it('cy.clear() - clears the value of an input or textarea element', function(){
// https://on.cypress.io/api/clear
cy
.get('.action-clear').type('We are going to clear this text')
.should('have.value', 'We are going to clear this text')
.clear()
.should('have.value', '')
})
it('cy.submit() - submit a form', function(){
// https://on.cypress.io/api/submit
cy
.get('.action-form')
.find('[type="text"]').type('HALFOFF')
.get('.action-form').submit()
.next().should('contain', 'Your form has been submitted!')
})
it('cy.click() - click on a DOM element', function(){
// https://on.cypress.io/api/click
cy.get('.action-btn').click()
// **** Click Position ****
//
// cy.click() accepts a position argument
// that controls where the click occurs
//
// clicking in the center of the element is the default
cy.get('#action-canvas').click()
// click the top left corner of the element
cy.get('#action-canvas').click('topLeft')
// click the top right corner of the element
cy.get('#action-canvas').click('topRight')
// click the bottom left corner of the element
cy.get('#action-canvas').click('bottomLeft')
// click the bottom right corner of the element
cy.get('#action-canvas').click('bottomRight')
// **** Click Coordinate ****
//
// cy.click() accepts a an x and y coordinate
// that controls where the click occurs :)
cy
.get('#action-canvas')
// click 80px on x coord and 75px on y coord
.click(80, 75)
.click(170, 75)
.click(80, 165)
.click(100, 185)
.click(125, 190)
.click(150, 185)
.click(170, 165)
// **** Click Options ****
//
// cy.click() accepts options that control clicking
//
// click multiple elements by passing multiple: true
// otherwise an error will be thrown if multiple
// elements are the subject of cy.click
cy.get('.action-labels>.label').click({multiple: true})
// Ignore error checking prior to clicking
// like whether the element is visible, clickable or disabled
// this button below is covered by another element.
cy.get('.action-opacity>.btn').click({force: true})
})
it('cy.dblclick() - double click on a DOM element', function(){
// We have a listener on 'dblclick' event in our 'scripts.js'
// that hides the div and shows an input on double click
// https://on.cypress.io/api/dblclick
cy
.get('.action-div').dblclick().should('not.be.visible')
.get('.action-input-hidden').should('be.visible')
})
it('cy.check() - check a checkbox or radio element', function(){
// By default, cy.check() will check all
// matching checkbox or radio elements in succession, one after another
// https://on.cypress.io/api/check
cy
.get('.action-checkboxes [type="checkbox"]').not('[disabled]').check().should('be.checked')
.get('.action-radios [type="radio"]').not('[disabled]').check().should('be.checked')
// **** Check Value ****
//
// cy.check() accepts a value argument
// that checks only checkboxes or radios
// with matching values
//
.get('.action-radios [type="radio"]').check('radio1').should('be.checked')
// **** Check Values ****
//
// cy.check() accepts an array of values
// that checks only checkboxes or radios
// with matching values
//
.get('.action-multiple-checkboxes [type="checkbox"]').check(['checkbox1', 'checkbox2']).should('be.checked')
// **** Check Options ****
//
// cy.check() accepts options that control checking
//
// Ignore error checking prior to checking
// like whether the element is visible, clickable or disabled
// this checkbox below is disabled.
.get('.action-checkboxes [disabled]')
.check({force: true}).should('be.checked')
.get('.action-radios [type="radio"]').check('radio3', {force: true}).should('be.checked')
})
it('cy.uncheck() - uncheck a checkbox element', function(){
// By default, cy.uncheck() will uncheck all matching
// checkbox elements in succession, one after another
// https://on.cypress.io/api/uncheck
cy
.get('.action-check [type="checkbox"]')
.not('[disabled]')
.uncheck().should('not.be.checked')
// **** Check Value ****
//
// cy.uncheck() accepts a value argument
// that unchecks only checkboxes
// with matching values
//
.get('.action-check [type="checkbox"]')
.check('checkbox1')
.uncheck('checkbox1').should('not.be.checked')
// **** Uncheck Values ****
//
// cy.uncheck() accepts an array of values
// that unchecks only checkboxes or radios
// with matching values
//
.get('.action-check [type="checkbox"]')
.check(['checkbox1', 'checkbox3'])
.uncheck(['checkbox1', 'checkbox3']).should('not.be.checked')
// **** Uncheck Options ****
//
// cy.uncheck() accepts options that control unchecking
//
// Ignore error checking prior to unchecking
// like whether the element is visible, clickable or disabled
// this checkbox below is disabled.
.get('.action-check [disabled]')
.uncheck({force: true}).should('not.be.checked')
})
it('cy.select() - select an option in a <select> element', function(){
// https://on.cypress.io/api/select
// Select the option with matching text content
cy.get('.action-select').select('apples')
// Select the option with matching value
cy.get('.action-select').select('fr-bananas')
// Select the options with matching text content
cy.get('.action-select-multiple').select(['apples', 'oranges', 'bananas'])
// Select the options with matching values
cy.get('.action-select-multiple').select(['fr-apples', 'fr-oranges', 'fr-bananas'])
})
})
\ No newline at end of file
context('Aliasing', function(){
beforeEach(function(){
cy.visit('http://localhost:8080/commands/aliasing')
})
// **** Aliasing ****
//
// We alias a DOM element for use later
// We don't have to traverse to the element
// later in our code, we just reference it with @
it('cy.as() - alias a route or DOM element for later use', function(){
// this is a good use case for an alias,
// we don't want to write this long traversal again
//
// https://on.cypress.io/api/as
cy
.get('.as-table').find('tbody>tr')
.first().find('td').first().find('button').as('firstBtn')
// maybe do some more testing here...
// when we reference the alias, we place an
// @ in front of it's name
.get('@firstBtn').click()
.get('@firstBtn')
.should('have.class', 'btn-success')
.and('contain', 'Changed')
})
})
\ No newline at end of file
context('Assertions', function(){
beforeEach(function(){
cy.visit('http://localhost:8080/commands/assertions')
})
// **** Assertions ****
//
describe('Implicit Assertions', function(){
it('cy.should - make an assertion about the current subject', function(){
// https://on.cypress.io/api/should
cy
.get('.assertion-table')
.find('tbody tr:last').should('have.class', 'success')
})
it('cy.and - chain multiple assertions together', function(){
// https://on.cypress.io/api/and
cy
.get('.assertions-link')
.should('have.class', 'active')
.and('have.attr', 'href')
.and('include', 'cypress.io')
})
})
describe('Explicit Assertions', function(){
it('expect - make an assertion about a specified subject', function(){
// We can use Chai's BDD style assertions
expect(true).to.be.true
// Pass a function to should that can have any number
// of explicit assertions within it.
cy
.get('.assertions-p').find('p')
.should(function($p){
// return an array of texts from all of the p's
var texts = $p.map(function(i, el){
// https://on.cypress.io/api/cypress-jquery
return Cypress.$(el).text()
})
// jquery map returns jquery object
// and .get() convert this to simple array
var texts = texts.get()
// array should have length of 3
expect(texts).to.have.length(3)
// set this specific subject
expect(texts).to.deep.eq([
'Some text from first p',
'More text from second p',
'And even more text from third p'
])
})
})
})
})
\ No newline at end of file
//
// **** Kitchen Sink Tests ****
//
// This app was developed to demonstrate
// how to write tests in Cypress utilizing
// all of the available commands
//
// Feel free to modify this spec in your
// own application as a jumping off point
// **** Test Structure ****
//
// Cypress has adopted Mocha's bdd syntax.
// https://on.cypress.io/guides/bundled-tools#section-mocha
//
describe('Kitchen Sink', function(){
beforeEach(function(){
// **** Resetting State Before Each Test ****
//
// Visiting our app before each test
// removes any state build up from
// previous tests. Visiting acts as if
// we closed a tab and opened a fresh one
//
// By default Cypress also automatically
// clears the Local Storage and Cookies
// before each test.
})
it('cy.should - assert that <title> is correct', function(){
// https://on.cypress.io/api/visit
cy.visit('http://localhost:8080')
// **** Making Assertions ****
//
// Here we've made our first assertion using a 'cy.should()' command.
// An assertion is comprised of a chainer, subject, and optional value.
// Chainers are available from Chai, Chai-jQuery, and Chai-Sinon.
// https://on.cypress.io/guides/making-assertions
//
// https://on.cypress.io/api/should
// https://on.cypress.io/api/and
// https://on.cypress.io/api/title
cy.title().should('include', 'Kitchen Sink')
// ↲ ↲ ↲
// subject chainer value
})
})
\ No newline at end of file
context('Cypress.config()', function(){
beforeEach(function(){
cy.visit('http://localhost:8080/cypress-api/config')
})
// **** Config ****
//
it('Cypress.config() - get and set configuration options', function(){
// https://on.cypress.io/api/config
var myConfig = Cypress.config()
expect(myConfig).to.have.property('animationDistanceThreshold', 5)
expect(myConfig).to.have.property('baseUrl', null)
expect(myConfig).to.have.property('commandTimeout', 4000)
expect(myConfig).to.have.property('requestTimeout', 5000)
expect(myConfig).to.have.property('responseTimeout', 20000)
expect(myConfig).to.have.property('viewportHeight', 660)
expect(myConfig).to.have.property('viewportWidth', 1000)
expect(myConfig).to.have.property('pageLoadTimeout', 30000)
expect(myConfig).to.have.property('waitForAnimations', true)
// *** get a single configuration option **
expect(Cypress.config('pageLoadTimeout')).to.eq(30000)
// *** set a single configuration option **
//
// this will change the config for the rest of your tests!
//
Cypress.config('pageLoadTimeout', 20000)
expect(Cypress.config('pageLoadTimeout')).to.eq(20000)
Cypress.config('pageLoadTimeout', 30000)
})
})
\ No newline at end of file
context('Connectors', function(){
beforeEach(function(){
cy.visit('http://localhost:8080/commands/connectors')
})
// **** Connectors ****
//
// Some commands are just used to manipulate elements,
// properties or invoke functions on the current subject
it('cy.each() - iterate over an array of elements', function(){
// https://on.cypress.io/api/each
cy
.get('.connectors-each-ul>li')
.each(function($el, index, $list){
console.log($el, index, $list)
})
})
it('cy.its() - get properties on the current subject', function(){
// https://on.cypress.io/api/its
cy
.get('.connectors-its-ul>li')
// calls the 'length' property returning that value
.its('length')
.should('be.gt', 2)
})
it('cy.invoke() - invoke a function on the current subject', function(){
// our div is hidden in our script.js
// $('.connectors-div').hide()
// https://on.cypress.io/api/invoke
cy
.get('.connectors-div').should('be.hidden')
// call the jquery method 'show' on the 'div.container'
.invoke('show')
.should('be.visible')
})
it('cy.spread() - spread an array as individual arguments to a callback function', function(){
// https://on.cypress.io/api/spread
var arr = ['foo', 'bar', 'baz']
cy.wrap(arr).spread(function(foo, bar, baz){
expect(foo).to.eq('foo')
expect(bar).to.eq('bar')
expect(baz).to.eq('baz')
})
})
it('cy.then() - invoke a callback function with the current subject', function(){
// https://on.cypress.io/api/then
cy.get('.connectors-list>li').then(function($lis){
expect($lis).to.have.length(3)
expect($lis.eq(0)).to.contain('Walk the dog')
expect($lis.eq(1)).to.contain('Feed the cat')
expect($lis.eq(2)).to.contain('Write JavaScript')
})
})
})
\ No newline at end of file
context('Cookies', function(){
beforeEach(function(){
Cypress.Cookies.debug(true)
cy.visit('http://localhost:8080/commands/cookies')
// clear cookies again after visiting to remove
// any 3rd party cookies picked up such as cloudflare
.clearCookies()
})
it('cy.getCookie() - get a browser cookie', function(){
// **** Get a Cookie ****
//
// // https://on.cypress.io/api/getcookie
cy
.get('#getCookie .set-a-cookie').click()