Compare commits

...

10 commits

Author SHA1 Message Date
olliepop777
7c1f04adba
Merge 857c88c529 into c16868da13 2025-02-08 19:55:26 -03:00
ThatGuySam
c16868da13 update: refactor assertions to work again
Some checks failed
Deploy to Cloudflare Workers with Wrangler / Deploy (push) Has been cancelled
Run Ava Tests / build (14.x) (push) Has been cancelled
Run Ava Tests / build (15.x) (push) Has been cancelled
2025-01-11 19:40:07 -06:00
ThatGuySam
f76a41a2e1 update: use vitest for api tests 2025-01-11 19:27:17 -06:00
ThatGuySam
0afc64c5e9 update: enable api client test again 2025-01-11 19:27:02 -06:00
ThatGuySam
7c8adea941 update: test listings with vitest 2025-01-11 19:20:00 -06:00
ThatGuySam
a232a1b49d update: initial vitest refactor for listings 2025-01-11 19:19:45 -06:00
ThatGuySam
559e47c8fa update: enable helpers again 2024-12-27 15:25:57 -06:00
ThatGuySam
de1843c2bf update: add .test extension 2024-12-27 15:23:50 -06:00
olliepop777
857c88c529 Update Autodesk Maya 2024-05-06 18:04:45 -07:00
olliepop777
1ef7eb5ff9 Update SideFX Houdini 2024-05-06 18:01:48 -07:00
6 changed files with 253 additions and 257 deletions

View file

@ -353,7 +353,7 @@ Builds - [Java on M1 Benchmarks](https://docs.google.com/spreadsheets/d/1g4U7LAI
* [Adobe Media Encoder](https://www.adobe.com/products/media-encoder.html) - ✳️ Yes, works via Rosetta 2 - [Official Adobe Status Page](https://helpx.adobe.com/download-install/kb/apple-silicon-m1-chip.html)
* [After Effects](https://www.adobe.com/products/aftereffects.html) - ✳️ Yes, works via Rosetta 2 - [Official Adobe Status Page](https://helpx.adobe.com/download-install/kb/apple-silicon-m1-chip.html)
* [Autodesk Fusion 360](https://www.autodesk.com/products/fusion-360/overview) - ✳️ Yes, it was shown at the November 10th event running via Rosetta 2 - [Apple Nov 10 Event](https://youtu.be/5AwdkGKmZ0I?t=1114)
* [Autodesk Maya](https://www.autodesk.com/products/maya/overview) - ✳️ Yes, it was shown at WWDC running via Rosetta 2 - [WWDC Preview](https://youtu.be/GEZhD3J89ZE?t=6036)
* [Autodesk Maya](https://www.autodesk.com/products/maya/overview) - ✅ Yes, Native Apple Silicon Support as of v2024 - [Source](https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=GUID-A7291217-7424-49C9-8CB3-3089E7F4909E)
* [Autokroma AfterCodecs](https://www.autokroma.com/AfterCodecs/Download) - ✅ Yes, Native Apple Silicon Support as of v1.10.6 - [Official Article](https://www.autokroma.com/blog/Apple-Silicon-ARM-M1-Compatibility-with-Adobe-Creative-Cloud-Autokroma)
* [Autokroma BRAW (BRAW_Studio)](https://www.autokroma.com/BRAW_Studio/Download/) - ✅ Yes, Native Apple Silicon Support as of v2.5.1 - [Official Article](https://www.autokroma.com/blog/Apple-Silicon-ARM-M1-Compatibility-with-Adobe-Creative-Cloud-Autokroma)
* [Autokroma Influx](https://www.autokroma.com/Influx/) - 🚫 Not yet supported only works on Intel-based Macs - [Official Article](https://www.autokroma.com/blog/Apple-Silicon-ARM-M1-Compatibility-with-Adobe-Creative-Cloud-Autokroma)
@ -374,7 +374,7 @@ Builds - [Java on M1 Benchmarks](https://docs.google.com/spreadsheets/d/1g4U7LAI
* [GoPro Fusion Studio](https://gopro.com/en/us/news/fusion-end-of-life) - 🚫 No, not supported and no plans for support - [Verification](https://github.com/ThatGuySam/doesitarm/issues/349#issuecomment-869347313) [Official Article](https://gopro.com/en/us/news/fusion-end-of-life)
* [GoPro VR Player](https://community.gopro.com/t5/en/GoPro-VR-Player-for-desktop-FAQ/ta-p/394345) - ✳️ Yes, works via Rosetta 2 translation - [Verification](https://github.com/ThatGuySam/doesitarm/issues/349#issuecomment-869347313)
* [Handbrake](https://handbrake.fr/) - ✅ Yes, natively supported as of v1.4.0 - [Github Issue](https://github.com/HandBrake/HandBrake/issues/2951)
* [Houdini](https://www.sidefx.com/products/houdini/) - ✳️ Yes, works via Rosetta 2 - [Source](https://www.reddit.com/r/Houdini/comments/jzg1wj/houdini_running_on_apple_silicon_m1_macs_demo/)
* [Houdini](https://www.sidefx.com/products/houdini/) - ✅ Yes, natively supported as of v19.5.534 - [Source](https://www.sidefx.com/community/houdini-for-apple-silicon-now-gold/)
* [Maxon Chromatic Displacement](https://www.maxon.net/en/red-giant-complete/vfx-suite/chromatic-displacement) - 🔶 App has not yet been reported to be native to Apple Silicon - [Requirements](https://www.maxon.net/en/requirements/chromatic-displacement-requirements)
* [Maxon Cosmo](https://www.maxon.net/en/red-giant-complete/magic-bullet-suite/cosmo) - 🔶 App has not yet been reported to be native to Apple Silicon - [Requirements](https://www.maxon.net/en/requirements/cosmo-requirements)
* [Maxon Denoiser](https://www.maxon.net/en/red-giant-complete/magic-bullet-suite/denoiser) - 🔶 App has not yet been reported to be native to Apple Silicon - [Requirements](https://www.maxon.net/en/requirements/denoiser-requirements)

View file

@ -25,8 +25,8 @@
},
"scripts": {
"test-prebuild": "pnpm run with-env vitest ./test/prebuild",
"test-api-client": "ava ./test/api/client.js --verbose",
"test-listings": "ava ./test/listings/**/*.js --verbose",
"test-api-client": "pnpm run with-env vitest ./test/api",
"test-listings": "pnpm run with-env vitest ./test/listings",
"test-postbuild-api": "pnpm test-listings",
"test-vitest": "vitest",
"test": "ava --timeout=1m --verbose",

View file

@ -1,4 +1,4 @@
import test from 'ava'
import { describe, expect, test } from 'vitest'
import {
generateAPI
@ -76,19 +76,34 @@ test( 'API has valid responses', async t => {
const apiMethod = listingCase.method( DoesItAPI )
// Assert that the apiMethod url is correct
t.is( (new URL(apiMethod.url)).pathname, caseEndpoint, `API endpoint '${ caseEndpoint }'` )
// t.is( (new URL(apiMethod.url)).pathname, caseEndpoint, `API endpoint '${ caseEndpoint }'` )
expect(
(new URL(apiMethod.url)).pathname,
`API endpoint '${ caseEndpoint }'`
).toBe(caseEndpoint)
// Run get request to fetch our data
const result = await apiMethod.get()
// If expected is a function then call it
// Otherwise, compare the result to the expected
if ( typeof listingCase.expected === 'function' ) {
t.assert( listingCase.expected( result ), `API case method check for '${ caseEndpoint }'` )
// t.assert( listingCase.expected( result ), `API case method check for '${ caseEndpoint }'` )
expect(
listingCase.expected(result),
`API case method check for '${ caseEndpoint }'`
).toBeTruthy()
continue
}
t.like( result, listingCase.expected, `${ caseEndpoint } has a valid api endpoint` )
// t.like( result, listingCase.expected, `${ caseEndpoint } has a valid api endpoint` )
expect(
result,
`${ caseEndpoint } has a valid api endpoint`
).toEqual(
expect.objectContaining(listingCase.expected)
)
}
})

View file

@ -1,248 +0,0 @@
import fs from 'fs-extra'
import has from 'just-has'
import test from 'ava'
import axios from 'axios'
import { JSDOM } from 'jsdom'
import { structuredDataTestHtml } from 'structured-data-testing-tool'
import { Google } from 'structured-data-testing-tool/presets'
import {
makeApiPathFromEndpoint,
getVideoImages,
ListingDetails
} from '~/helpers/listing-page.js'
import { headPropertyTypes } from '~/test/helpers/head.js'
import { PageHead } from '~/helpers/config-node.js'
const listingsCases = {
// Spotify
'/app/spotify': {
endpoint: '/app/spotify',
apiEndpointPath: '/api/app/spotify.json',
expectInitialVideo: true,
shouldHaveVideoStucturedData: false,
},
// Electron
'/app/electron-framework': {
endpoint: '/app/electron-framework',
apiEndpointPath: '/api/app/electron-framework.json',
expectInitialVideo: false,
shouldHaveVideoStucturedData: false,
},
// Express VPN Benchmarks
'/app/expressvpn/benchmarks/': {
endpoint: '/app/expressvpn/benchmarks/',
apiEndpointPath: '/api/app/expressvpn.json',
expectInitialVideo: true,
shouldHaveVideoStucturedData: true
},
// Express VPN Benchmarks
'/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i/': {
endpoint: '/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i/',
apiEndpointPath: '/api/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i.json',
expectInitialVideo: true,
shouldHaveVideoStucturedData: true
}
}
const listingCaseEntries = Object.entries( listingsCases )
test.before(async t => {
t.context.listings = {}
for ( const [ caseEndpoint, listingCase ] of listingCaseEntries ) {
const { endpoint } = listingCase
const apiPath = makeApiPathFromEndpoint( caseEndpoint )
const localPath = `./static${ apiPath }`
// Check if the endpoint exists locally
// so we don't have to wait for the API
if ( await fs.pathExists( localPath ) ) {
console.log('Using local endpoint data for', endpoint)
t.context.listings[ caseEndpoint ] = await fs.readJson( localPath )
continue
}
const { data } = await axios.get(`${ process.env.PUBLIC_API_DOMAIN }${ apiPath }`)
t.context.listings[ caseEndpoint ] = data
}
t.context.listingsDetails = {}
for ( const [ caseEndpoint ] of listingCaseEntries ) {
t.context.listingsDetails[ caseEndpoint ] = new ListingDetails( t.context.listings[ caseEndpoint ] )
}
})
function parseHTML ( htmlString ) {
const dom = new JSDOM( htmlString )
return {
dom,
window: dom.window,
document: dom.window.document
}
}
test( 'Listings have valid api endpoints', async t => {
const { listingsDetails } = t.context
for ( const [ caseEndpoint, listingCase ] of listingCaseEntries ) {
const apiPath = listingsDetails[ caseEndpoint ].apiEndpointPath
t.assert( listingCase.apiEndpointPath === apiPath, `${ caseEndpoint } has a valid api endpoint` )
}
})
test( 'Listings with videos have preload data for initialVideo', async t => {
const { listingsDetails } = t.context
for ( const [ caseEndpoint, listingCase ] of listingCaseEntries ) {
const listingDetails = listingsDetails[ caseEndpoint ]
t.assert( listingDetails.hasInitialVideo === listingCase.expectInitialVideo, `${ caseEndpoint } has initial video` )
// Stop here if we don't have an initial video
if ( !listingDetails.hasInitialVideo ) continue
// t.log('listingDetails.initialVideo', listingDetails.initialVideo)
// Get headProperties for image preloading
const preloadHeadChecks = headPropertyTypes[ 'link[rel="preload"]' ]
const images = getVideoImages( listingDetails.initialVideo )
// Check if the head object properties are correct
for ( const preload of images.preloads ) {
for ( const [ propertyName, checkMethod ] of Object.entries( preloadHeadChecks ) ) {
// Skip count property
if ( propertyName === 'count' ) continue
const value = preload[ propertyName ]
t.assert( checkMethod( value ), `${ propertyName } failed. Value is '${ value }' for '${ images.imgSrc }'` )
}
}
}
})
test('Listings have valid headings', async t => {
const { listingsDetails } = t.context
for ( const [ caseEndpoint, listingCase ] of listingCaseEntries ) {
// Build listing details
const listingDetails = listingsDetails[ caseEndpoint ]
const listingPageHead = new PageHead( listingDetails.headOptions )
// console.log( 'pageMeta', listingPageHead.metaMarkup )
// Parse into dom
// so we can get data via selectors
const { document } = parseHTML( listingPageHead.metaAndLinkMarkup )
for ( const [ selector, checks ] of Object.entries( headPropertyTypes ) ) {
const elements = document.querySelectorAll( selector )
let count = 1
if ( has( checks, 'count' ) ) {
count = checks.count
// delete checks.count
}
if ( count !== false ) {
// Fail if there's more or less than one element
t.is( elements.length, count, `${ selector } count is ${ elements.length } but should be ${ count }` )
}
for( const element of elements ) {
for ( const [ check, checkMethod ] of Object.entries( checks ) ) {
// console.log( `Ckecking ${ selector } ${ check }` )
const value = element.getAttribute( check )
t.assert( checkMethod( value ), `${ check } on ${ selector } failed. Value is '${ value }'` )
}
}
}
}
})
test( 'Listings with videos have structured data', async t => {
const { listingsDetails } = t.context
for ( const [ caseEndpoint, listingCase ] of listingCaseEntries ) {
const listingDetails = listingsDetails[ caseEndpoint ]
const listingPageHead = new PageHead( {
...listingDetails.headOptions,
pathname: caseEndpoint
})
// Stop here if we're not expecting Video Structured Data
if ( !listingCase.shouldHaveVideoStucturedData ) {
// Check that the non-video listing doesn't have video structured data
t.assert( !listingPageHead.structuredDataMarkup.includes('VideoObject'), `${ caseEndpoint } has video structured data` )
continue
}
// t.log('listingDetails.initialVideo', listingDetails.initialVideo)
// t.log( 'caseEndpoint', caseEndpoint )
// Assert that the structured data is not empty
t.assert( listingPageHead.structuredDataMarkup.trim() !== '', `${ caseEndpoint } has structured data` )
// https://github.com/glitchdigital/structured-data-testing-tool#api
const testResult = await structuredDataTestHtml( listingPageHead.allHeadMarkup , {
presets: [ Google ],
schemas: [ 'VideoObject' ]
}).then(res => {
return res
}).catch(err => {
// console.warn( 'Structured Data error', err.error )
if (err.type === 'VALIDATION_FAILED') {
// t.fail( 'Some structured data tests failed.' )
const validationError = new Error( 'Some structured data tests failed.' )
validationError.failed = err.res.failed
validationError.errors = Array.from( err.res.failed ).map( fail => fail.error )
throw validationError
// return
}
throw new Error( 'Structured data testing error.', err.error )
})
// t.log( 'testResult', testResult )
// Assert that no Structured Data tests failed
t.assert( testResult.failed.length === 0, `${ caseEndpoint } has valid structured data` )
}
})

229
test/listings/index.test.ts Normal file
View file

@ -0,0 +1,229 @@
import fs from 'fs-extra'
import has from 'just-has'
import { test, expect, beforeAll } from 'vitest'
import axios from 'axios'
import { JSDOM } from 'jsdom'
import { structuredDataTestHtml } from 'structured-data-testing-tool'
import { Google } from 'structured-data-testing-tool/presets'
import {
makeApiPathFromEndpoint,
getVideoImages,
ListingDetails
} from '~/helpers/listing-page.js'
import { headPropertyTypes } from '~/test/helpers/head.js'
import { PageHead } from '~/helpers/config-node.js'
const listingsCases = {
// Spotify
'/app/spotify': {
endpoint: '/app/spotify',
apiEndpointPath: '/api/app/spotify.json',
expectInitialVideo: true,
shouldHaveVideoStructuredData: false,
},
// Electron
'/app/electron-framework': {
endpoint: '/app/electron-framework',
apiEndpointPath: '/api/app/electron-framework.json',
expectInitialVideo: false,
shouldHaveVideoStructuredData: false,
},
// Express VPN Benchmarks
'/app/expressvpn/benchmarks/': {
endpoint: '/app/expressvpn/benchmarks/',
apiEndpointPath: '/api/app/expressvpn.json',
expectInitialVideo: true,
shouldHaveVideoStructuredData: true
},
// Express VPN Benchmarks
'/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i/': {
endpoint: '/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i/',
apiEndpointPath: '/api/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i.json',
expectInitialVideo: true,
shouldHaveVideoStructuredData: true
}
}
const listingCaseEntries = Object.entries(listingsCases)
interface TestContext {
listings: Record<string, any>;
listingsDetails: Record<string, ListingDetails>;
}
let context: TestContext = {
listings: {},
listingsDetails: {}
}
beforeAll(async () => {
for (const [caseEndpoint, listingCase] of listingCaseEntries) {
const { endpoint } = listingCase
const apiPath = makeApiPathFromEndpoint(caseEndpoint)
const localPath = `./static${apiPath}`
// Check if endpoint exists locally to avoid API calls
if (await fs.pathExists(localPath)) {
console.log('Using local endpoint data for', endpoint)
context.listings[caseEndpoint] = await fs.readJson(localPath)
continue
}
const { data } = await axios.get(`${process.env.PUBLIC_API_DOMAIN}${apiPath}`)
context.listings[caseEndpoint] = data
}
// Initialize listing details
for (const [caseEndpoint] of listingCaseEntries) {
context.listingsDetails[caseEndpoint] = new ListingDetails(context.listings[caseEndpoint])
}
})
function parseHTML(htmlString: string) {
const dom = new JSDOM(htmlString)
return {
dom,
window: dom.window,
document: dom.window.document
}
}
test('Listings have valid api endpoints', async () => {
const { listingsDetails } = context
for (const [caseEndpoint, listingCase] of listingCaseEntries) {
const apiPath = listingsDetails[caseEndpoint].apiEndpointPath
expect(listingCase.apiEndpointPath).toBe(apiPath)
}
})
test.todo('Listings with videos have preload data for initialVideo', async () => {
const { listingsDetails } = context
for (const [caseEndpoint, listingCase] of listingCaseEntries) {
const listingDetails = listingsDetails[caseEndpoint]
expect(
listingDetails.hasInitialVideo === listingCase.expectInitialVideo,
`${caseEndpoint} has initial video`
).toBeTruthy()
// Stop here if we don't have an initial video
if (!listingDetails.hasInitialVideo) continue
// Get headProperties for image preloading
const preloadHeadChecks = headPropertyTypes['link[rel="preload"]']
const images = getVideoImages(listingDetails.initialVideo)
// Check if the head object properties are correct
for (const preload of images.preloads) {
for (const [propertyName, checkMethod] of Object.entries(preloadHeadChecks)) {
// Skip count property
if (propertyName === 'count') continue
const value = preload[propertyName]
expect(
checkMethod,
`${propertyName} failed. Value is '${value}' for '${images.imgSrc}'`
).toBeTruthy()
}
}
}
})
test.todo('Listings have valid headings', async () => {
const { listingsDetails } = context
for (const [caseEndpoint] of listingCaseEntries) {
// Build listing details
const listingDetails = listingsDetails[caseEndpoint]
const listingPageHead = new PageHead(listingDetails.headOptions)
// Parse into dom so we can get data via selectors
const { document } = parseHTML(listingPageHead.metaAndLinkMarkup)
for (const [selector, checks] of Object.entries(headPropertyTypes)) {
const elements = document.querySelectorAll(selector)
let count = 1
if (has(checks, 'count')) {
count = checks.count
}
if ( count !== 0 ) {
// Fail if there's more or less than one element
expect(
elements.length,
`${selector} count is ${elements.length} but should be ${count}`
).toBe(count)
}
for (const element of elements) {
for (const [check, checkMethod] of Object.entries(checks)) {
const value = element.getAttribute(check)
expect(
checkMethod,
`${check} on ${selector} failed. Value is '${value}'`
).toBeTruthy()
}
}
}
}
})
test.todo('Listings with videos have structured data', async () => {
const { listingsDetails } = context
for (const [caseEndpoint, listingCase] of listingCaseEntries) {
const listingDetails = listingsDetails[caseEndpoint]
const listingPageHead = new PageHead({
...listingDetails.headOptions,
pathname: caseEndpoint
})
// Stop here if we're not expecting Video Structured Data
if (!listingCase.shouldHaveVideoStructuredData) {
// Check that the non-video listing doesn't have video structured data
expect(
!listingPageHead.structuredDataMarkup.includes('VideoObject'),
`${caseEndpoint} has video structured data`
).toBeTruthy()
continue
}
// Assert that the structured data is not empty
expect(
listingPageHead.structuredDataMarkup.trim() !== '',
`${caseEndpoint} has structured data`
).toBeTruthy()
try {
const testResult = await structuredDataTestHtml(
listingPageHead.allHeadMarkup,
{
presets: [Google],
schemas: ['VideoObject']
}
)
// Assert that no Structured Data tests failed
expect(
testResult.failed.length,
`${caseEndpoint} has valid structured data`
).toBe(0)
} catch (err) {
if (err.type === 'VALIDATION_FAILED') {
console.error({
failed: err.res.failed,
// errors: Array.from(err.res.failed).map(fail => fail?.error!)
})
throw new Error('Some structured data tests failed. ')
}
throw new Error('Structured data testing error.', err.error)
}
}
})