diff --git a/docs/docs/api/table_of_contents.md b/docs/docs/api/table_of_contents.md index 2f79441d8..66db86bd1 100644 --- a/docs/docs/api/table_of_contents.md +++ b/docs/docs/api/table_of_contents.md @@ -9,7 +9,7 @@ title: API Table of Contents

-In addition to the APIs below, you have full access to the [Playwright API](https://github.com/microsoft/playwright/blob/master/docs/api.md), the [Jest API](https://jestjs.io/docs/en/expect), and [expect-playwright API](https://github.com/playwright-community/expect-playwright#api-documentation). +In addition to the APIs below, you have full access to the [Playwright API](https://github.com/microsoft/playwright/blob/master/docs/api.md) and the [Jest API](https://jestjs.io/docs/en/expect). The QA Wolf API is minimal by design, since we want to leverage the power of Playwright/Jest as much as possible. diff --git a/docs/docs/create_a_test.mdx b/docs/docs/create_a_test.mdx index 45fb301a4..5d5bae310 100644 --- a/docs/docs/create_a_test.mdx +++ b/docs/docs/create_a_test.mdx @@ -15,13 +15,6 @@ npx qawolf create http://todomvc.com/examples/react myTest - [Edit as you go](#edit-as-you-go) in your code editor (`.qawolf/myTest.test.js`) -- [Add assertions](#optional-add-assertions) with the [expect-playwright](https://github.com/playwright-community/expect-playwright) library (included with QA Wolf): - -```js -await expect(page).toHaveText('Clear completed'); -await expect(page).toHaveSelector('.clear-completed'); -``` - - [Save your test](#save-a-test) by choosing `💾 Save and Exit` in the command line ::: @@ -124,61 +117,7 @@ The test code is created in real-time, so you can edit the test as you create it ::: -## Optional: Add assertions - -Let's add assertions to our test. - -We recommend adding assertions with the [expect-playwright library](https://github.com/playwright-community/expect-playwright), which automatically waits for assertions. QA Wolf includes this library by default, so you do not need to install anything to use it. - -### Assert that text appears - -The first assertion we will add is to check that the text `"Clear completed"` appears after we complete our todo. Specifically, we will call expect-playwright's [`toHaveText` method](https://github.com/playwright-community/expect-playwright#tohavetext) to verify that the text appears on the page. - -In our test code, let's add a line to assert that the text `"Clear completed"` appears on the page: - -```js -// ... - -test('myTest', async () => { - await page.goto('http://todomvc.com/examples/react'); - await page.click('[placeholder="What needs to be done?"]'); - await page.type('[placeholder="What needs to be done?"]', 'create test!'); - await page.press('[placeholder="What needs to be done?"]', 'Enter'); - await page.click('.toggle'); - // custom code starts - await expect(page).toHaveText('Clear completed'); - // custom code ends - await page.click('text=Clear completed'); -}); -``` - -### Assert that an element appears - -Rather than asserting that the text `"Clear completed"` appears on the page, we could instead assert that the `"Clear completed"` button appears on the page. - -In terms of the [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model), this means that there should be an element with the class `"clear-completed"`. The corresponding [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) for an element with the class `"clear-completed"` is `.clear-completed`. - -We'll use the [`toHaveSelector` method](https://github.com/playwright-community/expect-playwright#toHaveSelector) to assert that the CSS selector `.clear-completed` appears on the page after we complete our todo. - -Our test now looks like this: - -```js -// ... - -test('myTest', async () => { - await page.goto('http://todomvc.com/examples/react'); - await page.click('[placeholder="What needs to be done?"]'); - await page.type('[placeholder="What needs to be done?"]', 'create test!'); - await page.press('[placeholder="What needs to be done?"]', 'Enter'); - await page.click('.toggle'); - // custom code starts - await expect(page).toHaveSelector('.clear-completed'); - // custom code ends - await page.click('text=Clear completed'); -}); -``` - -If the `"Clear completed"` button does not appear on the page, our test will fail. +You can edit this file with assertions. To learn about assertions, see Playwright's [documentation](https://playwright.dev/#version=v1.2.0&path=docs%2Fassertions.md&q=custom-assertions). ## Save a test diff --git a/expect-playwright.js b/expect-playwright.js deleted file mode 100644 index 727b9b038..000000000 --- a/expect-playwright.js +++ /dev/null @@ -1,3 +0,0 @@ -const expect = require('expect-playwright'); - -module.exports = expect; diff --git a/js-jest.config.json b/js-jest.config.json index 2ad7153cb..873717bc6 100644 --- a/js-jest.config.json +++ b/js-jest.config.json @@ -1,4 +1,3 @@ { - "setupFilesAfterEnv": ["qawolf/expect-playwright"], "transform": {} } diff --git a/package-lock.json b/package-lock.json index be3574fd6..de23a929c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3496,11 +3496,6 @@ "jest-regex-util": "^25.2.6" } }, - "expect-playwright": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/expect-playwright/-/expect-playwright-0.2.4.tgz", - "integrity": "sha512-gsEJxwNPgjq924zuMqZ++P12zAOw2vxKOFRDQzWZgd4cK7cmannqEP41ArOKcfaQRKdSihuXL+ehJ5qDTiriJA==" - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", diff --git a/package.json b/package.json index 9ba4bdeba..76fe1bc5c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "types": "./build/index.d.ts", "files": [ "build", - "expect-playwright.js", "js-jest.config.json", "postInstallMessage.js", "ts-jest.config.json" @@ -53,7 +52,6 @@ "commander": "^5.1.0", "create-qawolf": "^1.0.2", "debug": "*", - "expect-playwright": "^0.2.4", "glob": "^7.1.6", "inquirer": "^7.2.0", "kleur": "^3.0.3", diff --git a/test/.qawolf/scroll.test.ts b/test/.qawolf/scroll.test.ts index 3b54fa90b..d3c80cbfa 100644 --- a/test/.qawolf/scroll.test.ts +++ b/test/.qawolf/scroll.test.ts @@ -20,6 +20,5 @@ afterAll(async () => { test('scroll', async () => { await page.goto(`${TEST_URL}infinite-scroll`); await page.evaluate(() => console.log('start scroll test')); - await expect(page).toHaveText('Item 1'); await qawolf.scroll(page, 'html', { x: 0, y: 500 }); }); diff --git a/ts-jest.config.json b/ts-jest.config.json index 5d4de3ea3..40bf5d923 100644 --- a/ts-jest.config.json +++ b/ts-jest.config.json @@ -5,6 +5,5 @@ "diagnostics": false } }, - "setupFilesAfterEnv": ["qawolf/expect-playwright"], "transform": {} }