Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Feat/combine allure reports #43

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f260bc1
feat(project): add codeceptjs with first test
demmyhonore Mar 2, 2021
83ce807
feat(project): add see visual difference testing
demmyhonore Mar 2, 2021
f1571d6
feat(project): add 5 test scenarios
demmyhonore Mar 2, 2021
5dc13e6
feat(project): add all test scenarios for person modal
demmyhonore Mar 3, 2021
5816a33
refactor(project): refactor end to end folders
demmyhonore Mar 3, 2021
0aa6369
feat(project): add all test scenarios for media modal
demmyhonore Mar 3, 2021
3b104ca
feat(project): add all scenarios for composition modal
demmyhonore Mar 3, 2021
f5541f6
feat(project): add all scenarios for score modal
demmyhonore Mar 4, 2021
40b2ae2
feat(project): add tests to validate more data sources
demmyhonore Mar 4, 2021
5c6de4b
feat(project): pass all local test on all browsers
demmyhonore Mar 8, 2021
6272a41
feat(project): add last screenshots
demmyhonore Mar 8, 2021
bc81e84
feat(project): add codeceptjs worklow
VincentCouzij Mar 8, 2021
1238060
chore(project): set fail-fast to false
VincentCouzij Mar 8, 2021
6f5915d
feat(project): add language switcher tests
demmyhonore Mar 8, 2021
604c827
Merge branch 'master' of https://github.com/trompamusic/trompa-multim…
RCVZ Mar 12, 2021
43768a6
feat(project): implement allure and new structure
demmyhonore Mar 17, 2021
3152e1a
feat(project): add screenshot differences to allure
demmyhonore Mar 17, 2021
5b8e1ce
fix(project): restore test-ids lost through merge
demmyhonore Mar 17, 2021
4ba7427
feat(project): add screenshots baseline
demmyhonore Mar 17, 2021
a9f81dc
feat(project): add allure reporting
VincentCouzij Mar 18, 2021
7a2e07f
chore(project): change path line for export
VincentCouzij Mar 18, 2021
4590bb7
chore(project): replace always with expression
VincentCouzij Mar 18, 2021
b55d064
Merge branch 'master' into feat/end-to-end-reporting
VincentCouzij Mar 18, 2021
ec963ee
chore: remove screenshots
ChristiaanScheermeijer Mar 19, 2021
6e4c366
feat(project): combine allure results in a single report
ChristiaanScheermeijer Mar 19, 2021
2111f85
chore(project): ignore test results from git
ChristiaanScheermeijer Mar 19, 2021
60aa887
chore(project): fix typo in workflow
ChristiaanScheermeijer Mar 19, 2021
ce8598e
chore(project): fix wrong artifact path
ChristiaanScheermeijer Mar 19, 2021
53fc054
chore(project): generate allure report from artifacts
ChristiaanScheermeijer Mar 19, 2021
a1acc80
chore(project): install allure manually
ChristiaanScheermeijer Mar 19, 2021
10f4ba5
chore(project): update github workflow allure results step
ChristiaanScheermeijer Mar 22, 2021
887b049
chore(project): fix allure generate command
ChristiaanScheermeijer Mar 22, 2021
2fc5d53
chore(project): fix artifact report path
ChristiaanScheermeijer Mar 22, 2021
eaf791f
chore(project): add yarn network-timeout and change step name
ChristiaanScheermeijer Mar 22, 2021
607bf0a
chore(project): always run alter allure results
ChristiaanScheermeijer Mar 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "react-app",
"extends": ["react-app", "plugin:codeceptjs/recommended"],
"plugins": [
"varspacing",
"import"
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/codeceptjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: End-to-end tests
on:
pull_request:
branches:
- master
jobs:
e2e-tests:
continue-on-error: true
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
- windows-2019
browser:
- chrome
- firefox
- safari
exclude:
- os: windows-2019
browser: safari
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- uses: microsoft/playwright-github-action@v1

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn --prefer-offline --network-timeout 1000000

- name: Run tests
run: yarn test:local:${{matrix.browser}}
env:
OS: ${{matrix.os}}
BROWSER: ${{matrix.browser}}

- name: Alter allure results with OS and Browser
if: always()
run: node scripts/editAllureResults.js
env:
OS: ${{matrix.os}}
BROWSER: ${{matrix.browser}}

- name: Upload Allure Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: allure-results-${{matrix.os}}-${{matrix.browser}}
path: automatic-tests/output/${{matrix.os}}-${{matrix.browser}}/allure-results

publish-allure-results:
name: "Publish Allure Tests Results"
needs: e2e-tests
runs-on: ubuntu-latest
if: success() || failure()

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn --prefer-offline

- name: Generate Allure report
run: yarn test:allure:reports

- name: Upload Allure Test Results
uses: actions/upload-artifact@v2
with:
name: Allure Report
path: allure-report
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*

*.failed.png
!.gitkeep

# allure
automatic-tests/output/allure/*/report
automatic-tests/output/*/allure-results/
/allure-report
automatic-tests/output/*
163 changes: 163 additions & 0 deletions automatic-tests/composition-modal_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
const { secondsToWait, visualDiffOptions, compositionModalLocators: locators } = require('./config/globals');

Feature('Composition modal');

let currentBrowser;

Scenario('Opens composition modal with expected content', ({ I }) => {
const screenshotPath = "composition_modal_loaded.png";

I.usePlaywrightTo('Detect current browser', async ({ browser }) => {
const browserObject = await browser;

currentBrowser = browserObject._initializer.name;
console.log('Current browser is:', currentBrowser);
});

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);

I.see('50 results');
I.see('Composer');
I.see('Henry Purcell');
I.see('Composition', locators.firstSearchResult);
I.see('Thomas Clark', locators.firstSearchResult);
I.see('Tis by thy strength the mountains stand', locators.firstSearchResult);
I.see('cpdl.org', locators.firstSearchResult);
});

Scenario('Language switcher initially loads English', ({ I }) => {
const screenshotPath = "composition_modal_language_switcher_loaded.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.see('English');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('Language switcher can select Dutch language', ({ I }) => {
const screenshotPath = "composition_modal_language_switcher_dutch_selected.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.click('English', { xpath: '//header//li[1]' });
I.click('Dutch', { xpath: '//ul//li[2]' });
I.see('Nederlands');

I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('Selects composition from modal', ({ I }) => {
const screenshotPath = "composition_modal_selected_.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.click('Tis by thy strength the mountains stand', locators.firstSearchResult);
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
I.see('Tis by thy strength the mountains stand');
});

Scenario('Opens composition source link from modal', ({ I }) => {
I.closeOtherTabs();
I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.click('cpdl.org', locators.firstSearchResult);
I.switchToNextTab();
I.grabCurrentUrl();
I.seeInCurrentUrl('http://www.cpdl.org/wiki/index.php/%27Tis_by_thy_strength_the_mountains_stand_(Thomas_Clark)');
});

Scenario('Gives results that match query within modal', ({ I }) => {
const screenshotPath = "composition_modal_with_composition_searched.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.fillField('search', 'Adieu');
I.waitForElement('//h6[contains(text(), "48 results")]', secondsToWait);
I.see('Adieu! sweet love, adieu');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('All relevant source links display in modal', ({ I }) => {
I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.see('cpdl.org');
I.see('en.wikipedia.org');
});

Scenario('Filters results with composer filter within modal', ({ I }) => {
const screenshotPath = "composition_modal_with_composer_filter_selected.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.checkOption('Christian Prein');
I.waitForElement('//h6[contains(text(), "0 results")]', secondsToWait);
I.see('1 selected');
I.see('sorry');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('Gives results that match query and applied filter within modal', ({ I }) => {
const screenshotPath = "composition_modal_with_composition_searched_and_filter_selected.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.checkOption('Christian Prein');
I.fillField('search', 'Cradle');
I.waitForElement('//h6[contains(text(), "0 results")]', secondsToWait);
I.see('1 selected');
I.see('sorry');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('Removing filters works as expected', ({ I }) => {
I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.checkOption('Christian Prein');
I.waitForElement('//h6[contains(text(), "0 results")]', secondsToWait);
I.click('clear');
I.waitForElement('//h6[contains(text(), "50 results")]', secondsToWait);
});

Scenario('Adding multiple filters works as expected', ({ I }) => {
const screenshotPath = "composition_modal_with_multiple_filters_selected.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);

I.checkOption('Christian Prein');
I.checkOption('Charles King');
I.waitForElement('//h6[contains(text(), "0 results")]', secondsToWait);
I.see('2 selected');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});

Scenario('Narrows down composer filters with filter search box within modal', ({ I }) => {
const screenshotPath = "composition_modal_with_composer_filter_search_box_used.png";

I.amOnPage('/');
I.click('Select', locators.selectCompositionModal);
I.waitForElement(locators.headerInitialResults, secondsToWait);
I.fillField('search-filter', 'Christian');
I.dontSee('Charles King');
I.saveScreenshot(screenshotPath);
I.seeVisualDiff(screenshotPath, visualDiffOptions);
});
24 changes: 24 additions & 0 deletions automatic-tests/config/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
secondsToWait : 15,
visualDiffOptions : { tolerance: 1, prepareBaseImage: true },
compositionModalLocators: {
selectCompositionModal: 'button[data-test-id=select-composition-modal]',
headerInitialResults : '//h6[contains(text(), "50 results")]',
firstSearchResult : 'div[data-test-id=first-search-result]',
},
mediaModalLocators: {
selectMediaModal : 'button[data-test-id=select-media-modal]',
headerInitialResults: '//h6[contains(text(), "18 results")]',
firstSearchResult : 'div[data-test-id=first-search-result]',
},
personModalLocators: {
selectPersonModal : 'button[data-test-id=select-person-modal]',
firstSearchResult : 'div[data-test-id=first-search-result]',
headerInitialResults: '//h6[contains(text(), "50 results")]',
},
scoreModalLocators: {
selectScoreModal : 'button[data-test-id=select-score-modal]',
headerInitialResults: '//h6[contains(text(), "50 results")]',
firstSearchResult : 'div[data-test-id=first-search-result]',
},
};
Loading