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

feat: add multistep construct and support for running test session [sc-17814] #868

Merged
merged 6 commits into from Oct 18, 2023

Conversation

ndom91
Copy link
Contributor

@ndom91 ndom91 commented Oct 12, 2023

I hereby confirm that I followed the code guidelines found at engineering guidelines

Affected Components

  • CLI
  • Create CLI
  • Test
  • Docs
  • Examples
  • Other

Notes for the Reviewer

  • Completes sc-17814 and sc-17815
    • Regarding 17814, we already supported MULTI_STEP check runs via test-session due to checkly-backend/api/src/modules/public-api/test-sessions/PublicTestSessionsController.js:93 and the following code paths submitting the check run to the correct queue based off of its checkType.
  • Adds multistep check construct, based off of browser construct
  • Supercedes: Antoinecoutellier/sc 17815/add new multistepcheck constructor to the #864
    • Reused test and example files from there 🙏

Manually tested with npm create checkly simple example and the following files:

// multistep.check.ts
import { MultiStepCheck } from 'checkly/constructs'

new MultiStepCheck('multi-step-check-1', {
  name: 'SpaceX Template',
  frequency: 15,
  code: { entrypoint: 'homepage.spec.ts' },
})
// homepage.spec.ts
import { test, expect } from '@playwright/test'

const baseUrl = 'https://api.spacexdata.com/v3'

test('space-x dragon capsules', async ({ request }) => {
  /**
   * Get all SpaceX Dragon Capsules
   */
  const response = await test.step('get all capsules', async () => {
    return request.get(`${baseUrl}/dragons`)
  })

  expect(response).toBeOK()

  const data = await response.json()
  expect(data.length).toBeGreaterThan(0)

  const [first] = data

  /**
   * Get a single Dragon Capsule
   */
  const getSingleResponse = await test.step('get single dragon capsule', async () => {
    return request.get(`${baseUrl}/dragons/${first.id}`)
  })

  expect(getSingleResponse).toBeOK()

  const dragonCapsule = await getSingleResponse.json()
  expect(dragonCapsule.name).toEqual(first.name)
})

Adding playwrights context to homepage.spec.ts:5 test callback arguments correctly returns cannot use 'context' in MULTI_STEP checks, confirming its been submitted and handled by 2023-09-multistep runner.

New Dependency Submission

@shortcut-integration
Copy link

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #17815: Add new MultiStepCheck constructor to the CLI.

@ndom91 ndom91 changed the title feat: add multistep construct file [sc-17814] feat: add multistep construct and support for running test session [sc-17814] Oct 12, 2023
@ndom91 ndom91 marked this pull request as ready for review October 12, 2023 13:57
*
* This class make use of the multi-step checks endpoints.
*/
export class MultiStepCheck extends Check {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the PR description, you mention Adds multistep check construct, based off of browser construct but it extends Check and not BrowserCheck. Is it wanted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was just based off of the browsercheck construct, meaning they both extend Check

Copy link
Member

@tnolet tnolet Oct 13, 2023

Choose a reason for hiding this comment

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

@ndom91 @Antoine-C we should not add the sslDomain property

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha we had this discussion elsewhere recently. They're still included in the multistep UI as well. So should we remove them completely from multistep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Contributor

@Antoine-C Antoine-C Oct 16, 2023

Choose a reason for hiding this comment

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

Do we need to update the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good question, that might be the reason for the failing tests. Doing some more digging here today..

@ndom91 ndom91 merged commit 88f8b12 into main Oct 18, 2023
3 checks passed
@ndom91 ndom91 deleted the ndom91/sc-17814/add-multistep-check-support branch October 18, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants