Skip to content

Commit

Permalink
DFPL-2084 - Enhance Playwright Testing Framework for Cross-Browser (#…
Browse files Browse the repository at this point in the history
…5085)

* init commit

* temp turn off stages for testing

* adding in CI parallelism

* adding in parallel stages for fortify and mutation for pipline

* rm parallel stages pipline as not working

---------

Co-authored-by: Georgina <“georgina.hall1@hmcts.net”>
  • Loading branch information
Iphiclus and Georgina authored Jan 18, 2024
1 parent e91c0d5 commit be31a15
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 42 deletions.
17 changes: 1 addition & 16 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ withNightlyPipeline(type, product, component) {
loadVaultSecrets(integrationTestSecrets)

enableMutationTest()
enableFullFunctionalTest(240)
// 'microsoft' and 'safari' to be returned to crossbrowser tests once FPLA-3172 improvements are complete
//enableCrossBrowserTest(['chrome', 'firefox'])
enableFortifyScan('fpl-aat')

enableFullFunctionalTest(240)

before('mutationTest') {
setupSecretsForIntegrationTests(pipelineConf)
Expand All @@ -106,25 +103,13 @@ withNightlyPipeline(type, product, component) {
env.CASE_SERVICE_URL = "http://fpl-case-service-aat.service.core-compute-aat.internal"
}

// before('crossBrowserTest') {
// yarnBuilder.yarn('yarn-update')
// yarnBuilder.yarn('install-dependencies')
// env.TEST_RETRIES = 5
// env.TESTS_FOR_ACCESSIBILITY = false
// env.ENV = 'aat'
// }

afterAlways('fullFunctionalTest') {
yarnBuilder.yarn('test:functional-nightly')
//archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
//archiveArtifacts allowEmptyArchive: true, artifacts: '**/test-results/functionalTest/*'
env.TESTS_FOR_ACCESSIBILITY = false
}

// afterAlways('crossBrowserTest') {
// steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'output/**/*'
// }

afterAlways('fortify-scan') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
}
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
"typings": "codeceptjs def && mv steps.d.ts typings/codeceptjs.d.ts",
"test": "codeceptjs run-multiple parallel",
"test:functional": "NODE_TLS_REJECT_UNAUTHORIZED=0 MOCHAWESOME_REPORTFILENAME=functional codeceptjs run-multiple parallel --grep '(?=.*)^(?!.*(@smoke-tests|@flaky|@nightlyOnly))' --reporter mocha-multi --verbose",
"test:functional-nightly": "yarn playwright install chromium && yarn playwright test smoke-test.spec.ts --reporter=html && NODE_TLS_REJECT_UNAUTHORIZED=0 MOCHAWESOME_REPORTFILENAME=functional codeceptjs run --grep \"@fixed\" --reporter mocha-multi --verbose",
"test:functional-nightly": "yarn playwright install chromium && yarn playwright install firefox && yarn playwright install webkit && yarn playwright test smoke-test.spec.ts --reporter=list && NODE_TLS_REJECT_UNAUTHORIZED=0 MOCHAWESOME_REPORTFILENAME=functional codeceptjs run --grep \"@fixed\" --reporter mocha-multi --verbose",
"test:smoke": "yarn npm audit --recursive --environment production && MOCHAWESOME_REPORTFILENAME=smoke REPORT_DIR=test-results/smokeTest REPORT_FILE=test-results/smokeTest/results.xml codeceptjs run --grep '@smoke-tests' --reporter mocha-multi --verbose",
"test:crossbrowser-e2e": "NODE_TLS_REJECT_UNAUTHORIZED=0 MOCHAWESOME_REPORTFILENAME=crossbrowser codeceptjs run-multiple --grep '@skip' ${BROWSER_GROUP:-'--all'} -c saucelabs.conf.js --reporter mocha-multi --verbose",
"test:crossbrowser": "./bin/run-crossbrowser-tests.sh",
"test:local": "./bin/runtestlocal.sh",
"prepare": "husky install",
"yarn-update": "yarn set version 3.x",
Expand Down
2 changes: 1 addition & 1 deletion playwright-e2e/settings/userCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const e2ePw = process.env.E2E_TEST_PASSWORD || "Password1234";
const e2ePw = process.env.E2E_TEST_PASSWORD || "";

export const newSwanseaLocalAuthorityUserOne = {
email: "local-authority-swansea-0001@maildrop.cc",
Expand Down
4 changes: 2 additions & 2 deletions playwright-e2e/tests/create-case.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { SmokeCreateCase } from "../pages/create-case";
import { StartApplication } from "../pages/start-application";
import { OrdersAndDirectionSought } from "../pages/orders-and-directions";


test("Create a case", async ({ page }) => {
// WIP
test.skip("Create a case", async ({ page }) => {
// 1. Sign in as local-authority user
const signInPage = new SignInPage(page);
const smokeCreateCase = new SmokeCreateCase(page);
Expand Down
43 changes: 23 additions & 20 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,29 @@ import { defineConfig, devices } from "@playwright/test";
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({

testDir: "./playwright-e2e",
/* Run tests in files in parallel */
fullyParallel: true,
timeout: 60000,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 1 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
workers: process.env.CI ? 4 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
["list"],
],
reporter: process.env.CI ? 'html' : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
// Capture screenshot after each test failure.
screenshot: 'only-on-failure',

// Record trace only when retrying a test for the first time.
trace: 'off',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
// Record video only when retrying a test for the first time.
video: 'retain-on-failure'
},

/* Configure projects for major browsers */
Expand All @@ -39,24 +42,24 @@ export default defineConfig({
use: { ...devices["Desktop Chrome"] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// name: "Mobile Chrome",
// use: { ...devices["Pixel 5"] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// name: "Mobile Safari",
// use: { ...devices["iPad Mini"] },
// },

/* Test against branded browsers. */
Expand Down
Binary file removed resources/cannot-send-yet.png
Binary file not shown.
Binary file removed resources/confidential.png
Binary file not shown.
Binary file removed resources/finished.png
Binary file not shown.
Binary file removed resources/in-progress-toggle-off.png
Binary file not shown.
Binary file removed resources/in-progress.png
Binary file not shown.
Binary file removed resources/information-added.png
Binary file not shown.

0 comments on commit be31a15

Please sign in to comment.