Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix component tests in contributor flow #27883

Merged

Conversation

young-robot
Copy link
Contributor

@young-robot young-robot commented Sep 22, 2023

In the contributor PR workflow, we see failures with some component tests because we're trying to access a property on an undefined object in the runner code. For example.

This PR adds optional chaining and null checks so that we don't throw an error here. Still don't know why this is different from running the tests with an internal author but it is.

@cypress-app-bot
Copy link
Collaborator

@@ -603,7 +603,7 @@ commands:
if [[ <<parameters.type>> == 'ct' ]]; then
# component tests are located side by side with the source codes.
# for the app component tests, ignore specs that are known to cause failures on contributor PRs (see https://discuss.circleci.com/t/how-to-exclude-certain-files-from-circleci-test-globbing/41028)
TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns|DebugPendingRunCounts|DebugRunStates|DebugPageHeader|DebugPendingRunSplash|DebugRunNavigation|DebugRunNavigationLimitMessage).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Copy link
Contributor

@astone123 astone123 Sep 22, 2023

Choose a reason for hiding this comment

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

We can probably remove even more of these since the error is fixed now - most of them were excluded because of this issue I believe. I want to do that in a different PR though, since we can't test the contributor workflow until it's merged into develop

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

Do we know if there is a way to get snyk to run on contributor PRs? Looks like @young-robot doesn't have access to run those from his github context?

@@ -1342,11 +1342,13 @@ export default {
const replacePreviousAttemptWith = (test) => {
const prevAttempt = _testsById[test.id]

const prevAttempts = prevAttempt.prevAttempts || []
const prevAttempts = prevAttempt?.prevAttempts || []
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiousity, why did you need to touch this code?

Copy link
Contributor

Choose a reason for hiding this comment

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

this code was throwing errors in the app component tests job for some reason - see the link to the failure in the PR description. This is what fixes those tests in the contributor workflow

Copy link
Contributor

Choose a reason for hiding this comment

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

Weird. Are those component tests retrying? I'm just trying to figure out why that would happen because there should be a previous attempt here if the currentRetry is 1 or more. I'm more so concerned there is some time of regression here, but I have no idea why this would be specifically on contributor PRs. any idea? I'm also OK with patching this after we get builds working it isn't a must to figure out right now imo

@astone123
Copy link
Contributor

@AtofStryker we're working on getting the Snyk checks to pass on contributor PRs - see this Slack thread

Copy link
Contributor

@jordanpowell88 jordanpowell88 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

I'm going to approve this, but I really think we should figure out what is going on in the runner for previous attempts and if it is a signal for bugs. Tracking this down would be difficult I suspect and don't think it should block this PR, but it is something we should investigate

@jennifer-shehane jennifer-shehane merged commit b3b7d3b into cypress-io:develop Oct 10, 2023
64 of 66 checks passed
astone123 added a commit that referenced this pull request Oct 11, 2023
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 11, 2023

Released in 13.3.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.3.1, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants