Skip to content

Commit

Permalink
chore: minor style updates & fix a windows test (#24558)
Browse files Browse the repository at this point in the history
* wait for config initialization to be complete

* increase timeout for cy-in-cy on windows

* run more CI steps on this branch

* tweak border, fix double scrollbar

* reach choose a browser page before login in launchpad test

* revert timeout change

* chore: update vite in system test

* Fixing value for monthIndex to Date.UTC

* chore: fix test date

* chore: fix tests in reporter-ct-mount-hover.cy.ts

* try fixing some flake

* fix yarn lock

* conditionally skip flaky test on windows

* note on skipped test

* chore: skip flaky tests on windows only [skip ci]

* update exports and snaps

* correctly use describe instead of it

* fix types

* do not run windows anymore

* add comment [skip ci]

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Stokes Player <stokes.player@gmail.com>
Co-authored-by: astone123 <adams@cypress.io>
  • Loading branch information
4 people committed Nov 8, 2022
1 parent a8a9c78 commit 5e3a21c
Show file tree
Hide file tree
Showing 12 changed files with 4,204 additions and 4,151 deletions.
6 changes: 1 addition & 5 deletions .circleci/config.yml
Expand Up @@ -27,7 +27,6 @@ mainBuildFilters: &mainBuildFilters
branches:
only:
- develop
- 'release/11.0.0'

# 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
Expand All @@ -36,7 +35,6 @@ macWorkflowFilters: &darwin-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'release/11.0.0', << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand All @@ -45,7 +43,6 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'release/11.0.0', << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand All @@ -63,7 +60,6 @@ windowsWorkflowFilters: &windows-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'release/11.0.0', << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -130,7 +126,7 @@ commands:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/11.0.0" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down
10 changes: 7 additions & 3 deletions packages/app/cypress/e2e/runner/reporter-ct-mount-hover.cy.ts
Expand Up @@ -12,9 +12,13 @@ const PROJECTS: {projectName: ProjectDirs[number], test: string}[] = [
{ projectName: 'nuxtjs-vue2-configured', test: 'Tutorial.cy' },
]

// These are especially flaky on windows, skipping them there.
const describeSkipIfWindows = Cypress.platform === 'win32' ? describe.skip : describe

// TODO: Add these tests to another cy-in-cy framework test to reduce CI cost as these scaffolding is expensive
for (const { projectName, test } of PROJECTS) {
describe(`CT Mount ${projectName}`, { viewportWidth: 1500, defaultCommandTimeout: 30000 }, () => {
// Flaky, especially on windows. Issue to improve these tests: https://github.com/cypress-io/cypress/issues/24579
describeSkipIfWindows(`CT Mount ${projectName}`, { viewportWidth: 1500, defaultCommandTimeout: 30000 }, () => {
beforeEach(() => {
cy.scaffoldProject(projectName)
cy.findBrowsers()
Expand All @@ -25,7 +29,7 @@ for (const { projectName, test } of PROJECTS) {
cy.startAppServer('component')
cy.visitApp()
cy.contains(`${test}`).click()
cy.waitForSpecToFinish()
cy.waitForSpecToFinish(undefined)
cy.get('.collapsible-header-inner:first').click().get('.command.command-name-mount > .command-wrapper').click().then(() => {
cy.get('iframe.aut-iframe').its('0.contentDocument.body').then(cy.wrap).within(() => {
cy.get('[data-cy-root]').children().should('have.length.at.least', 1)
Expand All @@ -36,7 +40,7 @@ for (const { projectName, test } of PROJECTS) {
cy.startAppServer('component')
cy.visitApp()
cy.contains(`${test}`).click()
cy.waitForSpecToFinish()
cy.waitForSpecToFinish(undefined)
cy.get('.command.command-name-mount > .command-wrapper').click().then(() => {
if (`${projectName}` === 'angular-14') {
cy.get('iframe.aut-iframe').its('0.contentDocument.body').children().should('have.length.at.least', 2)
Expand Down
12 changes: 8 additions & 4 deletions packages/app/cypress/e2e/runs.cy.ts
Expand Up @@ -848,9 +848,10 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
})
})

const RUNNING_COUNT = 3

describe('refetching', () => {
let obj: {toCall?: Function} = {}
const RUNNING_COUNT = 3

beforeEach(() => {
cy.scaffoldProject('component-tests')
Expand All @@ -874,7 +875,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
const setTimeout = win.setTimeout

// @ts-expect-error
win.setTimeout = function (fn, time) {
win.setTimeout = function (fn: () => void, time: number) {
if (fn.name === 'fetchNewerRuns') {
obj.toCall = fn
} else {
Expand All @@ -885,7 +886,10 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
})
})

it('should re-query for executing runs', () => {
// https://github.com/cypress-io/cypress/issues/24575
const itSkipIfWindows = Cypress.platform === 'win32' ? it.skip : it

itSkipIfWindows('should re-query for executing runs', () => {
cy.get('[data-cy="run-card-icon-RUNNING"]').should('have.length', RUNNING_COUNT).should('be.visible')

cy.remoteGraphQLIntercept(async (obj) => {
Expand Down Expand Up @@ -918,7 +922,7 @@ describe('App: Runs', { viewportWidth: 1200 }, () => {
completeNext(1)
})

it('should fetch newer runs and maintain them when navigating', () => {
itSkipIfWindows('should fetch newer runs and maintain them when navigating', () => {
cy.get('[data-cy="run-card-icon-RUNNING"]').should('have.length', RUNNING_COUNT).should('be.visible')

cy.remoteGraphQLIntercept(async (obj) => {
Expand Down
10 changes: 3 additions & 7 deletions packages/app/cypress/e2e/support/execute-spec.ts
@@ -1,7 +1,6 @@
import { shouldHaveTestResults } from '../runner/support/spec-loader'

export interface ExpectedResults
{
export interface ExpectedResults {
passCount?: number
failCount?: number
pendingCount?: number
Expand All @@ -23,13 +22,10 @@ declare global {
}
}

// Here we export the function with no intention to import it
// This only tells the typescript type checker that this definitely is a module
// This way, we are allowed to use the global namespace declaration
export const waitForSpecToFinish = (expectedResults, timeout?: number) => {
// First ensure the test is loaded
cy.get('.passed > .num').should('contain', '--')
cy.get('.failed > .num').should('contain', '--')
cy.get('.passed > .num').should('exist')
cy.get('.failed > .num').should('exist')

// Then ensure the tests are running
cy.contains('Your tests are loading...', { timeout: timeout || 20000 }).should('not.exist')
Expand Down
5 changes: 3 additions & 2 deletions packages/launchpad/cypress/e2e/top-nav-launchpad.cy.ts
Expand Up @@ -472,7 +472,7 @@ describe('Launchpad Top Nav Workflows', () => {
cy.findByTestId(headerBarId).findByTestId('user-avatar-title').should('be.visible')
})

it('if the project has no runs, shows "record your first run" prompt after clicking', () => {
it('if the project has no runs, shows "record your first run" prompt after choosing testing type', () => {
cy.remoteGraphQLIntercept((obj) => {
if (obj.result?.data?.cloudProjectBySlug?.runs?.nodes?.length) {
obj.result.data.cloudProjectBySlug.runs.nodes = []
Expand All @@ -483,10 +483,11 @@ describe('Launchpad Top Nav Workflows', () => {

cy.contains('Component Testing').click()

cy.contains(defaultMessages.setupWizard.chooseBrowser.title).should('be.visible')

mockLogInActionsForUser(mockUserNoName)

logIn({ expectedNextStepText: 'Continue', displayName: mockUserNoName.email })

cy.contains('[data-cy=standard-modal] h2', defaultMessages.specPage.banners.record.title).should('be.visible')
cy.contains('[data-cy=standard-modal]', defaultMessages.specPage.banners.record.content).should('be.visible')
cy.contains('button', 'Copy').should('be.visible')
Expand Down
Expand Up @@ -21,7 +21,7 @@ describe('<MajorVersionWelcome />', { viewportWidth: 1280, viewportHeight: 1400
})

it('renders correct time for releases and overflows correctly', () => {
cy.clock(Date.UTC(2022, 11, 8))
cy.clock(Date.UTC(2022, 10, 8))
cy.mount(<MajorVersionWelcome />)
cy.contains('11.0.0 Released just now')
cy.contains('10.0.0 Released 5 months ago')
Expand Down
8 changes: 4 additions & 4 deletions packages/launchpad/src/migration/MajorVersionWelcome.vue
Expand Up @@ -2,13 +2,13 @@
<div class="bg-no-repeat bg-cover h-screen min-h-700px lp-wrapper">
<div
ref="wrapper"
class="border-transparent rounded mx-auto bg-gray-50/50 border-4px max-w-80vw top-7vh w-716px relative overflow-hidden"
class="rounded mx-auto bg-gray-50/50 border-color-[rgba(0,0,0,0.05)] border-4px max-w-80vw top-7vh w-716px relative overflow-hidden"
>
<div
ref="scroller"
class="bg-white rounded-b max-h-72vh pb-90px overflow-scroll"
>
<div class="h-full overflow-scroll">
<div class="h-full">
<div class="p-16px">
<h1 class="font-medium mt-4px text-center mb-32px tracking-tighter text-22px text-gray-1000">
{{ t('majorVersionWelcome.title') }}
Expand Down Expand Up @@ -136,8 +136,8 @@ const handleClick = () => {
const versionReleaseDates = computed(() => {
return {
'10': useTimeAgo(Date.UTC(2022, 6, 1)).value,
'11': useTimeAgo(Date.UTC(2022, 11, 8)).value,
'10': useTimeAgo(Date.UTC(2022, 5, 1)).value,
'11': useTimeAgo(Date.UTC(2022, 10, 8)).value,
}
})
Expand Down
2 changes: 1 addition & 1 deletion system-tests/projects/react17/package.json
Expand Up @@ -7,7 +7,7 @@
"@vitejs/plugin-react": "^1.3.2",
"css-loader": "^4.3.0",
"style-loader": "^2.0.0",
"vite": "2.9.14",
"vite": "3.2.2",
"webpack": "^4"
},
"sideEffects": false,
Expand Down

5 comments on commit 5e3a21c

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e3a21c Nov 8, 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 arm64 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/11.0.0/linux-arm64/develop-5e3a21cf6dc229509fcae4b477a80a2a31e738ab/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e3a21c Nov 8, 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/11.0.0/linux-x64/develop-5e3a21cf6dc229509fcae4b477a80a2a31e738ab/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e3a21c Nov 8, 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 darwin arm64 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/11.0.0/darwin-arm64/develop-5e3a21cf6dc229509fcae4b477a80a2a31e738ab/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e3a21c Nov 8, 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 darwin 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/11.0.0/darwin-x64/develop-5e3a21cf6dc229509fcae4b477a80a2a31e738ab/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5e3a21c Nov 8, 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 win32 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/11.0.0/win32-x64/develop-5e3a21cf6dc229509fcae4b477a80a2a31e738ab/cypress.tgz

Please sign in to comment.