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 ability to copy playwright config into checkly config #919

Merged
merged 7 commits into from
Jan 16, 2024

Conversation

ferrandiaz
Copy link
Contributor

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

Since create-cli and cli are 2 different workspaces I had to duplicate quite some code, if this extends more it would probably be wise to add a shared workspace or package between the 2 for the playwright config.

PR is separated in 2 commits.

  1. Create CLI: adds option once creating the CLI to also import the playwright config file if found
  2. CLI: checkly sync-playwright currently hidden, if passed adds or updates the playwright config of the checkly config.

Once creating the CLI it will check if there is a playwright.config file on the directory,
then ask the user if he wants to copy it to the checkly config file
…mmand

New feature that allows the user to sync (update or create) their playwright config with the
checkly config
Copy link

@ferrandiaz ferrandiaz force-pushed the ferran/sc-18663/playwright-checkly-config branch from 27bafa2 to 466c6b0 Compare January 11, 2024 15:27
umutuzgur
umutuzgur previously approved these changes Jan 15, 2024
Copy link
Member

@umutuzgur umutuzgur left a comment

Choose a reason for hiding this comment

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

LGTM

return prompts({
type: 'confirm',
name: 'shouldCopyPlaywrightConfig',
message: 'It looks like you have a playwright config, do you want to copy it?',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think "copy it" is slightly vague. Maybe we can rephrase it a bit?

Suggested change
message: 'It looks like you have a playwright config, do you want to copy it?',
message: 'It looks like you have a Playwright config file. Would you like to copy your settings to your Checkly config file?',


export default class SyncPlaywright extends BaseCommand {
static hidden = true
static description = 'Sync playwright config'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think Playwright and Checkly should be capitalized in the user facing messages.

Maybe we can make the help description more specific too in case users aren't familiar with the command. Maybe something like this?

Suggested change
static description = 'Sync playwright config'
static description = 'Copy Playwright config into the Checkly config file'

static description = 'Sync playwright config'

async run (): Promise<void> {
ux.action.start('Sync playwright config with checkly config', undefined, { stdout: true })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ux.action.start('Sync playwright config with checkly config', undefined, { stdout: true })
ux.action.start('Syncing Playwright config to the Checkly config file', undefined, { stdout: true })

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clample Syncing or Synching? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I think Syncing is good. Apparently some British folks use Synching though. https://english.stackexchange.com/questions/681/synced-or-synched


const checksAst = this.findPropertyByName(checklyAst, 'checks')
if (!checksAst) {
return this.handleError('Could not parse your checkly config file')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that users will assume that either their config is invalid or the sync-playwright command is broken, and get confused / try to contact support.

I think that we could make it more clear that this can happen in some cases and there's no need to worry. For example, maybe they're importing the config from another file or using a helper function. Maybe something like this?

Suggested change
return this.handleError('Could not parse your checkly config file')
return this.handleError('Unable to automatically sync your config file. This can happen if your Checkly config is built using helper functions or other JS/TS features. You can still manually set Playwright config values in your Checkly config: https://www.checklyhq.com/docs/cli/constructs-reference/#project')

this.reWriteChecklyConfigFile(checklyConfigData, configFile.fileName, dir)

ux.action.stop('✅ ')
this.log('Successfully sync')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
this.log('Successfully sync')
this.log('Successfully updated Checkly config file')

Copy link
Member

Choose a reason for hiding this comment

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

@clample "...updated the Checkly config file"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point, thanks 😅

@clample
Copy link
Collaborator

clample commented Jan 15, 2024

Looks good to me 👍 I think that it could make sense to double check / tweak some of the user facing messages, though.

@ferrandiaz ferrandiaz merged commit fdc09c7 into main Jan 16, 2024
3 checks passed
@ferrandiaz ferrandiaz deleted the ferran/sc-18663/playwright-checkly-config branch January 16, 2024 10:43
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.

4 participants