-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
204 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
# Set job outputs to values from filters step below | ||
outputs: | ||
simple_static_task: ${{ steps.filter.outputs.simple_static_task }} | ||
static_react_task: ${{ steps.filter.outputs.static_react_task }} | ||
static_react_task_with_tips: ${{ steps.filter.outputs.static_react_task_with_tips }} | ||
mnist: ${{ steps.filter.outputs.mnist }} | ||
|
@@ -29,6 +30,8 @@ jobs: | |
id: filter | ||
with: | ||
filters: | | ||
simple_static_task: | ||
- 'examples/simple_static_task/**' | ||
static_react_task: | ||
- 'examples/static_react_task/**' | ||
static_react_task_with_tips: | ||
|
@@ -52,6 +55,51 @@ jobs: | |
mephisto-worker-addons: | ||
- 'packages/mephisto-worker-addons/src/**' | ||
# Learn more about this test here: https://github.com/facebookresearch/Mephisto/pull/881 | ||
simple_static_task: | ||
needs: changes | ||
if: ${{ (needs.changes.outputs.simple_static_task == 'true') || (needs.changes.outputs.mephisto-task == 'true') || (needs.changes.outputs.abstractions == 'true') || (needs.changes.outputs.data_model == 'true') || (needs.changes.outputs.operations == 'true') || (needs.changes.outputs.tools == 'true')}} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🔀 Checking out repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🐍 Installing python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: 🪨 Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: 🤖 Install Mephisto | ||
run: pip install -e . | ||
|
||
- name: 🖋 Create data directory | ||
run: mkdir -p ~/mephisto/data | ||
|
||
- name: 📂 Set the data directory | ||
run: mephisto config core.main_data_directory ~/mephisto/data | ||
|
||
- name: 📦 Setting up mephisto-task package | ||
run: | | ||
cd packages/mephisto-task | ||
yarn install | ||
yarn build | ||
npm link | ||
- name: ⌛️ Running cypress tests | ||
uses: cypress-io/[email protected] | ||
with: | ||
install: false | ||
browser: chrome | ||
project: ./mephisto/abstractions/blueprints/static_html_task/source | ||
config-file: ./cypress.config.js | ||
start: python ./examples/simple_static_task/static_test_script.py | ||
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1" | ||
command-prefix: yarn dlx | ||
headless: true | ||
|
||
# Learn more about this test here: https://github.com/facebookresearch/Mephisto/pull/795 | ||
static-react-task: | ||
needs: changes | ||
|
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
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
7 changes: 7 additions & 0 deletions
7
mephisto/abstractions/blueprints/static_html_task/source/cypress.config.js
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,7 @@ | ||
module.exports = { | ||
video: false, | ||
|
||
e2e: { | ||
baseUrl: "http://localhost:3000/?worker_id=x&assignment_id=1", | ||
}, | ||
}; |
53 changes: 53 additions & 0 deletions
53
...isto/abstractions/blueprints/static_html_task/source/cypress/e2e/simple_static_task.cy.js
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,53 @@ | ||
describe("Loads simple_static_task", () => { | ||
it("Makes request for agent", () => { | ||
cy.intercept({ pathname: "/request_agent" }).as("agentRequest"); | ||
cy.visit("/"); | ||
cy.wait("@agentRequest").then((interception) => { | ||
expect(interception.response.statusCode).to.eq(200); | ||
}); | ||
}); | ||
it("Loads correct elements", () => { | ||
cy.get('[data-cy="close-modal-button"]'); | ||
cy.get('[data-cy="instructions-panel-header"]'); | ||
cy.get('[data-cy="instructions-panel-body"]'); | ||
cy.get('[data-cy="character-name-paragraph"]'); | ||
cy.get('[data-cy="character-description-paragraph"]'); | ||
cy.get('[data-cy="character-dropdown"]'); | ||
cy.get('[data-cy="submit-button"]'); | ||
}); | ||
}); | ||
|
||
describe("Submits the html_static_task", () => { | ||
it("Closing starting modal", () => { | ||
cy.get('[data-cy="close-modal-button"]').as("modalButton").click(); | ||
cy.get("@modalButton").should("not.be.visible"); | ||
}); | ||
it("Select a character name description", () => { | ||
cy.get('[data-cy="character-dropdown"]').select("Good"); | ||
cy.get('[data-cy="character-dropdown"]').select("Bad"); | ||
}); | ||
it("Upload a file", () => { | ||
cy.fixture("bliss.png").then((fileContent) => { | ||
cy.get('[data-cy="character-file-input"]').attachFile({ | ||
fileContent: fileContent.toString(), | ||
fileName: "bliss.png", | ||
mimeType: "image/png", | ||
}); | ||
}); | ||
}); | ||
it("Submit the task", () => { | ||
cy.on("window:alert", (txt) => { | ||
expect(txt).to.contains( | ||
'The task has been submitted! Data: {"rating":"bad"' | ||
); | ||
expect(txt).to.contains('"name":"bliss.png"'); | ||
expect(txt).to.contains('"size":51824'); | ||
expect(txt).to.contains('"type":"image/png"'); | ||
}); | ||
cy.intercept({ pathname: "/submit_task" }).as("submitTask"); | ||
cy.get('[data-cy="submit-button"]').click(); | ||
cy.wait("@submitTask").then((interception) => { | ||
expect(interception.response.statusCode).to.eq(200); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+38 KB
...isto/abstractions/blueprints/static_html_task/source/cypress/fixtures/bliss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
mephisto/abstractions/blueprints/static_html_task/source/cypress/support/commands.js
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 @@ | ||
import "cypress-file-upload"; |
1 change: 1 addition & 0 deletions
1
mephisto/abstractions/blueprints/static_html_task/source/cypress/support/e2e.js
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 @@ | ||
import "./commands"; |
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