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

Fixing homepage broken image #2363

Merged
merged 89 commits into from Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
004acf5
Fixing homepage broken image
amankumarrr Mar 25, 2024
3ac1c5c
Adding mobile browser for the Playwright
amankumarrr Mar 25, 2024
42c3b6f
Adding browser for mobile safari
amankumarrr Mar 25, 2024
71d537b
Modifying tests for the mobile screen
amankumarrr Mar 25, 2024
77ce125
Running the template on pr trigger
amankumarrr Mar 25, 2024
d4494ca
Adding env for the template
amankumarrr Mar 25, 2024
77d8af4
Adding more attempts
amankumarrr Mar 25, 2024
4e33df7
Adding waituntil prop
amankumarrr Mar 26, 2024
eab2af1
Adding chromium browser for mobile viewport
amankumarrr Mar 26, 2024
888ad26
Undo the changes in the template
amankumarrr Mar 26, 2024
7f63a2f
Changing attempts to 2 from 4
amankumarrr Mar 26, 2024
86ec596
Updating the device name
amankumarrr Mar 26, 2024
9d373bf
Adding new pipeline to check images daily
amankumarrr Mar 26, 2024
3354cd5
Fixing syntax for the daily run
amankumarrr Mar 26, 2024
85a225a
Adding checkout step
amankumarrr Mar 26, 2024
feb9cc4
Adding a new step to extract env
amankumarrr Mar 26, 2024
bad97d8
echoing echo in a step
amankumarrr Mar 26, 2024
784d9c2
Adding shell to pwsh
amankumarrr Mar 26, 2024
7956f3b
Adding a new step to create issue
amankumarrr Mar 26, 2024
91cd7c3
Adding checkout step
amankumarrr Mar 26, 2024
b086f27
echoing test result
amankumarrr Mar 26, 2024
51fd441
Adding guard to create an issue and removing custom reporter for the …
amankumarrr Mar 26, 2024
365586c
Extracting the output without reporter
amankumarrr Mar 26, 2024
11a2e22
Echoing test result in the logs
amankumarrr Mar 27, 2024
8c4e2af
Changing the echo into write-ouput
amankumarrr Mar 27, 2024
3346435
Converting output into a string
amankumarrr Mar 27, 2024
de14139
Running test for the creating issue with right artifact
amankumarrr Mar 27, 2024
6fc3199
Fixing indentation in the issue template
amankumarrr Mar 27, 2024
8cc08bd
Removing project and status from md
amankumarrr Mar 27, 2024
f968b70
Removing custom reporter file
amankumarrr Mar 27, 2024
ef0ed54
Merge branch 'main' into 2362-broken-images-homepage
amankumarrr Mar 27, 2024
a59d681
Removing trigger for PR and adding input for dispatch
amankumarrr Mar 27, 2024
24e377c
Merge branch '2362-broken-images-homepage' of https://github.com/SSWC…
amankumarrr Mar 27, 2024
ac36e74
Removing env step
amankumarrr Mar 27, 2024
b48585e
Removing pull request trigger
amankumarrr Mar 27, 2024
7c51aa6
Commenting out size prop
amankumarrr Mar 27, 2024
64f497f
Update components/blocks/clientLogos.tsx
amankumarrr Mar 27, 2024
bf4e996
Adding a new step to add testpass value
amankumarrr Mar 27, 2024
60b13a5
Merge branch '2362-broken-images-homepage' of https://github.com/SSWC…
amankumarrr Mar 27, 2024
ea7f036
Removing PR trigger
amankumarrr Mar 27, 2024
3977941
Adding create an issue in daily image test
amankumarrr Mar 27, 2024
0c0e949
Removing the invalid props for steps
amankumarrr Mar 27, 2024
c53c0ca
Adding PR trigger for testing
amankumarrr Mar 27, 2024
fc43904
Removing the create an issue to test the output variables
amankumarrr Mar 27, 2024
a926895
Adding the default value for the testpassed
amankumarrr Mar 27, 2024
8d01f1f
Adding the chain condition within the block
amankumarrr Mar 27, 2024
e90ca82
Adding create issue step back in the flow
amankumarrr Mar 27, 2024
497f60a
Matt's feedback
amankumarrr Mar 28, 2024
1b116e3
Removing the test pass step and related variables
amankumarrr Mar 28, 2024
54c0f49
Merge branch 'main' into 2362-broken-images-homepage
amankumarrr Mar 29, 2024
ac0eb03
Test run
amankumarrr Mar 29, 2024
86d1cc2
Adding PR trigger for test
amankumarrr Mar 29, 2024
7ff61ea
Adding typo for test
amankumarrr Mar 29, 2024
89fbf03
Adding seo-pr for test
amankumarrr Mar 29, 2024
f2bd88d
Adding typo to test
amankumarrr Mar 29, 2024
d071b11
Adding typo to test
amankumarrr Mar 29, 2024
c27b42d
Adding failure step to get the outcome
amankumarrr Mar 29, 2024
2a5ffd1
Passing props on failure
amankumarrr Mar 29, 2024
51fa0b7
Adding continue on error
amankumarrr Mar 29, 2024
cb099a2
Adding testing output job
amankumarrr Mar 29, 2024
f2952cf
Changing the step name
amankumarrr Mar 29, 2024
d1a8995
removing single quote
amankumarrr Mar 29, 2024
e9b66be
Adding the step to output variable value
amankumarrr Mar 29, 2024
f85a2d0
Changing the run value
amankumarrr Mar 29, 2024
490da5d
Wrapping the value before publishing it
amankumarrr Mar 29, 2024
c384388
Adding output
amankumarrr Mar 29, 2024
85a3531
echoing create issue value
amankumarrr Mar 29, 2024
d06ad11
Changing the value type
amankumarrr Mar 29, 2024
c655914
adding env to get the default value
amankumarrr Mar 29, 2024
b7b728e
Changing the condition
amankumarrr Mar 29, 2024
b3d574c
Adding true check for the job
amankumarrr Mar 29, 2024
934e772
removing double quote for true
amankumarrr Mar 29, 2024
8bf2ea3
adding output value for create issue
amankumarrr Mar 29, 2024
762a8cc
Adding new false for consistency
amankumarrr Mar 29, 2024
3b2dae5
Adding extra condition
amankumarrr Mar 29, 2024
8be26b9
Wrapping with the variable name
amankumarrr Mar 29, 2024
48fa91d
removing condition
amankumarrr Mar 29, 2024
58aac10
Adding extra echo
amankumarrr Mar 29, 2024
c94c025
adding env for the github action
amankumarrr Mar 29, 2024
602d92a
removing echo
amankumarrr Mar 29, 2024
b73298c
adding quote to create issue variable
amankumarrr Mar 29, 2024
aa12eac
removing continue on true
amankumarrr Mar 29, 2024
7f1fc32
Adding variable for the continue on error
amankumarrr Mar 29, 2024
0c4efd2
failure condition for the job
amankumarrr Mar 29, 2024
ce270ae
Removing redundant steps
amankumarrr Mar 29, 2024
82c4324
Updating the variables and cleanup
amankumarrr Mar 29, 2024
a2a6231
Removing error
amankumarrr Mar 29, 2024
8edf96e
removing pull request trigger
amankumarrr Mar 29, 2024
f0365f0
Adding step to checkout repo for the template
amankumarrr Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/auto_bug_report.md
@@ -0,0 +1,17 @@
---
name: 🐛 Auto - Bug Report
about: Report a bug
title: "🐛 {{ env.TITLE }}"
labels: "Type: Bug"
assignees: ""
---

@SSWConsulting/ssw-website-maintainers

**Describe the bug**
Pipeline has detected some broken images on the website.

- [ ] Investigate and fix it asap.

**Download the Playwright Artifact:**
https://github.com/SSWConsulting/SSW.Website/actions/runs/{{env.GITHUB_RUN_ID}}/artifacts/{{ env.ARTIFACT_ID}} for more details.
70 changes: 70 additions & 0 deletions .github/workflows/daily-image-tests.yml
@@ -0,0 +1,70 @@
name: Daily broken images check

on:
schedule:
# Every Weekday at 8 AM AEDT - https://cron.help/#0_21_*_*_SUN-THU
- cron: "0 21 * * SUN-THU"
workflow_dispatch:
inputs:
deploy_url:
description: "The URL of the site to test"
required: true
tests_to_run:
description: "The tests to run"
required: true
create_issue:
description: "Create an issue if there are broken images"
type: boolean
default: true
defaults:
run:
shell: pwsh

env:
create_issue: ${{ github.event.inputs.create_issue || true }}

jobs:
check-broken-images:
name: Run Playwright Tests
uses: ./.github/workflows/template-ui-tests.yml
with:
deploy_url: ${{ inputs.deploy_url || 'https://ssw.com.au' }}
tests_to_run: ${{ inputs.tests_to_run || 'images'}}
continue-on-failure: true

env-output:
name: Env Output
runs-on: ubuntu-latest
needs: check-broken-images
outputs:
create_issue: ${{ steps.envs.outputs.create_issue }}
steps:
- name: Env variables into Output # this is necessary as env variables are not accessible at Job level
id: envs
shell: pwsh
run: |
echo "Test passed : ${{ needs.check-broken-images.outputs.testPassed }}"
echo "Artifact Id: ${{ needs.check-broken-images.outputs.artifact-id }}"
$create_issue='${{ env.create_issue }}'
echo "create_issue=$create_issue" >> $env:GITHUB_OUTPUT

create-an-issue:
name: GitHub Issue
runs-on: ubuntu-latest
needs:
- check-broken-images
- env-output
if: ${{ needs.env-output.outputs.create_issue == 'true' && needs.check-broken-images.outputs.testPassed == 'false'}}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Create an Issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: "Broken Images on Homepage"
ARTIFACT_ID: ${{ needs.check-broken-images.outputs.artifact-id }}
GITHUB_RUN_ID: ${{ github.run_id }}
with:
filename: .github/ISSUE_TEMPLATE/auto_bug_report.md
2 changes: 0 additions & 2 deletions .github/workflows/main-build-and-deploy.yml
Expand Up @@ -73,7 +73,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Deploy to staging
id: deploy
Expand Down Expand Up @@ -108,7 +107,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Azure CLI - Login
uses: azure/login@v2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main-infra.yml
Expand Up @@ -30,7 +30,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Build
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-main-infra-check.yml
Expand Up @@ -33,7 +33,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Build
run: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/pr-push-deploy.yml
Expand Up @@ -68,7 +68,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Deploy to slot
uses: ./.github/actions/deploy
Expand All @@ -90,7 +89,6 @@ jobs:
message: |
Deployed changes to <${{ steps.deploy.outputs.url }}>
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]"
allow-repeats: true

ui-test:
Expand Down Expand Up @@ -137,5 +135,4 @@ jobs:

View the full report <https://pagespeed.web.dev/report?url=${{ needs.pr-deploy.outputs.url }}>
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: "github-actions[bot]"
allow-repeats: true
1 change: 0 additions & 1 deletion .github/workflows/template-build.yml
Expand Up @@ -40,7 +40,6 @@ jobs:
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict

- name: Get current date
id: date
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/template-ui-tests.yml
Expand Up @@ -9,11 +9,25 @@ on:
tests_to_run:
type: string
required: true
continue-on-failure:
type: boolean
required: false
outputs:
artifact-id:
description: "Playwright Artifact ID"
value: ${{ jobs.test.outputs.artifact-id }}
testPassed:
description: "Test Passed"
value: ${{ jobs.test.outputs.testPassed }}
amankumarrr marked this conversation as resolved.
Show resolved Hide resolved

jobs:
test:
name: Run Playwright tests
runs-on: ubuntu-latest
continue-on-error: ${{ inputs.continue-on-failure || false }}
outputs:
testPassed: ${{ steps.onFailure.outputs.testPassed || 'true' }}
artifact-id: ${{ steps.artifact-report.outputs.artifact-id }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -42,12 +56,22 @@ jobs:
retry-delay: 10s

- name: Run Playwright tests
id: run
run: npx playwright test ${{ inputs.tests_to_run }}
env:
HOST_URL: ${{ inputs.deploy_url }}

- name: Run on failure
id: onFailure
shell: pwsh
if: failure() && steps.run.outcome == 'failure'
run: |
$testPassed='false'
echo "testPassed=$testPassed" >> $env:GITHUB_OUTPUT

- uses: actions/upload-artifact@v4
if: always()
id: artifact-report
with:
name: playwright-report
path: playwright-report/
Expand Down
2 changes: 2 additions & 0 deletions components/blocks/clientLogos.tsx
Expand Up @@ -15,6 +15,8 @@ export const ClientLogos = () => {
alt={client.clientName + " logo"}
height={113}
width={200}
// commented out to test whether this is breaking images on the homepage see #2368
//sizes="20vw"
amankumarrr marked this conversation as resolved.
Show resolved Hide resolved
className="my-4 max-w-full rounded-lg"
/>
))}
Expand Down
1 change: 1 addition & 0 deletions next.config.mjs
Expand Up @@ -8,6 +8,7 @@ const config = {
},
poweredByHeader: false,
images: {
deviceSizes: [384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840],
remotePatterns: [
{
protocol: "https",
Expand Down
12 changes: 6 additions & 6 deletions playwright.config.ts
Expand Up @@ -50,13 +50,13 @@ export default defineConfig({
// },

/* Test against mobile viewports. */
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// name: "Mobile Safari",
// use: { ...devices["iPhone 12"] },
// },

/* Test against branded browsers. */
Expand Down
41 changes: 0 additions & 41 deletions ui-tests/components/bookingForm.spec.ts

This file was deleted.

4 changes: 2 additions & 2 deletions ui-tests/images.spec.ts
Expand Up @@ -7,7 +7,7 @@ test("Images load successfully on index", async ({ page }) => {
}
});

const response = await page.goto("/", { waitUntil: "networkidle" });
const response = await page.goto("/", { waitUntil: "commit" });
expect(response.ok()).toBeTruthy();

// Taken from https://github.com/microsoft/playwright/issues/19277
Expand All @@ -32,7 +32,7 @@ test("Images load successfully on consulting page", async ({ page }) => {
});

const response = await page.goto("/consulting/react", {
waitUntil: "networkidle",
waitUntil: "commit",
});
expect(response.ok()).toBeTruthy();

Expand Down