diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 791d84b7fd5b..aac94fa74895 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -32,6 +32,7 @@ mainBuildFilters: &mainBuildFilters # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - 'update-v8-snapshot-cache-on-develop' - 'tgriesser/spike/spike' + - 'fix-duplicate-and-expired-cookies' # usually we don't build Mac app - it takes a long time # but sometimes we want to really confirm we are doing the right thing @@ -43,6 +44,7 @@ macWorkflowFilters: &darwin-workflow-filters - equal: [ 'feature/ct-public-api', << pipeline.git.branch >> ] - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - equal: [ 'tgriesser/spike/spike', << pipeline.git.branch >> ] + - equal: [ 'fix-duplicate-and-expired-cookies', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> @@ -55,6 +57,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - equal: [ 'tgriesser/spike/spike', << pipeline.git.branch >> ] + - equal: [ 'fix-duplicate-and-expired-cookies', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> @@ -73,7 +76,7 @@ windowsWorkflowFilters: &windows-workflow-filters or: - equal: [ develop, << pipeline.git.branch >> ] # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] + - equal: [ 'update-v8-snapshot-cache-on-develop', 'fix-duplicate-and-expired-cookies', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 4fb680375b25..81d87119a487 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -1,4 +1,17 @@ +## 12.6.1 + +_Released 03/1/2023 (PENDING)_ + +**Bugfixes:** + +- Fixed an issue where cookies were being duplicated with the same hostname, but a prepended dot. Fixed an issue where cookies may not be expiring correctly. Fixes [#25174](https://github.com/cypress-io/cypress/issues/25174), [#25205](https://github.com/cypress-io/cypress/issues/25205) and [#25495](https://github.com/cypress-io/cypress/issues/25495). +- Added missing TypeScript type definitions for the [`cy.reload()`](https://docs.cypress.io/api/commands/reload) command. Addressed in [#25779](https://github.com/cypress-io/cypress/pull/25779). + +**Misc:** + + - Made updates to the way that the Debug Page header displays information. Addresses [#25796](https://github.com/cypress-io/cypress/issues/25796) and [#25798](https://github.com/cypress-io/cypress/issues/25798). + ## 12.6.0 _Released 02/15/2023_ diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index b4a7dfc13582..59557feb3c59 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -1816,9 +1816,21 @@ declare namespace Cypress { * * @see https://on.cypress.io/reload * @example + * cy.visit('http://localhost:3000/admin') * cy.reload() */ - reload(options?: Partial): Chainable + reload(): Chainable + /** + * Reload the page. + * + * @see https://on.cypress.io/reload + * @param {Partial} options Pass in an options object to modify the default behavior of cy.reload() + * @example + * // Reload the page, do not log it in the command log and timeout after 15s + * cy.visit('http://localhost:3000/admin') + * cy.reload({log: false, timeout: 15000}) + */ + reload(options: Partial): Chainable /** * Reload the page without cache * @@ -1830,6 +1842,18 @@ declare namespace Cypress { * cy.reload(true) */ reload(forceReload: boolean): Chainable + /** + * Reload the page without cache and with log and timeout options + * + * @see https://on.cypress.io/reload + * @param {Boolean} forceReload Whether to reload the current page without using the cache. true forces the reload without cache. + * @param {Partial} options Pass in an options object to modify the default behavior of cy.reload() + * @example + * // Reload the page without using the cache, do not log it in the command log and timeout after 15s + * cy.visit('http://localhost:3000/admin') + * cy.reload(true, {log: false, timeout: 15000}) + */ + reload(forceReload: boolean, options: Partial): Chainable /** * Make an HTTP GET request. diff --git a/packages/app/cypress/e2e/debug.cy.ts b/packages/app/cypress/e2e/debug.cy.ts index b39c4ca19ddd..76fce07b3ac0 100644 --- a/packages/app/cypress/e2e/debug.cy.ts +++ b/packages/app/cypress/e2e/debug.cy.ts @@ -77,7 +77,7 @@ describe('App - Debug Page', () => { cy.findByTestId('debug-header-branch').contains('main') cy.findByTestId('debug-header-commitHash').contains('e9d176f') cy.findByTestId('debug-header-author').contains('Lachlan Miller') - cy.findByTestId('debug-header-createdAt').contains('01:18') + cy.findByTestId('debug-header-createdAt').contains('02h 00m 10s') }) cy.findByTestId('debug-passed').contains('Well Done!') @@ -148,7 +148,7 @@ describe('App - Debug Page', () => { cy.findByTestId('debug-header-branch').contains('main') cy.findByTestId('debug-header-commitHash').contains('commit1') cy.findByTestId('debug-header-author').contains('Lachlan Miller') - cy.findByTestId('debug-header-createdAt').contains('00:19') + cy.findByTestId('debug-header-createdAt').contains('00m 19s') }) cy.findByTestId('spec-contents').within(() => { diff --git a/packages/app/cypress/fixtures/debug-Failing/gql-Debug.json b/packages/app/cypress/fixtures/debug-Failing/gql-Debug.json index b3af1afc3f90..c522ac0f0f98 100644 --- a/packages/app/cypress/fixtures/debug-Failing/gql-Debug.json +++ b/packages/app/cypress/fixtures/debug-Failing/gql-Debug.json @@ -14,6 +14,7 @@ "commitInfo": { "sha": "commit1", "authorName": "Lachlan Miller", + "authorEmail": "hello@cypress.io", "summary": "chore: testing cypress", "branch": "main", "__typename": "CloudRunCommitInfo" diff --git a/packages/app/cypress/fixtures/debug-Passing/gql-Debug.json b/packages/app/cypress/fixtures/debug-Passing/gql-Debug.json index 770ddfb7f052..82ce76f8c171 100644 --- a/packages/app/cypress/fixtures/debug-Passing/gql-Debug.json +++ b/packages/app/cypress/fixtures/debug-Passing/gql-Debug.json @@ -10,10 +10,11 @@ "runNumber": 2, "createdAt": "2023-01-30T08:10:59.720Z", "status": "PASSED", - "totalDuration": 78898, + "totalDuration": 7210000, "commitInfo": { "sha": "e9d176f0c00c0428c9945577aec37cb6d48c5a26", "authorName": "Lachlan Miller", + "authorEmail": "asdf", "summary": "update projectId", "branch": "main", "__typename": "CloudRunCommitInfo" diff --git a/packages/app/src/debug/DebugPageHeader.cy.tsx b/packages/app/src/debug/DebugPageHeader.cy.tsx index fea3d08ea611..9ac73bbf5838 100644 --- a/packages/app/src/debug/DebugPageHeader.cy.tsx +++ b/packages/app/src/debug/DebugPageHeader.cy.tsx @@ -6,7 +6,7 @@ const defaults = [ { attr: 'debug-header-branch', text: 'Branch Name: feature/DESIGN-183' }, { attr: 'debug-header-commitHash', text: 'Commit Hash: b5e6fde' }, { attr: 'debug-header-author', text: 'Commit Author: cypressDTest' }, - { attr: 'debug-header-createdAt', text: 'Run Total Duration: 01:00 (an hour ago) ' }, + { attr: 'debug-header-createdAt', text: 'Run Total Duration: 01m 00s (an hour ago) ' }, ] describe('', { @@ -22,6 +22,7 @@ describe('', { result.commitInfo.summary = 'Adding a hover state to the button component' result.commitInfo.branch = 'feature/DESIGN-183' result.commitInfo.authorName = 'cypressDTest' + result.commitInfo.authorEmail = 'adams@cypress.io' result.commitInfo.sha = 'b5e6fde' } } @@ -144,4 +145,22 @@ describe('', { cy.findByTestId('debug-commitsAhead').should('not.exist') }) + + it('renders duration over 1 hour', () => { + cy.mountFragment(DebugPageHeaderFragmentDoc, { + onResult (result) { + if (result) { + result.totalDuration = 3602000000 + } + }, + render: (gqlVal) => { + return ( + + ) + }, + }) + + cy.findByTestId('debug-header-createdAt') + .should('have.text', 'Run Total Duration: 16h 33m 20s (an hour ago) ') + }) }) diff --git a/packages/app/src/debug/DebugPageHeader.vue b/packages/app/src/debug/DebugPageHeader.vue index 498f4e011044..8d9155884ce0 100644 --- a/packages/app/src/debug/DebugPageHeader.vue +++ b/packages/app/src/debug/DebugPageHeader.vue @@ -81,8 +81,9 @@ v-if="debug?.commitInfo?.authorName" data-cy="debug-header-author" > - Commit Author: {{ debug.commitInfo.authorName }} @@ -113,8 +114,8 @@ import CommitIcon from '~icons/cy/commit_x14' import { gql } from '@urql/core' import { dayjs } from '../runs/utils/day.js' import { useI18n } from 'vue-i18n' -import { useDurationFormat } from '../composables/useDurationFormat' import DebugRunNumber from './DebugRunNumber.vue' +import UserAvatar from '@cy/gql-components/topnav/UserAvatar.vue' const { t } = useI18n() @@ -132,6 +133,7 @@ fragment DebugPageHeader on CloudRun { ...RunResults commitInfo { authorName + authorEmail summary branch } @@ -147,7 +149,14 @@ const debug = computed(() => props.gql) const relativeCreatedAt = computed(() => dayjs(new Date(debug.value.createdAt!)).fromNow()) -const totalDuration = useDurationFormat(debug.value.totalDuration ?? 0) +/* + Format duration to in HH[h] mm[m] ss[s] format. The `totalDuration` field is milliseconds. Remove the leading "00h" if the value is less + than an hour. Currently, there is no expectation that a run duration will be greater 24 hours or greater, so it is okay that + this format would "roll-over" in that scenario. + Ex: 1 second which is 1000ms = 00m 01s + Ex: 1 hour and 1 second which is 3601000ms = 01h 00m 01s +*/ +const totalDuration = computed(() => dayjs.duration(debug.value.totalDuration ?? 0).format('HH[h] mm[m] ss[s]').replace(/^0+h /, ''))