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

#74 Installed Playwright and add in to CI/CD pipeline #92

Merged
merged 29 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e54ead8
installed playwright and added into the CICD pipeline
vmaineng Mar 24, 2024
d2aef6b
pulled in storyboook changes
vmaineng Mar 27, 2024
3d09d74
added in Playwright and RTL in ReadMe
vmaineng Mar 27, 2024
79b106b
cleaned up package.json
vmaineng Mar 27, 2024
4e71119
deleted commented code that was not used and updated file directory f…
vmaineng Mar 27, 2024
3462e33
pulled in new changes
vmaineng Apr 2, 2024
b4fdbbc
deleted test examples directories and modified test files
vmaineng Apr 2, 2024
817946c
removed test result and playwright report from .gitignore
vmaineng Apr 2, 2024
d747643
pulled changes from develop branch
vmaineng Apr 2, 2024
20f9a70
installed newest dependencies
vmaineng Apr 2, 2024
5dcc157
added in action-setupv2 in ci.yml
vmaineng Apr 2, 2024
5d3b1b1
removed the line I added
vmaineng Apr 2, 2024
bc64c6c
revert pnpm install back to pnpm ci
vmaineng Apr 2, 2024
9e861f9
modified ci.yml with cache
vmaineng Apr 3, 2024
e153ccd
revert changes back
vmaineng Apr 3, 2024
5109973
commented out mobile views
vmaineng Apr 3, 2024
4c45998
indented playwright testing
vmaineng Apr 3, 2024
fc231e0
modified indentation of yaml file
vmaineng Apr 3, 2024
0e434f0
revert back identation
vmaineng Apr 3, 2024
92bb771
revert changes
vmaineng Apr 4, 2024
b41cc39
added in different install
vmaineng Apr 4, 2024
3ff72a5
made modifications to readME to add exec
vmaineng Apr 4, 2024
acf6714
removed test files
vmaineng Apr 4, 2024
0b275fe
removed test folders
vmaineng Apr 4, 2024
02c3c70
Merge branch 'playwright' of github.com:LetsGetTechnical/gridiron-sur…
vmaineng Apr 4, 2024
fcb1964
added in example test file
vmaineng Apr 4, 2024
19e3a05
removed test example
vmaineng Apr 4, 2024
92e90bc
added in path to ignore playwright tests
vmaineng Apr 4, 2024
c7ba282
removed test results and playwright report out of .gitignore
vmaineng Apr 4, 2024
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
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,24 @@ jobs:
run: pnpm install
- name: tests
run: pnpm test
#Playwright Testing
test:
timeout-minutes: 60000
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: pnpm ci
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps
- name: Run Playwright tests
run: pnpm playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

*storybook.log
#playwright
/test-results/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we want to ignore? We will eventually create a deployment that can output the Playwright report so the person creating the PR can see this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo Thanks for explaining, Shashi. I will remove from the .gitignore file.

/playwright-report/
/blob-report/
/playwright/.cache/

*storybook.log

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,37 @@ Run Storybook in the project root
```
npm run storybook
```

## React Testing Library (RTL) && Jest

Install dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to remove the installation from our dependencies. 1 installation is all a new user would need to run. Then the specific commands would be needed for the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo Thanks for clarifying. I removed the pnpm i since only 1 installation is needed and left specific commands on how to run tests.


```
pnpm i
```

Run RTL && Jest in the project root

```
pnpm test
```

## Playwright Testing

Install dependencies

```
pnpm i
```

Run all Playwright tests

```
pnpm playwright test
```

Run sing Playwright tests

```
pnpm playwright test (name of file)
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"devDependencies": {
"@chromatic-com/storybook": "^1.2.18",
"@playwright/test": "^1.42.1",
"@storybook/addon-essentials": "^8.0.0",
"@storybook/addon-interactions": "^8.0.0",
"@storybook/addon-links": "^8.0.0",
Expand Down
47 changes: 47 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
testDir: "./",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Shashi! Would you please elaborate as to why Desktop Safari should be removed? I believe it's not as popular but I can still see Safari being used to this day. Please let me know. :) Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured you removed it because they are commented out. If it's not meant to be commented out, bring it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the commented code.

{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
],
});
35 changes: 35 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading