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

WIP: WEBDEV-6730 fix flaky tests - fixmes #40

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
04bd9d1
update tests and configs
dualcnhq Apr 17, 2024
7fe0ed4
update formatting and scripts
dualcnhq Apr 17, 2024
6ae56c4
update other tests and config
dualcnhq Apr 18, 2024
b29c169
update tests for details page
dualcnhq Apr 18, 2024
defe316
update run-test script
dualcnhq Apr 18, 2024
4f0b899
update tests and config with json reporter
dualcnhq Apr 18, 2024
c259d7c
more debugging
dualcnhq Apr 19, 2024
8c7eeb8
update config
dualcnhq Apr 20, 2024
1701416
update collection page test
dualcnhq Apr 22, 2024
3580e3c
another test update
dualcnhq Apr 29, 2024
abc3fb1
test update
dualcnhq Apr 29, 2024
2438dc4
refactor and formatting
dualcnhq Apr 29, 2024
a86d621
update config and tests
dualcnhq Apr 29, 2024
5ffc350
fix error in searchpage fixture
dualcnhq Apr 29, 2024
48e7576
update config and tests
dualcnhq Apr 30, 2024
eb9d8c0
update GH workflow
dualcnhq Apr 30, 2024
5d41ec0
update README and notes
dualcnhq May 1, 2024
77b1a88
add login page timeout
dualcnhq May 8, 2024
170998b
donation banner tests (#42)
iisa Apr 25, 2024
9dc1c8d
Lending bar tests for login and borrow and return now feature
nsharma123 Apr 26, 2024
7f76ed9
Address CR suggestion to remove new fixtures for lending-bar
nsharma123 Apr 30, 2024
77c2e31
Removed unused imports
nsharma123 Apr 30, 2024
e7caa60
update pipeline step workflows
dualcnhq May 9, 2024
89292f7
update workflow step
dualcnhq May 9, 2024
5dfcf78
add to use xvfb - as experiment
dualcnhq May 13, 2024
3652c47
update config with xvfb
dualcnhq May 13, 2024
fd292f4
remove xvfb
dualcnhq May 13, 2024
01ff1b4
update step run
dualcnhq May 13, 2024
6e83299
update runner image
dualcnhq May 14, 2024
54df545
update pipeline
dualcnhq May 14, 2024
2690e5f
initial timeout and waitloadstate cleanups
dualcnhq May 15, 2024
571eaba
update code
dualcnhq May 17, 2024
1c90ba8
Merge branch 'main' into webdev-6730-fix-flaky-tests
dualcnhq May 17, 2024
7d74154
fix merge with formatting and remove unused code
dualcnhq May 17, 2024
24a81c0
update
dualcnhq May 17, 2024
ef31861
fix conflict and dupe
dualcnhq May 17, 2024
686ad65
update webrunner to mac
dualcnhq May 17, 2024
7fdf3d6
Update Playwright
mc2 May 21, 2024
40405bd
Update Playwright config for retry and trace
mc2 May 21, 2024
031c806
Fix and comment flaky issues
mc2 May 21, 2024
b651b42
add env
dualcnhq May 22, 2024
219ad84
update pipeline and add fixme annotation
dualcnhq May 22, 2024
d6c2bf4
update setup env workflow
dualcnhq May 22, 2024
876e7db
fix job step workflow
dualcnhq May 22, 2024
0fb421e
update yml
dualcnhq May 22, 2024
6265802
update gh workflows
dualcnhq May 22, 2024
4cd872c
update pipeline
dualcnhq May 22, 2024
1cf3f3f
update pipeline
dualcnhq May 22, 2024
dee7ee8
update pipeline workflow
dualcnhq May 22, 2024
e0c503b
update pipeline
dualcnhq May 22, 2024
c8e3e6e
update fixme and manual pipeline
dualcnhq May 22, 2024
35691e4
Clean up temp console.log debugging
mc2 May 23, 2024
b706ff6
Merge pull request #46 from internetarchive/webdev-6852-fix-e2e-detai…
mc2 May 23, 2024
e812ed5
add fixme
dualcnhq May 23, 2024
ebd48e6
new manual workflow
dualcnhq May 23, 2024
7619895
update fixme
dualcnhq May 23, 2024
a2c54b9
add fixme annotations
dualcnhq May 24, 2024
2b95f5b
refactor search page tests
dualcnhq May 24, 2024
fe78dd4
fix format and refactor login
dualcnhq May 24, 2024
e19b755
add fixmes
dualcnhq May 24, 2024
70072c5
add fixme - music tests
dualcnhq May 24, 2024
175fe26
update fixmes
dualcnhq May 29, 2024
da4f63c
update fixme
dualcnhq May 31, 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
17 changes: 12 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
BROWSERSTACK_USERNAME="<retrieve_from_browserstack_account>"
BROWSERSTACK_ACCESS_KEY="<retrieve_from_browserstack_account>"

A_EMAIL="<priv_email>"
A_PASSWORD="<priv_password>"
B_EMAIL="<reg_email>"
B_PASSWORD="<reg_password>"
ARCHIVE_EMAIL="<priv_email>"
ARCHIVE_PASSWORD="<priv_password>"
PATRON_EMAIL="<reg_email>"
PATRON_PASSWORD="<reg_password>"

CATEGORY="all"
# default to `plugin` - indicating that testRun was triggered by VSCode Playwright plugin
dualcnhq marked this conversation as resolved.
Show resolved Hide resolved
CATEGORY="plugin"

# Set to true if whathost debugging is needed every testRun.
# Each fixtures will call an API service that will return a response with www<node> details,
# which can help in determining what host node you are connected to.
# This might be helpful in debugging if a www<node> is causing an issue/failing test
WHATHOST="false"
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Donation banner tests
name: Setup GH actions and install dependencies

on:
push:
branches: [ main, master ]

pull_request:
branches: [ main, master ]
on: workflow_call

jobs:
test:
Expand All @@ -24,6 +19,3 @@ jobs:

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run Donation Tests
run: npm run test:donation
86 changes: 86 additions & 0 deletions .github/workflows/call-run-individual-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Install deps and browsers, run tests, and upload artifacts

on: workflow_call

jobs:
# setup:
# name: Setup test environment
# uses: ./.github/actions/setup-env.yml

test:
runs-on: ubuntu-latest
# strategy:
# matrix:
# os: [macos-latest, ubuntu-latest]
# runs-on: ${{ matrix.os }}

env:
ARCHIVE_EMAIL: ${{ secrets.ARCHIVE_EMAIL }}
ARCHIVE_PASSWORD: ${{ secrets.ARCHIVE_PASSWORD }}
PATRON_EMAIL: ${{ secrets.PATRON_EMAIL }}
PATRON_PASSWORD: ${{ secrets.PATRON_PASSWORD }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run about tests
if: always()
Copy link
Contributor

Choose a reason for hiding this comment

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

q: do you need the always?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

always can be removed, it's just added so the next step will still run even if the previous step has failed

run: npm run test:about

- name: Run av tests
if: always()
run: npm run test:av

- name: Run books tests
if: always()
run: npm run test:books

- name: Run collection tests
if: always()
run: npm run test:collection

- name: Run details tests
if: always()
run: npm run test:details

- name: Run donation tests
if: always()
run: npm run test:donation

- name: Run home Tests
if: always()
run: npm run test:home

- name: Run login tests
if: always()
run: npm run test:login

- name: Run music tests
if: always()
run: npm run test:music

- name: Run profile tests
if: always()
run: npm run test:profile

- name: Run search tests
if: always()
run: npm run test:search

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 1
19 changes: 10 additions & 9 deletions .github/workflows/call-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Setup test environment
uses: ./.github/actions/setup-env

# - name: Run tests in Chromium browser
# run: npm run test:chrome

- name: Install dependencies
run: npm ci
# - name: Run tests in Firefox browser
# run: npm run test:firefox

- name: Install Playwright Browsers
run: npx playwright install --with-deps
# - name: Run tests in Webkit browser
# run: npm run test:webkit
Copy link
Contributor

Choose a reason for hiding this comment

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

whats the difference between this and the new worflow above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the new workflow will run the tests by category with specific order... while the other one will run the tests either by browser or all tests without order


- name: Run Playwright tests
run: ./run-tests.sh
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ jobs:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

test:
name: Run tests
uses: ./.github/workflows/call-run-tests.yml
name: Run tests individually
uses: ./.github/workflows/call-run-individual-tests.yml

# test:
# name: Run all tests
# uses: ./.github/workflows/call-run-tests.yml
9 changes: 9 additions & 0 deletions .github/workflows/manual-trigger-individual-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is a basic workflow that is manually triggered
Copy link
Contributor

Choose a reason for hiding this comment

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

q: why do we need a manual trigger?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this will help on debugging tests that runs in pipeline vs locally

name: Manual workflow - just for testing

on: workflow_dispatch

jobs:
test:
name: Run tests individually
uses: ./.github/workflows/call-run-individual-tests.yml
31 changes: 31 additions & 0 deletions .github/workflows/manual-trigger-specific-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is a basic workflow that is manually triggered

name: Manual workflow - just for testing

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
input_command:
name:
description: 'CLI command you want to execute in the pipeline'

jobs:
manual:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup test environment
uses: ./.github/actions/setup-env

- shell: bash
env:
ARCHIVE_EMAIL: ${{ secrets.ARCHIVE_EMAIL }}
ARCHIVE_PASSWORD: ${{ secrets.ARCHIVE_PASSWORD }}
PATRON_EMAIL: ${{ secrets.PATRON_EMAIL }}
PATRON_PASSWORD: ${{ secrets.PATRON_PASSWORD }}
run: |
${{ github.event.inputs.input_command }}
Copy link
Contributor

Choose a reason for hiding this comment

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

q? asking again if we need this manuall lever?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for this one, we want to have a way to run specific tests in pipeline and compare it to the one that was ran locally

17 changes: 0 additions & 17 deletions .github/workflows/manual-trigger-test.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ node_modules/
/playwright/.cache
/playwright/.auth

# json reporter summary
/ctrf
/playwright-summary
*-summary.json

.env
*.err
*.log
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# End to end tests for Archive.org using [Playwright](https://playwright.dev/)


## (Optional) BrowserStack Local Setup

- login to BrowserStack and retrieve the account username and access key, see documentation [here](https://www.browserstack.com/docs/automate/playwright/getting-started/nodejs/test-runner)
Expand All @@ -17,20 +18,28 @@

`npx playwright install`

- create a `.env` file by copying the contents from `.env.sample` and add the respective values you want to use for testing

- run all the tests in headless mode and generate 1 whole test report:

`npm run test`

- run all the tests in headless mode by each category and generate test report by category:
- run all the tests in headless mode by each category:

`./run-tests.sh`

- run all the tests in headless mode by browser:

- chrome: `./run-tests.sh -b chrome`

- firefox: `./run-tests.sh -b firefox`

- webkit: `./run-tests.sh -b webkit`

- run all the tests in headed mode (this will load multiple browsers):

`npm run test:headed`

- create a `.env` file by copying the contents from `.env.sample` and add the respective values you want to use for testing


## Running individual tests by category (headless mode)

Expand Down
8 changes: 4 additions & 4 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ dotenv.config();
export const config = {
baseURL: process.env.BASE_URL ?? "https://archive.org",
patronUser: {
email: process.env.B_EMAIL || '',
password: process.env.B_PASSWORD || ''
email: process.env.PATRON_EMAIL || '',
password: process.env.PATRON_PASSWORD || ''
},
privUser: {
email: process.env.A_EMAIL || '',
password: process.env.A_PASSWORD || '',
email: process.env.ARCHIVE_EMAIL || '',
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is special, then can we call these vars something else to match their special designation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes... but for now it was just what's agreed upon

password: process.env.ARCHIVE_PASSWORD || '',
},
}
Loading
Loading