From 56a588d9cb1a467f0cb5a96b1e1435fad0d3fe72 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 09:18:10 -0700 Subject: [PATCH 01/21] fix: fixed the context path --- .github/workflows/siteminder-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 59a3c438..68663c81 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -53,11 +53,10 @@ jobs: - name: Build docker image uses: docker/build-push-action@v3 with: - context: ./siteminder-tests + context: siteminder-tests/ push: false load: true tags: siteminder-tests - file: Dockerfile cache-from: type=local,src=/tmp/.buildx-test-cache cache-to: type=local,dest=/tmp/.buildx-test-cache-new - name: Move cache From 5757ca88594a2b498fe760af0be74e74534f6c8c Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 09:41:20 -0700 Subject: [PATCH 02/21] fix: updated hostname var to remove quotes --- .github/workflows/siteminder-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 68663c81..6e9b3d02 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -29,7 +29,7 @@ jobs: datacenters=$(echo "${{ secrets.SITEMINDER_TESTS_DATACENTERS }}" | jq '."${{ github.event.inputs.environment }}".datacenters') hostname=$(echo "${{ secrets.SITEMINDER_TESTS_DATACENTERS }}" | jq '."${{ github.event.inputs.environment }}".hostname') echo ::set-output name=datacenters::{\"include\":$(echo $datacenters)} - echo ::set-output name=hostname::$(echo $hostname) + echo ::set-output name=hostname::$(echo "$hostname") run-siteminder-tests: runs-on: ubuntu-20.04 From c2292d68e187050136642c88e909d3587bbba2e4 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 10:05:37 -0700 Subject: [PATCH 03/21] fix: removing quotes on hostname and always executing upload results step --- .github/workflows/siteminder-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 6e9b3d02..7f6f3328 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -1,4 +1,4 @@ -name: Run Siteminder Tests to Validate SAML Payload +name: Run siteminder tests to validate saml payload on: workflow_dispatch: @@ -27,7 +27,7 @@ jobs: id: set-matrix run: | datacenters=$(echo "${{ secrets.SITEMINDER_TESTS_DATACENTERS }}" | jq '."${{ github.event.inputs.environment }}".datacenters') - hostname=$(echo "${{ secrets.SITEMINDER_TESTS_DATACENTERS }}" | jq '."${{ github.event.inputs.environment }}".hostname') + hostname=$(echo "${{ secrets.SITEMINDER_TESTS_DATACENTERS }}" | jq -r '."${{ github.event.inputs.environment }}".hostname') echo ::set-output name=datacenters::{\"include\":$(echo $datacenters)} echo ::set-output name=hostname::$(echo "$hostname") @@ -73,6 +73,7 @@ jobs: --add-host=${{ needs.matrix-prep.outputs.hostname }}:${{ matrix.ip }} \ siteminder-tests - name: Upload test results + if: always() uses: actions/upload-artifact@v2 with: name: ${{ github.event.inputs.cluster }}-${{ github.event.inputs.environment }}-${{ matrix.name }}-results From 355a9a2959ad661bfa53f6c4d1bac9591c55ddbc Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 10:28:42 -0700 Subject: [PATCH 04/21] fix: adding env file to docker run command --- .github/workflows/siteminder-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 7f6f3328..e5fd62b2 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -69,6 +69,7 @@ jobs: echo "${{ secrets.SITEMINDER_TESTS_ENV }}" | base64 --decode > .env docker run --rm -e ENVIRONMENT=${{ github.event.inputs.environment }} \ -e CLUSTER=${{ github.event.inputs.cluster }} \ + --env-file .env \ -v $(pwd)/results:/app/results \ --add-host=${{ needs.matrix-prep.outputs.hostname }}:${{ matrix.ip }} \ siteminder-tests From 28e5dfda6d011da5c7abe46234988f13d066a920 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 10:42:58 -0700 Subject: [PATCH 05/21] fix: pass env file through volume --- .github/workflows/siteminder-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index e5fd62b2..9c484a82 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -69,7 +69,7 @@ jobs: echo "${{ secrets.SITEMINDER_TESTS_ENV }}" | base64 --decode > .env docker run --rm -e ENVIRONMENT=${{ github.event.inputs.environment }} \ -e CLUSTER=${{ github.event.inputs.cluster }} \ - --env-file .env \ + -v .env:/app/.env \ -v $(pwd)/results:/app/results \ --add-host=${{ needs.matrix-prep.outputs.hostname }}:${{ matrix.ip }} \ siteminder-tests From 6c983db28cb6af7f810a126700d8ee0e10d01d7a Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 11:35:11 -0700 Subject: [PATCH 06/21] fix: generating env file before build --- .github/workflows/siteminder-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 9c484a82..f5b47a39 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -42,6 +42,10 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 16 + - name: Generate env file + run: | + cd ${{ github.workspace }}/siteminder-tests + echo "${{ secrets.SITEMINDER_TESTS_ENV }}" | base64 --decode > .env - name: Set up docker buildx uses: docker/setup-buildx-action@v2 - name: Cache docker layers @@ -66,10 +70,8 @@ jobs: - name: Run siteminder tests run: | cd ${{ github.workspace }}/siteminder-tests - echo "${{ secrets.SITEMINDER_TESTS_ENV }}" | base64 --decode > .env docker run --rm -e ENVIRONMENT=${{ github.event.inputs.environment }} \ -e CLUSTER=${{ github.event.inputs.cluster }} \ - -v .env:/app/.env \ -v $(pwd)/results:/app/results \ --add-host=${{ needs.matrix-prep.outputs.hostname }}:${{ matrix.ip }} \ siteminder-tests From d8bff2a2071faa78839c937b7009d308043b53fc Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 12:28:19 -0700 Subject: [PATCH 07/21] fix: updated logic to click on continue button --- siteminder-tests/util.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 89d9ea7d..bb81a1e8 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -52,9 +52,8 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitForSelector('input[type=submit]'); - const continueButton = await page.$('input[type=submit]'); - await continueButton.evaluate((continueButton) => continueButton.click()); + await page.waitForSelector('input[type="submit"]'); + await page.click('input[type="submit"]'); } return new Promise((resolve) => { From adf5d4d79abb51f8290498ca4dce6e87959c9dd2 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 12:56:49 -0700 Subject: [PATCH 08/21] fix: waiting before clicking on continue button --- siteminder-tests/util.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index bb81a1e8..bbe572b6 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -52,8 +52,10 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitForSelector('input[type="submit"]'); - await page.click('input[type="submit"]'); + await this.page.waitFor(2000); + await page.waitForSelector('input[type=submit]'); + const continueButton = await page.$('input[type=submit]'); + await continueButton.evaluate((continueButton) => continueButton.click()); } return new Promise((resolve) => { From 1188c9631e155d30f4361cea3faebdc6ce0aa904 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 12:57:38 -0700 Subject: [PATCH 09/21] fix: removed this reference --- siteminder-tests/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index bbe572b6..028d4de9 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -52,7 +52,7 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await this.page.waitFor(2000); + await page.waitFor(2000); await page.waitForSelector('input[type=submit]'); const continueButton = await page.$('input[type=submit]'); await continueButton.evaluate((continueButton) => continueButton.click()); From 5d646551a239e2653b3f516b7454e41ce9536937 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 13:03:03 -0700 Subject: [PATCH 10/21] fix: updated timeout function --- siteminder-tests/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 028d4de9..ed30af87 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -52,7 +52,7 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitFor(2000); + await page.waitForTimeout(3000); await page.waitForSelector('input[type=submit]'); const continueButton = await page.$('input[type=submit]'); await continueButton.evaluate((continueButton) => continueButton.click()); From c37e3345bdb2a4ec4ab8a3e7c7b286041790d37f Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 13:30:29 -0700 Subject: [PATCH 11/21] chore: add new env var for timeout setting --- siteminder-tests/tests/index.test.js | 5 ++--- siteminder-tests/util.js | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index 3c5a9449..3eed9458 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -4,7 +4,6 @@ const { testsite, screenShotsDir } = require('../util'); const { idir_config, bceid_basic_config, bceid_business_config, fetchSsoUrl } = require('../config'); const assert = require('assert'); const { describe, it, beforeEach, afterEach } = require('mocha'); -const timeout = process.env.TIMEOUTSETTING ?? 3000; const addContext = require('mochawesome/addContext'); describe('siteminder test suite', function () { @@ -20,9 +19,9 @@ describe('siteminder test suite', function () { }); afterEach(async function () { - await page.waitForTimeout(timeout); + await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png` }); - await page.waitForTimeout(timeout); + await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.close(); await browser.close(); addContext(this, `assets/${this.currentTest.title}.png`); diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index ed30af87..f59bde03 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -5,6 +5,7 @@ const fs = require('fs'); const parseStringSync = promisify(parseString); const Buffer = require('buffer').Buffer; const screenShotsDir = './results/assets'; +const process = require('process'); if (!fs.existsSync(screenShotsDir)) { fs.mkdirSync(screenShotsDir, { recursive: true }); @@ -52,7 +53,7 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitForTimeout(3000); + await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.waitForSelector('input[type=submit]'); const continueButton = await page.$('input[type=submit]'); await continueButton.evaluate((continueButton) => continueButton.click()); From 490501b985bd55f15223a2ff00776cedae932af5 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 15:02:53 -0700 Subject: [PATCH 12/21] fix: added waitfornavigation --- siteminder-tests/util.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index f59bde03..6697ea64 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -54,9 +54,10 @@ module.exports = { if (!isIDIR) { await page.waitForTimeout(process.env.TIMEOUTSETTING); - await page.waitForSelector('input[type=submit]'); - const continueButton = await page.$('input[type=submit]'); - await continueButton.evaluate((continueButton) => continueButton.click()); + await Promise.all([ + page.waitForNavigation({ waitUntil: 'domcontentloaded' }), + page.click('input[type="submit"]'), + ]); } return new Promise((resolve) => { From e716a05f957fdebf747da270e6570c7872ea5b3b Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 15:52:26 -0700 Subject: [PATCH 13/21] fix: clicking twice to make sure its clicked --- siteminder-tests/util.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 6697ea64..31552d97 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -5,7 +5,6 @@ const fs = require('fs'); const parseStringSync = promisify(parseString); const Buffer = require('buffer').Buffer; const screenShotsDir = './results/assets'; -const process = require('process'); if (!fs.existsSync(screenShotsDir)) { fs.mkdirSync(screenShotsDir, { recursive: true }); @@ -53,11 +52,8 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitForTimeout(process.env.TIMEOUTSETTING); - await Promise.all([ - page.waitForNavigation({ waitUntil: 'domcontentloaded' }), - page.click('input[type="submit"]'), - ]); + await page.waitForSelector('input[value=Continue]', { visible: true }); + page.click('input[value=Continue]', { clickCount: 2 }); } return new Promise((resolve) => { From 22d991b63e1d1db45d9133bd2a6d99387acd1749 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 16:54:12 -0700 Subject: [PATCH 14/21] fix: using native function to click the button --- siteminder-tests/util.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 31552d97..5d94ffc9 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -52,8 +52,11 @@ module.exports = { const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { - await page.waitForSelector('input[value=Continue]', { visible: true }); - page.click('input[value=Continue]', { clickCount: 2 }); + await page.waitForTimeout(1000); + await page.waitForSelector('input[value=Continue]'); + await page.evaluate(() => { + document.querySelector('input[value=Continue]').click(); + }); } return new Promise((resolve) => { From 3e823e1b8da1fab85f314c36c17e61ea116061ca Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 17:19:48 -0700 Subject: [PATCH 15/21] fix: using incognito browser for tests --- siteminder-tests/tests/index.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index 3eed9458..9cd7f2ab 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -9,13 +9,15 @@ const addContext = require('mochawesome/addContext'); describe('siteminder test suite', function () { let browser; let page; + let context; beforeEach(async function () { browser = await puppeteer.launch({ headless: true, args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'], }); - page = await browser.newPage(); + context = await browser.createIncognitoBrowserContext(); + page = await context.newPage(); }); afterEach(async function () { From 95e2350adff46c9182914a94fb6affdb0ffcf0c4 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 17:43:27 -0700 Subject: [PATCH 16/21] fix: using good practices --- .github/workflows/siteminder-tests.yml | 1 + siteminder-tests/util.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index f5b47a39..0d3bba10 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -35,6 +35,7 @@ jobs: runs-on: ubuntu-20.04 needs: matrix-prep strategy: + max-parallel: 1 matrix: ${{ fromJson(needs.matrix-prep.outputs.datacenters) }} steps: - name: Check out repository diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 5d94ffc9..58ef1896 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -35,6 +35,7 @@ module.exports = { testsite: async function (website, idp_username, idp_password, test_name, page) { const siteminder_values = {}; await page.goto(website, { timeout: 0, waitUntil: 'domcontentloaded' }); + await page.waitForNavigation(); await page.waitForSelector('title'); await page.waitForSelector('input[name=user]'); await page.type('#user', idp_username); @@ -55,7 +56,8 @@ module.exports = { await page.waitForTimeout(1000); await page.waitForSelector('input[value=Continue]'); await page.evaluate(() => { - document.querySelector('input[value=Continue]').click(); + const $button = document.querySelector('input[value=Continue]'); + $button.click(); }); } From 7f4a2a93afb77c19afa0ac866e81256c50893834 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 18:21:43 -0700 Subject: [PATCH 17/21] fix: using timeout for initial goto website --- siteminder-tests/tests/index.test.js | 8 +++----- siteminder-tests/util.js | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index 9cd7f2ab..76f2d39e 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -9,20 +9,18 @@ const addContext = require('mochawesome/addContext'); describe('siteminder test suite', function () { let browser; let page; - let context; - beforeEach(async function () { browser = await puppeteer.launch({ headless: true, args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'], }); - context = await browser.createIncognitoBrowserContext(); - page = await context.newPage(); + page = await browser.newPage(); + await page.setViewport({ width: 800, height: 600 }); }); afterEach(async function () { await page.waitForTimeout(process.env.TIMEOUTSETTING); - await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png` }); + await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png`, fullPage: true }); await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.close(); await browser.close(); diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 58ef1896..92b60f26 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -34,7 +34,8 @@ module.exports = { screenShotsDir, testsite: async function (website, idp_username, idp_password, test_name, page) { const siteminder_values = {}; - await page.goto(website, { timeout: 0, waitUntil: 'domcontentloaded' }); + await page.waitForTimeout(1000); + await page.goto(website, { waitUntil: 'domcontentloaded' }); await page.waitForNavigation(); await page.waitForSelector('title'); await page.waitForSelector('input[name=user]'); From d6dc49a34af102605f22c859baa1b51a191df8ec Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 20:49:09 -0700 Subject: [PATCH 18/21] fix: using google chrome instead of chromium --- siteminder-tests/Dockerfile | 3 +++ siteminder-tests/tests/index.test.js | 1 + 2 files changed, 4 insertions(+) diff --git a/siteminder-tests/Dockerfile b/siteminder-tests/Dockerfile index 566e6056..f6468511 100644 --- a/siteminder-tests/Dockerfile +++ b/siteminder-tests/Dockerfile @@ -1,5 +1,8 @@ FROM node:16.14.2-slim +# We don't need the standalone Chromium +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true + RUN apt-get update && apt-get install curl gnupg -y \ && curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index 76f2d39e..5e19c4f4 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -11,6 +11,7 @@ describe('siteminder test suite', function () { let page; beforeEach(async function () { browser = await puppeteer.launch({ + executablePath: '/usr/bin/google-chrome', headless: true, args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'], }); From 039ce6293c378981f1245f105548848fcbf23609 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 21:01:13 -0700 Subject: [PATCH 19/21] fix: removing screenshots code for testing --- siteminder-tests/Dockerfile | 3 --- siteminder-tests/tests/index.test.js | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/siteminder-tests/Dockerfile b/siteminder-tests/Dockerfile index f6468511..566e6056 100644 --- a/siteminder-tests/Dockerfile +++ b/siteminder-tests/Dockerfile @@ -1,8 +1,5 @@ FROM node:16.14.2-slim -# We don't need the standalone Chromium -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true - RUN apt-get update && apt-get install curl gnupg -y \ && curl --location --silent https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index 5e19c4f4..c6ffc721 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -11,7 +11,6 @@ describe('siteminder test suite', function () { let page; beforeEach(async function () { browser = await puppeteer.launch({ - executablePath: '/usr/bin/google-chrome', headless: true, args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'], }); @@ -20,12 +19,12 @@ describe('siteminder test suite', function () { }); afterEach(async function () { - await page.waitForTimeout(process.env.TIMEOUTSETTING); - await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png`, fullPage: true }); - await page.waitForTimeout(process.env.TIMEOUTSETTING); + // await page.waitForTimeout(process.env.TIMEOUTSETTING); + // await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png` }); + // await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.close(); await browser.close(); - addContext(this, `assets/${this.currentTest.title}.png`); + //addContext(this, `assets/${this.currentTest.title}.png`); }); it('idir', async function () { From ece5eae2f7bc4250c208d45da4d42bb7da46d0b6 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 21:18:15 -0700 Subject: [PATCH 20/21] fix: removed redundant code --- siteminder-tests/tests/index.test.js | 8 ++++---- siteminder-tests/util.js | 10 +--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/siteminder-tests/tests/index.test.js b/siteminder-tests/tests/index.test.js index c6ffc721..853272cc 100644 --- a/siteminder-tests/tests/index.test.js +++ b/siteminder-tests/tests/index.test.js @@ -19,12 +19,12 @@ describe('siteminder test suite', function () { }); afterEach(async function () { - // await page.waitForTimeout(process.env.TIMEOUTSETTING); - // await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png` }); - // await page.waitForTimeout(process.env.TIMEOUTSETTING); + await page.waitForTimeout(process.env.TIMEOUTSETTING); + await page.screenshot({ path: `${screenShotsDir}/${this.currentTest.title}.png` }); + await page.waitForTimeout(process.env.TIMEOUTSETTING); await page.close(); await browser.close(); - //addContext(this, `assets/${this.currentTest.title}.png`); + addContext(this, `assets/${this.currentTest.title}.png`); }); it('idir', async function () { diff --git a/siteminder-tests/util.js b/siteminder-tests/util.js index 92b60f26..b5eb49e3 100644 --- a/siteminder-tests/util.js +++ b/siteminder-tests/util.js @@ -35,7 +35,7 @@ module.exports = { testsite: async function (website, idp_username, idp_password, test_name, page) { const siteminder_values = {}; await page.waitForTimeout(1000); - await page.goto(website, { waitUntil: 'domcontentloaded' }); + await page.goto(website); await page.waitForNavigation(); await page.waitForSelector('title'); await page.waitForSelector('input[name=user]'); @@ -43,14 +43,6 @@ module.exports = { await page.type('#password', idp_password); await page.keyboard.press('Enter'); - await page.goto(website); - await page.waitForSelector('title'); - - await page.waitForSelector('input[name=user]'); - await page.type('#user', idp_username); - await page.type('#password', idp_password); - - await page.keyboard.press('Enter'); const isIDIR = test_name.indexOf('IDIR') > -1; if (!isIDIR) { From c5a1d8ced00b8bfe9ade8a84041bef2144115cd8 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Tue, 26 Jul 2022 21:37:05 -0700 Subject: [PATCH 21/21] fix: running jobs parrallely and updated readme --- .github/workflows/siteminder-tests.yml | 1 - siteminder-tests/README.md | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/siteminder-tests.yml b/.github/workflows/siteminder-tests.yml index 0d3bba10..f5b47a39 100644 --- a/.github/workflows/siteminder-tests.yml +++ b/.github/workflows/siteminder-tests.yml @@ -35,7 +35,6 @@ jobs: runs-on: ubuntu-20.04 needs: matrix-prep strategy: - max-parallel: 1 matrix: ${{ fromJson(needs.matrix-prep.outputs.datacenters) }} steps: - name: Check out repository diff --git a/siteminder-tests/README.md b/siteminder-tests/README.md index 9f1a39af..0211672d 100644 --- a/siteminder-tests/README.md +++ b/siteminder-tests/README.md @@ -80,6 +80,18 @@ Executes all the tests and generates screenshots under `results/assets` Executes all the tests and generates screenshots and html report under `results` directory +**Note**: To run the tests on browser visually, update `beforeEach` hook in `./tests/index.test.js` file as shown below + +```js + beforeEach(async function () { + browser = await puppeteer.launch({ + headless: false, + }); + page = await browser.newPage(); + await page.setViewport({ width: 800, height: 600 }); + }); +``` + ### Docker - Create `.env`