Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
Browse files Browse the repository at this point in the history
…ture/1011-infra-feeds
  • Loading branch information
Tguntenaar committed Dec 9, 2024
2 parents f2a18a8 + 2846387 commit 0ae2963
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ useEffect(() => {
}
}, [props.transactionHashes]);

const DropdowntBtnContainer = styled.div`
const DropdownBtnContainer = styled.div`
font-size: 13px;
min-width: 150px;
Expand Down Expand Up @@ -666,7 +666,7 @@ const SubmitBtn = () => {
const selectedOption = btnOptions.find((i) => i.value === selectedStatus);

return (
<DropdowntBtnContainer>
<DropdownBtnContainer>
<div
className="custom-select"
tabIndex="0"
Expand Down Expand Up @@ -718,7 +718,7 @@ const SubmitBtn = () => {
</div>
)}
</div>
</DropdowntBtnContainer>
</DropdownBtnContainer>
);
};

Expand Down
1 change: 0 additions & 1 deletion playwright-tests/tests/events/proposals.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ test.describe("Wallet is connected", () => {
test.setTimeout(120000);
await getCurrentBlockHeight(page);
await page.goto(`/${account}/widget/app?page=create-proposal`);

await getCurrentBlockHeight(page);

const delay_milliseconds_between_keypress_when_typing = 100;
Expand Down
76 changes: 76 additions & 0 deletions playwright-tests/tests/infrastructure/proposal.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test as base, expect } from "@playwright/test";
import { pauseIfVideoRecording } from "../../testUtils";
import { MOCK_RPC_URL } from "../../util/rpcmock.js";

const test = base.extend({
// Define an option and provide a default value.
Expand Down Expand Up @@ -288,3 +289,78 @@ test.describe("Wallet is connected as admin", () => {
await expect(newTab).toHaveURL("https://www.google.com");
});
});

let acceptedTermsVersion = 122927956;
async function getCurrentBlockHeight(page) {
// set current block height for accepted terms and conditions
await page.route(MOCK_RPC_URL, async (route) => {
const request = route.request();
const requestPostData = request.postDataJSON();
if (
requestPostData?.method === "block" &&
requestPostData?.params?.finality === "optimistic"
) {
const response = await route.fetch();
const json = await response.json();
json.result.header.height = acceptedTermsVersion;
await route.fulfill({ response, json });
} else {
await route.continue();
}
});
}

test.describe("Wallet is connected", () => {
test.use({
storageState: "playwright-tests/storage-states/wallet-connected.json",
});

test("should create a autolink reference to existing proposal", async ({
page,
account,
}) => {
test.setTimeout(120000);
await getCurrentBlockHeight(page);
await page.goto(`/${account}/widget/app?page=create-proposal`);

const delay_milliseconds_between_keypress_when_typing = 0;
const titleArea = await page.getByRole("textbox").first();
await expect(titleArea).toBeEditable({ timeout: 10_000 });
await titleArea.pressSequentially("Test proposal 123456", {
delay: delay_milliseconds_between_keypress_when_typing,
});

await pauseIfVideoRecording(page);

const descriptionArea = await page
.frameLocator("iframe")
.locator(".CodeMirror textarea");
await descriptionArea.focus();
await descriptionArea.scrollIntoViewIfNeeded();
await descriptionArea.pressSequentially(
`The test proposal description. And referencing #`,
{
delay: delay_milliseconds_between_keypress_when_typing,
}
);
await descriptionArea.pressSequentially("2", { delay: 10 });
await pauseIfVideoRecording(page);

let proposalLink = await page
.frameLocator("iframe")
.getByText(
"#2 Proposal: Near Enablement in Alterscope Risk Infrastructure"
)
.click({ timeout: 10000 });
// check the visibility
await expect(
page
.frameLocator("iframe")
.getByText(
"https://near.social/infrastructure-committee.near/widget/app?page=proposal&id=2"
)
).toBeVisible({ timeout: 10000 });

await pauseIfVideoRecording(page);
});
});

0 comments on commit 0ae2963

Please sign in to comment.