From b07e6899621aa3e867139a837f3b76017755cc79 Mon Sep 17 00:00:00 2001 From: FORCHA Date: Mon, 5 Sep 2022 11:14:53 +0100 Subject: [PATCH 1/3] Test Canvas Resolution change Test Canvas Resolution change --- test/ui/interface.test.js | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/ui/interface.test.js diff --git a/test/ui/interface.test.js b/test/ui/interface.test.js new file mode 100644 index 000000000..55459338b --- /dev/null +++ b/test/ui/interface.test.js @@ -0,0 +1,48 @@ +const timeout = process.env.SLOWMO ? 30000 : 100000; +beforeAll(async () => { + await page.goto('http://127.0.0.1:8080/index2.html', {waitUntil: 'domcontentloaded'}); +}); + +describe('Change Resolution of Canvas ', () => { + test('Test Canvas Multiple Resolution', async () => { + // Wait for #image Canvas to load + await page.waitForSelector('#image'); + // Wait for #qvga Button to load + await page.waitForSelector('#qvga'); + // Wait for #vga Button load + await page.waitForSelector('#vga'); + // Wait for #hd Button to load + await page.waitForSelector('#hd'); + // Wait for #full-hd Button to load + await page.waitForSelector('#full-hd'); + + // Click #qvga Button + await page.evaluate(()=>document.querySelector('#qvga').click()); + // Get Height and Width of canvas #image + const ImageQvgaWidthInput = await page.evaluate(()=>document.querySelector('#image').width); + const ImageQvgaHeightInput = await page.evaluate(()=>document.querySelector('#image').height); + + await page.evaluate(()=>document.querySelector('#vga').click()); + const ImageVgaWidthInput = await page.evaluate(()=>document.querySelector('#image').width); + const ImageVgaHeightInput = await page.evaluate(()=>document.querySelector('#image').height); + await page.evaluate(()=>document.querySelector('#hd').click()); + const ImageHDWidthInput = await page.evaluate(()=>document.querySelector('#image').width); + const ImageHDHeightInput = await page.evaluate(()=>document.querySelector('#image').height); + await page.evaluate(()=>document.querySelector('#full-hd').click()); + const ImageFullHdWidthInput = await page.evaluate(()=>document.querySelector('#image').width); + const ImageFullDdHeightInput = await page.evaluate(()=>document.querySelector('#image').height); + + //Qvga confirmation + expect(ImageQvgaWidthInput).toBe(100); + expect(ImageQvgaHeightInput).toBe(100); + //Vga confirmation + expect(ImageVgaWidthInput).toEqual(800); + expect(ImageVgaHeightInput).toEqual(600); + //HD confirmation + expect(ImageHDWidthInput).toEqual(1920); + expect(ImageHDHeightInput).toEqual(1080); + //Full-HD confirmation + expect(ImageFullHdWidthInput).toEqual(7680); + expect(ImageFullDdHeightInput).toEqual(4320); + }, timeout); +}); From f26975ab751cf3515bac09af04b09217a403d94e Mon Sep 17 00:00:00 2001 From: FORCHA Date: Mon, 5 Sep 2022 11:27:24 +0100 Subject: [PATCH 2/3] Create fullscreen.test.js --- test/ui/fullscreen.test.js | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/ui/fullscreen.test.js diff --git a/test/ui/fullscreen.test.js b/test/ui/fullscreen.test.js new file mode 100644 index 000000000..7cdc88033 --- /dev/null +++ b/test/ui/fullscreen.test.js @@ -0,0 +1,57 @@ +const timeout = process.env.SLOWMO ? 30000 : 100000; +beforeAll(async () => { + await page.goto('http://127.0.0.1:8080/index.html', {waitUntil: 'domcontentloaded'}); +}); + +describe('Enter FullSreen Mode', () => { + test('Test if FullSreen Expands', async () => { + // Wait for Elements to load + await page.waitForSelector('.fullscreen'); + await page.waitForSelector('#image'); + + //Stimulate click on fullscreen + await page.evaluate(()=>document.querySelector('.fullscreen').click()) + + // get values of input fields + + const imageDisplayInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).display); + const imageHeightInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).height); + const imageWidthInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).width); + const imagePositionInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).position); + const imageZIndexInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).zIndex); + + // Check if value is changed or not + expect(imageDisplayInput).toEqual('block'); + expect(imageHeightInput).not.toEqual('100%'); + expect(imageWidthInput).not.toEqual('auto'); + expect(imagePositionInput).toEqual('absolute'); + expect(imageZIndexInput).toEqual('2'); + + + }, timeout); +}); + +describe('Exit FullSreen Mode', () => { + test('Test if FullSreen Exits', async () => { + // Wait for Elements to load + await page.waitForSelector('.fullscreen'); + await page.waitForSelector('#image'); + + + //Stimulate click on fullscreen + await page.evaluate(()=>document.querySelector('.fullscreen').click()) + + // get values of input fields + + const imageDisplayInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).display); + const imageLeftInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).left); + const imagePositionInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).position); + + // Check if value is changed or not + expect(imageDisplayInput).toEqual('inline'); + expect(imageLeftInput).not.toEqual('0'); + expect(imagePositionInput).toEqual('relative'); + + + }, timeout); +}); From b29ad977af62004a58200fa4716907b9cd5b08fc Mon Sep 17 00:00:00 2001 From: FORCHA Date: Mon, 5 Sep 2022 11:46:59 +0100 Subject: [PATCH 3/3] Delete fullscreen.test.js --- test/ui/fullscreen.test.js | 57 -------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 test/ui/fullscreen.test.js diff --git a/test/ui/fullscreen.test.js b/test/ui/fullscreen.test.js deleted file mode 100644 index 7cdc88033..000000000 --- a/test/ui/fullscreen.test.js +++ /dev/null @@ -1,57 +0,0 @@ -const timeout = process.env.SLOWMO ? 30000 : 100000; -beforeAll(async () => { - await page.goto('http://127.0.0.1:8080/index.html', {waitUntil: 'domcontentloaded'}); -}); - -describe('Enter FullSreen Mode', () => { - test('Test if FullSreen Expands', async () => { - // Wait for Elements to load - await page.waitForSelector('.fullscreen'); - await page.waitForSelector('#image'); - - //Stimulate click on fullscreen - await page.evaluate(()=>document.querySelector('.fullscreen').click()) - - // get values of input fields - - const imageDisplayInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).display); - const imageHeightInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).height); - const imageWidthInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).width); - const imagePositionInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).position); - const imageZIndexInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).zIndex); - - // Check if value is changed or not - expect(imageDisplayInput).toEqual('block'); - expect(imageHeightInput).not.toEqual('100%'); - expect(imageWidthInput).not.toEqual('auto'); - expect(imagePositionInput).toEqual('absolute'); - expect(imageZIndexInput).toEqual('2'); - - - }, timeout); -}); - -describe('Exit FullSreen Mode', () => { - test('Test if FullSreen Exits', async () => { - // Wait for Elements to load - await page.waitForSelector('.fullscreen'); - await page.waitForSelector('#image'); - - - //Stimulate click on fullscreen - await page.evaluate(()=>document.querySelector('.fullscreen').click()) - - // get values of input fields - - const imageDisplayInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).display); - const imageLeftInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).left); - const imagePositionInput = await page.evaluate(() => getComputedStyle(document.querySelector('#image')).position); - - // Check if value is changed or not - expect(imageDisplayInput).toEqual('inline'); - expect(imageLeftInput).not.toEqual('0'); - expect(imagePositionInput).toEqual('relative'); - - - }, timeout); -});