-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { test, expect, Page } from '@playwright/test' | ||
import { uploadFile } from './TestUtils' | ||
|
||
test('Test all distribution combinations', async ({ page }) => { | ||
await page.goto('/') | ||
|
||
await uploadFile('result_small_cluster.zip', page) | ||
|
||
const options = getAllOptionCombinations() | ||
for (const option of options) { | ||
await compareDistributionDiagramm(page, option) | ||
} | ||
}) | ||
|
||
/** | ||
* Checks if the distribution diagramm is correct for the given options | ||
* @param page Page currently tested on | ||
* @param options Options to be selected | ||
*/ | ||
async function compareDistributionDiagramm(page: Page, options: string[]) { | ||
const distributionDiagrammContainer = page.getByText('Distribution of Comparisons:Options:') | ||
for (const option of options) { | ||
await distributionDiagrammContainer.getByText(option).click() | ||
} | ||
// This timeout is so that the screenshot is taken after the animation is finished | ||
await page.waitForTimeout(3000) | ||
const distributionDiagramm = await page.locator('canvas').first().screenshot() | ||
expect(distributionDiagramm).toMatchSnapshot(`distribution_${options.join('_')}.png`) | ||
} | ||
|
||
function getAllOptionCombinations() { | ||
const options = [['Average', 'Maximum']] | ||
|
||
function combine(a: string[][], b: string[]) { | ||
const combinations: string[][] = [] | ||
for (let i = 0; i < a.length; i++) { | ||
for (let j = 0; j < b.length; j++) { | ||
combinations.push(a[i].concat(b[j])) | ||
} | ||
} | ||
return combinations | ||
} | ||
|
||
let combinations: string[][] = [] | ||
for (let i = 0; i < options[0].length; i++) { | ||
combinations.push([options[0][i]]) | ||
} | ||
|
||
for (let i = 1; i < options.length; i++) { | ||
combinations = combine(combinations, options[i]) | ||
} | ||
return combinations | ||
} |
Binary file added
BIN
+13 KB
...ests/e2e/Distribution.spec.ts-snapshots/distribution-Average-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.1 KB
...tests/e2e/Distribution.spec.ts-snapshots/distribution-Average-firefox-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.5 KB
.../tests/e2e/Distribution.spec.ts-snapshots/distribution-Average-webkit-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.1 KB
...ests/e2e/Distribution.spec.ts-snapshots/distribution-Maximum-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.9 KB
...tests/e2e/Distribution.spec.ts-snapshots/distribution-Maximum-firefox-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
.../tests/e2e/Distribution.spec.ts-snapshots/distribution-Maximum-webkit-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.