Skip to content

Commit

Permalink
chore: replace codepen with github pages
Browse files Browse the repository at this point in the history
I kept getting the DDoS warning on codepen, and it was hanging forever. Using github pages shouldn't have that problem.
  • Loading branch information
Kelly Selden authored and kellyselden committed Nov 20, 2020
1 parent d69edfe commit ddc65de
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 32 deletions.
43 changes: 34 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@

module.exports = {
root: true,
extends: [
'crowdstrike-node',
],
rules: {
// https://github.com/eslint/eslint/issues/11899
'require-atomic-updates': 'off',

'faltest/no-browser-throttle': 'error',
},
overrides: [
{
files: [
'**/*.js',
],
extends: [
'crowdstrike',
],
},
{
files: [
'**/*.js',
'**/*.json',
],
excludedFiles: [
'docs/**/*.js',
],
extends: [
'crowdstrike-node',
],
rules: {
// https://github.com/eslint/eslint/issues/11899
'require-atomic-updates': 'off',

'faltest/no-browser-throttle': 'error',
},
},
{
files: [
'packages/*/test/**/*-test.js',
Expand Down Expand Up @@ -71,5 +88,13 @@ module.exports = {
'node/shebang': 'off',
},
},
{
files: [
'docs/**/*.js',
],
env: {
browser: true,
},
},
],
};
39 changes: 39 additions & 0 deletions docs/dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div>
Env: Dev
</div>

<div>
Target:
<span id="target">No target</span>
</div>

<div id="log-in-form">
<div>
Email:
<input id="email">
</div>

<div>
Password:
<input id="password" type="password">
</div>

<div>
<button id="log-in">Log in</button>
</div>
</div>

<div id="member-section" style="display:none">
<div>
Logged in as:
<span id="email-label"></span>
</div>
<div id="finished-feature">
Finished feature
</div>
<div id="in-progress-feature">
In-progress feature
</div>
</div>

<script src="index.js"></script>
17 changes: 17 additions & 0 deletions docs/dev/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let url = new URL(window.location.href);
let target = url.searchParams.get('target');
document.getElementById('target').innerText = target;

document.getElementById('log-in').addEventListener('click', () => {
let email = document.getElementById('email').value;

document.getElementById('email-label').innerText = email;

document.getElementById('log-in-form').style.display = 'none';
document.getElementById('member-section').style.display = 'block';
});

window.featureFlags = [
'finished-feature',
'in-progress-feature',
];
36 changes: 36 additions & 0 deletions docs/prod/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div>
Env: Prod
</div>

<div>
Target:
<span id="target">No target</span>
</div>

<div id="log-in-form">
<div>
Email:
<input id="email">
</div>

<div>
Password:
<input id="password" type="password">
</div>

<div>
<button id="log-in">Log in</button>
</div>
</div>

<div id="member-section" style="display:none">
<div>
Logged in as:
<span id="email-label"></span>
</div>
<div id="finished-feature">
Finished feature
</div>
</div>

<script src="index.js"></script>
16 changes: 16 additions & 0 deletions docs/prod/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let url = new URL(window.location.href);
let target = url.searchParams.get('target');
document.getElementById('target').innerText = target;

document.getElementById('log-in').addEventListener('click', () => {
let email = document.getElementById('email').value;

document.getElementById('email-label').innerText = email;

document.getElementById('log-in-form').style.display = 'none';
document.getElementById('member-section').style.display = 'block';
});

window.featureFlags = [
'finished-feature',
];
13 changes: 1 addition & 12 deletions examples/full-suite/page-objects/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ const { BasePageObject } = require('@faltest/page-objects');

class Page extends BasePageObject {
async open(env, target) {
let envs = {
dev: 'YzKwVQq',
prod: 'wvwMbee',
};

await this._browser.url(`https://codepen.io/crowdstrike/full/${envs[env]}?target=${target}`);

// wait for DDoS protection if running headless
await this._browser.waitForDestroy('.cf-im-under-attack');

// only needed for codepen, selects the iframe
await this._browser._browser.switchToFrame(await this._browser.$('#result'));
await this._browser.url(`https://crowdstrike.github.io/faltest/${env}?target=${target}`);
}

get email() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"connect": "^3.7.0",
"cross-env": "^7.0.0",
"eslint": "^7.0.0",
"eslint-config-crowdstrike": "^3.0.0",
"eslint-config-crowdstrike": "^3.0.1",
"eslint-config-crowdstrike-node": "^3.0.0",
"eslint-plugin-faltest": "^1.0.7",
"eslint-plugin-json-files": "0.8.1",
Expand Down
8 changes: 2 additions & 6 deletions test/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,23 @@ describe(function() {
});

describe(getCwd('full-suite'), function() {
it('yarn start --target fixtures --env dev --tag user --tag smoke', async function() {
this.timeout(30e3);
this.timeout(30e3);

it('yarn start --target fixtures --env dev --tag user --tag smoke', async function() {
let output = await this.run();

expect(output).to.include(' 1 passing');
expect(output).to.not.include(' pending');
});

it('yarn start --tag admin --tag !smoke', async function() {
this.timeout(60e3);

let output = await this.run();

expect(output).to.include(' 2 passing');
expect(output).to.include(' 1 pending');
});

it('yarn start --tag admin --filter unfinished', async function() {
this.timeout(30e3);

let output = await this.run();

expect(output).to.include(' 1 passing');
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,10 @@ eslint-config-crowdstrike-node@^3.0.0:
resolved "https://registry.yarnpkg.com/eslint-config-crowdstrike-node/-/eslint-config-crowdstrike-node-3.0.0.tgz#b7b4c6dc84008f8683c74b33af86a16dcf4d8da0"
integrity sha512-yIeeg4BTT3SYsebbbOdg7S5MIN8g0NcexvH9RHxiagmYPKmmVaBB9BITPCT1kuVLi9wq/OGebc9U/ErypXYCDg==

eslint-config-crowdstrike@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-crowdstrike/-/eslint-config-crowdstrike-3.0.0.tgz#0917fd0a8003d1931e87caa00ee6cdd5c75f7bcc"
integrity sha512-kpr3EoYpYzrafjsujmIfSO6ssJnhtl+v5XOcwfDnR6DJ+KCDbGvM1rV1Glu8iF+/Ti6ZJWi+WPEuaPVZlDdVkQ==
eslint-config-crowdstrike@^3.0.1:
version "3.0.1"
resolved "https://registry.npmjs.org/eslint-config-crowdstrike/-/eslint-config-crowdstrike-3.0.1.tgz#61b7f585d5c2da1f95e4ce41d4536253f5db0ee9"
integrity sha512-6VM2asASbT6YbGVkthvUkb0cah2NpvtUrIhkhDJd07r3hn5bTXrqXn5eigSpScfn+ztHr8G3XZ1JGBfjd5VfMA==

eslint-plugin-es@^3.0.0:
version "3.0.1"
Expand Down

0 comments on commit ddc65de

Please sign in to comment.