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 - Adding Playwright Tests #8804

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b01cf28
a release note about release notes
stevector Dec 14, 2023
b913994
a release note about release notes
stevector Dec 14, 2023
441a713
adding another sample
stevector Dec 14, 2023
aecdfff
rename dir
stevector Dec 14, 2023
9744350
trying to get release notes pages generating
stevector Dec 14, 2023
bb2f193
starting to get release notes loading
stevector Dec 14, 2023
1225a00
releaseNotesListing
stevector Dec 14, 2023
1f7f50d
bring back deleted stuff
stevector Dec 14, 2023
ef9e33b
more progress on release notes
stevector Dec 14, 2023
b382559
adding a note
stevector Dec 14, 2023
8a4d7e0
updates
stevector Dec 14, 2023
1c64f89
release notes
stevector Dec 14, 2023
a86b85e
getting categories partially working
stevector Dec 14, 2023
1920864
starting on a separate category component
stevector Dec 14, 2023
7822081
more release notes cleanup
stevector Dec 14, 2023
8d284e5
listing all
stevector Dec 14, 2023
b2319aa
category listing
stevector Dec 15, 2023
3e0d46c
moar templating
stevector Dec 15, 2023
016065f
getting tests passing
stevector Dec 18, 2023
7e7e457
adding playwright examples
stevector Dec 18, 2023
38ac5e6
Adding Playwright example
stevector Dec 18, 2023
a2925c1
run in the correct dir
stevector Dec 18, 2023
d72f07d
hard-code url
stevector Dec 18, 2023
073638d
setting base url as variable
stevector Dec 18, 2023
09862cb
need to handle building on main
stevector Dec 18, 2023
2bcf7c1
setting pr number
stevector Dec 18, 2023
56112a7
fixing path for test reports
stevector Dec 18, 2023
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
32 changes: 32 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Playwright Tests
# todo, this GitHub Action should either be Triggered by Pantheon's build process
# phoning back to GitHub Actions after the deployment completes
# Or the GitHub Action will need to poll somehow that the deployment has completed.
# The Gatsby Build Process could place a file that reports that Git Hash that it was
# built from. Check that via polling.
on:
pull_request:
branches: [ main, master ]
env:
GITHUB_PR_NUMBER: ${{ github.event.number }}
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: cd tests && npm ci
- name: Install Playwright Browsers
run: cd tests && npx playwright install --with-deps
- name: Run Playwright tests
run: cd tests && npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: tests/playwright-report/
retention-days: 30
13 changes: 13 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ module.exports = {
name: `changelogs`,
},
},

{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/releasenotes`,
name: `releasenotes`,
},
},





{
resolve: `gatsby-source-filesystem`,
options: {
Expand Down
121 changes: 109 additions & 12 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ const calculateSlug = (node, getNode) => {
const split = fileName.split('-'); // split the file name where hyphenated...
return `changelog/${split[0]}/${split[1]}` // and return a slug of changelog/YYYY/MM
}
// This section creates the releasenotes slug based on the YYYY-MM-DD-slug.md template
if (getNode(node.parent).absolutePath.includes("releasenotes")) { // If the file is in the releasenotes directory...
const split = fileName.split('-'); // split the file name where hyphenated...
// #todo, wait this should the slug should include all the words after the date, not just the first one.
// set a const to remaining slug based on the keys from split that are not the date.
const remainingSlug = split.slice(3).join('-');
return `releasenotes/${split[0]}/${split[1]}/${remainingSlug}` // and return a slug of releasenotes/YYYY/MM/slug
}

return `${fileName}` // Otherwise, as long as there is a filename in GraphQL, use it as the slug.
}
Expand Down Expand Up @@ -127,7 +135,7 @@ exports.createPages = ({ graphql, actions }) => {
{
allDocs: allMdx(
filter: {
fileAbsolutePath: { regex: "/content(?!/(partials|changelog|guides)/)/"}
fileAbsolutePath: { regex: "/content(?!/(partials|changelog|guides|releasenotes)/)/"}
frontmatter: {
draft: {ne: true}
}
Expand Down Expand Up @@ -184,6 +192,42 @@ exports.createPages = ({ graphql, actions }) => {
}
}

allReleaseNotes: allMdx(
filter: {
fileAbsolutePath: { regex: "/releasenotes/"}
},
sort: { fields: [fileAbsolutePath], order: DESC }
) {
edges {

previous {
fields {
slug
}
}

node {
id
frontmatter {
title,
categories,
published_date
}
fields {
slug
}
}

next {
fields {
slug
}
}

}
}


allChangelogs: allMdx(
filter: {
fileAbsolutePath: { regex: "/changelogs/"}
Expand Down Expand Up @@ -292,6 +336,21 @@ exports.createPages = ({ graphql, actions }) => {
}
})

// Create Terminus Command pages
const terminusCommands = result.data.dataJson.commands
terminusCommands.forEach(command => {
const slugRegExp = /:/g
const slug = command.name.replace(slugRegExp, "-")
createPage({
path: `terminus/commands/${slug}`,
component: path.resolve(`./src/templates/terminusCommand.js`),
context: {
slug: slug,
name: command.name
}
})
})

// Create changelog pages.
const changelogs = result.data.allChangelogs.edges
changelogs.forEach(changelog => {
Expand All @@ -309,21 +368,23 @@ exports.createPages = ({ graphql, actions }) => {
})
})

// Create Terminus Command pages
const terminusCommands = result.data.dataJson.commands
terminusCommands.forEach(command => {
const slugRegExp = /:/g
const slug = command.name.replace(slugRegExp, "-")


// Create each release note page.
const releaseNotes = result.data.allReleaseNotes.edges;
releaseNotes.forEach(releaseNote => {
const template = calculateTemplate(releaseNote.node, "releaseNote");
createPage({
path: `terminus/commands/${slug}`,
component: path.resolve(`./src/templates/terminusCommand.js`),
path: releaseNote.node.fields.slug,
component: path.resolve(`./src/templates/${template}.js`),
context: {
slug: slug,
name: command.name
}
slug: releaseNote.node.fields.slug,
},
})
console.log('hello');
})


// Create changelog pagination.
const postsPerPage = 6
const numPages = Math.ceil(changelogs.length / postsPerPage)
Expand All @@ -345,6 +406,36 @@ exports.createPages = ({ graphql, actions }) => {
})
})

// Create release notes without pagination. At a later date, we may want to add pagination.
// And can reused the code above.
createPage({
path: `/release-notes/`,
component: path.resolve("./src/templates/releaseNotesListing.js"),
})

const allowedReleaseNoteCategories = {
"security": {
"Display Name": "Security",
"color": "red"
},
"documentation": {
"Display Name": "Documentation",
"color": "purple"
},
};

// Loop through all allowed categories and create a page for each one.
Object.keys(allowedReleaseNoteCategories).forEach((category) => {
createPage({
path: `/release-notes/${category}`,
component: path.resolve("./src/templates/releaseNotesListingByCategory.js"),
context: {
category: category,
},
})
})


// Create contributor pages.
const contributors = result.data.allContributorYaml.edges
contributors.forEach(contributor => {
Expand Down Expand Up @@ -433,7 +524,7 @@ exports.onCreateNode = ({ node, getNode, actions }) => {
}
}

if (sourceInstanceName === 'changelogs') {
if (sourceInstanceName === 'changelogs' || sourceInstanceName === 'releasenotes') {
const content = matter(node.internal.content, { excerpt: true, excerpt_separator: '<!-- excerpt -->' } );
const excerpt = content.excerpt || "";

Expand All @@ -443,6 +534,7 @@ exports.onCreateNode = ({ node, getNode, actions }) => {
value: excerpt,
})


const textNode = {
id: `${node.id}-MarkdownBody`,
parent: node.id,
Expand Down Expand Up @@ -507,3 +599,8 @@ exports.onPreBootstrap = () => {

fs.copySync(scriptsCopyFrom, scriptsCopyTo)
}


/* todo should there be an error thrown if a release note category is set that is not allowed */
/* todo, infer published date from file name. And throw an error if there are files that don't follow the pattern. */
/* todo, make a json file of allowed categories, description of the category, color name */
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Pantheon Advanced Page Cache WordPress Plugin Updates"
published_date: "2023-08-08"
---


We released an update for the [Pantheon Advanced Page Cache](https://wordpress.org/plugins/pantheon-advanced-page-cache/) WordPress plugin which adds a filter to allow disabling surrogate keys for posts' taxonomy terms. This can be especially helpful for posts with large numbers of taxonomies (such as WooCommerce products with a large number of global attributes).

For more information, see [Pantheon documentation](/guides/wordpress-configurations/plugins#disable-surrogate-keys-for-taxonomy-terms).
9 changes: 9 additions & 0 deletions source/releasenotes/2023-08-18-php-security-updates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "PHP Security Updates"
published_date: "2023-08-18"
---


Pantheon has deployed PHP versions [8.2.9](https://www.php.net/ChangeLog-8.php#8.2.9), [8.1.22](https://www.php.net/ChangeLog-8.php#8.1.22), and [8.0.30](https://www.php.net/ChangeLog-8.php#8.0.30) to customer sites running on the platform. These releases address vulnerabilities disclosed in [CVE-2023-3823](https://nvd.nist.gov/vuln/detail/CVE-2023-3823) and [CVE-2023-3824](https://nvd.nist.gov/vuln/detail/CVE-2023-3824).

If you are using PHP 8.2, 8.1 or 8.0, there is nothing further that you need to do. If you are still on PHP 7.4 or earlier, though, you should schedule some time to upgrade to a supported version.While the vulnerabilities patched in these latest releases are not reported to affect PHP 7.4, the fact remains that there could be (and probably are) unpatched vulnerabilities in the end-of-life versions. Read more about it in Greg Anderson’s [blog post](https://pantheon.io/blog/php-829-security-release-demonstrates-pantheons-commitment-protecting-your-sites).
10 changes: 10 additions & 0 deletions source/releasenotes/2023-09-20-drupal-sa-core-2023-006.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Drupal Security Update: SA Core 2023-006"
published_date: "2023-09-20"
categories: [security]
---


On September 20th, [Drupal core updates were released to address a critical vulnerability in the JSON:API module](https://status.pantheon.io/incidents/vj842n7k7w40). Those updates became immediately available within the Pantheon dashboard for one-click code updates. Additionally, [our engineers updated our CDN to mitigate potential attacks](https://status.pantheon.io/incidents/598zxv2v8l7p).

If you have a Drupal site using JSON:API we suggest you update as soon as possible if you haven't done so already. And even if you aren't using JSON:API, it'll still feel good to apply an update, right? To better understand the nature of security updates, [come watch the Pantheon YouTube Livestream on October 25th](https://www.youtube.com/watch?v=WV2ZSeBOziU).
9 changes: 9 additions & 0 deletions source/releasenotes/2023-09-30-docs-design-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Documentation Site Updated with the Design System
published_date: "2023-09-30"
---


We're excited to announce that our documentation site has been seamlessly integrated with our brand-new design system. This enhancement brings a fresh and cohesive look to our documentation, providing a unified and visually appealing experience for our users. Explore the updated, improved, and more accessible [Docs site](/) today.

![Docs Design System](../images/DocsDesignSystem.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Front-End Build Site Caching
published_date: "2023-10-31"
---

Pantheon introduced a new build pipeline for Front End Sites to significantly improve build times. Beginning on November 13th, 2023, newly created sites are automatically using the new pipeline and cannot opt back to the old pipeline. Sites made prior to that date can opt-in to the new pipeline to take advantage of the new features. All pre-existing sites that do not opt-in will be switched over for new builds on or around January 15th.

Additionally, we are adding support for Node 18 (for dynamic sites) and 20 (for both static and dynamic sites). To select a specific version, Pantheon is [moving away from using .nvmrc](/guides/decoupled/overview/manage-settings#nodejs-version) and will instead look to the [“engines” field](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#engines) in your project’s `package.json` file.

12 changes: 12 additions & 0 deletions source/releasenotes/2023-11-02-terminus-composer-logs-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Terminus Composer Logs Plugin 1.0.0 Released
published_date: "2023-11-02"
---


Visibility into composer logs has been a top customer request. Now, if you need to debug a composer build failure due to an error, install the Terminus Composer Logs plugin on your machine to view more details. Upstream Update logs are also available. Installation instructions and command usage can be found here in the [plugin's GitHub repository](https://github.com/pantheon-systems/terminus-composer-logs-plugin).



TODO: Does this note belong in "action required?" Not every customer needs to do something. Only those who want to use the plugin.
After discussion with Ingrid, no this would not get "Action required". because that should only be used for things that would disrupt.
18 changes: 18 additions & 0 deletions source/releasenotes/2023-12-31-new-release-notes-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: New Release Notes Structure
published_date: "2023-12-31"
categories: [security, documentation]
---

For nearly a decade, we have published a monthly "changelog" here within our Documentation site that summarizes significant changes to the platform.
Going forward in 2024 we are changing some of the details of how we publish and organize this information.

Rather than treating the monthly retrospective as the base unit of information, we will instead publish a new "Release Note" for each significant change to the platform as needed, rather than waiting for the monthly summary.

This switch will support more proactive communication and ensure that any noteworthy change is marked here in addition to the blog posts, emails, and other channels we use to communicate with our customers.

Here you will find:
* A listing of all Release Notes at docs.pantheon.io/release-notes
* A listing of Release Notes by category (WordPress, Drupal, etc) like docs.pantheon.io/release-notes/infrastructure


39 changes: 39 additions & 0 deletions src/components/releaseNoteCategories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react"
import { Link } from "gatsby"

const ReleaseNoteCategories = ({categories}) => {

console.log(categories);

if (!categories) {
return null
}

return (
<div>
{/* If there is one category display the singular form. */
categories.length === 1
? <h3>Category:</h3>
: <h3>Categories:</h3>
}

{categories.map((category, index) => (
<div key={index}>

<Link
to={`/release-notes/${category}`}
>
<h4>{category}</h4>
</Link>



</div>
))
}
</div>

)
}

export default ReleaseNoteCategories
Loading
Loading