Re-enabled visual regression testing (#838)

* re-enabled visual regression testing

* clean up syntax-test
main
Michael Fix 5 years ago committed by GitHub
parent de5e3254d4
commit ae834cc3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,7 @@
/* global cy,before,after */ /* global cy, before, after */
import { environment } from '../../util' import { environment } from '../../util'
describe.skip('Visual Regression Testing', () => {
describe('Visual Regression Testing', () => {
before(() => { before(() => {
cy.eyesOpen({ cy.eyesOpen({
appName: 'Carbon', appName: 'Carbon',
@ -9,18 +10,20 @@ describe.skip('Visual Regression Testing', () => {
}) })
cy.visit('/') cy.visit('/')
}) })
after(() => {
cy.eyesClose()
})
beforeEach(() => { beforeEach(() => {
cy.reload() cy.reload()
}) })
after(() => {
cy.eyesClose()
})
it('test export button', () => { it('test export button', () => {
cy.get('[data-cy=export-button]').click() cy.get('[data-cy=export-button]').click()
cy.eyesCheckWindow({ cy.eyesCheckWindow({
tag: 'export button', tag: 'export button',
sizeMode: 'selector', //mode target: 'region',
selector: '.page' selector: '.page'
}) })
}) })
@ -29,7 +32,7 @@ describe.skip('Visual Regression Testing', () => {
cy.get('[data-cy=display]').click() cy.get('[data-cy=display]').click()
cy.eyesCheckWindow({ cy.eyesCheckWindow({
tag: 'display button', tag: 'display button',
sizeMode: 'selector', //mode target: 'region',
selector: '.page' selector: '.page'
}) })
}) })
@ -41,7 +44,7 @@ describe.skip('Visual Regression Testing', () => {
cy.wait(500) cy.wait(500)
cy.eyesCheckWindow({ cy.eyesCheckWindow({
tag: 'color button', tag: 'color button',
sizeMode: 'selector', //mode target: 'region',
selector: '.page' selector: '.page'
}) })
}) })

@ -1,6 +1,7 @@
/* global cy,before,after */ /* global cy, before, after */
import { environment } from '../../util' import { environment } from '../../util'
describe.skip('Visual Regression Testing', () => {
describe('Visual Regression Testing', () => {
before(() => { before(() => {
cy.eyesOpen({ cy.eyesOpen({
appName: 'Carbon', appName: 'Carbon',
@ -8,33 +9,25 @@ describe.skip('Visual Regression Testing', () => {
browser: environment browser: environment
}) })
}) })
after(() => { after(() => {
cy.eyesClose() cy.eyesClose()
}) })
it('syntax test for JSON', () => { const cases = [
cy.visit("/?code={name:'Andrew',age:30}&l=application%2Fjson") ['JSON', "/?code={name:'Andrew',age:30}&l=application%2Fjson"],
cy.eyesCheckWindow({ ['C#', '/?code=class Program { static void Main(){ do }}&l=text%2Fx-csharp'],
tag: 'JSON', ['C++', '/?l=text%2Fx-c%2B%2Bsrc&code=for(size_t i=0 ;i<length; i%2B%2B){}']
sizeMode: 'selector', //mode ]
selector: '.page'
})
})
it('syntax test for C#', () => { cases.forEach(([language, example]) => {
cy.visit('/?code=class Program { static void Main(){ do }}&l=text%2Fx-csharp') it(`Syntax test for "${language}"`, () => {
cy.visit(example)
cy.eyesCheckWindow({ cy.eyesCheckWindow({
tag: 'C#', tag: language,
sizeMode: 'selector', //mode target: 'region',
selector: '.page' selector: '.page'
}) })
}) })
it('syntax test for C++', () => {
cy.visit('/?l=text%2Fx-c%2B%2Bsrc&code=for(size_t i=0 ;i<length; i%2B%2B){}')
cy.eyesCheckWindow({
tag: 'C++',
sizeMode: 'selector', //mode
selector: '.page'
})
}) })
}) })

@ -1,8 +1,8 @@
/* global cy,before,after */ /* global cy, before ,after */
import { environment } from '../../util' import { environment } from '../../util'
import { THEMES } from '../../../lib/constants'
// TODO: remove .skip - Applitools is not working right now describe('Visual Regression Testing', () => {
describe.skip('Visual Regression Testing', () => {
before(() => { before(() => {
cy.eyesOpen({ cy.eyesOpen({
appName: 'Carbon', appName: 'Carbon',
@ -11,20 +11,19 @@ describe.skip('Visual Regression Testing', () => {
}) })
cy.visit('/') cy.visit('/')
}) })
after(() => { after(() => {
cy.eyesClose() cy.eyesClose()
}) })
it('themes test', () => { THEMES.forEach(t => {
for (let childIndex = 1; childIndex < 28; childIndex++) { it(`Test theme: "${t.name}"`, () => {
cy.get('[data-cy="themes-container"] [data-cy="theme-selector-button"]').click() cy.get('[data-cy="themes-container"] [data-cy="theme-selector-button"]').click()
cy.get( cy.contains(t.name).click({ force: true })
`[data-cy="themes-container"] [data-cy="dropdown-item"]:nth-child(${childIndex + 1})`
).click({ force: true })
cy.eyesCheckWindow({ cy.eyesCheckWindow({
sizeMode: 'selector', //mode target: 'region',
selector: '.page' selector: '.page'
}) })
} })
}) })
}) })

Loading…
Cancel
Save