Skip to content

Commit

Permalink
fix!: remove actions functionality
Browse files Browse the repository at this point in the history
When migrating next-toggler to Tool Kit, we found out that the actions functionality were causing the n-test smoke tests to fail.

The `actions` functionality was not used in our basic search of FT repos here: https://github.com/search?q=org%3AFinancial-Times+actions+path%3Atest%2Fsmoke.js++NOT+is%3Aarchived&type=code
  • Loading branch information
joelcarr committed Jan 23, 2024
1 parent 2da4f1a commit 523579f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 317 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ These can all be set at a suite level, as well as a URL level, like so:
}
...
```
### Actions

n-test allows some basic actions (e.g. clicking, interacting with forms). This has been ported from [pa11y](https://github.com/pa11y/pa11y) - see the [section on their README](https://github.com/pa11y/pa11y/blob/5.0.4/README.md#actions) for more.

### FT User Sessions

Expand Down
277 changes: 0 additions & 277 deletions lib/helpers/actions.js

This file was deleted.

9 changes: 0 additions & 9 deletions lib/smoke/puppeteer-page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const getUserTokens = require('./get-user-tokens');
const setSessionCookies = require('./set-session-cookies');
const runAction = require('../helpers/actions');
const { URL } = require('url');

const REDIRECT_CODES = [301, 302, 303, 307, 308];
Expand All @@ -27,7 +26,6 @@ class PuppeteerPage {
this.dimensions = DIMENSIONS[options.breakpoint] || DIMENSIONS['XL'];
this.user = options.user || null;
this.requestHeaderPaths = options.requestHeaderPaths || [];
this.actions = options.actions || [];

this.pageErrors = [];
this.consoleMessages = [];
Expand Down Expand Up @@ -169,13 +167,6 @@ class PuppeteerPage {
const gotoResponse = await this.page.goto(this.url.toString(), { waitUntil: this.waitUntil });
this.response = this.response || gotoResponse;

// Run actions
if (this.actions.length) {
for (const action of this.actions) {
await runAction(browser, this.page, action);
}
}

if(this.check.cssCoverage) {
this.coverageReports = await this.page.coverage.stopCSSCoverage();
}
Expand Down
8 changes: 0 additions & 8 deletions test/fixtures/smoke-pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ module.exports = [{
maxPixels: 0
}
}
},
'/actions': {
actions: [
'click element .my-button'
],
elements: {
'.content': true
}
}
}
}];
19 changes: 0 additions & 19 deletions test/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,6 @@ app.get('/no-jank', (req, res) => {
`);
});

app.get('/actions', (req, res) => {
res.send(`
<body>
<style>
.content {
display: none;
}
</style>
<div class="content">Content</div>
<button class="my-button">Show content</button>
<script async defer>
document.querySelector('.my-button').addEventListener('click', () => {
document.querySelector('.content').style.display = 'block';
});
</script>
</body>
`);
});

if (!module.parent) {
app.listen(process.env.PORT || 3004);
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/tasks/smoke.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Smoke Tests of the Smoke', () => {
});
smoke.run()
.then((results) => {
expect(results.passed.length).toEqual(12);
expect(results.passed.length).toEqual(11);
expect(results.failed.length).toEqual(0);
expect(results.errors.length).toEqual(0);
done();
Expand Down

0 comments on commit 523579f

Please sign in to comment.