mirror of https://github.com/sgoudham/carbon.git
Store Unsplash background image not dataturl (#836)
* store background image, not background selection in presets * move localStorage into save utils * curry omit util fn * clean up manual image upload by URL * refactor image changes * separate uploadImage from selectImage * upgrade visual regression testing tests * add TODOsmain
parent
3d86e9d77e
commit
552a9c99be
@ -0,0 +1,115 @@
|
||||
/* global cy, before, after */
|
||||
import { environment } from '../util'
|
||||
|
||||
describe.skip('Visual regression testing', () => {
|
||||
describe('Buttons', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Button',
|
||||
browser: environment
|
||||
})
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.reload()
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
it('test export button', () => {
|
||||
cy.get('[data-cy=export-button]').click()
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'export button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
|
||||
it('test display button', () => {
|
||||
cy.get('[data-cy=display]').click()
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'display button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
|
||||
it('test color button', () => {
|
||||
cy.get('[data-cy=display]').click()
|
||||
cy.wait(2000)
|
||||
cy.get('[title="#50E3C2"]').click()
|
||||
cy.wait(500)
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'color button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Syntax', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Syntax',
|
||||
browser: environment
|
||||
})
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
const cases = [
|
||||
['JSON', "/?code={name:'Andrew',age:30}&l=application%2Fjson"],
|
||||
['C#', '/?code=class Program { static void Main(){ do }}&l=text%2Fx-csharp'],
|
||||
['C++', '/?l=text%2Fx-c%2B%2Bsrc&code=for(size_t i=0 ;i<length; i%2B%2B){}']
|
||||
]
|
||||
|
||||
cases.forEach(([language, example]) => {
|
||||
it(`Syntax test for "${language}"`, () => {
|
||||
cy.visit(example)
|
||||
cy.eyesCheckWindow({
|
||||
tag: language,
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Themes', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Syntax',
|
||||
browser: environment
|
||||
})
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
const cases = [
|
||||
['JSON', "/?code={name:'Andrew',age:30}&l=application%2Fjson"],
|
||||
['C#', '/?code=class Program { static void Main(){ do }}&l=text%2Fx-csharp'],
|
||||
['C++', '/?l=text%2Fx-c%2B%2Bsrc&code=for(size_t i=0 ;i<length; i%2B%2B){}']
|
||||
]
|
||||
|
||||
cases.forEach(([language, example]) => {
|
||||
it(`Syntax test for "${language}"`, () => {
|
||||
cy.visit(example)
|
||||
cy.eyesCheckWindow({
|
||||
tag: language,
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -1,51 +0,0 @@
|
||||
/* global cy, before, after */
|
||||
import { environment } from '../../util'
|
||||
|
||||
describe('Visual Regression Testing', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Button',
|
||||
browser: environment
|
||||
})
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.reload()
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
it('test export button', () => {
|
||||
cy.get('[data-cy=export-button]').click()
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'export button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
|
||||
it('test display button', () => {
|
||||
cy.get('[data-cy=display]').click()
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'display button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
|
||||
it('test color button', () => {
|
||||
cy.get('[data-cy=display]').click()
|
||||
cy.wait(2000)
|
||||
cy.get('[title="#50E3C2"]').click()
|
||||
cy.wait(500)
|
||||
cy.eyesCheckWindow({
|
||||
tag: 'color button',
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
@ -1,33 +0,0 @@
|
||||
/* global cy, before, after */
|
||||
import { environment } from '../../util'
|
||||
|
||||
describe('Visual Regression Testing', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Syntax',
|
||||
browser: environment
|
||||
})
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
const cases = [
|
||||
['JSON', "/?code={name:'Andrew',age:30}&l=application%2Fjson"],
|
||||
['C#', '/?code=class Program { static void Main(){ do }}&l=text%2Fx-csharp'],
|
||||
['C++', '/?l=text%2Fx-c%2B%2Bsrc&code=for(size_t i=0 ;i<length; i%2B%2B){}']
|
||||
]
|
||||
|
||||
cases.forEach(([language, example]) => {
|
||||
it(`Syntax test for "${language}"`, () => {
|
||||
cy.visit(example)
|
||||
cy.eyesCheckWindow({
|
||||
tag: language,
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -1,29 +0,0 @@
|
||||
/* global cy, before ,after */
|
||||
import { environment } from '../../util'
|
||||
import { THEMES } from '../../../lib/constants'
|
||||
|
||||
describe('Visual Regression Testing', () => {
|
||||
before(() => {
|
||||
cy.eyesOpen({
|
||||
appName: 'Carbon',
|
||||
testName: 'Themes',
|
||||
browser: environment
|
||||
})
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
after(() => {
|
||||
cy.eyesClose()
|
||||
})
|
||||
|
||||
THEMES.forEach(t => {
|
||||
it(`Test theme: "${t.name}"`, () => {
|
||||
cy.get('[data-cy="themes-container"] [data-cy="theme-selector-button"]').click()
|
||||
cy.contains(t.name).click({ force: true })
|
||||
cy.eyesCheckWindow({
|
||||
target: 'region',
|
||||
selector: '.page'
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue