Skip to content

Instantly share code, notes, and snippets.

@dev-jonghoonpark
Created February 7, 2023 09:14
Show Gist options
  • Save dev-jonghoonpark/a7eafec1661610cca4c5719fa1394401 to your computer and use it in GitHub Desktop.
Save dev-jonghoonpark/a7eafec1661610cca4c5719fa1394401 to your computer and use it in GitHub Desktop.
use dci (describe, context, it) pattern in playwright (playwright 에서 dci 패턴 사용하기)
import { test, expect } from '@playwright/test';
function describe(title, callback) {
return test.describe(title, callback)
}
function context(title, callback) {
return test.describe(title, callback)
}
function it(title, callback) {
return test(title, callback);
}
export { describe, context, it, test, expect }
import { describe, context, it, expect } from '../../util/playwright/pattern/dci';
describe('playwright 메인페이지', () => {
context('시작 버튼을 누르면', () => {
it('get started link 페이지로 이동한다.', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();
// Expects the URL to contain intro.
await expect(page).toHaveURL(/.*intro/);
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment