Skip to content

Commit

Permalink
Merge pull request #1130 from w3c/releases
Browse files Browse the repository at this point in the history
June 12, 2024 Production Release

Includes changes recently included in the [releases branch](https://github.com/w3c/aria-at-app/tree/releases) through #1129.

[Latest CHANGELOG.md update](https://github.com/w3c/aria-at-app/blob/releases/CHANGELOG.md#131-2024-06-12)
  • Loading branch information
howard-e authored Jun 12, 2024
2 parents 4488588 + b720653 commit ee8fd6a
Show file tree
Hide file tree
Showing 15 changed files with 483 additions and 142 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/runtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ jobs:
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ${PGDATABASE} to ${PGUSER};"
yarn sequelize:test db:migrate
yarn sequelize:test db:seed:all
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_1}
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_2}
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_3}
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_4}
yarn workspace server db-import-tests:test -c "${IMPORT_ARIA_AT_TESTS_COMMIT_1} ${IMPORT_ARIA_AT_TESTS_COMMIT_2} ${IMPORT_ARIA_AT_TESTS_COMMIT_3} ${IMPORT_ARIA_AT_TESTS_COMMIT_4}"
yarn workspace server db-import-tests:test
yarn workspace server db-populate-sample-data:test
# yarn test would run all of these in serial, however we split this up to allow it continue
# yarn test would run all of these in serial, however we split this up to allow it to continue
# in case of errors - all tests will still run even if lint fails for instance.
- run: yarn workspace shared prettier
if: always()
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### [1.3.1](https://github.com/w3c/aria-at-app/compare/v1.3.0...v1.3.1) (2024-06-12)


### Bug Fixes

* add test for decimal rowNumber test automation ([#1114](https://github.com/w3c/aria-at-app/issues/1114)) ([347bf07](https://github.com/w3c/aria-at-app/commit/347bf07261d4cc3606b05b04742a2388cb1a1add)), closes [#1106](https://github.com/w3c/aria-at-app/issues/1106)
* Include the latest w3c/aria-at data imports in tests and update sample data ([#1111](https://github.com/w3c/aria-at-app/issues/1111)) ([ae90bce](https://github.com/w3c/aria-at-app/commit/ae90bce0ce56e00d0b4d9b0c8b823f62e5618bbf))
* Update incorrectly set deprecation dates for test plan versions ([#1122](https://github.com/w3c/aria-at-app/issues/1122)) ([d077bb5](https://github.com/w3c/aria-at-app/commit/d077bb54c2be8a0ce1ea93992d69ea7ff1543eeb)), closes [#966](https://github.com/w3c/aria-at-app/issues/966)

## [1.3.0](https://github.com/w3c/aria-at-app/compare/v1.2.1...v1.3.0) (2024-05-28)


Expand Down
3 changes: 2 additions & 1 deletion admins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ lolaodelola
stalgiag
IsaDC
ccanash
Paul-Clue
Paul-Clue
gracemccants
16 changes: 4 additions & 12 deletions docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ The database migrations are managed by [Sequelize](https://sequelize.org/). The
```
4. Import the most recent tests from the [aria-at repository](https://github.com/w3c/aria-at):
```
yarn db-import-tests:dev -c 5fe7afd82fe51c185b8661276105190a59d47322;
yarn db-import-tests:dev -c 1aa3b74d24d340362e9f511eae33788d55487d12;
yarn db-import-tests:dev -c ab77d47ab19db71c635c9bb459ba5c34182e1400;
yarn db-import-tests:dev -c d34eddbb8e751f07bd28d952de15fa7fe5f07353;
yarn db-import-tests:dev -c "5fe7afd82fe51c185b8661276105190a59d47322 1aa3b74d24d340362e9f511eae33788d55487d12 ab77d47ab19db71c635c9bb459ba5c34182e1400 d34eddbb8e751f07bd28d952de15fa7fe5f07353";
yarn db-import-tests:dev;
```
Expand All @@ -54,10 +51,7 @@ fi;

yarn sequelize db:migrate;
yarn sequelize db:seed:all;
yarn db-import-tests:dev -c 5fe7afd82fe51c185b8661276105190a59d47322;
yarn db-import-tests:dev -c 1aa3b74d24d340362e9f511eae33788d55487d12;
yarn db-import-tests:dev -c ab77d47ab19db71c635c9bb459ba5c34182e1400;
yarn db-import-tests:dev -c d34eddbb8e751f07bd28d952de15fa7fe5f07353;
yarn db-import-tests:dev -c "5fe7afd82fe51c185b8661276105190a59d47322 1aa3b74d24d340362e9f511eae33788d55487d12 ab77d47ab19db71c635c9bb459ba5c34182e1400 d34eddbb8e751f07bd28d952de15fa7fe5f07353";
yarn db-import-tests:dev;
```
Expand Down Expand Up @@ -100,10 +94,8 @@ The instructions are similar for the test database, with one extra step:
yarn db-init:test;
yarn sequelize:test db:migrate;
yarn sequelize:test db:seed:all;
yarn workspace server db-import-tests:test -c 5fe7afd82fe51c185b8661276105190a59d47322;
yarn workspace server db-import-tests:test -c 1aa3b74d24d340362e9f511eae33788d55487d12;
yarn workspace server db-import-tests:test -c ab77d47ab19db71c635c9bb459ba5c34182e1400;
yarn workspace server db-import-tests:test -c d34eddbb8e751f07bd28d952de15fa7fe5f07353;
yarn workspace server db-import-tests:test -c "5fe7afd82fe51c185b8661276105190a59d47322 1aa3b74d24d340362e9f511eae33788d55487d12 ab77d47ab19db71c635c9bb459ba5c34182e1400 d34eddbb8e751f07bd28d952de15fa7fe5f07353";
yarn workspace server db-import-tests:test;
yarn workspace server db-populate-sample-data:test;
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aria-at-app",
"version": "1.3.0",
"version": "1.3.1",
"description": "Run ARIA-AT tests and report results",
"main": "server/index.js",
"private": true,
Expand Down
4 changes: 1 addition & 3 deletions server/controllers/AutomationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ const getTestByRowNumber = async ({ testPlanRun, testRowNumber, context }) => {
null,
context
);
return tests.find(
test => String(test.rowNumber) === String(testRowNumber)
);
return tests.find(test => String(test.rowNumber) === String(testRowNumber));
};

const updateOrCreateTestResultWithResponses = async ({
Expand Down
38 changes: 19 additions & 19 deletions server/handlebars/embed/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ details summary::after {
}

details > summary.recommended::after {
background-color: #115b11;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6.861' viewBox='0 0 12 6.861'%3E%3Cpath id='Icon_ionic-ios-arrow-down' data-name='Icon ionic-ios-arrow-down' d='M12.19,16.039,16.727,11.5a.854.854,0,0,1,1.211,0,.865.865,0,0,1,0,1.215L12.8,17.858a.856.856,0,0,1-1.183.025L6.438,12.717A.858.858,0,1,1,7.649,11.5Z' transform='translate(18.188 18.108) rotate(180)' fill='rgb(233, 251, 233)'/%3E%3C/svg%3E%0A");
background-color: #115b11;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6.861' viewBox='0 0 12 6.861'%3E%3Cpath id='Icon_ionic-ios-arrow-down' data-name='Icon ionic-ios-arrow-down' d='M12.19,16.039,16.727,11.5a.854.854,0,0,1,1.211,0,.865.865,0,0,1,0,1.215L12.8,17.858a.856.856,0,0,1-1.183.025L6.438,12.717A.858.858,0,1,1,7.649,11.5Z' transform='translate(18.188 18.108) rotate(180)' fill='rgb(233, 251, 233)'/%3E%3C/svg%3E%0A");
}

details[open] summary::after {
Expand All @@ -73,8 +73,8 @@ details > summary {
}

details > summary.recommended {
border: 1.5px solid #7ac498;
background-color: #e9fbe9;
border: 1.5px solid #7ac498;
background-color: #e9fbe9;
}

details > summary > ::before {
Expand All @@ -90,26 +90,26 @@ details > summary > ::before {
}

details > summary.recommended ::before {
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj4KICA8IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNS4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZ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4zIDAgMjQgMTAuNyAyNCAyNHMtMTAuNyAyNC0yNCAyNEgyMTZjLTEzLjMgMC0yNC0xMC43LTI0LTI0czEwLjctMjQgMjQtMjR6bTQwLTIwOGEzMiAzMiAwIDEgMSAwIDY0IDMyIDMyIDAgMSAxIDAtNjR6IgogIC8+Cjwvc3ZnPgo=');
}

details > summary > h4 {
position: relative;
padding-left: var(--left-right-padding);
padding-right: var(--left-right-padding);
position: relative;
padding-left: var(--left-right-padding);
padding-right: var(--left-right-padding);

font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
color: #60470c;
display: inline-block;
font-family: Arial, Helvetica, sans-serif;
font-size: 1em;
color: #60470c;
display: inline-block;
}

details > summary.recommended > h4 {
color: #384338;
color: #384338;
}

details summary::-webkit-details-marker {
display: none;
display: none;
}

.content-container {
Expand All @@ -130,11 +130,11 @@ details summary::-webkit-details-marker {
}

div.recommended {
border-bottom: 1.5px solid #7ac498;
border-left: 1.5px solid #7ac498;
border-right: 1.5px solid #7ac498;
background-color: #e9fbe9;
color: #384338;
border-bottom: 1.5px solid #7ac498;
border-left: 1.5px solid #7ac498;
border-right: 1.5px solid #7ac498;
background-color: #e9fbe9;
color: #384338;
}

.no-data-cell {
Expand Down
120 changes: 120 additions & 0 deletions server/migrations/20240522032230-fixIncorrectDeprecationDates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
const SECOND = 1000;
const MINUTE = 60 * SECOND;

const versionAndRangeCheck = async (
deprecatedVersion,
maybeDeprecatingVersion,
transaction
) => {
let relevantPhaseDateFound = false;
let maybeDeprecatingVersionPhaseDate =
maybeDeprecatingVersion.updatedAt;

if (deprecatedVersion.recommendedPhaseReachedAt) {
if (!maybeDeprecatingVersion.recommendedPhaseReachedAt) return;
maybeDeprecatingVersionPhaseDate =
maybeDeprecatingVersion.recommendedPhaseReachedAt;
relevantPhaseDateFound = true;
}

if (
deprecatedVersion.candidatePhaseReachedAt &&
!relevantPhaseDateFound
) {
if (!maybeDeprecatingVersion.candidatePhaseReachedAt) return;
maybeDeprecatingVersionPhaseDate =
maybeDeprecatingVersion.candidatePhaseReachedAt;
relevantPhaseDateFound = true;
}

if (
deprecatedVersion.draftPhaseReachedAt &&
!relevantPhaseDateFound
) {
if (!maybeDeprecatingVersion.draftPhaseReachedAt) return;
maybeDeprecatingVersionPhaseDate =
maybeDeprecatingVersion.draftPhaseReachedAt;
}

// Get a 5-minute range around deprecated version to compare to other
// versions which could have potentially deprecated it based on
// their phase change dates
const deprecatedAtDate = new Date(deprecatedVersion.deprecatedAt);
const startDate = new Date(deprecatedAtDate.getTime() - 5 * MINUTE);
const endDate = new Date(deprecatedAtDate.getTime() + 5 * MINUTE);

if (
maybeDeprecatingVersionPhaseDate.getTime() >=
startDate.getTime() &&
maybeDeprecatingVersionPhaseDate.getTime() <= endDate.getTime()
) {
// Set updated deprecatedAt date as being 2 seconds before
// whichever dated phase change caused it; exactly how
// updatePhaseResolver and import-tests is done
const updatedDeprecatedAt = new Date(
new Date(
maybeDeprecatingVersionPhaseDate.getTime() - 2 * SECOND
)
);

await queryInterface.sequelize.query(
`update "TestPlanVersion"
set "deprecatedAt" = ?
where id = ?
and "gitSha" = ?
and directory = ?`,
{
replacements: [
updatedDeprecatedAt,
deprecatedVersion.id,
deprecatedVersion.gitSha,
deprecatedVersion.directory
],
transaction
}
);
}
};

return queryInterface.sequelize.transaction(async transaction => {
const testPlanVersions = await queryInterface.sequelize.query(
`select "id",
"phase",
"gitSha",
"directory",
"updatedAt",
"draftPhaseReachedAt",
"candidatePhaseReachedAt",
"recommendedPhaseReachedAt",
"deprecatedAt"
from "TestPlanVersion"`,
{ type: Sequelize.QueryTypes.SELECT, transaction }
);

const deprecatedVersions = testPlanVersions.filter(
({ phase }) => phase === 'DEPRECATED'
);

for (let deprecatedVersion of deprecatedVersions) {
const maybeDeprecatingVersions = testPlanVersions.filter(
({ id, directory }) =>
id !== deprecatedVersion.id &&
directory === deprecatedVersion.directory
);

for (let maybeDeprecatingVersion of maybeDeprecatingVersions) {
await versionAndRangeCheck(
deprecatedVersion,
maybeDeprecatingVersion,
transaction
);
}
}
});
}
};
15 changes: 13 additions & 2 deletions server/resolvers/TestPlanVersionOperations/updatePhaseResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,24 @@ const updatePhaseResolver = async (
// If oldTestPlanVersion's results are being used to update this earlier
// version, deprecate it (if the same phase)
if (oldTestPlanVersion && phase === oldTestPlanVersion.phase) {
// Set deprecation date to happen 2 minutes before the new version being
// updated
let deprecatedAt;
if (updateParams.draftPhaseReachedAt)
deprecatedAt = new Date(updateParams.draftPhaseReachedAt);
else if (updateParams.candidatePhaseReachedAt)
deprecatedAt = new Date(updateParams.candidatePhaseReachedAt);
else deprecatedAt = new Date(updateParams.recommendedPhaseReachedAt);

if (deprecatedAt)
deprecatedAt.setSeconds(deprecatedAt.getSeconds() - 120);

await updateTestPlanVersionById({
id: oldTestPlanVersion.id, // same as testPlanVersionDataToIncludeId
values: { phase: 'DEPRECATED', deprecatedAt: new Date() },
values: { phase: 'DEPRECATED', deprecatedAt },
transaction
});
}

await updateTestPlanVersionById({
id: testPlanVersionId,
values: updateParams,
Expand Down
38 changes: 33 additions & 5 deletions server/scripts/import-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,26 @@ const gitRun = (args, cwd = gitCloneDirectory) => {
};

const importTestPlanVersions = async transaction => {
const { gitCommitDate } = await readRepo();
await cloneRepo();

// Get list of commits when multiple passed in as
// `<import_cmd> -c "commit1 commit2 commitN ..."`
const commits = args.commit
? args.commit
.trim()
.split(' ')
.filter(el => !!el)
: [];

if (commits.length) {
for (const commit of commits) {
await buildTestsAndCreateTestPlanVersions(commit, { transaction });
}
} else await buildTestsAndCreateTestPlanVersions(null, { transaction });
};

const buildTestsAndCreateTestPlanVersions = async (commit, { transaction }) => {
const { gitCommitDate } = await readCommit(commit);

console.log('Running `npm install` ...\n');
const installOutput = spawn.sync('npm', ['install'], {
Expand Down Expand Up @@ -184,7 +203,7 @@ const importTestPlanVersions = async transaction => {
// Deprecations happen slightly before update during normal app operations.
// This is to maintain correctness and any app sorts issues
const deprecatedAt = new Date(updatedAt);
deprecatedAt.setSeconds(deprecatedAt.getSeconds() - 60);
deprecatedAt.setSeconds(deprecatedAt.getSeconds() - 120);
await updateTestPlanVersionById({
id: testPlanVersionToDeprecate.id,
values: { phase: 'DEPRECATED', deprecatedAt },
Expand Down Expand Up @@ -227,17 +246,26 @@ const importTestPlanVersions = async transaction => {
transaction
});
}

// To ensure build folder is clean when multiple commits are being processed
// to prevent `EPERM` errors
console.log('Running `npm run cleanup` ...\n');
const cleanupOutput = spawn.sync('npm', ['run', 'cleanup'], {
cwd: gitCloneDirectory
});
console.log('`npm run cleanup` output', cleanupOutput.stdout.toString());
};

const readRepo = async () => {
const cloneRepo = async () => {
fse.ensureDirSync(gitCloneDirectory);

console.info('Cloning aria-at repo ...');
spawn.sync('git', ['clone', ariaAtRepo, gitCloneDirectory]);
console.info('Cloning aria-at repo complete.');
};

gitRun(`checkout ${args.commit ?? ariaAtDefaultBranch}`);

const readCommit = async commit => {
gitRun(`checkout ${commit ?? ariaAtDefaultBranch}`);
const gitCommitDate = new Date(gitRun(`log --format=%aI -n 1`));

return { gitCommitDate };
Expand Down
8 changes: 8 additions & 0 deletions server/scripts/populate-test-data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ const populateTestDatabase = async transaction => {
transaction
});

await populateFakeTestResults(
19,
new Array(12).fill('completeAndPassing'),
{
transaction
}
);

console.info(
'Successfully populated. Please wait a moment for the process to close.'
);
Expand Down
Loading

0 comments on commit ee8fd6a

Please sign in to comment.