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: update check resource example #270

Merged
merged 1 commit into from
Aug 10, 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
19 changes: 9 additions & 10 deletions docs/resources/check.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,18 @@ resource "checkly_check" "browser_check_1" {
"us-west-1"
]

runtime_id = "2021.06"
runtime_id = "2023.02"

script = <<EOT
const assert = require("chai").assert;
const puppeteer = require("puppeteer");
const { expect, test } = require('@playwright/test')

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://google.com/");
const title = await page.title();
test.use({ actionTimeout: 10000 })

assert.equal(title, "Google");
await browser.close();
test('visit page and take screenshot', async ({ page }) => {
const response = await page.goto(process.env.ENVIRONMENT_URL || 'https://checklyhq.com')
await page.screenshot({ path: 'screenshot.jpg' })
expect(response.status(), 'should respond with correct status code').toBeLessThan(400)
})
EOT
}

Expand Down Expand Up @@ -180,7 +179,7 @@ resource "checkly_check" "example_check" {
# "us-west-1"
# ]

# runtime_id = "2021.06"
# runtime_id = "2023.02"
# script = data.local_file.browser_script.content
# }
```
Expand Down
19 changes: 9 additions & 10 deletions examples/resources/checkly_check/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,18 @@ resource "checkly_check" "browser_check_1" {
"us-west-1"
]

runtime_id = "2021.06"
runtime_id = "2023.02"

script = <<EOT
const assert = require("chai").assert;
const puppeteer = require("puppeteer");
const { expect, test } = require('@playwright/test')

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://google.com/");
const title = await page.title();
test.use({ actionTimeout: 10000 })

assert.equal(title, "Google");
await browser.close();
test('visit page and take screenshot', async ({ page }) => {
const response = await page.goto(process.env.ENVIRONMENT_URL || 'https://checklyhq.com')
await page.screenshot({ path: 'screenshot.jpg' })
expect(response.status(), 'should respond with correct status code').toBeLessThan(400)
})
EOT
}

Expand Down Expand Up @@ -165,6 +164,6 @@ resource "checkly_check" "example_check" {
# "us-west-1"
# ]

# runtime_id = "2021.06"
# runtime_id = "2023.02"
# script = data.local_file.browser_script.content
# }
Loading