-
Notifications
You must be signed in to change notification settings - Fork 96
INT-3399: Add smoke test #446
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
Open
tiny-ben-tran
wants to merge
42
commits into
main
Choose a base branch
from
feature/INT-3399
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+200
−8
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
74f8072
Add a build file for running smoke tests
tiny-ben-tran 25f4da9
Install next angular version
tiny-ben-tran fb3c060
Fix command
tiny-ben-tran 934797c
Add smoketest file
tiny-ben-tran a5fa379
Update the test script to run browser tests only
tiny-ben-tran 9d34d34
Add a smoke-test bash script file
tiny-ben-tran 2a3b94c
Update jenkins smoke test file
tiny-ben-tran 57d3098
Fix jenkin errors
tiny-ben-tran 12575f1
Log messages
tiny-ben-tran da57e4b
Add the missing parall process
tiny-ben-tran 76f26f8
Try firefox
tiny-ben-tran abf48b1
Use remote command
tiny-ben-tran e57f0c8
Fix syntax
tiny-ben-tran 6a6c418
Add missing browser
tiny-ben-tran 095fc15
Move bashcript into jenkinsfile
tiny-ben-tran 07e31c3
Fix errors
tiny-ben-tran 3700ef9
More fixes
tiny-ben-tran 2622164
Use workspace
tiny-ben-tran 6a5bb32
Use double quotes where interpolation is required
tiny-ben-tran b6ebd98
Fix string
tiny-ben-tran 71c5dc7
Preserve double quotes in json format
tiny-ben-tran 7d8c46b
Use JSON utility functions to handle json
tiny-ben-tran 9e928ed
Enable tests on more platforms
tiny-ben-tran 7ece6dc
Reduce the number of times of installing the upcoming release
tiny-ben-tran f589733
Fix variable not defined
tiny-ben-tran 3e1d8a4
Move build target
tiny-ben-tran ccec3a3
Fix custom route file not found
tiny-ben-tran 709c5b3
Fix workspace error
tiny-ben-tran daa19e3
try again
tiny-ben-tran c8aa14b
Install dependencies on each browser test
tiny-ben-tran 1d9b70e
Revert previous changes
tiny-ben-tran 9cd6a37
Refactor
tiny-ben-tran 941ecd9
Default NPM_TAG param
tiny-ben-tran 3b42bba
Again
tiny-ben-tran 90d3e0a
more changes
tiny-ben-tran 7aef68b
Fix test directory not found
tiny-ben-tran 9665a0f
Echo the target framework version
tiny-ben-tran c32332d
Clean up
tiny-ben-tran 5d9eaac
Fix lint errors
tiny-ben-tran 66111d0
Stop running a node inside another node
tiny-ben-tran 439dd7c
More improvements
tiny-ben-tran 4f618dd
Fix node context issue
tiny-ben-tran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| #!groovy | ||
| @Library('waluigi@release/7') _ | ||
|
|
||
| properties([ | ||
| disableConcurrentBuilds(), | ||
| buildDiscarder(logRotator( | ||
| artifactDaysToKeepStr: '', | ||
| artifactNumToKeepStr: '1', | ||
| daysToKeepStr: '', | ||
| numToKeepStr: '50' | ||
| )), | ||
| parameters([ | ||
| string(defaultValue: 'next', description: 'The NPM publish tag ', name: 'NPM_TAG', trim: false), | ||
| ]) | ||
| ]) | ||
|
|
||
| // Generates a custom route file that contains the next version of Angular to test against | ||
| def generateNPMVersionRouteFile(Map args = new LinkedHashMap()) { | ||
| // @angular/core's version is the one baked into the angular app | ||
| def nextVersion = sh(script: "npm view @angular/core@${args.npm_tag} version", returnStdout: true).trim() | ||
|
|
||
| echo "Target framework version: ${nextVersion}" | ||
|
|
||
| def routeFileContent = readJSON text: """ | ||
| [{ | ||
| "request": { | ||
| "method": "get", | ||
| "path": "/custom/integration/info" | ||
| }, | ||
| "response": { | ||
| "status": 200, | ||
| "json": { | ||
| "version": "${nextVersion}" | ||
| } | ||
| } | ||
| }] | ||
| """ | ||
| writeJSON file: "${args.filePath}", json: routeFileContent | ||
| } | ||
|
|
||
| // Updates the Angular dependencies to the version specified by the npm tag | ||
| def updateDependenciesWithTag(Map args = new LinkedHashMap()) { | ||
| String npm_tag = args.npm_tag | ||
| sh "yarn add @angular/core@${npm_tag} @angular/animations@${npm_tag} @angular/common@${npm_tag} @angular/compiler@${npm_tag} @angular/core@${npm_tag} @angular/forms@${npm_tag} @angular/platform-browser@${npm_tag} @angular-devkit/build-angular@${npm_tag} @angular/cli@${npm_tag} @angular/compiler-cli@${npm_tag}" | ||
| } | ||
|
|
||
| def runSmokeTests(Map args = new LinkedHashMap()) { | ||
| def platforms = args.platforms ?: [ | ||
| [ browser: "chrome", provider: "lambdatest" ] | ||
| ] | ||
| String customRouteFilePath = "${WORKSPACE}/version.json" | ||
| String additionalArgs = "--chunk 20 --totalTimeout 1800000 --singleTimeout 90000 --retries 3 --customRoutes ${customRouteFilePath}" | ||
|
|
||
| def processes = [:] | ||
|
|
||
| for (int i = 0; i < platforms.size(); i++) { | ||
| def platform = platforms.get(i) | ||
| def buckets = platform.buckets ?: 1 | ||
|
|
||
| for (int bucket = 1; bucket <= buckets; bucket++) { | ||
| // clousure var - don't inline or jenkins complains | ||
| def currBucket = bucket | ||
| def suffix = currBucket == 1 ? '' : "-${currBucket}" | ||
|
|
||
| // Run using remote provider | ||
| if (platform.provider) { | ||
| def name = "${platform.browser}-${platform.provider}${suffix}" | ||
| processes[name] = { | ||
| stage("${name}") { | ||
| bedrockRemoteTools.tinyWorkSishTunnel() | ||
| bedrockRemoteTools.withRemoteCreds(platform.provider) { | ||
| String customArgs = additionalArgs + " --remote ${platform.provider}" | ||
| if (platform.provider == "aws") { | ||
| customArgs = customArgs + " --sishDomain \"sish.osu.tiny.work\"" | ||
| } | ||
| if (platform.os) { | ||
| customArgs = customArgs + " --platformName \"${platform.os}\"" | ||
| } | ||
|
|
||
| generateNPMVersionRouteFile(npm_tag: args.npm_tag, filePath: customRouteFilePath) | ||
| updateDependenciesWithTag(npm_tag: args.npm_tag) | ||
| bedrockTests( | ||
| name: name, | ||
| browser: platform.browser, | ||
| testDirs: [ "tinymce-angular-component/src/test/ts" ], | ||
| bucket: currBucket, | ||
| buckets: buckets, | ||
| custom: customArgs | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } else { | ||
| // Headless code in case is needed | ||
| def name = "headless-${platform.browser}${suffix}" | ||
| processes[name] = { | ||
| stage("${name}") { | ||
| generateNPMVersionRouteFile(npm_tag: args.npm_tag, filePath: customRouteFilePath) | ||
| updateDependenciesWithTag(npm_tag: args.npm_tag) | ||
| bedrockTests( | ||
| name: name, | ||
| browser: platform.browser, | ||
| testDirs: [ "tinymce-angular-component/src/test/ts" ], | ||
| bucket: currBucket, | ||
| buckets: buckets, | ||
| custom: additionalArgs + " --useSelenium" | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| parallel processes | ||
| } | ||
|
|
||
| timestamps { | ||
| tinyPods.node() { | ||
| stage('deps') { | ||
| yarnInstall() | ||
| } | ||
|
|
||
| stage('build') { | ||
| sh 'yarn build' | ||
| } | ||
|
|
||
| stage('tests') { | ||
| runSmokeTests(npm_tag: params.NPM_TAG ?: 'latest') | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
54 changes: 54 additions & 0 deletions
54
tinymce-angular-component/src/test/ts/smoke-test/VerifyIntegrationTest.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import '../alien/InitTestEnvironment'; | ||
|
|
||
| import { Assertions } from '@ephox/agar'; | ||
| import { describe, it, context, before } from '@ephox/bedrock-client'; | ||
| import { Global } from '@ephox/katamari'; | ||
| import { SugarElement, Attribute } from '@ephox/sugar'; | ||
|
|
||
| import { EditorComponent, TINYMCE_SCRIPT_SRC } from '../../../main/ts/public_api'; | ||
| import { Version } from '../../../main/ts/editor/editor.component'; | ||
| import { editorHook } from '../alien/TestHooks'; | ||
| import type { Editor } from 'tinymce'; | ||
| import { deleteTinymce, supportedTinymceVersions } from '../alien/TestHelpers'; | ||
|
|
||
| /* | ||
| This test requires the targeted Angular version provided via custom route | ||
| */ | ||
| describe('VerifyIntegrationTest', () => { | ||
| interface IntegrationInfo { | ||
| version: string; | ||
| } | ||
|
|
||
| const assertTinymceVersion = (version: Version, editor: Editor) => { | ||
| Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, editor.editorManager.majorVersion); | ||
| Assertions.assertEq(`Loaded version of TinyMCE should be ${version}`, version, Global.tinymce.majorVersion); | ||
| }; | ||
|
|
||
| for (const version of supportedTinymceVersions()) { | ||
| context(`With local Tinymce version ${version}`, () => { | ||
| const createFixture = editorHook(EditorComponent, { | ||
| providers: [ | ||
| { | ||
| provide: TINYMCE_SCRIPT_SRC, | ||
| useValue: `/project/node_modules/tinymce-${version}/tinymce.min.js`, | ||
| }, | ||
| ], | ||
| }); | ||
|
|
||
| before(deleteTinymce); | ||
|
|
||
| it('Should be able to load with the specified Angular version', async () => { | ||
| const { editor } = await createFixture(); | ||
| const integrationInfo = await window.fetch('/custom/integration/info').then((resp) => resp.json()) as IntegrationInfo; | ||
| const container = editor.getContainer(); | ||
|
|
||
| Assertions.assertEq(`Angular version should be ${integrationInfo.version}`, | ||
| true, | ||
| Attribute.get(SugarElement.fromDom(container), 'data-framework-version') === integrationInfo.version | ||
| ); | ||
|
|
||
| assertTinymceVersion(version, editor); | ||
| }); | ||
| }); | ||
| } | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's one way of doing it, I guess 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be made easier/nicer if
ng updatecommand could resolve with private/local packages ie: tinymce-4, tinymce-5, etc. At the moment, it just throws not found error because it tries to fetch the packages from NPM