Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: Proposal Create mock structure. #2676

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ProposalForm/ProposalForm.jsx
Expand Up @@ -337,7 +337,7 @@ const ProposalForm = React.memo(function ProposalForm({
)}
<SelectField
name="domain"
id="domain-selector"
id="proposal-domain-selector"
onChange={handleSelectFiledChange("domain")}
options={domainOptions}
className={classNames(styles.typeSelectWrapper, "margin-top-m")}
Expand Down
4 changes: 2 additions & 2 deletions teste2e/cypress/e2e/proposal/create.js
Expand Up @@ -15,7 +15,7 @@ describe("Proposal Create", () => {
// components, in order to fill the new form fields such as: start & end dates
// and amount - issue to track <insert issue link>
//
it("Paid user can create proposals manually", () => {
it("should be able to create proposals", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should be able to create proposals", () => {
it("should allow paid user to create proposals", () => {

// paid user with proposal credits
cy.userEnvironment("user", { verifyIdentity: true });
const proposal = buildProposal();
Expand All @@ -25,7 +25,7 @@ describe("Proposal Create", () => {
cy.findByRole("button", { name: /submit/i }).click();
// needs more time in general to complete this request so we increase the
// responseTimeout
cy.wait("@newProposal", { timeout: 10000 }).should((xhr) => {
cy.wait("@newProposal").should((xhr) => {
expect(xhr.status).to.equal(200);
cy.piMiddleware("summaries", { amountByStatus: { unvetted: 1 } });
const token = xhr.response.body.record.censorshiprecord.token;
Expand Down
11 changes: 3 additions & 8 deletions teste2e/cypress/support/commands.js
Expand Up @@ -160,17 +160,12 @@ Cypress.Commands.add("typeCreateProposal", (proposal) => {
cy.findByTestId("proposal-name").type(proposal.name);
cy.findByTestId("proposal-amount").type(String(proposal.amount / 100)); // get dollars from cents.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier: 80 max char per line.

const startDate = new Date(proposal.startDate * 1000);
cy.findAllByTestId("datepicker").first()
.children()
cy.findAllByTestId("datepicker").first().children().first().click();
cy.findAllByTestId("days-list")
.first()
.click();
cy.findAllByTestId("days-list").first()
.findByText(startDate.getDate())
.click();
cy.findAllByTestId("datepicker").first().next()
.children()
.first()
.click();
cy.findAllByTestId("datepicker").first().next().children().first().click();
cy.get("[data-testid=days-list]:eq(1)").find(">li").last().click();
const domainTxt = RECORD_DOMAINS[proposal.domain];
cy.get("#domain-selector").click().contains(domainTxt).click({ force: true });
Expand Down
4 changes: 2 additions & 2 deletions teste2e/cypress/support/core/api.js
@@ -1,4 +1,4 @@
import { Record, File, Inventory, Proposal } from "./generate";
import { Record, File, Inventory } from "./generate";
import { stateToString } from "./utils";

export const API_BASE_URL = "/api/records/v1";
Expand Down Expand Up @@ -103,7 +103,7 @@ export function detailsReply({

/**
* newRecordReply is the reply to the new command. It returns a new record for the
* request data with given `files`, `publickey`, `signature` and `author` testParams.
* request data with given `files`, `publickey`, `signature` and `username` testParams.
*
* @param {Object} { testParams, requestParams }
* @returns Proposal
Expand Down