Unable to run protractor using jenkins - jenkins

I am able to run the protractor using command prompt.
However, when I try to run protractor using jenkins, it started the selenium server but does not execute the browser and will fail due to timeout.
Is there any configuration that I need to do at jenkins side aside from the project path?
I also have tried to install the package manually to makesure its updated.
Below is the error when I try to build/run protractor using jenkins:
> webhis_jasmine# protractor C:\Users\user1\.jenkins\HISWEBJASMINE
> protractor conf.js
[12:06:44] I/launcher - Running 1 instances of WebDriver
[12:06:44] I/local - Starting selenium standalone server...
[12:06:46] I/local - Selenium standalone server started at http://10.190.40.39:56419/wd/hub
Started
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m
i tried to run webdriver-manager update only using jenkins just to check and it is giving below error:
C:\Users\user1\.jenkins\HISWEBJASMINE>webdriver-manager update
'webdriver-manager' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\user1\.jenkins\HISWEBJASMINE>exit 9009
Here is config file:
// conf.js
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
capabilities: {
'browserName': 'chrome'
},
specs: ['Patient_positive.js','Visit_positive.js'],
suites:{
Smoke: ['ChainLocators.js', 'Dropdown.js'],
Regression: 'ElementBasics.js',
Testbed: 'testbed.js',
PatientPositive: 'Patient_positive.js',
PatientNegative: 'Patient_negative.js',
VisitPositive: 'Visit_positive.js',
VisitNegative: 'Visit_negative.js',
EpisodeCPOEPositive: 'EpisodeCPOE_positive.js'
},
onPrepare:function(){
browser.driver.manage().window().maximize();
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: './test/reports/',
screenshotsFolder: 'images',
takeScreenshots: true,
fixedScreenshotName: true,
takeScreenshotsOnlyOnFailures: false,
cleanDestination: false,
showPassed: true,
fileName: 'Test_Report',
fileNameSuffix: '',
fileNameDateSuffix: true
})
);
},
jasmineNodeOpts:{
showColors: true
}
};
Is it related?
Update: I strip the spec to have to only 1 'it' and run. Manage to get a success result and report is generated, but i see the browser not launched as when running using cmd prompt.
C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE>npm run protractor
> webhis_jasmine# protractor C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE
> protractor conf.js
[15:14:40] I/launcher - Running 1 instances of WebDriver
[15:14:40] I/local - Starting selenium standalone server...
[15:14:43] I/local - Selenium standalone server started at http://10.190.40.39:52793/wd/hub
Started
Successfully open patient page
Successfully enter name
Successfully select title
Successfully select gender
Successfully enter date of birth
Successfully select ID type
Successfully enter idno= 850921141112
Successfully select Nationality= Malaysia
Successfully enter mobile no
Successfully enter patient address line 1
Successfully enter patient address line 2
Successfully enter patient address line 3
Successfully enter patient postcode= 57000
Successfully enter patient city= Bukit Jalil
Successfully select patient State= Kuala Lumpur
Successfully select patient State= Malaysia
[32m.[0m
1 spec, 0 failures
Finished in 63.169 seconds
CGM
[15:15:52] I/local - Shutting down selenium standalone server.
[15:15:52] I/launcher - 0 instance(s) of WebDriver still running
[15:15:52] I/launcher - chrome #01 passed
Finished: SUCCESS

Try using directConnect:true in your config file instead of seleniumAddress: 'http://localhost:4444/wd/hub',
before runing the test do the below activities
webdriver-manager clean
node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0
Hope it helps you

Related

'No matching tab was found with the following properties: Title=Demo Web Shop*' when running testcase in Jenkins for a tosca testcase

I have integrated Tosca with jenkins to run in local .The test runs successfully on jenkins .However I see below error in result.xml file .The tests run fine in Tosca its only in Jenkins that I see this error .What do I do?
This is the result.xml output
<testcase name="Shipping Costs" time="12.7" timestamp="2022-10-07T16:04:47.1086587+05:30" log="- Failed Shipping Costs {LogInfo='Execution will be continued with the next TestCase, because there was an error in the current TestCase.'} + Passed Open Web Shop - Failed Navigate to Log In Page {LogInfo='No matching tab was found with the following properties: Title=Demo Web Shop*'} ">
- Failed Shipping Costs {LogInfo='Execution will be continued with the next TestCase, because there was an error in the current TestCase.'} + Passed Open Web Shop - Failed Navigate to Log In Page {LogInfo='No matching tab was found with the following properties: Title=Demo Web Shop*'}

createMinToInstruction authorized by PDA, works fine in LocalNet, but gives "Account not associated with this Mint" when run on DevNet

I create an automate deployment script that will mint 2million SPL tokens to an address, the mint is owned by the program PDA as shown in Solana explorer:
Bellow is the last step in the deployment script:
export async function mint2e6Tokens(provider: anchor.AnchorProvider, tokenAccount: PublicKey, mint: PublicKey): Promise<void> {
// get the token account could be PDA
const programKeypair = await createKeypairFromFile(PROGRAM_KEYPAIR_PATH);
/** Load from PDA */
let mint_tokens_tx = new Transaction().add(
createMintToInstruction(
mint,
tokenAccount,
programKeypair.publicKey, // -> I DOUBLE CHECKED, THIS IS 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
2e6,
[],
TOKEN_PROGRAM_ID
)
);
// We sign with our programId instead of the wallet because this is a PDA
// Program Derived Adress
await provider.sendAndConfirm(mint_tokens_tx, [programKeypair]);
}
When I run in LocalNet, it works:
Migrating to LocalNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
31999500
However when I switch to DevNet, it always give me error
Migrating to DevNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3
at Connection.sendEncodedTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4248:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4210:20)
at async sendAndConfirmRawTransaction (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:288:21)
at async AnchorProvider.sendAndConfirm (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:148:14) {
logs: [
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Instruction: MintTo',
'Program log: Error: Account not associated with this Mint',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2809 of 200000 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x3'
]
}
Why the authority is right, but Solana complain that Error: Account not associated with this Mint?
It turns out that my versions for Solana, Anchor and Rust are not compatible with DevNet and / or testnet.
I upgrade solana to main net recommended version and it works. One more things to mention that don't forget to run "solana program close --buffers" before trying. My current settings are:
root#d4c64206ce03:/code# solana --version
solana-cli 1.10.31 (src:77a40cd8; feat:4192065167)
root#d4c64206ce03:/code# rustc --version
rustc 1.63.0 (4b91a6ea7 2022-08-08)
root#d4c64206ce03:/code# anchor --version
anchor-cli 0.25.0

weblogic.management.provider.EditWaitTimedOutException

I am currently using Jenkins 2.138.1, Oracle Weblogic 12c.
I tried to deploy the war file into Weblogic server by using Jenkins Weblogic Deployer Plugin.
The Jenkins Build will be triggered every midnight 3am.
Sometimes the build is success, but sometimes failed with the error below:
Deployment Plan: null
App root: null
App config: null
Deployment Options: {
isRetireGracefully=true,
isGracefulProductionToAdmin=false,
isGracefulIgnoreSessions=false,
rmiGracePeriod=-1,
retireTimeoutSecs=-1,
undeployAllVersions=false,
archiveVersion=null,
planVersion=null,
isLibrary=false,
libSpecVersion=null,
libImplVersion=null,
stageMode=null,
clusterTimeout=3600000,
altDD=null,
altWlsDD=null,
name=myapp,
securityModel=null,
securityValidationEnabled=false,
versionIdentifier=null,
isTestMode=false,
forceUndeployTimeout=0,
defaultSubmoduleTargets=true,
timeout=0,
deploymentPrincipalName=null,
useExpiredLock=false
}
[BasicOperation.execute():445] : Initiating undeploy operation for app,
myApp, on targets: [BasicOperation.execute():447] : MyMgdSvr1
weblogic.management.provider.EditWaitTimedOutException: Waited 0
milliseconds at weblogic.utils.StackTraceDisabled.unknownMethod()
I think I have found the solution, the issue is actually caused by it cannot obtain the edit lock from Weblogic admin server.
Therefore before I un-deploy and deploy the application, I overwritten the user lock so that my instance is able to obtain the lock.

Jenkins Job not execute Protractor tests good

I have Protractor tests, and I run tests with command tests with protractor protractor.conf.js --suite full in VS code on my local. VS code run chrome instance and executed tests well.
After that I setup Jenkins job for Protractor tests. My steps:
Pull code form BitBucket
Execute windows command npm install
Executed windows command node_modules\.bin\ng e2e --webdriver-update
Jenkins opened chrome browser on http://localhost:49156/ ** and start with Protractor tests.
On Chrome browser my tests could to find element by ID,HTML,text, but when needed to click on element I have this error [31m- [39m[31mFailed: element not interactable.
This is piece of console output:
[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used
Creating configuration for
[31m× Creating default configuration [39m
[31m- [39m[31mFailed: element not interactable
(Session info: chrome=69.0.3497.100)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)[39m
(Session info: chrome=69.0.3497.100)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.2.9200 x86_64)
at Object.checkLegacyResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Program Files (x86)\Jenkins\workspace\newGen_protractor\NewGenProject\ui\node_modules\selenium-webdriver\lib\http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
From: Task: WebElement.click()
This is the Protractor tests:
it('Creating default configuration 2000 ', () => {
_home.get2000Configuration().click();
_descriptionModal.buttonStartCreate().click();
for (let i = 0; i < 4; i++) {
_wizardModal.buttonNext().click();
}
_descriptionModal.buttonCreate().click();
expect(_configurationView.getBaImage().isDisplayed()).toBe(true).then(function (result) {
expect(_configurationView.getNeb().count()).toBe(2);
expect(_configurationView.getmage().count()).toBe(2);
expect(_configurationView.getEngineImage().isDisplayed()).toBe(true);
});
});
Checking the error stack that you posted I can see this:
[15:37:51] W/element - more than one element found for locator by.buttonText("Create") - the first result will be used
My guess is that has more than one button with this "Create" text and your code is getting lost. I would suggest check upon the button names and make sure that only one has this "Create" label, for example.

How to save MS Test's result in a Jenkins variable?

One of my Jenkins job is executing MSTest. I am passing the following command to
Execute Windows batch command:
del TestResults.trx
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" /testcontainer:D:\Projects\Jenkins\TestResultVerificationFromJenkins\TestResultVerificationFromJenkins\bin\Debug\TestResultVerificationFromJenkins.dll /resultsfile:TestResults.trx /nologo /detail:stdout
At the time of execution, Console Output is displaying the following values:
Starting execution...
Results Top Level Tests
------- ---------------
Passed TestResultVerificationFromJenkins.UnitTest1.PassTest
[stdout] = Test is passed*
1/1 test(s) Passed
Summary
Test Run Completed.
Passed 1
Total 1
Results file: C:\Program Files (x86)\Jenkins\jobs\JenkinsTestResultReader\workspace\TestResults.trx
Test Settings: Default Test Settings
In the post build step, I have to pass the MS test result "Test is passed" to a HTTP Request.
Is there any way to save this result in a Jenkins variable so that I can pass that to HTTP Request?
Regards,
Umesh
Since you are in the postbuild step, would parsing the console output for the test result and sending it off to the HTTP Request be an option for you?
For example, using Groovy Postbuild plugin, you could write a small script that could do this.
Perhaps something like:
if(manager.build.logFile.text.indexOf("Test Run Completed. Passed") >= 0)
manager.listener.logger.println (new URL("http://localhost?parameter=Test+is+passed")).getText()

Resources