Skip to content

Commit

Permalink
use test-widgets in tests for testing instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 committed Jan 14, 2025
1 parent 20a87b9 commit 0c87fc9
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 10 deletions.
2 changes: 1 addition & 1 deletion instances/treasury-devdao.near/aliases.mainnet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"REPL_BASE_DEPLOYMENT_ACCOUNT": "treasury-devdao.near",
"REPL_BASE_DEPLOYMENT_ACCOUNT": "widgets.treasury-factory.near",
"REPL_INSTANCE": "treasury-devdao.near",
"REPL_TREASURY": "devdao.sputnik-dao.near",
"REPL_PROPOSALS_CACHE_URL": "https://devhub-cache-api-rs.fly.dev"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,12 @@ test.describe("admin with function access keys", function () {
await expect(
page.getByRole("cell", { name: `${newProposalId}`, exact: true })
).toBeVisible({ timeout: 10_000 });
const widgetsAccount =
(instanceAccount.includes("testing") ? "test-widgets" : "widgets") +
".treasury-factory.near";
const firstRow = page
.locator(
'tr[data-component="widgets.treasury-factory.near/widget/pages.payments.Table"]'
`tr[data-component="${widgetsAccount}/widget/pages.payments.Table"]`
)
.nth(1);
await expect(firstRow).toContainText(
Expand Down
6 changes: 5 additions & 1 deletion playwright-tests/tests/payments/vote-on-request.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ async function voteOnProposal({
},
});

const widgetsAccount =
(instanceAccount.includes("testing") === true
? "test-widgets"
: "widgets") + ".treasury-factory.near";
await page.goto(`/${instanceAccount}/widget/app?page=payments`);
await setDontAskAgainCacheValues({
page,
widgetSrc: "widgets.treasury-factory.near/widget/components.VoteActions",
widgetSrc: `${widgetsAccount}/widget/components.VoteActions`,
contractId,
methodName: "act_proposal",
});
Expand Down
7 changes: 6 additions & 1 deletion playwright-tests/tests/settings/request-feed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ async function voteOnProposal({
});

await page.goto(`/${instanceAccount}/widget/app?page=settings`);
const widgetsAccount =
(instanceAccount.includes("testing") === true
? "test-widgets"
: "widgets") + ".treasury-factory.near";

await setDontAskAgainCacheValues({
page,
widgetSrc: "widgets.treasury-factory.near/widget/components.VoteActions",
widgetSrc: `${widgetsAccount}/widget/components.VoteActions`,
contractId,
methodName: "act_proposal",
});
Expand Down
37 changes: 32 additions & 5 deletions playwright-tests/tests/stake-delegation/stake-delegation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,18 @@ async function voteOnProposal({
});

await page.goto(`/${instanceAccount}/widget/app?page=stake-delegation`);
const widgetsAccount =
(instanceAccount.includes("testing") === true
? "test-widgets"
: "widgets") + ".treasury-factory.near";

await setDontAskAgainCacheValues({
page,
widgetSrc: "widgets.treasury-factory.near/widget/components.VoteActions",
widgetSrc: `${widgetsAccount}/widget/components.VoteActions`,
contractId,
methodName: "act_proposal",
});

await expect(
await page.locator("div").filter({ hasText: /^Stake Delegation$/ })
).toBeVisible({ timeout: 20_000 });
Expand Down Expand Up @@ -817,14 +822,24 @@ test.describe("Withdraw request", function () {
});
});

async function openLockupStakingForm({ page, daoAccount, lockupContract }) {
async function openLockupStakingForm({
page,
daoAccount,
lockupContract,
instanceAccount,
}) {
const createRequestButton = await page.getByText("Create Request", {
exact: true,
});
await createRequestButton.click();
const widgetsAccount =
(instanceAccount.includes("testing") === true
? "test-widgets"
: "widgets") + ".treasury-factory.near";

await page
.locator(
'div[data-component="widgets.treasury-factory.near/widget/pages.stake-delegation.CreateButton"] .option',
`div[data-component="${widgetsAccount}widgets.treasury-factory.near/widget/pages.stake-delegation.CreateButton"] .option`,
{ hasText: "Stake" }
)
.first()
Expand Down Expand Up @@ -908,9 +923,15 @@ test.describe("Lockup staking", function () {
page,
daoAccount,
lockupContract,
instanceAccount,
}) => {
test.setTimeout(120_000);
await openLockupStakingForm({ page, daoAccount, lockupContract });
await openLockupStakingForm({
page,
daoAccount,
lockupContract,
instanceAccount,
});
await fillValidatorAccount({
page,
});
Expand Down Expand Up @@ -1020,9 +1041,15 @@ test.describe("Lockup staking", function () {
page,
daoAccount,
lockupContract,
instanceAccount,
}) => {
test.setTimeout(120_000);
await openLockupStakingForm({ page, daoAccount, lockupContract });
await openLockupStakingForm({
page,
daoAccount,
lockupContract,
instanceAccount,
});
await page.waitForTimeout(20_000);
const poolSelector = page.locator(".custom-select").first();
await expect(poolSelector).toBeVisible({ timeout: 20_000 });
Expand Down
7 changes: 6 additions & 1 deletion playwright-tests/tests/web4/web4.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ test("should go directly to app widget for instance", async ({
await route.continue({ url: baseURL });
});
await page.goto(pageOrigin);
const widgetsAccount =
(instanceAccount.includes("testing") === true
? "test-widgets"
: "widgets") + ".treasury-factory.near";

await expect(
await page
.locator(
'div[data-component="widgets.treasury-factory.near/widget/components.Navbar"]'
`div[data-component="${widgetsAccount}/widget/components.Navbar"]`
)
.first()
).toContainText(daoAccount);
Expand Down

0 comments on commit 0c87fc9

Please sign in to comment.