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

docs: adds first snapshot docs [sc-00] #934

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading