Skip to content

Commit

Permalink
Merge branch 'develop' into v5.0-release
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-shehane committed Aug 10, 2020
2 parents a882763 + ef25aa7 commit 9a1b4c6
Show file tree
Hide file tree
Showing 13 changed files with 332 additions and 90 deletions.
34 changes: 34 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,40 @@ jobs:
path: /tmp/artifacts
- store-npm-logs

desktop-gui-visual-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
- run:
command: yarn build-prod
working_directory: packages/desktop-gui
- run:
name: Desktop GUI server
command: yarn start
working_directory: packages/desktop-gui
background: true
- run:
# will use PERCY_TOKEN environment variable if available
# to tie Percy builds together, use environment variables
# https://docs.percy.io/docs/parallel-test-suites
# we can use workflow id and list number of jobs with Percy screenshots
# if we allow Percy snapshots in more jobs, use the same
# PERCY_* variables in all of them
# NOTE: we only execute specs with "cy.percySnapshot" commands in them
command: |
CYPRESS_KONFIG_ENV=production \
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_ID \
PERCY_PARALLEL_TOTAL=1 \
yarn percy exec -- \
yarn cypress:run \
--spec cypress/integration/settings_spec.js,cypress/integration/specs_list_spec.js,cypress/integration/runs_list_spec.js
working_directory: packages/desktop-gui
- verify-mocha-results
# we don't really need any artifacts - we are only interested in visual screenshots
- store-npm-logs

desktop-gui-component-tests:
<<: *defaults
parallelism: 1
Expand Down
50 changes: 24 additions & 26 deletions packages/desktop-gui/cypress/integration/runs_list_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe('Runs List', function () {
})
})

it('shows \'cannot connect to api server\' message', function () {
it('shows "cannot connect to api server" message', function () {
cy.contains('Cannot connect to API server')
cy.contains('http://api.server')
cy.contains('ECONNREFUSED')
Expand Down Expand Up @@ -327,8 +327,8 @@ describe('Runs List', function () {
this.goToRuns()
})

it('displays \'need to set up\' message', () => {
cy.contains('You have no recorded runs')
it('displays "need to set up" message', () => {
cy.contains('You could see test recordings here')
})
})

Expand All @@ -342,13 +342,13 @@ describe('Runs List', function () {
this.goToRuns()
})

it('displays \'need to set up\' message', () => {
cy.contains('You have no recorded runs')
it('displays "need to set up" message', () => {
cy.contains('You could see test recordings here')
})

describe('click setup project', function () {
beforeEach(() => {
cy.contains('Set up project').click()
cy.contains('Connect to Dashboard').click()
})

it('shows login message', () => {
Expand Down Expand Up @@ -439,10 +439,10 @@ describe('Runs List', function () {
cy.contains('Request access')
})

it('displays \'need to set up\' message', function () {
it('displays "need to set up" message', function () {
this.ipcError({ type: 'NO_PROJECT_ID' })

cy.contains('You have no recorded runs')
cy.contains('You could see test recordings here')
})

it('displays old runs if another error', function () {
Expand Down Expand Up @@ -541,7 +541,7 @@ describe('Runs List', function () {
cy.get('@requestAccessBtn').should('be.disabled')
})

it('hides \'Request access\' text', () => {
it('hides "Request access" text', () => {
cy.get('@requestAccessBtn').find('span').should('not.be.visible')
})

Expand All @@ -558,7 +558,7 @@ describe('Runs List', function () {
cy.contains('Request sent')
})

it('\'persists\' request state (until app is reloaded at least)', function () {
it('persists request state (until app is reloaded at least)', function () {
this.ipc.getRuns.onCall(1).rejects({ name: 'foo', message: 'There\'s an error', statusCode: 403 })

cy.get('.navbar-default a').contains('Tests').click()
Expand Down Expand Up @@ -613,7 +613,7 @@ describe('Runs List', function () {
cy.get('@requestAccessBtn').should('not.be.disabled')
})

it('shows \'Request access\' text', () => {
it('shows "Request access" text', () => {
cy.get('@requestAccessBtn').find('span').should('be.visible')
})

Expand All @@ -627,7 +627,7 @@ describe('Runs List', function () {
this.requestAccess.reject({ type: 'DENIED', name: 'foo', message: 'There\'s an error' })
})

it('shows \'success\' message', () => {
it('shows "success" message', () => {
cy.contains('Request sent')
})
})
Expand All @@ -637,7 +637,7 @@ describe('Runs List', function () {
this.requestAccess.reject({ type: 'ALREADY_REQUESTED', name: 'foo', message: 'There\'s an error' })
})

it('shows \'success\' message', () => {
it('shows "success" message', () => {
cy.contains('Request sent')
})
})
Expand All @@ -653,6 +653,7 @@ describe('Runs List', function () {

it('shows login message', () => {
cy.get('.empty h4').should('contain', 'Log in')
cy.percySnapshot()
})

it('clicking Log In to Dashboard opens login', () => {
Expand Down Expand Up @@ -723,12 +724,13 @@ describe('Runs List', function () {
})
})

it('displays \'need to set up\' message', () => {
cy.contains('You have no recorded runs')
it('displays "need to set up" message', () => {
cy.contains('You could see test recordings here')
cy.percySnapshot()
})

it('clears message after setting up to record', function () {
cy.contains('.btn', 'Set up project').click()
it('clears message after setting up to record', () => {
cy.contains('.btn', 'Connect to Dashboard').click()
cy.get('.organizations-select__dropdown-indicator').click()
cy.get('.organizations-select__menu').should('be.visible')
cy.get('.organizations-select__option')
Expand All @@ -747,11 +749,7 @@ describe('Runs List', function () {
this.openProject.resolve(this.config)

this.goToRuns().then(() => {
this.getRuns.reject({ name: 'foo', message: `\
{
"no runs": "for you"
}\
`, type: 'UNKNOWN' })
this.getRuns.reject({ name: 'foo', message: `{"no runs": "for you"}`, type: 'UNKNOWN' })
})
})

Expand Down Expand Up @@ -824,8 +822,8 @@ describe('Runs List', function () {
})
})

it('displays \'need to set up\' message', () => {
cy.contains('You have no recorded runs')
it('displays "need to set up" message', () => {
cy.contains('You could see test recordings here')
})
})
})
Expand All @@ -843,14 +841,14 @@ describe('Runs List', function () {
cy.contains('To record your first')
})

it('opens project id guide on clicking \'Why?\'', () => {
it('opens project id guide on clicking "Why?"', () => {
cy.contains('Why?').click()
.then(function () {
expect(this.ipc.externalOpen).to.be.calledWith('https://on.cypress.io/what-is-a-project-id')
})
})

it('opens dashboard on clicking \'Cypress Dashboard\'', () => {
it('opens dashboard on clicking "Cypress Dashboard"', () => {
cy.contains('Cypress Dashboard').click()
.then(function () {
expect(this.ipc.externalOpen).to.be.calledWith(`https://on.cypress.io/dashboard/projects/${this.config.projectId}/runs`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Set Up Project', function () {
describe('Connect to Dashboard', function () {
beforeEach(function () {
cy.fixture('user').as('user')
cy.fixture('projects').as('projects')
Expand Down Expand Up @@ -46,8 +46,8 @@ describe('Set Up Project', function () {
})
})

it('displays \'need to set up\' message', () => {
cy.contains('You have no recorded runs')
it('displays "need to set up" message', () => {
cy.contains('You could see test recordings here')
})

describe('when there is a current user', function () {
Expand All @@ -59,7 +59,7 @@ describe('Set Up Project', function () {
beforeEach(function () {
this.getOrgs.resolve(this.orgs)

cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('clicking link opens setup project window', () => {
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('Set Up Project', function () {

describe('loading behavior', function () {
beforeEach(function () {
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('calls getOrgs', function () {
Expand All @@ -111,7 +111,7 @@ describe('Set Up Project', function () {
beforeEach(function () {
this.getOrgs.resolve(this.orgs)

cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
cy.get('.modal-content')
cy.get('.organizations-select__dropdown-indicator').click()
cy.get('.organizations-select__menu').should('be.visible')
Expand All @@ -135,7 +135,7 @@ describe('Set Up Project', function () {
context('with orgs', function () {
beforeEach(function () {
this.getOrgs.resolve(this.orgs)
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()

cy.get('.modal-content')
})
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('Set Up Project', function () {
context('orgs with no default org', function () {
beforeEach(function () {
this.getOrgs.resolve(Cypress._.filter(this.orgs, { 'default': false }))
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('lists organizations to assign to project', function () {
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('Set Up Project', function () {
context('without orgs', function () {
beforeEach(function () {
this.getOrgs.resolve([])
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('displays empty message', () => {
Expand All @@ -236,7 +236,7 @@ describe('Set Up Project', function () {
'default': true,
}])

cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
cy.get('.modal-content')
})

Expand Down Expand Up @@ -264,7 +264,7 @@ describe('Set Up Project', function () {
beforeEach(function () {
cy.clock()
this.getOrgs.resolve(this.orgs)
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('polls for orgs twice in 10+sec on click of org', function () {
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('Set Up Project', function () {
describe('on submit', function () {
beforeEach(function () {
this.getOrgs.resolve(this.orgs)
cy.contains('.btn', 'Set up project').click()
cy.contains('.btn', 'Connect to Dashboard').click()
cy.get('.organizations-select__dropdown-indicator').click()
cy.get('.organizations-select__menu').should('be.visible')
cy.get('.organizations-select__option')
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('Set Up Project', function () {
orgId: '000',
})

cy.contains('.btn', 'Set up project').click()
cy.contains('.btn', 'Connect to Dashboard').click()
})

it('sends project name, org id, and public flag to ipc event', function () {
Expand Down Expand Up @@ -450,7 +450,7 @@ describe('Set Up Project', function () {
describe('errors', function () {
beforeEach(function () {
this.getOrgs.resolve(this.orgs)
cy.contains('.btn', 'Set up project').click()
cy.contains('.btn', 'Connect to Dashboard').click()
cy.get('.organizations-select__dropdown-indicator').click()
cy.get('.organizations-select__menu').should('be.visible')
cy.get('.organizations-select__option')
Expand All @@ -471,12 +471,7 @@ describe('Set Up Project', function () {
it('displays error name and message when unexpected', function () {
this.setupDashboardProject.reject({
name: 'Fatal Error!',
message: `\
{
"system": "down",
"toxicity": "of the city"
}\
`,
message: `{ "system": "down", "toxicity": "of the city" }`,
})

cy.contains('"system": "down"')
Expand All @@ -485,7 +480,7 @@ describe('Set Up Project', function () {

describe('when get orgs 401s', function () {
beforeEach(function () {
cy.contains('.btn', 'Set up project').click()
cy.contains('.btn', 'Connect to Dashboard').click()
.then(() => {
this.getOrgs.reject({ name: '', message: '', statusCode: 401 })
})
Expand All @@ -501,7 +496,7 @@ describe('Set Up Project', function () {
beforeEach(function () {
this.getCurrentUser.resolve(null)

cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

it('shows login', () => {
Expand All @@ -511,7 +506,7 @@ describe('Set Up Project', function () {
it('closes login modal', () => {
cy.get('.modal').contains('Log In to Dashboard')
cy.get('.close').click()
cy.get('.btn').contains('Set up project').click()
cy.get('.btn').contains('Connect to Dashboard').click()
})

describe('when login succeeds', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-gui/src/auth/login-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LoginForm extends Component {
<div className='login-content'>
{this._error()}
<button
className={cs('btn btn-login btn-black btn-block', {
className={cs('btn btn-login btn-primary btn-wide', {
disabled: this.state.isLoggingIn,
})}
onClick={this._login}
Expand Down

0 comments on commit 9a1b4c6

Please sign in to comment.