Skip to content

Commit

Permalink
Command Timeout Progress Bar (#7646)
Browse files Browse the repository at this point in the history
* Timeout animation

* Add timeout to log object

* Set timeout to log when explicitly overwritten

* No need to display if no timeout

* Throw timeouts everywhere!
I'll clean it up later

* Correctly set timeout indicator regardless of when test is opened

* Slightly modify that

* Update timeout for commands

* Update progress bar for consistent progress

* Fix issue with flashing full progress bar after complete

* Add test for progress

* Move progress bar to function

* Update unit test

* Move more command progress to css

* No progress bar for xhr

* Fix unit test

* Adding tests for progress indicator

* Fix some types

* Add e2e tests for progress bar

* Remove timeout progress from assertion logs

Co-authored-by: Jessica Sachs <jess@jessicasachs.io>
  • Loading branch information
panzarino and JessicaSachs committed Jun 16, 2020
1 parent f305f8b commit dc07561
Show file tree
Hide file tree
Showing 33 changed files with 286 additions and 112 deletions.
1 change: 1 addition & 0 deletions packages/driver/src/cy/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ const create = function (state, queue, retryFn) {
message,
passed,
selector: value ? value.selector : undefined,
timeout: 0,
type (current, subject) {
// if our current command has arguments assume
// we are an assertion that's involving the current
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/actions/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const checkOrUncheck = (Cypress, cy, type, subject, values = [], userOptions = {
options._log = Cypress.log({
message: deltaOptions,
$el,
timeout: options.timeout,
consoleProps () {
return _.extend(consoleProps, {
Options: deltaOptions,
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/actions/click.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options._log = Cypress.log({
message: deltaOptions,
$el,
timeout: options.timeout,
})

options._log.snapshot('before', { next: 'after' })
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/actions/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log) {
options._log = Cypress.log({
$el: options.$el,
timeout: options.timeout,
consoleProps () {
return { 'Applied To': $dom.getElements(options.$el) }
},
Expand Down Expand Up @@ -115,6 +116,7 @@ module.exports = (Commands, Cypress, cy) => {
options._log = Cypress.log({
$el: options.$el,
message: deltaOptions,
timeout: options.timeout,
consoleProps () {
return { 'Applied To': $dom.getElements(options.$el) }
},
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/actions/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ module.exports = (Commands, Cypress, cy, state) => {
const log = {
$el: options.$el,
message: deltaOptions,
timeout: options.timeout,
consoleProps () {
const obj = {
// merge into consoleProps without mutating it
Expand Down Expand Up @@ -302,6 +303,7 @@ module.exports = (Commands, Cypress, cy, state) => {

const log = {
message: messageArgs.join(', '),
timeout: options.timeout,
consoleProps () {
// merge into consoleProps without mutating it
const obj = {}
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/actions/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = (Commands, Cypress, cy) => {
options._log = Cypress.log({
message: deltaOptions,
$el: options.$el,
timeout: options.timeout,
consoleProps () {
// merge into consoleProps without mutating it
return _.extend({}, consoleProps, {
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/actions/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log) {
options._log = Cypress.log({
$el: options.$el,
timeout: options.timeout,
consoleProps () {
return {
'Applied To': $dom.getElements(options.$el),
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/actions/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
if (options.log) {
options._log = Cypress.log({
$el: subject,
timeout: options.timeout,
consoleProps () {
return {
'Yielded': subject,
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/actions/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
options._log = Cypress.log({
message: [chars, deltaOptions],
$el: options.$el,
timeout: options.timeout,
consoleProps () {
return {
'Typed': chars,
Expand Down Expand Up @@ -476,6 +477,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
options._log = Cypress.log({
message: deltaOptions,
$el,
timeout: options.timeout,
consoleProps () {
return {
'Applied To': $dom.getElements($el),
Expand Down
4 changes: 3 additions & 1 deletion packages/driver/src/cy/commands/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ module.exports = (Commands, Cypress, cy, state) => {
options = _.defaults({}, userOptions, { log: true })

if (options.log) {
options._log = Cypress.log()
options._log = Cypress.log({
timeout: options.timeout,
})
}

switch (type) {
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ module.exports = function (Commands, Cypress, cy, state) {
options._log = Cypress.log({
message,
$el: $dom.isElement(subject) ? subject : null,
timeout: options.timeout,
consoleProps () {
return { Subject: subject }
},
Expand Down
5 changes: 5 additions & 0 deletions packages/driver/src/cy/commands/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: name,
timeout: options.timeout,
consoleProps () {
let c
const obj = {}
Expand Down Expand Up @@ -202,6 +203,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
consoleProps () {
let c
const obj = {}
Expand Down Expand Up @@ -250,6 +252,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: [name, value],
timeout: options.timeout,
consoleProps () {
let c
const obj = {}
Expand Down Expand Up @@ -315,6 +318,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: name,
timeout: options.timeout,
consoleProps () {
let c
const obj = {}
Expand Down Expand Up @@ -362,6 +366,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
consoleProps () {
let c
const obj = {}
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/debugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options._log = Cypress.log({
snapshot: true,
autoEnd: false,
timeout: 0,
})
}

Expand Down Expand Up @@ -112,6 +113,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options._log = Cypress.log({
snapshot: true,
end: true,
timeout: 0,
})
}

Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = (Commands, Cypress, cy) => {

options._log = Cypress.log({
message: _.truncate(cmd, { length: 25 }),
timeout: options.timeout,
consoleProps () {
return consoleOutput
},
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log) {
options._log = Cypress.log({
message: file,
timeout: options.timeout,
consoleProps () {
return consoleProps
},
Expand Down Expand Up @@ -97,6 +98,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log) {
options._log = Cypress.log({
message: fileName,
timeout: 0,
consoleProps () {
return consoleProps
},
Expand Down
3 changes: 3 additions & 0 deletions packages/driver/src/cy/commands/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log !== false) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
})
}

Expand All @@ -39,6 +40,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log !== false) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
})
}

Expand Down Expand Up @@ -83,6 +85,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log !== false) {
options._log = Cypress.log({
message: key != null ? key : '',
timeout: options.timeout,
})
}

Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log !== false) {
options._log = Cypress.log({
message: arg,
timeout: options.timeout,
})

if ($dom.isElement(arg)) {
Expand Down
6 changes: 4 additions & 2 deletions packages/driver/src/cy/commands/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ const stabilityChanged = (Cypress, state, config, stable) => {
name: 'page load',
message: '--waiting for new page to load--',
event: true,
timeout: options.timeout,
consoleProps () {
return {
Note: 'This event initially fires when your application fires its \'beforeunload\' event and completes when your application fires its \'load\' event after the next page loads.',
Expand Down Expand Up @@ -484,7 +485,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
}

if (options.log) {
options._log = Cypress.log({})
options._log = Cypress.log({ timeout: options.timeout })

options._log.snapshot('before', { next: 'after' })
}
Expand Down Expand Up @@ -526,7 +527,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
})

if (options.log) {
options._log = Cypress.log({})
options._log = Cypress.log({ timeout: options.timeout })
}

const win = state('window')
Expand Down Expand Up @@ -697,6 +698,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {

options._log = Cypress.log({
message,
timeout: options.timeout,
consoleProps () {
return consoleProps
},
Expand Down
8 changes: 6 additions & 2 deletions packages/driver/src/cy/commands/querying.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ module.exports = (Commands, Cypress, cy, state) => {
})

if (options.log) {
options._log = Cypress.log({
})
options._log = Cypress.log({ timeout: options.timeout })
}

const log = ($el) => {
Expand Down Expand Up @@ -102,6 +101,7 @@ module.exports = (Commands, Cypress, cy, state) => {
message: selector,
referencesAlias: (aliasObj != null && aliasObj.alias) ? { name: aliasObj.alias } : undefined,
aliasType,
timeout: options.timeout,
consoleProps: () => {
return consoleProps
},
Expand Down Expand Up @@ -369,6 +369,7 @@ module.exports = (Commands, Cypress, cy, state) => {
if (options.log !== false) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
})
}

Expand Down Expand Up @@ -475,6 +476,7 @@ module.exports = (Commands, Cypress, cy, state) => {
options._log = Cypress.log({
message: _.compact([filter, text]),
type: subject ? 'child' : 'parent',
timeout: options.timeout,
consoleProps: () => {
return consoleProps
},
Expand Down Expand Up @@ -554,6 +556,7 @@ module.exports = (Commands, Cypress, cy, state) => {
options._log = Cypress.log({
$el: subject,
message: '',
timeout: options.timeout,
})
}

Expand Down Expand Up @@ -635,6 +638,7 @@ module.exports = (Commands, Cypress, cy, state) => {

if (options.log !== false) {
options._log = Cypress.log({
timeout: options.timeout,
consoleProps () {
return consoleProps
},
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
if (options.log) {
options._log = Cypress.log({
message: '',
timeout: options.timeout,
consoleProps () {
const resp = options.response || {}
let rr = resp.allRequestResponses || []
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ module.exports = function (Commands, Cypress, cy, state, config) {
if (options.log) {
options._log = Cypress.log({
message: name,
timeout: options.timeout,
consoleProps () {
return consoleProps
},
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = (Commands, Cypress, cy) => {

options._log = Cypress.log({
message,
timeout: options.timeout,
consoleProps () {
return consoleOutput
},
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cy/commands/traversals.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module.exports = (Commands, Cypress, cy) => {
if (options.log !== false) {
options._log = Cypress.log({
message: getSelector(),
timeout: options.timeout,
consoleProps () {
return consoleProps
},
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/cy/commands/waiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = (Commands, Cypress, cy, state) => {

if (options.log !== false) {
options._log = Cypress.log({
timeout: cy.timeout(),
consoleProps () {
return {
'Waited For': `${ms}ms before continuing`,
Expand All @@ -54,6 +55,7 @@ module.exports = (Commands, Cypress, cy, state) => {

if (options.log !== false) {
log = options._log = Cypress.log({
timeout: options.timeout,
type: 'parent',
aliasType: 'route',
options: userOptions,
Expand Down
8 changes: 4 additions & 4 deletions packages/driver/src/cy/commands/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options = _.defaults({}, userOptions, { log: true })

if (options.log) {
options._log = Cypress.log({
})
options._log = Cypress.log({ timeout: options.timeout })
}

const resolveTitle = () => {
Expand All @@ -99,7 +98,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options = _.defaults({}, userOptions, { log: true })

if (options.log) {
options._log = Cypress.log({})
options._log = Cypress.log({ timeout: options.timeout })
}

const getWindow = () => {
Expand Down Expand Up @@ -141,7 +140,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
options = _.defaults({}, userOptions, { log: true })

if (options.log) {
options._log = Cypress.log({})
options._log = Cypress.log({ timeout: options.timeout })
}

const getDocument = () => {
Expand Down Expand Up @@ -197,6 +196,7 @@ module.exports = (Commands, Cypress, cy, state, config) => {
const isPreset = typeof presetOrWidth === 'string'

options._log = Cypress.log({
timeout: options.timeout,
consoleProps () {
const obj = {}

Expand Down
Loading

4 comments on commit dc07561

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dc07561 Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/linux-x64/circle-develop-dc075618bb6c747b19e26c14968e530813b47147-366822/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/circle-develop-dc075618bb6c747b19e26c14968e530813b47147-366802/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dc07561 Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-x64/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.9.0/win32-x64/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-x64/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-x64/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dc07561 Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-ia32/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.9.0/win32-ia32/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-ia32/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/win32-ia32/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.9.0/appveyor-develop-dc075618bb6c747b19e26c14968e530813b47147-33557502/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dc07561 Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.9.0/darwin-x64/circle-develop-dc075618bb6c747b19e26c14968e530813b47147-366886/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.9.0/circle-develop-dc075618bb6c747b19e26c14968e530813b47147-366808/cypress.tgz

Please sign in to comment.