Skip to content

Commit

Permalink
EXUI-2472 - make crossbrowser checks run on playwright. (#4159)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydummer authored Dec 18, 2024
1 parent c5ea534 commit 7291d28
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 22 deletions.
45 changes: 25 additions & 20 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ def secrets = [
secret('test-email', 'TEST_EMAIL'),
secret('test-password', 'TEST_PASSWORD'),
secret('appinsights-instrumentationkey-mc', 'APPINSIGHTS_INSTRUMENTATIONKEY'),
secret('appinsights-connection-string-mc', 'APPINSIGHTS_CONNECTION_STRING'),
secret('system-user-name', 'SYSTEM_USER_NAME'),
secret('system-user-password', 'SYSTEM_USER_PASSWORD')
secret('system-user-password', 'SYSTEM_USER_PASSWORD'),
secret('launch-darkly-client-id', 'LAUNCH_DARKLY_CLIENT_ID'),
],
]

Expand All @@ -43,23 +45,21 @@ static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
}

withNightlyPipeline(type, product, component) {
env.TEST_URL = 'https://manage-case.aat.platform.hmcts.net/'

enableSlackNotifications(channel)
loadVaultSecrets(secrets)
env.TEST_URL = 'https://manage-case.aat.platform.hmcts.net'
enableFortifyScan('rpx-aat')
enableFullFunctionalTest(120)
// enableSecurityScan()
//enableMutationTest()
enableCrossBrowserTest()


afterSuccess('checkout') {
yarnBuilder.yarn('cache clean')
}

afterSuccess('build') {
yarnBuilder.yarn('build')

publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
Expand All @@ -76,7 +76,23 @@ withNightlyPipeline(type, product, component) {
reportFiles : 'index.html',
reportName : 'ng lint Report'
])

stage('Cross Browser Test') {
try {
yarnBuilder.yarn('test:crossbrowser')
} catch (Error) {
unstable(message: "${STAGE_NAME} is unstable: " + Error.toString())
} finally {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/crossbrowser/",
reportFiles : 'index.html',
reportName : 'XUI Manage Cases Cross Browser Tests'
])
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/tests-results/CaseAPIFunctional/*'
}
}
// yarnBuilder.yarn('test:a11y')
// publishHTML([
// allowMissing : true,
Expand Down Expand Up @@ -132,17 +148,6 @@ withNightlyPipeline(type, product, component) {
])
}

afterSuccess('crossBrowserTest') {
publishHTML([
allowMissing : true,
alwaysLinkToLastBuild: true,
keepAll : true,
reportDir : "reports/tests/crossbrowser/",
reportFiles : 'index.html',
reportName : 'XUI Manage Cases Cross Browser Tests'
])
}

afterSuccess('securityScan') {
publishHTML([
allowMissing : true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"test:all": "yarn test:ng && yarn test:node && yarn test:smoke && yarn test:functional && yarn test:crossbrowser",
"test:smoke": "yarn playwright install chromium && TEST_TYPE=smoke npx codeceptjs run --plugins cucumberJsonReporter --plugins retryFailedStep --config ./test_codecept/codeceptCommon/codecept.conf.ts --features --grep @smoke --reporter mochawesome",
"test:smoke:local": "webdriver-manager update --versions.chrome 2.40 && protractor ./test/e2e/config/smoke.conf.js --local",
"test:crossbrowser": "protractor ./test/e2e/config/crossbrowser.conf.js",
"test:crossbrowser": "yarn playwright install && npx playwright test -c playwright-nightly.config.ts",
"test:fullfunctional": "yarn playwright install && npm-run-all -p -l -n -c test:api test:xuiIntegration test:codeceptE2E",
"test:playwrightE2E": "yarn playwright install && npx playwright test --project chromium",
"test:functional1": "yarn run test:xuiIntegration && yarn run test:functionalApiE2e",
Expand Down
62 changes: 62 additions & 0 deletions playwright-nightly.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { defineConfig, devices } from '@playwright/test';

const headlessMode = process.env.HEAD !== 'true';
export const axeTestEnabled = process.env.ENABLE_AXE_TESTS === 'true';

module.exports = defineConfig({
testDir: './playwright_tests/E2E',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: 3, // Set the number of retries for all projects

timeout: 3 * 60 * 1000,
expect: {
timeout: 1 * 60 * 1000
},
reportSlowTests: null,

/* Opt out of parallel tests on CI. */
workers: process.env.FUNCTIONAL_TESTS_WORKERS ? parseInt(process.env.FUNCTIONAL_TESTS_WORKERS, 10) : 1,

reporter: [[process.env.CI ? 'html' : 'list'],
['html', { open: 'never', outputFolder: 'functional-output/tests/playwright-e2e' }]],

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'],
channel: 'chrome',
headless: headlessMode,
trace: 'on-first-retry'
}
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'],
screenshot: 'only-on-failure',
headless: headlessMode,
trace: 'off'
}
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'],
screenshot: 'only-on-failure',
headless: headlessMode,
trace: 'off'
}
}
// {
// name: 'MicrosoftEdge',
// use: { ...devices['Desktop Edge'],
// channel: 'msedge',
// screenshot: 'only-on-failure',
// headless: headlessMode,
// trace: 'off'
// }
// }
]
});
2 changes: 1 addition & 1 deletion test_codecept/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

sourceCompatibility = 11
targetCompatibility = 11
targetCompatibility = 17

// tag::repositories[]
repositories {
Expand Down

0 comments on commit 7291d28

Please sign in to comment.