Skip to content

Commit

Permalink
docs: adds first snapshot docs [sc-00] (#934)
Browse files Browse the repository at this point in the history
* docs: adds first snapshot docs [sc-00]

* docs: updates docs / changes checks

* docs: fix small typos
  • Loading branch information
tnolet authored Nov 9, 2023
1 parent 33d5dfe commit 6178681
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 61 deletions.
4 changes: 2 additions & 2 deletions __checks__/alertChannels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { OpsgenieAlertChannel, SlackAlertChannel } from 'checkly/constructs'
import { alertChannelIds } from './defaults'

export const slackChannelOps = SlackAlertChannel.fromId(alertChannelIds.slack)
export const opsGenieChannelP1 = OpsgenieAlertChannel.fromId(alertChannelIds.opsGenieP1)
// removed temporarily for testing snapshots / visual comparisons
export const opsGenieChannelP3 = OpsgenieAlertChannel.fromId(alertChannelIds.opsGenieP3)
export const alertChannels = [slackChannelOps, opsGenieChannelP3]
export const alertChannels = [slackChannelOps]
8 changes: 8 additions & 0 deletions __checks__/docs-visual.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test } from '@playwright/test'
import { ChecklySitePage } from './poms/ChecklySitePage'

test('homepage visual comparison', async ({ page }) => {
const checklyPage = new ChecklySitePage(page)
await checklyPage.goto('/docs')
await checklyPage.doScreenshotCompare()
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions __checks__/poms/ChecklySitePage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { BrowserContext, Page } from '@playwright/test'
import type { Page } from '@playwright/test'
import { expect } from '@playwright/test'
import { defaults } from '../defaults'

export class ChecklySitePage {
public page: Page

constructor (page) {
constructor (page: Page) {
this.page = page
}

Expand All @@ -17,7 +18,17 @@ export class ChecklySitePage {
await this.page.goto(defaults.baseURL + uri)
}

async screenshot (name) {
async screenshot (name: string) {
await this.page.screenshot({ path: `${defaults.screenshotPath}/${name}.jpg` })
}

async doScreenshotCompare () {
await expect(this.page).toHaveScreenshot({
maxDiffPixelRatio: 0.2,
mask: [
this.page.locator('.optanon-alert-box-wrapper'),
this.page.locator('#intercom-container-body')
]
})
}
}
3 changes: 2 additions & 1 deletion __checks__/site.check-group.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { CheckGroup, RetryStrategyBuilder } from 'checkly/constructs'
import { CheckGroup, RetryStrategyBuilder, Frequency } from 'checkly/constructs'
import { alertChannels } from './alertChannels'

export const checklyhqComGroup = new CheckGroup('checklyhq-docs-1', {
name: 'checklyhq.com/docs',
activated: true,
muted: false,
runtimeId: '2023.02',
frequency: Frequency.EVERY_1H,
locations: [
'us-east-1',
'us-west-1',
Expand Down
102 changes: 48 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"devDependencies": {
"@playwright/test": "1.31.2",
"checkly": "4.1.0",
"checkly": "4.4.0-prerelease",
"eslint": "7.32.0",
"eslint-config-standard": "16.0.3",
"eslint-plugin-html": "7.1.0",
Expand Down
Loading

1 comment on commit 6178681

@vercel
Copy link

@vercel vercel bot commented on 6178681 Nov 9, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.