-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created by Github action
- Loading branch information
Showing
79 changed files
with
2,624 additions
and
371 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class AllBlocksPage { | ||
visit() { | ||
cy.visit("/blocks"); | ||
} | ||
|
||
get createBlockButton() { | ||
return cy.getBySelector("create-block-button"); | ||
} | ||
|
||
get onboardingDialog() { | ||
return cy.getBySelector("onboarding-dialog"); | ||
} | ||
|
||
get onboardingNextButton() { | ||
return cy.getBySelector("onboarding-next-button"); | ||
} | ||
|
||
get createModelDialog() { | ||
return cy.getBySelector("create-model-dialog"); | ||
} | ||
|
||
get searchBlocksInput() { | ||
return cy.getBySelector("search-blocks-input"); | ||
} | ||
|
||
clickOnboardingNextButton() { | ||
this.onboardingNextButton.click(); | ||
} | ||
|
||
createBlock(name) { | ||
this.createBlockButton.click(); | ||
cy.getBySelector("create-model-display-name-input").type(name); | ||
cy.getBySelector("create-model-submit-button").click(); | ||
} | ||
} | ||
|
||
export default new AllBlocksPage(); |
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,13 @@ | ||
class BlockPage { | ||
get createVariantButton() { | ||
return cy.getBySelector("create-variant-button"); | ||
} | ||
|
||
createVariant(name) { | ||
this.createVariantButton.click(); | ||
cy.getBySelector("variant-name-input").type(name); | ||
cy.getBySelector("create-variant-confirm-button").click(); | ||
} | ||
} | ||
|
||
export default new BlockPage(); |
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,65 @@ | ||
import AllBlocksPage from "../pages/AllBlocksPage"; | ||
import BlockPage from "../pages/BlockPage"; | ||
import SchemaPage from "../../schema/pages/SchemaPage"; | ||
|
||
const CypressTestBlock = "Cypress Test Block"; | ||
const CypressTestVariant = "Cypress Test Variant"; | ||
|
||
describe("All Blocks Tests", () => { | ||
before(() => { | ||
AllBlocksPage.visit(); | ||
}); | ||
|
||
after(() => { | ||
SchemaPage.visit(); | ||
SchemaPage.deleteModel(CypressTestBlock); | ||
}); | ||
|
||
it("should show and traverse onboarding flow", () => { | ||
AllBlocksPage.onboardingDialog.should("be.visible"); | ||
const totalSteps = 4; | ||
for (let i = 0; i < totalSteps; i++) { | ||
AllBlocksPage.clickOnboardingNextButton(); | ||
} | ||
AllBlocksPage.onboardingDialog.should("not.exist"); | ||
}); | ||
|
||
it("creates new block with default values", () => { | ||
AllBlocksPage.createBlock(CypressTestBlock); | ||
cy.contains(CypressTestBlock).should("exist"); | ||
SchemaPage.visit(); | ||
SchemaPage.addSingleLineTextFieldWithDefaultValue( | ||
CypressTestBlock, | ||
"Foo", | ||
"Default Foo" | ||
); | ||
AllBlocksPage.visit(); | ||
}); | ||
|
||
it("searches for a block", () => { | ||
AllBlocksPage.searchBlocksInput.type(CypressTestBlock); | ||
cy.contains(CypressTestBlock).should("exist"); | ||
}); | ||
|
||
it("shows no results when no blocks are found", () => { | ||
AllBlocksPage.searchBlocksInput.find("input").clear(); | ||
AllBlocksPage.searchBlocksInput.type("Non Existent Block"); | ||
cy.contains( | ||
"Your search “Non Existent Block” could not find any results" | ||
).should("exist"); | ||
}); | ||
|
||
it("navigates to block detail page", () => { | ||
cy.contains(CypressTestBlock).click(); | ||
cy.contains("Start Creating Variants Now").should("exist"); | ||
}); | ||
|
||
it("creates a variant with default values", () => { | ||
cy.contains(CypressTestBlock).click(); | ||
BlockPage.createVariant(CypressTestVariant); | ||
cy.contains( | ||
new RegExp(`${CypressTestBlock}:\\s*${CypressTestVariant}`) | ||
).should("exist"); | ||
cy.get('input[name="foo"]').should("have.value", "Default Foo"); | ||
}); | ||
}); |
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,50 @@ | ||
class SchemaPage { | ||
visit() { | ||
cy.visit("/schema"); | ||
} | ||
|
||
get modelHeaderMenuButton() { | ||
return cy.getBySelector("model-header-menu"); | ||
} | ||
|
||
get modelMenuDeleteButton() { | ||
return cy.getBySelector("delete-model-menu-button"); | ||
} | ||
|
||
get deleteModelConfirmationInput() { | ||
return cy.getBySelector("delete-model-confirmation-input"); | ||
} | ||
|
||
get deleteModelConfirmationButton() { | ||
return cy.getBySelector("delete-model-confirmation-button"); | ||
} | ||
|
||
get addFieldButton() { | ||
return cy.getBySelector("AddFieldBtn"); | ||
} | ||
|
||
get rulesTabButton() { | ||
return cy.getBySelector("RulesTabBtn"); | ||
} | ||
|
||
deleteModel(name) { | ||
cy.contains(name).click(); | ||
this.modelHeaderMenuButton.click(); | ||
this.modelMenuDeleteButton.click(); | ||
this.deleteModelConfirmationInput.type(name); | ||
this.deleteModelConfirmationButton.click(); | ||
} | ||
|
||
addSingleLineTextFieldWithDefaultValue(modelName, fieldName, defaultValue) { | ||
cy.contains(modelName).click(); | ||
this.addFieldButton.click(); | ||
cy.contains("Single Line Text").click(); | ||
cy.getBySelector("FieldFormInput_label").type(fieldName); | ||
this.rulesTabButton.click(); | ||
cy.getBySelector("DefaultValueCheckbox").click(); | ||
cy.getBySelector("DefaultValueInput").type(defaultValue); | ||
cy.getBySelector("FieldFormAddFieldBtn").click(); | ||
} | ||
} | ||
|
||
export default new SchemaPage(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.