-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blueprints: Use the major WordPress version to download RC/beta trans…
…lations (#2017) Uses a major WordPress version to fetch the translations, e.g. `https://downloads.wordpress.org/translation/core/6.6-RC/en_US.zip` instead of `https://downloads.wordpress.org/translation/core/6.6.1-RC/en_US.zip` This fixes an issue introduced in #1987 that caused the E2E tests to fail on trunk: ``` ✘ 77 [chromium] › blueprints.spec.ts:438:6 › should translate WP-admin to Spanish for the beta WordPress build (retry #3) (30.2s) ``` The setSiteLanguage step would try to download the translations from https://downloads.wordpress.org/translation/core/6.7.1-RC/es_ES.zip which responded with a 404, instead of https://downloads.wordpress.org/translation/core/6.7-RC/es_ES.zip where the translations are actually available. ## Testing instructions * Confirm the E2E tests pass * Go here and confirm you can see a Spanish version of wp admin: http://localhost:5400/website-server/?language=es_ES&url=%2Fwp-admin%2F&wp=beta&modal=error-report
- Loading branch information
Showing
2 changed files
with
62 additions
and
33 deletions.
There are no files selected for viewing
78 changes: 52 additions & 26 deletions
78
packages/playground/blueprints/src/lib/steps/set-site-language.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,73 @@ | ||
import { MinifiedWordPressVersions } from '@wp-playground/wordpress-builds'; | ||
import { getWordPressTranslationUrl } from './set-site-language'; | ||
|
||
describe('getTranslationUrl()', () => { | ||
it('should return a major.minor translation URL for a major.minor version', () => { | ||
expect(getWordPressTranslationUrl('6.6', 'en_US')).toBe( | ||
'https://downloads.wordpress.org/translation/core/6.6/en_US.zip' | ||
); | ||
}); | ||
|
||
it('should return a major.minor.patch translation URL for a major.minor.patch version', () => { | ||
expect(getWordPressTranslationUrl('6.5.1', 'es_ES')).toBe( | ||
'https://downloads.wordpress.org/translation/core/6.5.1/es_ES.zip' | ||
); | ||
}); | ||
|
||
[ | ||
{ | ||
version: '6.6-RC1', | ||
versionString: '6.2', | ||
latestBetaVersion: '6.6-RC', | ||
latestMinifiedVersion: '6.5.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.2/en_US.zip`, | ||
description: | ||
'should return a major.minor translation URL when the input version string is in a major.minor format', | ||
}, | ||
{ | ||
versionString: '6.2.1', | ||
latestBetaVersion: '6.3.1-RC', | ||
latestMinifiedVersion: '6.4.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.2.1/en_US.zip`, | ||
description: | ||
'should return a major.minor.patch translation URL when the input version string is in a major.minor.patch format', | ||
}, | ||
{ | ||
versionString: '6.6-RC1', | ||
latestBetaVersion: '6.6-RC', | ||
latestMinifiedVersion: '6.5.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.6-RC/en_US.zip`, | ||
description: | ||
'should return the latest RC translation URL for a RC version', | ||
}, | ||
{ | ||
version: '6.6-beta2', | ||
versionString: '6.6-beta2', | ||
latestBetaVersion: '6.6-RC', | ||
latestMinifiedVersion: '6.5.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.6-RC/en_US.zip`, | ||
description: | ||
'should return the latest RC translation URL for a beta version', | ||
}, | ||
{ | ||
version: '6.6-nightly', | ||
versionString: '6.6-nightly', | ||
latestBetaVersion: '6.6-RC', | ||
latestMinifiedVersion: '6.5.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.6-RC/en_US.zip`, | ||
description: | ||
'should return the latest RC translation URL for a nightly version', | ||
}, | ||
{ | ||
version: '6.8-alpha-59408', | ||
versionString: '6.8-alpha-59408', | ||
latestBetaVersion: '6.8-RC', | ||
latestMinifiedVersion: '6.7.2', | ||
expectedUrl: `https://downloads.wordpress.org/translation/core/6.8-RC/en_US.zip`, | ||
description: | ||
'should return the latest RC translation URL for an alpha version', | ||
}, | ||
].forEach(({ version, description }) => { | ||
it(description, () => { | ||
const latestBetaVersion = | ||
MinifiedWordPressVersions['beta'].split('-')[0]; | ||
expect(getWordPressTranslationUrl(version, 'en_US')).toBe( | ||
`https://downloads.wordpress.org/translation/core/${latestBetaVersion}-RC/en_US.zip` | ||
); | ||
}); | ||
}); | ||
].forEach( | ||
({ | ||
versionString, | ||
latestBetaVersion, | ||
latestMinifiedVersion, | ||
expectedUrl, | ||
description, | ||
}) => { | ||
it(description, () => { | ||
expect( | ||
getWordPressTranslationUrl( | ||
versionString, | ||
'en_US', | ||
latestBetaVersion, | ||
latestMinifiedVersion | ||
) | ||
).toBe(expectedUrl); | ||
}); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters