Skip to content

Commit

Permalink
Merge branch 'develop' into marktnoonan/16098
Browse files Browse the repository at this point in the history
  • Loading branch information
marktnoonan committed Sep 7, 2022
2 parents 17142b3 + 35fe5b4 commit 1ce850c
Show file tree
Hide file tree
Showing 105 changed files with 1,709 additions and 539 deletions.
@@ -1,10 +1,10 @@
name: Add issue/PR to project
name: 'Triage: add issue/PR to project'

on:
issues:
types:
- opened
pull_request:
pull_request_target:
types:
- opened

Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/triage_add_to_routed_project.yml
@@ -0,0 +1,39 @@
name: 'Triage: route to team project board'
on:
issues:
types:
- labeled
jobs:
route-to-e2e:
if: github.event.label.name == 'routed-to-e2e'
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
ORGANIZATION: 'cypress-io'
PROJECT_NUMBER: 10
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectV2(number: $number) {
id
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq -r '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV
- name: add issue to e2e project
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
ISSUE_ID: ${{ github.event.issue.node_id }}
run: |
gh api graphql -f query='
mutation($project:ID!, $issue:ID!) {
addProjectV2ItemById(input: {projectId: $project, contentId: $issue}) {
item {
id
}
}
}' -f project=$PROJECT_ID -f issue=$ISSUE_ID
93 changes: 93 additions & 0 deletions .github/workflows/triage_closed_issue_comment.yml
@@ -0,0 +1,93 @@
name: 'Triage: closed issue comment'
on:
issue_comment:
types:
- created
jobs:
move-to-new-issue-status:
if: |
!github.event.issue.pull_request &&
github.event.issue.state == 'closed' &&
github.event.comment.created_at != github.event.issue.closed_at &&
github.event.sender.login != 'cypress-bot'
runs-on: ubuntu-latest
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
ORGANIZATION: 'cypress-io'
REPOSITORY: 'cypress'
PROJECT_NUMBER: 9
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
gh api graphql -f query='
query($org: String!, $repo: String!, $project: Int!, $issue: Int!) {
organization(login: $org) {
repository(name: $repo) {
issue(number: $issue) {
projectItems(first: 10, includeArchived: false) {
nodes {
id
fieldValueByName(name: "Status") {
... on ProjectV2ItemFieldSingleSelectValue {
name
field {
... on ProjectV2SingleSelectField {
project {
... on ProjectV2 {
id
number
}
}
}
}
}
}
}
}
}
}
projectV2(number: $project) {
field(name: "Status") {
... on ProjectV2SingleSelectField {
id
options {
id
name
}
}
}
}
}
}' -f org=$ORGANIZATION -f repo=$REPOSITORY -F issue=$ISSUE_NUMBER -F project=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq -r '.data.organization.repository.issue.projectItems.nodes[].fieldValueByName.field.project | select(.number == ${{ env.PROJECT_NUMBER }}) | .id' project_data.json) >> $GITHUB_ENV
echo 'PROJECT_ITEM_ID='$(jq -r '.data.organization.repository.issue.projectItems.nodes[] | select(.fieldValueByName.field.project.number == ${{ env.PROJECT_NUMBER }}) | .id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq -r '.data.organization.projectV2.field | .id' project_data.json) >> $GITHUB_ENV
echo 'STATUS='$(jq -r '.data.organization.repository.issue.projectItems.nodes[].fieldValueByName | select(.field.project.number == ${{ env.PROJECT_NUMBER }}) | .name' project_data.json) >> $GITHUB_ENV
echo 'NEW_ISSUE_OPTION_ID='$(jq -r '.data.organization.projectV2.field.options[] | select(.name== "New Issue") | .id' project_data.json) >> $GITHUB_ENV
- name: Move issue to New Issue status
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
if: env.STATUS == 'Closed'
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$status_field: ID!
$status_value: String!
) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $status_field
value: {
singleSelectOptionId: $status_value
}
}) {
projectV2Item {
id
}
}
}' -f project=$PROJECT_ID -f item=$PROJECT_ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=$NEW_ISSUE_OPTION_ID
114 changes: 114 additions & 0 deletions .github/workflows/triage_issue_metrics.yml
@@ -0,0 +1,114 @@
name: 'Triage: issue metrics'

on:
workflow_dispatch:
inputs:
startDate:
description: 'Start date (YYYY-MM-DD)'
type: date
endDate:
description: 'End date (YYYY-MM-DD)'
type: date
jobs:
seven-day-close:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
env:
ORGANIZATION: 'cypress-io'
REPOSITORY: 'cypress'
PROJECT_NUMBER: 9
with:
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
script: |
const ROUTED_TO_LABELS = ['routed-to-e2e', 'routed-to-ct']
const MS_PER_DAY = 1000 * 60 * 60 * 24
const { REPOSITORY, ORGANIZATION, PROJECT_NUMBER } = process.env
const issues = []
const determineDateRange = () => {
const inputStartDate = '${{ inputs.startDate }}'
const inputEndDate = '${{ inputs.endDate }}'
if (inputStartDate && inputEndDate) {
return { startDate: inputStartDate, endDate: inputEndDate }
}
if (inputStartDate || inputEndDate) {
core.setFailed('Both startDate and endDate are required if one is provided.')
}
const startDate = new Date()
startDate.setDate(startDate.getDate() - 6)
return { startDate: startDate.toISOString().split('T')[0], endDate: (new Date()).toISOString().split('T')[0] }
}
const dateRange = determineDateRange()
const query = `is:issue+repo:${ORGANIZATION}/${REPOSITORY}+project:${ORGANIZATION}/${PROJECT_NUMBER}+created:${dateRange.startDate}..${dateRange.endDate}`
const findLabelDateTime = async (issueNumber) => {
const iterator = github.paginate.iterator(github.rest.issues.listEventsForTimeline, {
owner: ORGANIZATION,
repo: REPOSITORY,
issue_number: issueNumber,
})
for await (const { data: timelineData } of iterator) {
for (const timelineItem of timelineData) {
if (timelineItem.event === 'labeled' && ROUTED_TO_LABELS.includes(timelineItem.label.name)) {
return timelineItem.created_at
}
}
}
}
const calculateElapsedDays = (createdAt, routedOrClosedAt) => {
return Math.round((new Date(routedOrClosedAt) - new Date(createdAt)) / MS_PER_DAY, 0)
}
const iterator = github.paginate.iterator(github.rest.search.issuesAndPullRequests, {
q: query,
per_page: 100,
})
for await (const { data } of iterator) {
for (const issue of data) {
let routedOrClosedAt
if (!issue.pull_request) {
const routedLabel = issue.labels.find((label) => ROUTED_TO_LABELS.includes(label.name))
if (routedLabel) {
routedOrClosedAt = await findLabelDateTime(issue.number)
} else if (issue.state === 'closed') {
routedOrClosedAt = issue.closed_at
}
let elapsedDays
if (routedOrClosedAt) {
elapsedDays = calculateElapsedDays(issue.created_at, routedOrClosedAt)
}
issues.push({
number: issue.number,
title: issue.title,
state: issue.state,
url: issue.html_url,
createdAt: issue.created_at,
routedOrClosedAt,
elapsedDays,
})
}
}
}
const issuesRoutedOrClosedIn7Days = issues.filter((issue) => issue.elapsedDays <= 7).length
const percentage = Number(issues.length > 0 ? issuesRoutedOrClosedIn7Days / issues.length : 0).toLocaleString(undefined, { style: 'percent', minimumFractionDigits: 2 })
console.log(`Triage Metrics (${dateRange.startDate} - ${dateRange.endDate})`)
console.log('Total issues:', issues.length)
console.log(`Issues routed/closed within 7 days: ${issuesRoutedOrClosedIn7Days} (${percentage})`)
37 changes: 31 additions & 6 deletions circle.yml
Expand Up @@ -66,7 +66,8 @@ windowsWorkflowFilters: &windows-workflow-filters
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ linux-arm64, << pipeline.git.branch >> ]
- equal: [ 'marktnoonan/16098', << pipeline.git.branch >> ]
- equal: [ 'lmiller/fixing-flake-1', << pipeline.git.branch >> ]
- equal: [ 'skip-or-fix-flaky-tests-2', << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -177,6 +178,14 @@ commands:
mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules
mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules
install-webkit-deps:
steps:
- run:
name: Install WebKit dependencies
command: |
npx playwright install webkit
npx playwright install-deps webkit
build-and-persist:
description: Save entire folder as artifact for other jobs to run without reinstalling
steps:
Expand Down Expand Up @@ -461,6 +470,11 @@ commands:
- install-chrome:
channel: <<parameters.install-chrome-channel>>
version: $(node ./scripts/get-browser-version.js chrome:<<parameters.install-chrome-channel>>)
- when:
condition:
equal: [ webkit, << parameters.browser >> ]
steps:
- install-webkit-deps
- run:
name: Run driver tests in Cypress
environment:
Expand All @@ -469,11 +483,6 @@ commands:
echo Current working directory is $PWD
echo Total containers $CIRCLE_NODE_TOTAL
if [[ "<<parameters.browser>>" = "webkit" ]]; then
npx playwright install webkit
npx playwright install-deps webkit
fi
if [[ -v MAIN_RECORD_KEY ]]; then
# internal PR
if <<parameters.experimentalSessionAndOrigin>>; then
Expand Down Expand Up @@ -609,6 +618,11 @@ commands:
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
- when:
condition:
equal: [ webkit, << parameters.browser >> ]
steps:
- install-webkit-deps
- run:
name: Run system tests
command: |
Expand Down Expand Up @@ -1447,6 +1461,13 @@ jobs:
- run-system-tests:
browser: firefox

system-tests-webkit:
<<: *defaults
parallelism: 8
steps:
- run-system-tests:
browser: webkit

system-tests-non-root:
<<: *defaults
steps:
Expand Down Expand Up @@ -2362,6 +2383,10 @@ linux-x64-workflow: &linux-x64-workflow
context: test-runner:performance-tracking
requires:
- system-tests-node-modules-install
- system-tests-webkit:
context: test-runner:performance-tracking
requires:
- system-tests-node-modules-install
- system-tests-non-root:
context: test-runner:performance-tracking
executor: non-root-docker-user
Expand Down
14 changes: 7 additions & 7 deletions cli/types/cypress.d.ts
Expand Up @@ -2720,6 +2720,13 @@ declare namespace Cypress {
* @default 60000
*/
pageLoadTimeout: number
/**
* Whether Cypress will search for and replace
* obstructive JS code in .js or .html files.
*
* @see https://on.cypress.io/configuration#modifyObstructiveCode
*/
modifyObstructiveCode: boolean
/**
* Time, in milliseconds, to wait for an XHR request to go out in a [cy.wait()](https://on.cypress.io/wait) command
* @default 5000
Expand Down Expand Up @@ -2968,13 +2975,6 @@ declare namespace Cypress {
* Whether Cypress was launched via 'cypress open' (interactive mode)
*/
isInteractive: boolean
/**
* Whether Cypress will search for and replace
* obstructive JS code in .js or .html files.
*
* @see https://on.cypress.io/configuration#modifyObstructiveCode
*/
modifyObstructiveCode: boolean
/**
* The platform Cypress is running on.
*/
Expand Down
6 changes: 5 additions & 1 deletion cli/types/tests/cypress-npm-api-test.ts
@@ -1,6 +1,6 @@
// type tests for Cypress NPM module
// https://on.cypress.io/module-api
import cypress from 'cypress'
import cypress, { defineConfig } from 'cypress'

cypress.run // $ExpectType (options?: Partial<CypressRunOptions> | undefined) => Promise<CypressRunResult | CypressFailedRunResult>
cypress.open // $ExpectType (options?: Partial<CypressOpenOptions> | undefined) => Promise<void>
Expand Down Expand Up @@ -51,6 +51,10 @@ cypress.run().then(results => {
}
})

const config = defineConfig({
modifyObstructiveCode: true
})

// component options
const componentConfigNextWebpack: Cypress.ConfigOptions = {
component: {
Expand Down

1 comment on commit 1ce850c

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1ce850c Sep 7, 2022

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.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.7.1/linux-x64/marktnoonan/16098-1ce850c18a2b1a3846f93a86fa2bd584bfc3bb54/cypress.tgz

Please sign in to comment.