-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix docker js_server image * Fix for prettier ignore * Remove tab * Remove .prettierignore * Make the JS docker image build at publish time and run tests on it against the live contract * remove hard coded version * remove unnecessary rm * remove reference to .prettierignore * fix html and add ignore rules * move build steps * lint * lint --------- Co-authored-by: forgetso <[email protected]>
- Loading branch information
Showing
15 changed files
with
249 additions
and
469 deletions.
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
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,22 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Procaptcha demo: Live Test</title> | ||
<script | ||
id="procaptchaScript" | ||
type="module" | ||
src="http://localhost:3080/js/procaptcha.bundle.js" | ||
async | ||
defer | ||
></script> | ||
</head> | ||
<body> | ||
<form> | ||
<div | ||
class="procaptcha" | ||
data-theme="light" | ||
data-sitekey="5HUBceb4Du6dvMA9BiwN5VzUrzUsX9Zp7z7nSR2cC1TCv5jg" | ||
></div> | ||
</form> | ||
</body> | ||
</html> |
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,12 @@ | ||
{ | ||
"extends": "../../tsconfig.esm.json", | ||
"compilerOptions": { | ||
"lib": ["ES2021", "dom"], | ||
"types": ["node"], | ||
"noEmit": true, | ||
"noEmitOnError": true, | ||
"sourceMap": false | ||
}, | ||
"include": ["**/*.ts"], | ||
"references": [] | ||
} |
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,9 @@ | ||
export default { | ||
watch: false, | ||
mode: 'development', | ||
server: { | ||
https: false, | ||
host: true, | ||
cors: true, | ||
}, | ||
} |
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
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,63 @@ | ||
// Copyright 2021-2023 Prosopo (UK) Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
/// <reference types="cypress" /> | ||
import '@cypress/xpath' | ||
import { Captcha } from '@prosopo/types' | ||
import { ProsopoDatasetError } from '@prosopo/common' | ||
import { checkboxClass } from '../support/commands.js' | ||
import { datasetWithSolutionHashes } from '@prosopo/datasets' | ||
|
||
describe('Captchas', () => { | ||
beforeEach(() => { | ||
const solutions = datasetWithSolutionHashes.captchas.map((captcha) => ({ | ||
captchaContentId: captcha.captchaContentId, | ||
solution: captcha.solution, | ||
})) | ||
|
||
if (!solutions) { | ||
throw new ProsopoDatasetError('DATABASE.DATASET_WITH_SOLUTIONS_GET_FAILED', { | ||
context: { datasetWithSolutionHashes }, | ||
}) | ||
} | ||
cy.intercept('/dummy').as('dummy') | ||
|
||
// visit the base URL specified on command line when running cypress | ||
return cy.visit(Cypress.env('default_page')).then(() => { | ||
cy.get(checkboxClass).should('be.visible') | ||
// wrap the solutions to make them available to the tests | ||
cy.wrap(solutions).as('solutions') | ||
}) | ||
}) | ||
|
||
it('Selecting the correct images passes the captcha', () => { | ||
cy.clickIAmHuman().then(() => { | ||
// Make sure the images are loaded | ||
cy.captchaImages().then(() => { | ||
// Solve the captchas | ||
cy.get('@captchas') | ||
.each((captcha: Captcha) => { | ||
cy.log('in each function') | ||
// Click correct images and submit the solution | ||
cy.clickCorrectCaptchaImages(captcha) | ||
}) | ||
.then(() => { | ||
// Get inputs of type checkbox | ||
cy.get("input[type='checkbox']").then((checkboxes) => { | ||
cy.wrap(checkboxes).first().should('be.checked') | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
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
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
FROM nginx:alpine | ||
|
||
COPY ./js_bundles_host_temp/ /usr/share/nginx/html/js/ | ||
FROM nginx:latest | ||
COPY ./docker/images/js.server.nginx.conf /etc/nginx/conf.d/default.conf |
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
Oops, something went wrong.