{"id":24438647,"url":"https://github.com/empawlowski/automation-exercise-playwright","last_synced_at":"2026-03-01T13:03:09.631Z","repository":{"id":180940757,"uuid":"665936455","full_name":"empawlowski/automation-exercise-playwright","owner":"empawlowski","description":"[E2E, API] Automation tests for online shop by using 🎭Playwright framework.","archived":false,"fork":false,"pushed_at":"2025-05-13T10:39:21.000Z","size":336,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T10:03:39.533Z","etag":null,"topics":["api-tests","cicd","e2e","e2e-tests","fixtures","page-object-model","playwright","pom","test-automation","typescript","visual-studio-code"],"latest_commit_sha":null,"homepage":"https://automationexercise.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/empawlowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-13T10:29:50.000Z","updated_at":"2025-05-13T10:39:22.000Z","dependencies_parsed_at":"2025-04-30T09:44:51.726Z","dependency_job_id":"90b087f1-003a-4e93-8832-36a75c62f156","html_url":"https://github.com/empawlowski/automation-exercise-playwright","commit_stats":null,"previous_names":["empawlowski/e2e-online-shop","empawlowski/playwright-online-shop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/empawlowski/automation-exercise-playwright","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/empawlowski%2Fautomation-exercise-playwright","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/empawlowski%2Fautomation-exercise-playwright/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/empawlowski%2Fautomation-exercise-playwright/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/empawlowski%2Fautomation-exercise-playwright/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/empawlowski","download_url":"https://codeload.github.com/empawlowski/automation-exercise-playwright/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/empawlowski%2Fautomation-exercise-playwright/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T12:56:10.327Z","status":"ssl_error","status_checked_at":"2026-03-01T12:55:24.744Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-tests","cicd","e2e","e2e-tests","fixtures","page-object-model","playwright","pom","test-automation","typescript","visual-studio-code"],"created_at":"2025-01-20T19:17:21.121Z","updated_at":"2026-03-01T13:03:09.613Z","avatar_url":"https://github.com/empawlowski.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=https://skillicons.dev/icons?i=vscode,nodejs,js,ts,github /\u003e\n\u003c/p\u003e\n\n# [E2E, API] Automation tests for page: `https://automationexercise.com`\n\n## Hyperlinks for contents\n\n- [Extension](#used-extensions-and-library-in-project)\n- [Playwright snippets](#playwright-snippets)\n- [Config modifications](#playwright-config-modifications)\n- [Installation](#installation)\n  - [Project installation](#project-installation)\n  - [Prettier](#prettier)\n  - [Faker.js](#faker)\n\n## Used extensions and library in project\n\n- ### 🎭 Playwright Test for VSCode\n- ### GitHub Actions/ GitLens Inspect\n- ### Prettier ([installation bellow](#prettier))\n- ### Better Comments\n- ### Code Spell Checker\n- ### Auto-Open Markdown Preview\n- ### VSCode-icons\n- ### Faker.js ([installation bellow](#faker)) (`library`)\n\n## Playwright snippets\n\n- advertisements blocker\n\n  ```javascript\n  await page.route('**/*', (route) =\u003e {\n    if (route.request().url().startsWith('https://googleads.')) {\n      route.abort();\n    } else if (route.request().url().startsWith('https://fonts.googleapis.')) {\n      route.abort();\n    } else {\n      route.continue();\n    }\n  });\n  ```\n\n- interact with the web page `dialogs` [ `products.spec.ts` \u003e `Test Case 6: Contact Us Form` ]\n\n  ```javascript\n  page.on('dialog', (dialog) =\u003e dialog.accept());\n  await page.locator('#dialog').click();\n  ```\n\n- `scroll down` the page [ `products.spec.ts` \u003e `Test Case 10: Verify Subscription in home page` ]\n\n  ```javascript\n  // Scroll Down\n  await page.evaluate(() =\u003e {\n    window.scrollTo(0, document.body.scrollHeight);\n  });\n\n  // Scroll Up\n  await page.evaluate(() =\u003e {\n    window.scrollTo(0, 0);\n  });\n  ```\n\n- `catch` success alert [ `products.spec.ts` \u003e `Test Case 10: Verify Subscription in home page` ]\n\n  ```javascript\n  await expect(page.locator('#alert')).toContainText('Success!');\n  ```\n\n- `count` all rows in table [ `navbar.spec.ts` \u003e `Test Case 12: Add Products in Cart` ]\n\n  ```javascript\n  const rowCount = await page.locator('tr').count();\n  await expect(rowCount).toBe(number);\n  ```\n\n- use `regex` to check changing link \"Logged in as `userName`\"\n\n  ```javascript\n  /^Logged in as \\w+$/;\n  ```\n\n- locating by using href link\n\n  ```javascript\n  page.locator('[href*=\"/pageName\"]', { hasText: 'Page Name' });\n  ```\n\n- examples using loop `for` [ `cart.spec.ts` \u003e `Test Case 20: Search Products and Verify Cart After Login` ]\n\n  - catching by `$$ selector`\n\n    ```javascript\n    const loops = await page.$$('selector');\n\n    for (const loop of loops) {\n      await loop.click();\n    }\n    ```\n\n  - catching by `text` and method `.all()`\n    ```javascript\n    for (const loop of await page.locator('.class').getByText('Text').all()) {\n      await loop.click();\n    }\n    ```\n  - catching by `text` and method `.count()`\n    ```javascript\n    const loop = page.locator('.class').getByText('Text');\n    for (let i = 0; i \u003c (await loop.count()); i++) {\n      await loop.nth(i).click();\n    }\n    ```\n\n- `download` method with `console.log` [ `cart.spec.ts` \u003e `Test Case 24: Download Invoice after purchase order` ]\n\n  ```javascript\n  const downloadPromise = page.waitForEvent('download');\n  await page.locator('#download').click();\n  const download = await downloadPromise;\n  if (download) {\n    console.log('File downloaded successfully.');\n    await download.saveAs('./test-download/e2e/cart/Invoice.txt');\n  } else {\n    console.log('File download failed.');\n  }\n  ```\n\n- `catch` page by `screen` [ `home.spec.ts` \u003e `Test Case 25/26: Verify Scroll Up using/without 'Arrow' button and Scroll Down functionality` ]\n\n  - full page\n\n    ```javascript\n    await page.screenshot({ path: './screenshot.png', fullPage: true });\n    ```\n\n  - actually visible elements of page\n\n    ```javascript\n    await page.screenshot({ path: './screenshot.png' });\n    ```\n\n  - element on page\n\n    ```javascript\n    await page.locator('.class').screenshot({ path: './screenshot.png' });\n    ```\n\n## Playwright Config modifications\n\n- add `timeout` and `expect timeout`\n  ```javascript\n  timeout: 30 * 1000,\n  expect: {\n      /**\n      * Maximum time expect() should wait for the condition to be met.\n      * For example in `await expect(locator).toHaveText();`\n      */\n        timeout: 5000,\n        },\n  ```\n- add other `attribute` for `testid`\n  ```javascript\n  use: {\n      // Set the test id to use a custom data attribute.\n      testIdAttribute: 'data-qa',\n      },\n  ```\n- add `Trace Viewer`, `Video` and `Screenshot` when retrying failed test\n  ```javascript\n  use: {\n        trace: 'retain-on-failure',\n        video: 'retain-on-failure',\n        screenshot: 'only-on-failure',\n      },\n  ```\n\n## Installation\n\n- ### `Project installation`\n\n  - install commands\n\n    ```javascript\n    npm install\n    npm init playwright@latest\n    ```\n\n- ### `Prettier`\n\n  - install\n    ```javascript\n    npm install --save-dev --save-exact prettier\n    ```\n  - configure\n\n    - exclude files in `.prettierignore`\n\n      ```\n      package-lock.json\n      playwright-report\n      test-download\n      test-upload\n      test-results\n      ```\n\n    - set rules in `.prettierrc.json`\n\n      ```javascript\n      {\n      \"singleQuote\": true,\n      \"endOfLine\": \"auto\",\n      \"printWidth\": 150\n      }\n      ```\n\n- ### `Faker`\n\n  - install\n    ```javascript\n    npm install --save-dev @faker-js/faker\n    ```\n  - usage\n\n    ```javascript\n    import { faker } from '@faker-js/faker';\n\n    const email = faker.internet.email();\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fempawlowski%2Fautomation-exercise-playwright","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fempawlowski%2Fautomation-exercise-playwright","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fempawlowski%2Fautomation-exercise-playwright/lists"}