From 17388100fcbc56692d8d5bc061c7409bd92fa25c Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Fri, 11 Aug 2023 18:07:11 +0530 Subject: [PATCH 01/13] WIP: Organizing Test Files --- .github/workflows/Test.yml | 4 +- config.js | 6 +- env.example | 1 - tests/CommonFile/TestData.js | 14 +++-- tests/TC01/TC01-02_TokenValues.spec.js | 2 +- tests/TC01/TC01-03_TokenWithValues.spec.js | 57 +++++++++++++++++++ .../TC02-01_CreateDAO.spec.js} | 0 .../TC02-02_DAOValues.spec.js} | 0 .../TC03-01_ChangeDelegate.spec.js} | 7 ++- .../TC03-02_ChangeGuardian.spec.js} | 0 .../TC03-03_TransferTokens.spec.js} | 0 .../TC03-04_ChangeConfiguration.spec.js} | 0 .../TC03-05_TransferNFT.spec.js} | 0 .../TC03-06_EditRegistry.spec.js} | 0 .../TC03-07_AddLambda.spec.js} | 0 .../TC03-08_RemoveLambda.spec.js} | 0 .../TC03-09_ExecuteLambda.spec.js} | 0 .../TC04-01_VoteOnProposal.spec.js} | 4 +- .../TC04-02_ProposalExecutionandDrop.spec.js} | 4 +- .../TC05-01_OffChainPoll.spec.js} | 6 +- .../TC05-02_VoteonOffChainPoll.spec.js} | 0 ...03_CorrectVoteCountOnOffChainPoll.spec.js} | 0 .../TC06-01_SuccessfulTokenStaking.spec.js} | 4 +- .../TC06-02_SuccessfulTokenUnStaking.spec.js} | 0 ...TC06-03_SuccessfulTokenWithdrawal.spec.js} | 0 25 files changed, 86 insertions(+), 23 deletions(-) delete mode 100644 env.example create mode 100644 tests/TC01/TC01-03_TokenWithValues.spec.js rename tests/{TC01/TC01-03_CreateDAO.spec.js => TC02/TC02-01_CreateDAO.spec.js} (100%) rename tests/{TC01/TC01-04_DAOValues.spec.js => TC02/TC02-02_DAOValues.spec.js} (100%) rename tests/{TC05-01_ChangeDelegate.spec.js => TC03/TC03-01_ChangeDelegate.spec.js} (87%) rename tests/{TC05-02_ChangeGuardian.spec.js => TC03/TC03-02_ChangeGuardian.spec.js} (100%) rename tests/{TC05-03_TransferTokens.spec.js => TC03/TC03-03_TransferTokens.spec.js} (100%) rename tests/{TC05-04_ChangeConfiguration.spec.js => TC03/TC03-04_ChangeConfiguration.spec.js} (100%) rename tests/{TC05-05_TransferNFT.spec.js => TC03/TC03-05_TransferNFT.spec.js} (100%) rename tests/{TC05-06_EditRegistry.spec.js => TC03/TC03-06_EditRegistry.spec.js} (100%) rename tests/{TC05-07_AddLambda.spec.js => TC03/TC03-07_AddLambda.spec.js} (100%) rename tests/{TC05-08_RemoveLambda.spec.js => TC03/TC03-08_RemoveLambda.spec.js} (100%) rename tests/{TC05-09_ExecuteLambda.spec.js => TC03/TC03-09_ExecuteLambda.spec.js} (100%) rename tests/{TC06_VoteOnProposal.spec.js => TC04/TC04-01_VoteOnProposal.spec.js} (93%) rename tests/{TC07_ProposalExecutionandDrop.spec.js => TC04/TC04-02_ProposalExecutionandDrop.spec.js} (89%) rename tests/{TC08_OffChainPoll.spec.js => TC05/TC05-01_OffChainPoll.spec.js} (92%) rename tests/{TC09_VoteonOffChainPoll.spec.js => TC05/TC05-02_VoteonOffChainPoll.spec.js} (100%) rename tests/{TC10_CorrectVoteCountOnOffChainPoll.spec.js => TC05/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js} (100%) rename tests/{TC11_SuccessfulTokenStaking.spec.js => TC06/TC06-01_SuccessfulTokenStaking.spec.js} (88%) rename tests/{TC12_SuccessfulTokenUnStaking.spec.js => TC06/TC06-02_SuccessfulTokenUnStaking.spec.js} (100%) rename tests/{TC13_SuccessfulTokenWithdrawal.spec.js => TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js} (100%) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 3671161..f56a916 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -3,10 +3,10 @@ name: Run Playwright Tests on: push: branches: - - main + - dev-aayushi pull_request: branches: - - main + - dev-aayushi workflow_dispatch: permissions: diff --git a/config.js b/config.js index e555dc6..747bdfd 100644 --- a/config.js +++ b/config.js @@ -1,7 +1,11 @@ -require("dotenv").config() +require ("dotenv").config() const AppConfig = { + TestURL: process.env.WEBAPP_URL + } +console.log("WEBAPP_URL:", process.env.WEBAPP_URL); + module.exports = AppConfig \ No newline at end of file diff --git a/env.example b/env.example deleted file mode 100644 index bbc5ec3..0000000 --- a/env.example +++ /dev/null @@ -1 +0,0 @@ -WEBAPP_URL=https://deploy-preview-*********.netlify.app \ No newline at end of file diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index b66df97..9aab231 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -10,11 +10,13 @@ const TezosTestData = { Icon: "Picture.PNG", WalletAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Amount: "100", + TC02Amount:"10", + ErrorText2: "Total Supply not fully allocated", }, DAOCreate: { - DAOName: "Decentralized Governance Initiative", - TokenAddress: "KT1EHxvnhn5gX9EcNyFsp3y1HnKCBM2JjXpm", + DAOName: "My Test DAO", + TokenAddress: "KT1FZiY1zuGqD5k1EMk1ijBUsFasJRN9QSqZ", TokenID: "0", GuardianAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Description: "A DAO focused on funding and promoting open-source projects related to sustainability and renewable energy.", @@ -26,7 +28,7 @@ const TezosTestData = { ExecutionHours: "00", ExecutionMinutes: "01", ThresholdExpiryDays: "01", - ThresholdExpiryHours: "00", + ThresholdExpiryHours: "01", ThresholdExpiryMinutes: "00", QuorumThreshold: '2', QuorumChange: '2', @@ -46,16 +48,16 @@ const TezosTestData = { }, ChangeGuardian: { - WalletAddress: "tz1VxgGHwU6T6MaWrzfCBSpg2tw823KWVbk6", + WalletAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", }, ChangeDelegate: { - NewDelegateAddress: "tz1VxgGHwU6T6MaWrzfCBSpg2tw823KWVbk6", + NewDelegateAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", }, TransferToken: { - RecipientAddress: "tz1VxgGHwU6T6MaWrzfCBSpg2tw823KWVbk6", + RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Asset: "SRD", Amount: "10", AgoraPostID: "10", diff --git a/tests/TC01/TC01-02_TokenValues.spec.js b/tests/TC01/TC01-02_TokenValues.spec.js index 5a6fb65..f57cc5b 100644 --- a/tests/TC01/TC01-02_TokenValues.spec.js +++ b/tests/TC01/TC01-02_TokenValues.spec.js @@ -33,6 +33,6 @@ test("Test Case 2: Token Creation with Various Input Values", async ({ page, }) await expect(textMessage).toBeVisible(); //Verify The Text Present on The Web - console.log(" Create Token with input values are fail due to the decimals test box not accept 0 value"); + console.log(" Create Token with input values are fail due to the description test box does not accept empty string"); }); diff --git a/tests/TC01/TC01-03_TokenWithValues.spec.js b/tests/TC01/TC01-03_TokenWithValues.spec.js new file mode 100644 index 0000000..8139324 --- /dev/null +++ b/tests/TC01/TC01-03_TokenWithValues.spec.js @@ -0,0 +1,57 @@ +const {test, expect} = require('@playwright/test'); +const { changeNetwork } = require('../CommonFile/Action'); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); + + +test('Test3: Amount Less than Supply Token',async ({page})=>{ + + test.setTimeout(120000); + + // set Network to Ghostnet + await changeNetwork(page); + + //Click Create DAO button + await page.click(pageLocators.TokenCreator.CreateDAO); + + //click "No, I need one" + await page.click(pageLocators.TokenCreator.GovernanceToken); + + //Enter token name + await page.fill(pageLocators.TokenCreator.TokenName, TezosTestData.TokenCreator.TokenName); + + //Enter token description + await page.fill(pageLocators.TokenCreator.TokenDescription, TezosTestData.TokenCreator.TokenDescription) + //Enter Supply + await page.fill(pageLocators.TokenCreator.TotalSupply, TezosTestData.TokenCreator.SupplyToken) + //Enter Decimals + await page.fill(pageLocators.TokenCreator.Decimals, TezosTestData.TokenCreator.Decimals) + //Enter Icon + await page.fill(pageLocators.TokenCreator.Icon, TezosTestData.TokenCreator.Icon) + //Enter Symbol + await page.fill(pageLocators.TokenCreator.Symbol, TezosTestData.TokenCreator.Symbol) + + // Click Continue + await page.click(pageLocators.TokenCreator.ContinueButton1); + + await page.waitForTimeout(2000); + + + //Enter Wallet Address + await page.fill(pageLocators.TokenCreator.WalletAddress, TezosTestData.TokenCreator.WalletAddress); + + //Enter The Amount + await page.fill(pageLocators.TokenCreator.Amount, TezosTestData.TokenCreator.TC02Amount); + + //Click on Continue Button + await page.click(pageLocators.TokenCreator.ContinueButton2); + + const errorText = await page.getByText(TezosTestData.TokenCreator.ErrorText2); + await expect(errorText).toBeVisible() + console.log("message shown: ",TezosTestData.TokenCreator.ErrorText2); + console.log("Token cannot be created if Amount is less than Supply Token"); + + await page.waitForTimeout(5000); + + +}) \ No newline at end of file diff --git a/tests/TC01/TC01-03_CreateDAO.spec.js b/tests/TC02/TC02-01_CreateDAO.spec.js similarity index 100% rename from tests/TC01/TC01-03_CreateDAO.spec.js rename to tests/TC02/TC02-01_CreateDAO.spec.js diff --git a/tests/TC01/TC01-04_DAOValues.spec.js b/tests/TC02/TC02-02_DAOValues.spec.js similarity index 100% rename from tests/TC01/TC01-04_DAOValues.spec.js rename to tests/TC02/TC02-02_DAOValues.spec.js diff --git a/tests/TC05-01_ChangeDelegate.spec.js b/tests/TC03/TC03-01_ChangeDelegate.spec.js similarity index 87% rename from tests/TC05-01_ChangeDelegate.spec.js rename to tests/TC03/TC03-01_ChangeDelegate.spec.js index b97b384..30b74a5 100644 --- a/tests/TC05-01_ChangeDelegate.spec.js +++ b/tests/TC03/TC03-01_ChangeDelegate.spec.js @@ -1,7 +1,7 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreAction"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-01: Change Delegate', async ({ page }) => { @@ -11,6 +11,7 @@ test('Test case 05-01: Change Delegate', async ({ page }) => { test.setTimeout(600000); //To Extend the time of test Execution await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + // await page.waitForTimeout(3000); await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal diff --git a/tests/TC05-02_ChangeGuardian.spec.js b/tests/TC03/TC03-02_ChangeGuardian.spec.js similarity index 100% rename from tests/TC05-02_ChangeGuardian.spec.js rename to tests/TC03/TC03-02_ChangeGuardian.spec.js diff --git a/tests/TC05-03_TransferTokens.spec.js b/tests/TC03/TC03-03_TransferTokens.spec.js similarity index 100% rename from tests/TC05-03_TransferTokens.spec.js rename to tests/TC03/TC03-03_TransferTokens.spec.js diff --git a/tests/TC05-04_ChangeConfiguration.spec.js b/tests/TC03/TC03-04_ChangeConfiguration.spec.js similarity index 100% rename from tests/TC05-04_ChangeConfiguration.spec.js rename to tests/TC03/TC03-04_ChangeConfiguration.spec.js diff --git a/tests/TC05-05_TransferNFT.spec.js b/tests/TC03/TC03-05_TransferNFT.spec.js similarity index 100% rename from tests/TC05-05_TransferNFT.spec.js rename to tests/TC03/TC03-05_TransferNFT.spec.js diff --git a/tests/TC05-06_EditRegistry.spec.js b/tests/TC03/TC03-06_EditRegistry.spec.js similarity index 100% rename from tests/TC05-06_EditRegistry.spec.js rename to tests/TC03/TC03-06_EditRegistry.spec.js diff --git a/tests/TC05-07_AddLambda.spec.js b/tests/TC03/TC03-07_AddLambda.spec.js similarity index 100% rename from tests/TC05-07_AddLambda.spec.js rename to tests/TC03/TC03-07_AddLambda.spec.js diff --git a/tests/TC05-08_RemoveLambda.spec.js b/tests/TC03/TC03-08_RemoveLambda.spec.js similarity index 100% rename from tests/TC05-08_RemoveLambda.spec.js rename to tests/TC03/TC03-08_RemoveLambda.spec.js diff --git a/tests/TC05-09_ExecuteLambda.spec.js b/tests/TC03/TC03-09_ExecuteLambda.spec.js similarity index 100% rename from tests/TC05-09_ExecuteLambda.spec.js rename to tests/TC03/TC03-09_ExecuteLambda.spec.js diff --git a/tests/TC06_VoteOnProposal.spec.js b/tests/TC04/TC04-01_VoteOnProposal.spec.js similarity index 93% rename from tests/TC06_VoteOnProposal.spec.js rename to tests/TC04/TC04-01_VoteOnProposal.spec.js index c063376..a7813ec 100644 --- a/tests/TC06_VoteOnProposal.spec.js +++ b/tests/TC04/TC04-01_VoteOnProposal.spec.js @@ -1,6 +1,6 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreAction"); +const { pageLocators } = require("../CommonFile/Locator"); const path = require('path'); test('Test case 06: Vote On Proposal ', async ({ page }) => { diff --git a/tests/TC07_ProposalExecutionandDrop.spec.js b/tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js similarity index 89% rename from tests/TC07_ProposalExecutionandDrop.spec.js rename to tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js index ed1c198..dfcdb6b 100644 --- a/tests/TC07_ProposalExecutionandDrop.spec.js +++ b/tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js @@ -1,6 +1,6 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreAction"); +const { pageLocators } = require("../CommonFile/Locator"); test('Test case 07: Proposal Execution & Drop', async ({ page }) => { diff --git a/tests/TC08_OffChainPoll.spec.js b/tests/TC05/TC05-01_OffChainPoll.spec.js similarity index 92% rename from tests/TC08_OffChainPoll.spec.js rename to tests/TC05/TC05-01_OffChainPoll.spec.js index 7f25113..6692ae7 100644 --- a/tests/TC08_OffChainPoll.spec.js +++ b/tests/TC05/TC05-01_OffChainPoll.spec.js @@ -1,7 +1,7 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreAction"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { diff --git a/tests/TC09_VoteonOffChainPoll.spec.js b/tests/TC05/TC05-02_VoteonOffChainPoll.spec.js similarity index 100% rename from tests/TC09_VoteonOffChainPoll.spec.js rename to tests/TC05/TC05-02_VoteonOffChainPoll.spec.js diff --git a/tests/TC10_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC05/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js similarity index 100% rename from tests/TC10_CorrectVoteCountOnOffChainPoll.spec.js rename to tests/TC05/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js diff --git a/tests/TC11_SuccessfulTokenStaking.spec.js b/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js similarity index 88% rename from tests/TC11_SuccessfulTokenStaking.spec.js rename to tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js index 095e2f4..bb30e42 100644 --- a/tests/TC11_SuccessfulTokenStaking.spec.js +++ b/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js @@ -1,6 +1,6 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreAction"); +const { pageLocators } = require("../CommonFile/Locator"); const path = require('path'); test('Test case 11: Successful Token Staking', async ({ page }) => { diff --git a/tests/TC12_SuccessfulTokenUnStaking.spec.js b/tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js similarity index 100% rename from tests/TC12_SuccessfulTokenUnStaking.spec.js rename to tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js diff --git a/tests/TC13_SuccessfulTokenWithdrawal.spec.js b/tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js similarity index 100% rename from tests/TC13_SuccessfulTokenWithdrawal.spec.js rename to tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js From df7e4807f9f772deaa68cad798a5e731fddb825b Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Sat, 12 Aug 2023 21:36:20 +0530 Subject: [PATCH 02/13] WIP: TC03 --- tests/CommonFile/Action.js | 8 +- tests/CommonFile/Locator.js | 102 +++++++------- tests/CommonFile/TestData.js | 14 +- tests/TC01/TC01-01_CreateToken.spec.js | 66 ++++++---- tests/TC01/TC01-02_TokenValues.spec.js | 46 ++++--- tests/TC01/TC01-03_TokenWithValues.spec.js | 44 +++---- tests/TC02/TC02-01_CreateDAO.spec.js | 146 +++++++++++++-------- tests/TC02/TC02-02_DAOValues.spec.js | 43 +++--- 8 files changed, 273 insertions(+), 196 deletions(-) diff --git a/tests/CommonFile/Action.js b/tests/CommonFile/Action.js index 0c2a19b..e84996d 100644 --- a/tests/CommonFile/Action.js +++ b/tests/CommonFile/Action.js @@ -7,13 +7,13 @@ async function changeNetwork(page){ console.log("WebApp URL for Testing:", AppConfig.TestURL) await page.goto(AppConfig.TestURL); - await page.click(pageLocators.TokenCreator.EnterApp) + await page.click(pageLocators.TokenCreation.EnterApp) - await page.click(pageLocators.TokenCreator.MainNet); + await page.getByText(pageLocators.TokenCreation.MainNet).click() - await page.waitForSelector(pageLocators.TokenCreator.frame); + await page.waitForSelector(pageLocators.TokenCreation.frame); - await page.click(pageLocators.TokenCreator.GhostNet); + await page.getByText(pageLocators.TokenCreation.GhostNet).click(); } diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 37952aa..540e2bb 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -1,64 +1,60 @@ const pageLocators = { - TokenCreator: { - MainNet:"//p[text()='Mainnet']", - GhostNet:"//h6[text()='Ghostnet']", + TokenCreation: { + MainNet:'Mainnet', + GhostNet:"Ghostnet", EnterApp: ".MuiButtonBase-root.MuiButton-root.MuiButton-contained.jss11.jss12.MuiButton-containedSecondary", frame: "div.MuiGrid-root.MuiGrid-container.MuiGrid-align-items-xs-center.MuiGrid-justify-content-xs-center", - ConnectWallet: "//span[text()='Connect Wallet']", - CreateDAO: "//button[@class='MuiButtonBase-root MuiButton-root MuiButton-contained jss37 jss38 MuiButton-containedSecondary']", - GovernanceToken: "//span[normalize-space()='No, I need one']", - TokenName: "//input[@placeholder='Contract Name']", - TokenDescription: "//textarea[@placeholder='Type a description']", - TotalSupply: "//input[@name='totalSupply']", - Decimals: "//input[@name='decimals']", - Symbol: "//input[@name='symbol']", - Icon: "//input[@name='icon']", - ContinueButton1: "//p[text()='Continue']", - WalletAddress: "//input[@placeholder='Wallet address']", - Amount: "//input[@placeholder='0']", - ContinueButton2: "//p[text()='Continue']", - launch: "//p[text()='Launch']", + // ConnectWallet: "//span[text()='Connect Wallet']", + CreateDAO: "Create DAO", + GovernanceToken: "No, I need one", + TokenName: "input[placeholder='Contract Name']", + TokenDescription: "textarea[placeholder='Type a description']", + TotalSupply: "input[name='totalSupply']", + Decimals: "input[name='decimals']", + Symbol: "input[name='symbol']", + Icon: "input[name='icon']", + ContinueButton: "Continue", + WalletAddress: "input[placeholder='Wallet address']", + Amount: "input[name='holders.[0].amount']", + launch: "Launch", DeployText: "Governance token successfully deployed", ConsoleAddress: "p[class='MuiTypography-root-165 MuiTypography-body1-167 MuiTypography-colorTextSecondary-191']", ErrorText: "Required", - }, - - DAOCreate: { - CreateDAO: "//span[text()='Create DAO']", - GovernanceToken: "//span[text()='Yes, I have one']", - FullDAO: "//p[normalize-space()='Full DAO']", - ContinueButton1: "//p[text()='Continue']", - DAOName: "//input[@name='name']", - TokenAddress: "//input[@name='governanceToken.address']", - TokenID: "//input[@name='governanceToken.tokenId']", - Description: "//textarea[@placeholder='Type a description']", - GuardianAddress: "//input[@placeholder='tz1PXn....']", - ContinueButton2: "//p[text()='Continue']", - VotingDays: "//input[@name='votingBlocksDay']", - VotingHours: "//input[@name='votingBlocksHours']", - VotingMinutes: "//input[@name='votingBlocksMinutes']", - ExecutionDays: "//input[@name='proposalFlushBlocksDay']", - ExecutionHours: "//input[@name='proposalFlushBlocksHours']", - ExecutionMinutes: "//input[@name='proposalFlushBlocksMinutes']", - ThresholdExpiryDays: "//input[@name='proposalExpiryBlocksDay']", - ThresholdExpiryHours: "//input[@name='proposalExpiryBlocksHours']", - ThresholdExpiryMinutes: "//input[@name='proposalExpiryBlocksMinutes']", + ErrorText2: "Total Supply not fully allocated", + }, + + DAOCreation: { + CreateDAO: "Create DAO", + GovernanceToken: "Yes, I have one", + FullDAO: "Full DAO", + ContinueButton: "Continue", + DAOName: "input[placeholder='DAO Name']", + TokenAddress: "input[name='governanceToken.address']", + TokenID: "input[name='governanceToken.tokenId']", + GuardianAddress: "input[name='guardian']", + Description: "textarea[placeholder='Type a description']", + VotingDays: "input[name='votingBlocksDay']", + VotingHours: "input[name='votingBlocksHours']", + VotingMinutes: "input[name='votingBlocksMinutes']", + ExecutionDays: "input[name='proposalFlushBlocksDay']", + ExecutionHours: "input[name='proposalFlushBlocksHours']", + ExecutionMinutes: "input[name='proposalFlushBlocksMinutes']", + ThresholdExpiryDays: "input[name='proposalExpiryBlocksDay']", + ThresholdExpiryHours: "input[name='proposalExpiryBlocksHours']", + ThresholdExpiryMinutes: "input[name='proposalExpiryBlocksMinutes']", + RequireStake: "input[name='proposeStakeRequired']", Slider:"span[role='slider']", - RequireStake: "//input[@name='proposeStakeRequired']", - MinAmount: "//input[@name='minXtzAmount']", - MaxAmount: "//input[@name='maxXtzAmount']", - ContinueButton3: "//p[text()='Continue']", - QuorumThreshold:"//input[@name='quorumThreshold']", - QuorumChange:"//input[@name='quorumChange']", - MinQuorumAmount:"//input[@name='minQuorumAmount']", - QuorumMaxChange:"//input[@name='quorumMaxChange']", - MaxQuorumAmount:"//input[@name='maxQuorumAmount']", - ContinueButton4: "//p[text()='Continue']", - ContinueButton5: "//p[text()='Continue']", - SelfDeployed: " //p[text()='Self-Deployed']", - Managed: "//p[text()='Managed']", - DeployDAO: "//p[text()='Deploy DAO']", + MinAmount: "input[name='minXtzAmount']", + MaxAmount: "input[name='maxXtzAmount']", + QuorumThreshold:"input[name='quorumThreshold']", + QuorumChange:"input[name='quorumChange']", + MinQuorumAmount:"input[name='minQuorumAmount']", + QuorumMaxChange:"input[name='quorumMaxChange']", + MaxQuorumAmount:"input[name='maxQuorumAmount']", + SelfDeployed: " Self-Deployed", + DeployDAO: "Deploy DAO", + // Managed: "//p[text()='Managed']", DAOText: "Go to my DAO", ErrorText: "Required", }, diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 9aab231..ca100df 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -1,26 +1,26 @@ const TezosTestData = { - TokenCreator: { + TokenCreation: { TokenName: "My token name", TokenDescription: "My Token Descriptions", - TC02TokenDescription: "", + TC01_02TokenDescription: "", SupplyToken: "100", Decimals: "18", Symbol: "#", Icon: "Picture.PNG", WalletAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Amount: "100", - TC02Amount:"10", - ErrorText2: "Total Supply not fully allocated", + TC01_03Amount:"10", + }, - DAOCreate: { + DAOCreation: { DAOName: "My Test DAO", - TokenAddress: "KT1FZiY1zuGqD5k1EMk1ijBUsFasJRN9QSqZ", + TokenAddress: "KT1ND3pDj67PqfjvzqPUAvSRqmcqcHnqpiEQ", TokenID: "0", GuardianAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Description: "A DAO focused on funding and promoting open-source projects related to sustainability and renewable energy.", - TC04DAODescription: "", + TC02_02DAODescription: "", VotingDays: '00', VotingHours: '01', VotingMinutes: "00", diff --git a/tests/TC01/TC01-01_CreateToken.spec.js b/tests/TC01/TC01-01_CreateToken.spec.js index b1a6134..99f853e 100644 --- a/tests/TC01/TC01-01_CreateToken.spec.js +++ b/tests/TC01/TC01-01_CreateToken.spec.js @@ -1,54 +1,70 @@ -const { test } = require("@playwright/test"); +const { test, expect } = require("@playwright/test"); const { changeNetwork } = require("../CommonFile/Action"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData");+ test("Test Case 1: Successful Token Creation", async ({ page }) => { - console.log('Extending Test Case timeout to 10 minutes') - test.setTimeout(10 * 60* 1000); //To extend the time of test execution + //To extend the time of test execution + test.setTimeout(120000); - await changeNetwork(page); //PreConditions Open URL and Selecting the Ghost-net + //Open URL and Selecting the Ghost-net + await changeNetwork(page); - await page.click(pageLocators.TokenCreator.CreateDAO); //Select A Create New DAO + //Select A Create New DAO + await page.getByText(pageLocators.TokenCreation.CreateDAO).click(); - await page.click(pageLocators.TokenCreator.GovernanceToken); //Selecting the Governance Token + //Selecting the Governance Token + await page.getByText(pageLocators.TokenCreation.GovernanceToken).click(); - await page.fill(pageLocators.TokenCreator.TokenName, TezosTestData.TokenCreator.TokenName); //Pass The Token Name + //Pass The Token Name + await page.fill(pageLocators.TokenCreation.TokenName, TezosTestData.TokenCreation.TokenName); - await page.fill(pageLocators.TokenCreator.TokenDescription, TezosTestData.TokenCreator.TokenDescription); //Pass The Token Description + //Pass The Token Description + await page.fill(pageLocators.TokenCreation.TokenDescription, TezosTestData.TokenCreation.TokenDescription); - await page.fill(pageLocators.TokenCreator.TotalSupply, TezosTestData.TokenCreator.SupplyToken); //Total Supply of Tokens + //Total Supply of Tokens + await page.fill(pageLocators.TokenCreation.TotalSupply, TezosTestData.TokenCreation.SupplyToken); - await page.fill(pageLocators.TokenCreator.Decimals, TezosTestData.TokenCreator.Decimals); //Pass The Decimals + //Pass The Decimals + await page.fill(pageLocators.TokenCreation.Decimals, TezosTestData.TokenCreation.Decimals); - await page.fill(pageLocators.TokenCreator.Symbol, TezosTestData.TokenCreator.Symbol); //Pass The Symbol for token + //Pass The Symbol for token + await page.fill(pageLocators.TokenCreation.Symbol, TezosTestData.TokenCreation.Symbol); - await page.fill(pageLocators.TokenCreator.Icon, TezosTestData.TokenCreator.Icon); //Pass The Icon for Token + //Pass The Icon for Token + await page.fill(pageLocators.TokenCreation.Icon, TezosTestData.TokenCreation.Icon); - await page.click(pageLocators.TokenCreator.ContinueButton1); //Click On Continue Button + //Click On Continue Button + await page.getByText(pageLocators.TokenCreation.ContinueButton).click(); - await page.fill(pageLocators.TokenCreator.WalletAddress, TezosTestData.TokenCreator.WalletAddress); //Pass The Wallet Address + //Pass The Wallet Address + await page.fill(pageLocators.TokenCreation.WalletAddress, TezosTestData.TokenCreation.WalletAddress); - await page.fill(pageLocators.TokenCreator.Amount, TezosTestData.TokenCreator.Amount); //Pass The Amount + //Pass The Amount + await page.fill(pageLocators.TokenCreation.Amount, TezosTestData.TokenCreation.Amount); - await page.click(pageLocators.TokenCreator.ContinueButton2); //Click on Continue Button + //Click on Continue Button + await page.getByText(pageLocators.TokenCreation.ContinueButton).click(); - await page.click(pageLocators.TokenCreator.launch); //Click on launch button + //Click on launch button + await page.getByText(pageLocators.TokenCreation.launch).click(); - await page.waitForTimeout(30000); //Wait for the Token Create + //Wait for the Token Create + await page.waitForTimeout(30000); - const content = await page.content(); //Assume Page + // Check whether Deploy text is visible + const content = await page.getByText(pageLocators.TokenCreation.DeployText); + await expect(content).toBeVisible; + + //Wait for find the Element + await page.waitForSelector(pageLocators.TokenCreation.ConsoleAddress); - const isTextVisible = content.includes(pageLocators.TokenCreator.DeployText, { visible: true }); //Verify that text visible on the webpage - - await page.waitForSelector(pageLocators.TokenCreator.ConsoleAddress); //Wait for find the Element - - const element = await page.$(pageLocators.TokenCreator.ConsoleAddress); // get The element + const element = await page.$(pageLocators.TokenCreation.ConsoleAddress); // get The element const textContent = await element.innerText(); //get the text From this element console.log('Token Address:', textContent); // Console The test Present on the Webpage - console.log("The token is successfully created and the user is redirected to a confirmation page with the details of the newly created token."); + console.log("The token is successfully created and the user is redirected to a confirmation page."); }); diff --git a/tests/TC01/TC01-02_TokenValues.spec.js b/tests/TC01/TC01-02_TokenValues.spec.js index f57cc5b..19f7b5a 100644 --- a/tests/TC01/TC01-02_TokenValues.spec.js +++ b/tests/TC01/TC01-02_TokenValues.spec.js @@ -5,34 +5,46 @@ const { TezosTestData } = require("../CommonFile/TestData"); test("Test Case 2: Token Creation with Various Input Values", async ({ page, }) => { - test.setTimeout(600000); //To extend the time of test execution + //To extend the time of test execution + test.setTimeout(120000); - await changeNetwork(page); //PreConditions Open URL and selecting the Ghost-net + //Open URL and Selecting the Ghost-net + await changeNetwork(page); - await page.click(pageLocators.TokenCreator.CreateDAO); //Select A Create New DAO + //Select A Create New DAO + await page.getByText(pageLocators.TokenCreation.CreateDAO).click(); + + //Selecting the Governance Token + await page.getByText(pageLocators.TokenCreation.GovernanceToken).click(); - await page.click(pageLocators.TokenCreator.GovernanceToken); //Selecting the Governance Token + //Pass The Token Name + await page.fill(pageLocators.TokenCreation.TokenName, TezosTestData.TokenCreation.TokenName); - await page.fill(pageLocators.TokenCreator.TokenName, TezosTestData.TokenCreator.TokenName); //Pass The Token Name + //Pass The Token Description + await page.fill(pageLocators.TokenCreation.TokenDescription, TezosTestData.TokenCreation.TC01_02TokenDescription); - await page.fill(pageLocators.TokenCreator.TokenDescription, TezosTestData.TokenCreator.TC02TokenDescription); //Pass The Token Description + //Total Supply of Tokens + await page.fill(pageLocators.TokenCreation.TotalSupply, TezosTestData.TokenCreation.SupplyToken); - await page.fill(pageLocators.TokenCreator.TotalSupply, TezosTestData.TokenCreator.SupplyToken); //Total Supply of Tokens + //Pass The Decimals + await page.fill(pageLocators.TokenCreation.Decimals, TezosTestData.TokenCreation.Decimals); - await page.fill(pageLocators.TokenCreator.Decimals, TezosTestData.TokenCreator.Decimals); //Pass The Decimals + //Pass The Symbol for token + await page.fill(pageLocators.TokenCreation.Symbol, TezosTestData.TokenCreation.Symbol); - await page.fill(pageLocators.TokenCreator.Symbol, TezosTestData.TokenCreator.Symbol); //Pass The Symbol for token + //Pass The Icon for Token + await page.fill(pageLocators.TokenCreation.Icon, TezosTestData.TokenCreation.Icon); - await page.fill(pageLocators.TokenCreator.Icon, TezosTestData.TokenCreator.Icon); //Pass The Icon for Token + //Click On Continue Button + await page.getByText(pageLocators.TokenCreation.ContinueButton).click(); - await page.click(pageLocators.TokenCreator.ContinueButton1); //Click On Continue Button + //Get error the text + const textMessage = page.getByText(pageLocators.TokenCreation.ErrorText); - const textMessage = page.getByText(pageLocators.TokenCreator.ErrorText); //Get The Text + //Verify The Text Present on The Web + await expect(textMessage).toBeVisible(); - console.log(textMessage); //Console The Results - - await expect(textMessage).toBeVisible(); //Verify The Text Present on The Web - - console.log(" Create Token with input values are fail due to the description test box does not accept empty string"); + console.log(textMessage); + console.log("Create Token with input values failed because description test box does not accept empty string"); }); diff --git a/tests/TC01/TC01-03_TokenWithValues.spec.js b/tests/TC01/TC01-03_TokenWithValues.spec.js index 8139324..214cf4c 100644 --- a/tests/TC01/TC01-03_TokenWithValues.spec.js +++ b/tests/TC01/TC01-03_TokenWithValues.spec.js @@ -6,50 +6,50 @@ const { TezosTestData } = require("../CommonFile/TestData"); test('Test3: Amount Less than Supply Token',async ({page})=>{ - test.setTimeout(120000); + //To extend the time of test execution + test.setTimeout(120000); - // set Network to Ghostnet - await changeNetwork(page); + //Open URL and Selecting the Ghost-net + await changeNetwork(page); //Click Create DAO button - await page.click(pageLocators.TokenCreator.CreateDAO); + await page.getByText(pageLocators.TokenCreation.CreateDAO).click(); //click "No, I need one" - await page.click(pageLocators.TokenCreator.GovernanceToken); + await page.getByText(pageLocators.TokenCreation.GovernanceToken).click(); //Enter token name - await page.fill(pageLocators.TokenCreator.TokenName, TezosTestData.TokenCreator.TokenName); + await page.fill(pageLocators.TokenCreation.TokenName, TezosTestData.TokenCreation.TokenName); //Enter token description - await page.fill(pageLocators.TokenCreator.TokenDescription, TezosTestData.TokenCreator.TokenDescription) + await page.fill(pageLocators.TokenCreation.TokenDescription, TezosTestData.TokenCreation.TokenDescription) //Enter Supply - await page.fill(pageLocators.TokenCreator.TotalSupply, TezosTestData.TokenCreator.SupplyToken) + await page.fill(pageLocators.TokenCreation.TotalSupply, TezosTestData.TokenCreation.SupplyToken) //Enter Decimals - await page.fill(pageLocators.TokenCreator.Decimals, TezosTestData.TokenCreator.Decimals) + await page.fill(pageLocators.TokenCreation.Decimals, TezosTestData.TokenCreation.Decimals) //Enter Icon - await page.fill(pageLocators.TokenCreator.Icon, TezosTestData.TokenCreator.Icon) + await page.fill(pageLocators.TokenCreation.Icon, TezosTestData.TokenCreation.Icon) //Enter Symbol - await page.fill(pageLocators.TokenCreator.Symbol, TezosTestData.TokenCreator.Symbol) + await page.fill(pageLocators.TokenCreation.Symbol, TezosTestData.TokenCreation.Symbol) // Click Continue - await page.click(pageLocators.TokenCreator.ContinueButton1); - - await page.waitForTimeout(2000); - + await page.getByText(pageLocators.TokenCreation.ContinueButton).click(); //Enter Wallet Address - await page.fill(pageLocators.TokenCreator.WalletAddress, TezosTestData.TokenCreator.WalletAddress); + await page.fill(pageLocators.TokenCreation.WalletAddress, TezosTestData.TokenCreation.WalletAddress); //Enter The Amount - await page.fill(pageLocators.TokenCreator.Amount, TezosTestData.TokenCreator.TC02Amount); + await page.fill(pageLocators.TokenCreation.Amount, TezosTestData.TokenCreation.TC01_03Amount); //Click on Continue Button - await page.click(pageLocators.TokenCreator.ContinueButton2); + await page.getByText(pageLocators.TokenCreation.ContinueButton).click(); + + //Get error message + const errorText = await page.getByText(pageLocators.TokenCreation.ErrorText2); + await expect(errorText).toBeVisible(); - const errorText = await page.getByText(TezosTestData.TokenCreator.ErrorText2); - await expect(errorText).toBeVisible() - console.log("message shown: ",TezosTestData.TokenCreator.ErrorText2); - console.log("Token cannot be created if Amount is less than Supply Token"); + console.log("message shown: ",TezosTestData.TokenCreation.ErrorText2); + console.log("Create Token with input values failed because amount cannot be less than or greater than supply."); await page.waitForTimeout(5000); diff --git a/tests/TC02/TC02-01_CreateDAO.spec.js b/tests/TC02/TC02-01_CreateDAO.spec.js index 7444052..a15df71 100644 --- a/tests/TC02/TC02-01_CreateDAO.spec.js +++ b/tests/TC02/TC02-01_CreateDAO.spec.js @@ -5,104 +5,146 @@ const { TezosTestData } = require("../CommonFile/TestData"); test('Test Case 3 : Create DAO Successfully', async ({ page }) => { - test.setTimeout(600000); //To extend the time of test execution + //To extend the time of test execution + test.setTimeout(120000); - await changeNetwork(page); //PreConditions Open URL and Selecting the Ghost-net + //Open URL and Selecting the Ghost-net + await changeNetwork(page); - await page.click(pageLocators.DAOCreate.CreateDAO); //Click on Create DAO + //Click on Create DAO + await page.getByText(pageLocators.DAOCreation.CreateDAO).click(); - await page.click(pageLocators.DAOCreate.GovernanceToken); //Selecting Governance (Yes, I Have one) + //Selecting Yes, I Have one + await page.getByText(pageLocators.DAOCreation.GovernanceToken).click(); - await page.click(pageLocators.DAOCreate.FullDAO); //Click on FullDAO + //Click on FullDAO + await page.getByText(pageLocators.DAOCreation.FullDAO).click(); - await page.click(pageLocators.DAOCreate.ContinueButton1); //Click On Continue + //Click On Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.fill(pageLocators.DAOCreate.DAOName, TezosTestData.DAOCreate.DAOName); //Fill DAO Name + //Fill DAO Name + await page.fill(pageLocators.DAOCreation.DAOName, TezosTestData.DAOCreation.DAOName); - await page.fill(pageLocators.DAOCreate.TokenAddress, TezosTestData.DAOCreate.TokenAddress); //Fill Token Address + //Fill Token Address + await page.fill(pageLocators.DAOCreation.TokenAddress, TezosTestData.DAOCreation.TokenAddress); - await page.fill(pageLocators.DAOCreate.TokenID, TezosTestData.DAOCreate.TokenID); //Fill Token ID + //Fill Token ID + await page.fill(pageLocators.DAOCreation.TokenID, TezosTestData.DAOCreation.TokenID); - await page.fill(pageLocators.DAOCreate.GuardianAddress, TezosTestData.DAOCreate.GuardianAddress); //Fill The Wallet Address + //Fill The Wallet Address + await page.fill(pageLocators.DAOCreation.GuardianAddress, TezosTestData.DAOCreation.GuardianAddress); - await page.fill(pageLocators.DAOCreate.Description, TezosTestData.DAOCreate.Description); //Fill The Description + //Fill The Description + await page.fill(pageLocators.DAOCreation.Description, TezosTestData.DAOCreation.Description); - await page.click(pageLocators.DAOCreate.ContinueButton2); //Click on Continue + //Click on Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.fill(pageLocators.DAOCreate.VotingDays, TezosTestData.DAOCreate.VotingDays); //Pass The Voting Cycle Days Duration + //Pass The Voting Cycle Days Duration + await page.fill(pageLocators.DAOCreation.VotingDays, TezosTestData.DAOCreation.VotingDays); - await page.fill(pageLocators.DAOCreate.VotingHours, TezosTestData.DAOCreate.VotingHours); //Pass The Voting Cycle Hours Duration + //Pass The Voting Cycle Hours Duration + await page.fill(pageLocators.DAOCreation.VotingHours, TezosTestData.DAOCreation.VotingHours); - await page.fill(pageLocators.DAOCreate.VotingMinutes, TezosTestData.DAOCreate.VotingMinutes); //Pass The Voting Minutes Duration + //Pass The Voting Minutes Duration + await page.fill(pageLocators.DAOCreation.VotingMinutes, TezosTestData.DAOCreation.VotingMinutes); - await page.fill(pageLocators.DAOCreate.ExecutionDays, TezosTestData.DAOCreate.ExecutionDays); //Pass The Proposal Execution Days Duration + //Pass The Proposal Execution Days Duration + await page.fill(pageLocators.DAOCreation.ExecutionDays, TezosTestData.DAOCreation.ExecutionDays); - await page.fill(pageLocators.DAOCreate.ExecutionHours, TezosTestData.DAOCreate.ExecutionHours); //Pass The Proposal Execution Hours Duration + //Pass The Proposal Execution Hours Duration + await page.fill(pageLocators.DAOCreation.ExecutionHours, TezosTestData.DAOCreation.ExecutionHours); - await page.fill(pageLocators.DAOCreate.ExecutionMinutes, TezosTestData.DAOCreate.ExecutionMinutes); //Pass The Proposal Execution Minutes Duration + //Pass The Proposal Execution Minutes Duration + await page.fill(pageLocators.DAOCreation.ExecutionMinutes, TezosTestData.DAOCreation.ExecutionMinutes); - await page.fill(pageLocators.DAOCreate.ThresholdExpiryDays, TezosTestData.DAOCreate.ThresholdExpiryDays); //Pass The Proposal Expiry Threshold Days Duration + //Pass The Proposal Expiry Threshold Days Duration + await page.fill(pageLocators.DAOCreation.ThresholdExpiryDays, TezosTestData.DAOCreation.ThresholdExpiryDays); - await page.fill(pageLocators.DAOCreate.ThresholdExpiryHours, TezosTestData.DAOCreate.ThresholdExpiryHours); //Pass The Proposal Expiry Threshold Hours Duration + //Pass The Proposal Expiry Threshold Hours Duration + await page.fill(pageLocators.DAOCreation.ThresholdExpiryHours, TezosTestData.DAOCreation.ThresholdExpiryHours); - await page.fill(pageLocators.DAOCreate.ThresholdExpiryMinutes, TezosTestData.DAOCreate.ThresholdExpiryMinutes); //Pass The Proposal Expiry Threshold Minutes Duration + //Pass The Proposal Expiry Threshold Minutes Duration + await page.fill(pageLocators.DAOCreation.ThresholdExpiryMinutes, TezosTestData.DAOCreation.ThresholdExpiryMinutes); - await page.fill(pageLocators.DAOCreate.RequireStake, TezosTestData.DAOCreate.RequiredStake); //Fill Required Stake + //Fill Required Stake + await page.fill(pageLocators.DAOCreation.RequireStake, TezosTestData.DAOCreation.RequiredStake); - const slider = page.locator(pageLocators.DAOCreate.Slider); //Locate The Slider + //Locate The Slider + const slider = page.locator(pageLocators.DAOCreation.Slider); - const targetPosition = { x: 50, y: 0 }; // Replace with the desired target position. + // Get Target position. + const targetPosition = { x: 50, y: 0 }; - await slider.scrollIntoViewIfNeeded(); // Ensure the slider is in view + // Ensure the slider is in view + await slider.scrollIntoViewIfNeeded(); - const sliderBoundingBox = await slider.boundingBox(); // Get the bounding box of the slider for dragging + // Get the bounding box of the slider for dragging + const sliderBox = await slider.boundingBox(); - const targetX = sliderBoundingBox.x + targetPosition.x; // Calculate the target position based on the slider's bounding box - - const targetY = sliderBoundingBox.y + targetPosition.y; - - await page.mouse.move(sliderBoundingBox.x, sliderBoundingBox.y); // Create a mouse action context and perform the drag and drop + // Calculate the target position based on the slider's bounding box + const targetX = sliderBox.x + targetPosition.x; + const targetY = sliderBox.y + targetPosition.y; + // Create a mouse action context and perform the drag and drop + await page.mouse.move(sliderBox.x, sliderBox.y); await page.mouse.down(); - await page.mouse.move(targetX, targetY, { steps: 50 }); // You can adjust the number of steps for smoother animation - - await page.mouse.up(); + // You can adjust the number of steps for smoother animation + // await page.mouse.move(targetX, targetY, { steps: 50 }); - await page.fill(pageLocators.DAOCreate.MinAmount, TezosTestData.DAOCreate.MinAmount); //Pass Min Transfer Amount + // await page.mouse.up(); - await page.fill(pageLocators.DAOCreate.MaxAmount, TezosTestData.DAOCreate.MaxAmount); //Pass Max Transfer Amount + //Pass Min Transfer Amount + await page.fill(pageLocators.DAOCreation.MinAmount, TezosTestData.DAOCreation.MinAmount); - await page.click(pageLocators.DAOCreate.ContinueButton3); //Click On Continue + //Pass Max Transfer Amount + await page.fill(pageLocators.DAOCreation.MaxAmount, TezosTestData.DAOCreation.MaxAmount); - await page.fill(pageLocators.DAOCreate.QuorumThreshold, TezosTestData.DAOCreate.QuorumThreshold); //Pass The Initial Quorum Threshold + //Click On Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.fill(pageLocators.DAOCreate.QuorumChange, TezosTestData.DAOCreate.QuorumChange); //Pass The Initial Quorum Change + //Pass The Initial Quorum Threshold + await page.fill(pageLocators.DAOCreation.QuorumThreshold, TezosTestData.DAOCreation.QuorumThreshold); - await page.fill(pageLocators.DAOCreate.MinQuorumAmount, TezosTestData.DAOCreate.MinQuorumAmount); //Pass The Min. Quorum Threshold + //Pass The Initial Quorum Change + await page.fill(pageLocators.DAOCreation.QuorumChange, TezosTestData.DAOCreation.QuorumChange); - await page.fill(pageLocators.DAOCreate.QuorumMaxChange, TezosTestData.DAOCreate.QuorumChange); //Pass The Max. Quorum Change + //Pass The Min. Quorum Threshold + await page.fill(pageLocators.DAOCreation.MinQuorumAmount, TezosTestData.DAOCreation.MinQuorumAmount); - await page.fill(pageLocators.DAOCreate.MaxQuorumAmount, TezosTestData.DAOCreate.MaxQuorumAmount); //Pass The Max. Quorum Threshold + //Pass The Max. Quorum Change + await page.fill(pageLocators.DAOCreation.QuorumMaxChange, TezosTestData.DAOCreation.QuorumChange); - await page.waitForTimeout(1000); //Wait for the Page Load + //Pass The Max. Quorum Threshold + await page.fill(pageLocators.DAOCreation.MaxQuorumAmount, TezosTestData.DAOCreation.MaxQuorumAmount); - await page.click(pageLocators.DAOCreate.ContinueButton4); //Click On Continue + //Wait for the Page Load + await page.waitForTimeout(1000); - await page.waitForTimeout(1000); //Wait For The Page Load + //Click On Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.click(pageLocators.DAOCreate.ContinueButton5); //Click On Continue + //Wait For The Page Load + await page.waitForTimeout(1000); - await page.click(pageLocators.DAOCreate.SelfDeployed); //Click On Self Deployed + //Click On Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.click(pageLocators.DAOCreate.DeployDAO); //Click On Launch + //Click On Self Deployed + await page.getByText(pageLocators.DAOCreation.SelfDeployed).click(); - await page.waitForTimeout(60000); //Wait for Deploy the DAO + //Click On Launch + await page.getByText(pageLocators.DAOCreation.DeployDAO).click(); - const content = await page.content(); //Assume Page + //Wait for Deploy the DAO + await page.waitForTimeout(60000); - const isTextVisible = content.includes(pageLocators.DAOCreate.DAOText, { visible: true }); //Verify that text visible on the webpage + //Verify that text visible on the webpage + const content = await page.getByText(pageLocators.DAOCreation.DAOText); + await expect(content).toBeVisible; - console.log("The DAO is successfully created and the user is redirected to a confirmation page that links to the newly created DAO"); + console.log("The DAO is successfully created and the user is redirected to a confirmation page"); }) \ No newline at end of file diff --git a/tests/TC02/TC02-02_DAOValues.spec.js b/tests/TC02/TC02-02_DAOValues.spec.js index 445b022..56ce55f 100644 --- a/tests/TC02/TC02-02_DAOValues.spec.js +++ b/tests/TC02/TC02-02_DAOValues.spec.js @@ -5,36 +5,47 @@ const { TezosTestData } = require("../CommonFile/TestData"); test('Test Case 4 : Create DAO with various input values', async ({ page }) => { - test.setTimeout(600000); //To extend the time of test execution + //To extend the time of test execution + test.setTimeout(120000); - await changeNetwork(page); //PreConditions Open URL and Selecting the Ghost-net + //Open URL and Selecting the Ghost-net + await changeNetwork(page); - await page.click(pageLocators.DAOCreate.CreateDAO); //Click on Create DAO + //Click on Create DAO + await page.getByText(pageLocators.DAOCreation.CreateDAO).click(); - await page.click(pageLocators.DAOCreate.GovernanceToken); //Selecting Governance (Yes, I Have one) + //Selecting Yes, I Have one + await page.getByText(pageLocators.DAOCreation.GovernanceToken).click(); - await page.click(pageLocators.DAOCreate.FullDAO); //Click on FullDAO + //Click on FullDAO + await page.getByText(pageLocators.DAOCreation.FullDAO).click(); - await page.click(pageLocators.DAOCreate.ContinueButton1); //Click On Continue + //Click On Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - await page.fill(pageLocators.DAOCreate.DAOName, TezosTestData.DAOCreate.DAOName); //Fill DAO Name + //Fill DAO Name + await page.fill(pageLocators.DAOCreation.DAOName, TezosTestData.DAOCreation.DAOName); - await page.fill(pageLocators.DAOCreate.TokenAddress, TezosTestData.DAOCreate.TokenAddress); //Fill Token Address + //Fill Token Address + await page.fill(pageLocators.DAOCreation.TokenAddress, TezosTestData.DAOCreation.TokenAddress); - await page.fill(pageLocators.DAOCreate.TokenID, TezosTestData.DAOCreate.TokenID); //Fill Token ID + //Fill Token ID + await page.fill(pageLocators.DAOCreation.TokenID, TezosTestData.DAOCreation.TokenID); - await page.fill(pageLocators.DAOCreate.GuardianAddress, TezosTestData.DAOCreate.GuardianAddress); //Fill The Wallet Address + //Fill The Wallet Address + await page.fill(pageLocators.DAOCreation.GuardianAddress, TezosTestData.DAOCreation.GuardianAddress); - await page.fill(pageLocators.DAOCreate.Description, TezosTestData.DAOCreate.TC04DAODescription); //Fill The Description + //Fill The Description + await page.fill(pageLocators.DAOCreation.Description, TezosTestData.DAOCreation.TC02_02DAODescription); - await page.click(pageLocators.DAOCreate.ContinueButton2); //Click on Continue + //Click on Continue + await page.getByText(pageLocators.DAOCreation.ContinueButton).click(); - const errorMessage = page.getByText(pageLocators.DAOCreate.ErrorText); //Get The Text + //Get error message + const errorMessage = page.getByText(pageLocators.DAOCreation.ErrorText); + await expect(errorMessage).toBeVisible(); console.log(errorMessage) //Show The Result - - await expect(errorMessage).toBeVisible(); //Verify The Text Shows Description is Required - console.log("The system handles the input appropriately, either creating the DAO or displaying an error message."); }) \ No newline at end of file From 59550756a788d6bb8f388fa2ca7fddab1d3b2c30 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Sat, 19 Aug 2023 17:35:24 +0530 Subject: [PATCH 03/13] WIP: TC03 & TC04 --- tests/CommonFile/Locator.js | 15 ++++++++--- tests/CommonFile/PreAction.js | 18 ------------- tests/CommonFile/PreProposal.js | 27 +++++++++++++++++++ ...mbda.spec.js => TC03-01_AddLambda.spec.js} | 20 +++++++++----- ...a.spec.js => TC03-02_RemoveLambda.spec.js} | 20 +++++++++----- ....spec.js => TC03-03_ExecuteLambda.spec.js} | 20 +++++++++----- ...ec.js => TC03-04_DAOConfiguration.spec.js} | 23 ++++++++++------ ...spec.js => TC03-05_ChangeGuardian.spec.js} | 20 +++++++++----- ...spec.js => TC03-06_ChangeDelegate.spec.js} | 22 +++++++++------ ...spec.js => TC03-07_TransferTokens.spec.js} | 0 ...FT.spec.js => TC03-08_TransferNFT.spec.js} | 0 ...y.spec.js => TC03-09_EditRegistry.spec.js} | 0 .../TC05-01_OffChainPoll.spec.js | 11 ++++---- .../TC05-02_VoteonOffChainPoll.spec.js | 0 ...-03_CorrectVoteCountOnOffChainPoll.spec.js | 0 .../TC04-01_VoteOnProposal.spec.js | 2 +- .../TC04-02_ProposalExecutionandDrop.spec.js | 2 +- .../TC06-01_SuccessfulTokenStaking.spec.js | 2 +- 18 files changed, 128 insertions(+), 74 deletions(-) delete mode 100644 tests/CommonFile/PreAction.js create mode 100644 tests/CommonFile/PreProposal.js rename tests/TC03/{TC03-07_AddLambda.spec.js => TC03-01_AddLambda.spec.js} (55%) rename tests/TC03/{TC03-08_RemoveLambda.spec.js => TC03-02_RemoveLambda.spec.js} (59%) rename tests/TC03/{TC03-09_ExecuteLambda.spec.js => TC03-03_ExecuteLambda.spec.js} (65%) rename tests/TC03/{TC03-04_ChangeConfiguration.spec.js => TC03-04_DAOConfiguration.spec.js} (58%) rename tests/TC03/{TC03-02_ChangeGuardian.spec.js => TC03-05_ChangeGuardian.spec.js} (61%) rename tests/TC03/{TC03-01_ChangeDelegate.spec.js => TC03-06_ChangeDelegate.spec.js} (65%) rename tests/TC03/{TC03-03_TransferTokens.spec.js => TC03-07_TransferTokens.spec.js} (100%) rename tests/TC03/{TC03-05_TransferNFT.spec.js => TC03-08_TransferNFT.spec.js} (100%) rename tests/TC03/{TC03-06_EditRegistry.spec.js => TC03-09_EditRegistry.spec.js} (100%) rename tests/{TC05 => TC04}/TC05-01_OffChainPoll.spec.js (86%) rename tests/{TC05 => TC04}/TC05-02_VoteonOffChainPoll.spec.js (100%) rename tests/{TC05 => TC04}/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js (100%) rename tests/{TC04 => TC05}/TC04-01_VoteOnProposal.spec.js (96%) rename tests/{TC04 => TC05}/TC04-02_ProposalExecutionandDrop.spec.js (94%) diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 540e2bb..38e7af0 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -59,6 +59,15 @@ const pageLocators = { ErrorText: "Required", }, + ProposalCreation: { + Search: "input[placeholder='Search']", + ExampleDAO: "Example DAO", + Proposal: "//p[text()='Proposals']", + Cycle: "Creating", + NewProposal: "New Proposal", + + }, + DAOConfiguration: { DAOConfiguration: "//p[text()='DAO Configuration']", ProposalFee: "input[placeholder='Proposal fee']", @@ -155,9 +164,9 @@ const pageLocators = { }, OffChainPoll: { - ExampleDAO: "//p[text()='Example DAO']", - Proposal: "//p[text()='Proposals']", - cycle: "//p[text()='Creating']", + // ExampleDAO: "//p[text()='Example DAO']", + // Proposal: "//p[text()='Proposals']", + // cycle: "//p[text()='Creating']", NewProposal: "//span[text()='New Proposal']", OffChainPoll: "//p[text()='Off Chain Poll']", ProposalTitle: "input[placeholder='Proposal Title*']", diff --git a/tests/CommonFile/PreAction.js b/tests/CommonFile/PreAction.js deleted file mode 100644 index 6fdb156..0000000 --- a/tests/CommonFile/PreAction.js +++ /dev/null @@ -1,18 +0,0 @@ -const { test } = require("@playwright/test"); -const { pageLocators } = require ("./Locator"); -const { changeNetwork } = require("./Action"); - -async function PreProposal(page){ - - await changeNetwork(page); //PreConditions Open URL and Selecting the Ghost-net - - await page.click(pageLocators.OffChainPoll.ExampleDAO); //Click on Mask DAO - - await page.click(pageLocators.OffChainPoll.Proposal); //Click on Proposal - -} - - -module.exports= { - PreProposal -} \ No newline at end of file diff --git a/tests/CommonFile/PreProposal.js b/tests/CommonFile/PreProposal.js new file mode 100644 index 0000000..6e347ce --- /dev/null +++ b/tests/CommonFile/PreProposal.js @@ -0,0 +1,27 @@ +const { test } = require("@playwright/test"); +const { pageLocators } = require ("./Locator"); +const { changeNetwork } = require("./Action"); + +async function PreProposal(page){ + + + //To extend the time of test execution + test.setTimeout(120000); + + //Open URL and Selecting the Ghost-net + await changeNetwork(page); + + // Select Example DAO + await page.locator(pageLocators.ProposalCreation.Search).type("Example") + + await page.getByText(pageLocators.ProposalCreation.ExampleDAO).click(); + + // Click Proposals + await page.click(pageLocators.ProposalCreation.Proposal) + +} + + +module.exports= { + PreProposal +} \ No newline at end of file diff --git a/tests/TC03/TC03-07_AddLambda.spec.js b/tests/TC03/TC03-01_AddLambda.spec.js similarity index 55% rename from tests/TC03/TC03-07_AddLambda.spec.js rename to tests/TC03/TC03-01_AddLambda.spec.js index 189090c..b67d1c5 100644 --- a/tests/TC03/TC03-07_AddLambda.spec.js +++ b/tests/TC03/TC03-01_AddLambda.spec.js @@ -1,19 +1,25 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-07: Add Lambda ', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - test.setTimeout(600000); //To Extend the time of test Execution + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await page.click(pageLocators.OffChainPoll.NewProposal); //Click On New Proposal + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.AddLambda.AddLambda); // Click on Add Lambda diff --git a/tests/TC03/TC03-08_RemoveLambda.spec.js b/tests/TC03/TC03-02_RemoveLambda.spec.js similarity index 59% rename from tests/TC03/TC03-08_RemoveLambda.spec.js rename to tests/TC03/TC03-02_RemoveLambda.spec.js index 5d5cfd6..0dd4588 100644 --- a/tests/TC03/TC03-08_RemoveLambda.spec.js +++ b/tests/TC03/TC03-02_RemoveLambda.spec.js @@ -1,19 +1,25 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-08: Remove Lambda ', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - test.setTimeout(600000); //To Extend the time of test Execution + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await page.click(pageLocators.OffChainPoll.NewProposal); //Click On New Proposal + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.RemoveLambda.RemoveLambda); //Click on Remove Lambda diff --git a/tests/TC03/TC03-09_ExecuteLambda.spec.js b/tests/TC03/TC03-03_ExecuteLambda.spec.js similarity index 65% rename from tests/TC03/TC03-09_ExecuteLambda.spec.js rename to tests/TC03/TC03-03_ExecuteLambda.spec.js index 5e7f87b..6d2948a 100644 --- a/tests/TC03/TC03-09_ExecuteLambda.spec.js +++ b/tests/TC03/TC03-03_ExecuteLambda.spec.js @@ -1,19 +1,25 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-09: Execute Lambda ', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - test.setTimeout(600000); //To Extend the time of test Execution - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.NewProposal); //Click On New Proposal + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.ExecuteLambda.ExecuteLambda); //Click on Execute Lambda await page.type(pageLocators.ExecuteLambda.SearchBox, TezosTestData.ExecuteLambda.SearchText); //Pass the Search Text diff --git a/tests/TC03/TC03-04_ChangeConfiguration.spec.js b/tests/TC03/TC03-04_DAOConfiguration.spec.js similarity index 58% rename from tests/TC03/TC03-04_ChangeConfiguration.spec.js rename to tests/TC03/TC03-04_DAOConfiguration.spec.js index a6531a7..e4a5cf9 100644 --- a/tests/TC03/TC03-04_ChangeConfiguration.spec.js +++ b/tests/TC03/TC03-04_DAOConfiguration.spec.js @@ -1,18 +1,25 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); -test('Test case 05-04: Change Configuration', async ({ page }) => { +test('Test case 05-04: DAO Configuration', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); - try { + try { - test.setTimeout(600000) //To Extend The Time of test Execution + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.DAOConfiguration.DAOConfiguration); //Click on DAO Configuration diff --git a/tests/TC03/TC03-02_ChangeGuardian.spec.js b/tests/TC03/TC03-05_ChangeGuardian.spec.js similarity index 61% rename from tests/TC03/TC03-02_ChangeGuardian.spec.js rename to tests/TC03/TC03-05_ChangeGuardian.spec.js index 94d89ad..9af0211 100644 --- a/tests/TC03/TC03-02_ChangeGuardian.spec.js +++ b/tests/TC03/TC03-05_ChangeGuardian.spec.js @@ -1,19 +1,25 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-02: Change Guardian', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - test.setTimeout(600000); //To Extend the time of test Execution + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.ChangeGuardian.ChangeGuardian); //Click on Change Guardian diff --git a/tests/TC03/TC03-01_ChangeDelegate.spec.js b/tests/TC03/TC03-06_ChangeDelegate.spec.js similarity index 65% rename from tests/TC03/TC03-01_ChangeDelegate.spec.js rename to tests/TC03/TC03-06_ChangeDelegate.spec.js index 30b74a5..ec71706 100644 --- a/tests/TC03/TC03-01_ChangeDelegate.spec.js +++ b/tests/TC03/TC03-06_ChangeDelegate.spec.js @@ -1,19 +1,25 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreAction"); -const { pageLocators } = require("../CommonFile/Locator"); +const { test, expect } = require ("@playwright/test"); +const { pageLocators } = require ("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); +const { PreProposal } = require("../CommonFile/PreProposal"); test('Test case 05-01: Change Delegate', async ({ page }) => { - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - test.setTimeout(600000); //To Extend the time of test Execution - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status - // await page.waitForTimeout(3000); + //To Extend the time of test Execution + test.setTimeout(120000); - await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + + await expect(cyclestatus).toBeVisible() + + //Click On New Proposal + await page.getByText(pageLocators.ProposalCreation.NewProposal).click() await page.click(pageLocators.ChangeDelegate.ChangeDelegate); //Click on Change Delegate diff --git a/tests/TC03/TC03-03_TransferTokens.spec.js b/tests/TC03/TC03-07_TransferTokens.spec.js similarity index 100% rename from tests/TC03/TC03-03_TransferTokens.spec.js rename to tests/TC03/TC03-07_TransferTokens.spec.js diff --git a/tests/TC03/TC03-05_TransferNFT.spec.js b/tests/TC03/TC03-08_TransferNFT.spec.js similarity index 100% rename from tests/TC03/TC03-05_TransferNFT.spec.js rename to tests/TC03/TC03-08_TransferNFT.spec.js diff --git a/tests/TC03/TC03-06_EditRegistry.spec.js b/tests/TC03/TC03-09_EditRegistry.spec.js similarity index 100% rename from tests/TC03/TC03-06_EditRegistry.spec.js rename to tests/TC03/TC03-09_EditRegistry.spec.js diff --git a/tests/TC05/TC05-01_OffChainPoll.spec.js b/tests/TC04/TC05-01_OffChainPoll.spec.js similarity index 86% rename from tests/TC05/TC05-01_OffChainPoll.spec.js rename to tests/TC04/TC05-01_OffChainPoll.spec.js index 6692ae7..da46cda 100644 --- a/tests/TC05/TC05-01_OffChainPoll.spec.js +++ b/tests/TC04/TC05-01_OffChainPoll.spec.js @@ -1,17 +1,16 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreAction"); +const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { - test.setTimeout(600000); //To Extend the time of test Execution - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); try { - - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status + //To extend the time of test execution + test.setTimeout(120000); await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal diff --git a/tests/TC05/TC05-02_VoteonOffChainPoll.spec.js b/tests/TC04/TC05-02_VoteonOffChainPoll.spec.js similarity index 100% rename from tests/TC05/TC05-02_VoteonOffChainPoll.spec.js rename to tests/TC04/TC05-02_VoteonOffChainPoll.spec.js diff --git a/tests/TC05/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC04/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js similarity index 100% rename from tests/TC05/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js rename to tests/TC04/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js diff --git a/tests/TC04/TC04-01_VoteOnProposal.spec.js b/tests/TC05/TC04-01_VoteOnProposal.spec.js similarity index 96% rename from tests/TC04/TC04-01_VoteOnProposal.spec.js rename to tests/TC05/TC04-01_VoteOnProposal.spec.js index a7813ec..8943393 100644 --- a/tests/TC04/TC04-01_VoteOnProposal.spec.js +++ b/tests/TC05/TC04-01_VoteOnProposal.spec.js @@ -1,5 +1,5 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreAction"); +const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const path = require('path'); diff --git a/tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js similarity index 94% rename from tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js rename to tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js index dfcdb6b..6ca602c 100644 --- a/tests/TC04/TC04-02_ProposalExecutionandDrop.spec.js +++ b/tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js @@ -1,5 +1,5 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreAction"); +const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); test('Test case 07: Proposal Execution & Drop', async ({ page }) => { diff --git a/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js b/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js index bb30e42..7709a68 100644 --- a/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js +++ b/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js @@ -1,5 +1,5 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreAction"); +const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const path = require('path'); From fe93f43e7b11cfe252fc82d2e4848eddf633fdd2 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Thu, 24 Aug 2023 22:13:30 +0530 Subject: [PATCH 04/13] WIP TC04 --- tests/CommonFile/Locator.js | 90 ++----------------- tests/CommonFile/TestData.js | 57 +++--------- tests/TC03/TC03-07_TransferTokens.spec.js | 56 ------------ tests/TC03/TC03-08_TransferNFT.spec.js | 30 ------- tests/TC03/TC03-09_EditRegistry.spec.js | 38 -------- tests/TC04/TC04-01_OffChainPoll.spec.js | 65 ++++++++++++++ ....js => TC04-02_VoteonOffChainPoll.spec.js} | 0 ...03_CorrectVoteCountOnOffChainPoll.spec.js} | 0 tests/TC04/TC05-01_OffChainPoll.spec.js | 50 ----------- tests/TC05/TC04-01_VoteOnProposal.spec.js | 49 ---------- .../TC04-02_ProposalExecutionandDrop.spec.js | 30 ------- .../TC06-01_SuccessfulTokenStaking.spec.js | 26 ------ .../TC06-02_SuccessfulTokenUnStaking.spec.js | 25 ------ .../TC06-03_SuccessfulTokenWithdrawal.spec.js | 24 ----- 14 files changed, 81 insertions(+), 459 deletions(-) delete mode 100644 tests/TC03/TC03-07_TransferTokens.spec.js delete mode 100644 tests/TC03/TC03-08_TransferNFT.spec.js delete mode 100644 tests/TC03/TC03-09_EditRegistry.spec.js create mode 100644 tests/TC04/TC04-01_OffChainPoll.spec.js rename tests/TC04/{TC05-02_VoteonOffChainPoll.spec.js => TC04-02_VoteonOffChainPoll.spec.js} (100%) rename tests/TC04/{TC05-03_CorrectVoteCountOnOffChainPoll.spec.js => TC04-03_CorrectVoteCountOnOffChainPoll.spec.js} (100%) delete mode 100644 tests/TC04/TC05-01_OffChainPoll.spec.js delete mode 100644 tests/TC05/TC04-01_VoteOnProposal.spec.js delete mode 100644 tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js delete mode 100644 tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js delete mode 100644 tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js delete mode 100644 tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 38e7af0..a08fe9a 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -90,31 +90,6 @@ const pageLocators = { }, - TransferToken: { - Treasury: "//p[text()='Treasury']", - NewTransfer: "//span[text()='New Transfer']", - Recipient: "input[placeholder='Type an Address Here']", - Asset: "//input[@class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']", - Amount: "input[placeholder='0']", - AgoraPostID: "input[placeholder='Type an Agora Post ID']", - SubmitButton: "//span[normalize-space()='Submit']", - TransactionText: "Registry proposal transaction confirmed", - }, - - TransferNFT: { - NFTs: "//span[text()='NFTs']", - }, - - EditRegistry: { - Registry: "//p[text()='Registry']", - NewItem: "//span[text()='New Item']", - BatchTransfer: "//input[@type='checkbox']", - Key: "//input[@placeholder='Type a Key']", - Value: "//textarea[@placeholder='Type a value']", - Submit: "//span[text()='Submit']", - - }, - AddLambda: { AddLambda: "//p[text()='Add Lambda']", TestBox: ".npm__react-simple-code-editor__textarea", @@ -137,40 +112,14 @@ const pageLocators = { SubmitButton: "//span[text()='Submit']", }, - VoteOnProposal: { - VotingCycle: "//p[text()='Creating']", - OnChainButton: "//button[@class='MuiButtonBase-root MuiButton-root MuiButton-text jss417']", - Active: "//p[text()='Active']", - Pending: "//p[text()='Pending']", - VoteFor: "//span[text()='Vote For']", - VoteAgainst: "//span[text()='Vote Against']", - UseMax: "//p[text()='Use Max']", - Submit: "//span[text()='Submit']", - View: "//span[text()='View']", - Support: ".MuiGrid-root.MuiGrid-container.MuiGrid-item.MuiGrid-wrap-xs-nowrap.MuiGrid-align-items-xs-baseline.MuiGrid-grid-md-12", - Oppose: ".MuiGrid-root.MuiGrid-container.MuiGrid-wrap-xs-nowrap.MuiGrid-align-items-xs-center.MuiGrid-grid-md-12", - - }, - - ProposalExecutionAndDrop: { - PassedExecutable: "//p[text()='Passed - Executable']", - Passed: "//p[text()='Passed']", - NoQuorum: "//p[text()='No Quorum']", - Expired: "//p[text()='Expired']", - DropProposal: "//span[text()='Drop Proposal']", - PercentageText: "//p[@class='MuiTypography-root jss1339 jss1340 MuiTypography-body1']", - DropExpired: "//span[text()='Drop Expired']", - Execute: "//span[text()='Execute']", - }, - OffChainPoll: { // ExampleDAO: "//p[text()='Example DAO']", // Proposal: "//p[text()='Proposals']", // cycle: "//p[text()='Creating']", - NewProposal: "//span[text()='New Proposal']", - OffChainPoll: "//p[text()='Off Chain Poll']", + NewProposal: "New Proposal", + OffChainPoll: "Off Chain Poll", ProposalTitle: "input[placeholder='Proposal Title*']", - ShortDescription: "textarea[placeholder='Short description']", + Description: "textarea[placeholder='Short description']", ExternalLink: "input[placeholder='External Link']", multipleChoice: "input[value='1']", Choice1: "input[placeholder='Choice 1']", @@ -180,8 +129,8 @@ const pageLocators = { DD: "input[placeholder='DD']", HH: "input[placeholder='HH']", MM: "input[placeholder='MM']", - CreateProposalButton: "button[class='MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedSecondary']", - CreateText: "//div[text()='Proposal created!']", + CreateProposalButton: "Create Proposal", + CreateText: "Proposal created!", }, VoteOnOffChainPoll: { @@ -190,35 +139,6 @@ const pageLocators = { Option2: "//p[text()='Increase Proposal Exploration Period']", CastYourVote: "//span[text()='Cast your vote']", VoteDone: "Your vote has been submitted", - }, - - CorrectVoteCount: { - VoteCount: "div[class='MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-6 MuiGrid-grid-md-6 MuiGrid-grid-lg-6'] p[class='MuiTypography-root MuiTypography-body1 MuiTypography-colorSecondary']", - Option1: "div[class='MuiGrid-root jss342 jss373 jss372 MuiGrid-container MuiGrid-direction-xs-column'] div[class='MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-justify-content-xs-flex-end MuiGrid-grid-xs-12 MuiGrid-grid-sm-6 MuiGrid-grid-lg-6'] p[class='MuiTypography-root MuiTypography-body2 MuiTypography-colorTextPrimary']", - Option2: "div[class='MuiGrid-root jss342 jss374 jss372 MuiGrid-container MuiGrid-direction-xs-column'] div[class='MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-justify-content-xs-flex-end MuiGrid-grid-xs-12 MuiGrid-grid-sm-6 MuiGrid-grid-lg-6'] p[class='MuiTypography-root MuiTypography-body2 MuiTypography-colorTextPrimary']", - - }, - - TokenStaking: { - User: "//p[text()='User']", - Deposit: "//span[text()='Deposit']", - PassAmount: "//input[@placeholder='0']", - UseMax: "//p[text()='Use Max']", - Submit: "//span[text()='Submit']", - TransactionText: "Deposit transaction confirmed", - }, - - UnStakingToken: { - UnStakeVotes: "//span[text()='Unstake Votes']", - TransactionText: "Execute transaction confirmed", - }, - - TokenWithdrawal: { - Withdraw: "//span[text()='Withdraw']", - Amount: "//input[@placeholder='0']", - UseMax: "//p[text()='Use Max']", - Submit: "//span[text()='Submit']", - TransactionText: "Withdrawal transaction confirmed", } }; diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index ca100df..274e6a4 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -40,6 +40,17 @@ const TezosTestData = { MaxAmount: "20", }, + OffChainPoll: { + ProposalTitle: "Testing Proposal", + Description: "This proposal aims to conduct an off-chain poll.", + ExternalLink: "https://example.com", + Choice1: "option1", + Choice2: "option2", + DD: "01", + HH: "02", + MM: "05", + }, + DAOConfiguration: { ProposalFee: "1", @@ -56,23 +67,6 @@ const TezosTestData = { NewDelegateAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", }, - TransferToken: { - RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", - Asset: "SRD", - Amount: "10", - AgoraPostID: "10", - }, - - TransferNFT: { - - }, - - EditRegistry: { - Key: "Hello", - Value: "Hi", - - }, - AddLambda: { MichelsonCode: ".npm__react-simple-code-editor__textarea", @@ -89,35 +83,6 @@ const TezosTestData = { }, - VoteOnProposal: { - - }, - - ProposalExecutionAndDrop: { - Execute: "//span[text()='Execute']", - DropExpired: "//span[text()='Drop Expired']", - }, - - - OffChainPoll: { - ProposalTitle: "Community Governance Upgrades Poll", - ShortDescription: "This proposal aims to conduct an off-chain poll to gather community input on potential upgrades to the Tezos governance process.", - ExternalLink: "https://examplelink.com/tezos-gov-upgrades-poll", - Choice1: "Introduce Liquid Democracy", - Choice2: "Increase Proposal Exploration Period", - CreateProposalButton: "button[class='MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedSecondary']", - DD: "01", - HH: "05", - MM: "00", - }, - - TokenStaking: { - Amount: "000+-e" - }, - - TokenWithdrawal: { - Amount: "23456E_+", - }, diff --git a/tests/TC03/TC03-07_TransferTokens.spec.js b/tests/TC03/TC03-07_TransferTokens.spec.js deleted file mode 100644 index 500bec6..0000000 --- a/tests/TC03/TC03-07_TransferTokens.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); - -test('Test case 05-03: Transfer Tokens', async ({ page }) => { - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - try { - - test.setTimeout(600000); //To Extend the time of test Execution - - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status - - await page.click(pageLocators.TransferToken.Treasury); //Click on Treasury - - await page.click(pageLocators.TransferToken.NewTransfer); //Click on Transfer - - await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); //Pass The Recipient Address - - await page.type(pageLocators.TransferToken.Asset, TezosTestData.TransferToken.Asset); //Click on Asset Button - - await page.waitForTimeout(2000) //Wait For Locate The Token - - await page.keyboard.press('ArrowDown'); //Click on DownArrow Button - - await page.keyboard.press('Enter'); //Click on Enter Button - - await page.type(pageLocators.TransferToken.Amount, TezosTestData.TransferToken.Amount); //Pass The Amount Wants to Transfer - - await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); //Pass The Agora Post ID - - await page.click(pageLocators.TransferToken.SubmitButton); //Click On Submit Button - - await page.waitForTimeout(30000); //Wait for Transfer Tokens - - const isTextVisible = content.includes(pageLocators.TransferToken.TransactionText, { visible: true }); //Verify that text visible on the webpage - - console.log(isTextVisible); // console The Pass And Fail Result - - console.log("Uploading Report"); - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") - - } - catch (error) { - console.log("Now Voting Cycle is running"); - } - - - - - - -}) \ No newline at end of file diff --git a/tests/TC03/TC03-08_TransferNFT.spec.js b/tests/TC03/TC03-08_TransferNFT.spec.js deleted file mode 100644 index c43cbae..0000000 --- a/tests/TC03/TC03-08_TransferNFT.spec.js +++ /dev/null @@ -1,30 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); -const path = require('path'); - -test('Test case 05-05: Transfer NFT ', async ({ page }) => { - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - try { - - test.setTimeout(600000); //To Extend the time of test Execution - - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status - - await page.click(pageLocators.TransferToken.Treasury); //Click on the Treasury - - await page.click(pageLocators.TransferNFT.NFTs); //Click on the NFT Button - - console.log("Uploading Report"); - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") - - } - catch (error) { - console.log("Now Voting Cycle is Running"); - } - -}) \ No newline at end of file diff --git a/tests/TC03/TC03-09_EditRegistry.spec.js b/tests/TC03/TC03-09_EditRegistry.spec.js deleted file mode 100644 index 379eb1f..0000000 --- a/tests/TC03/TC03-09_EditRegistry.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); - -test('Test case 05-06: Edit Registry', async ({ page }) => { - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - try { - - test.setTimeout(600000); //To Extend the time of test Execution - - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status - - await page.click(pageLocators.EditRegistry.Registry); //Click on the Registry on Tab - - await page.click(pageLocators.EditRegistry.NewItem); // Click On the New Registry item - - await page.type(pageLocators.EditRegistry.Key,TezosTestData.EditRegistry.Key); // Pass The Key For Registry - - await page.type(pageLocators.EditRegistry.Value, TezosTestData.EditRegistry.Value); //Pass The Value - - await page.click(pageLocators.EditRegistry.Submit); //Click on the submit button - - await page.waitForTimeout(30000); //Wait for Timeout the Script - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal."); - - } - catch (error) { - console.log("Now Voting Cycle is Running"); - } - - - -}) - diff --git a/tests/TC04/TC04-01_OffChainPoll.spec.js b/tests/TC04/TC04-01_OffChainPoll.spec.js new file mode 100644 index 0000000..54b4ae3 --- /dev/null +++ b/tests/TC04/TC04-01_OffChainPoll.spec.js @@ -0,0 +1,65 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + //To extend the time of test execution + test.setTimeout(120000); + + //Click on new Proposal + await page.getByText(pageLocators.OffChainPoll.NewProposal).click(); + + //Click on Off Chain Poll + await page.getByText(pageLocators.OffChainPoll.OffChainPoll).click(); + + //Pass the Proposal Title + await page.type(pageLocators.OffChainPoll.ProposalTitle, TezosTestData.OffChainPoll.ProposalTitle); + + //Pass the Short Description + await page.type(pageLocators.OffChainPoll.Description, TezosTestData.OffChainPoll.Description); + + //Pass the External Link + await page.type(pageLocators.OffChainPoll.ExternalLink, TezosTestData.OffChainPoll.ExternalLink); + + // Click on Multiple Choice + await page.click(pageLocators.OffChainPoll.multipleChoice); + + //Pass the Choice 1 Data + await page.type(pageLocators.OffChainPoll.Choice1, TezosTestData.OffChainPoll.Choice1); + + //Click on Add Choice + await page.click(pageLocators.OffChainPoll.AddChoice); + + //Pass The Choice 2 Data + await page.type(pageLocators.OffChainPoll.Choice2, TezosTestData.OffChainPoll.Choice2); + + //Pass The Date + await page.type(pageLocators.OffChainPoll.DD, TezosTestData.OffChainPoll.DD); + + //Pass The Hours + await page.type(pageLocators.OffChainPoll.HH, TezosTestData.OffChainPoll.HH); + + //Pass The Minute + await page.type(pageLocators.OffChainPoll.MM, TezosTestData.OffChainPoll.MM); + + //Click on the Create Proposal Button + await page.getByText(pageLocators.OffChainPoll.CreateProposalButton).click(); + + //Wait for Text Visible on Webpage + const validateText = await page.getByText(pageLocators.OffChainPoll.CreateText) + await expect (validateText).toBeVisible + + console.log("The poll is successfully created and the user is redirected to a confirmation page with the details of the newly created poll.") + + } catch (error) { + console.error('Error:', error); + } + + +}) \ No newline at end of file diff --git a/tests/TC04/TC05-02_VoteonOffChainPoll.spec.js b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js similarity index 100% rename from tests/TC04/TC05-02_VoteonOffChainPoll.spec.js rename to tests/TC04/TC04-02_VoteonOffChainPoll.spec.js diff --git a/tests/TC04/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js similarity index 100% rename from tests/TC04/TC05-03_CorrectVoteCountOnOffChainPoll.spec.js rename to tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js diff --git a/tests/TC04/TC05-01_OffChainPoll.spec.js b/tests/TC04/TC05-01_OffChainPoll.spec.js deleted file mode 100644 index da46cda..0000000 --- a/tests/TC04/TC05-01_OffChainPoll.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const { TezosTestData } = require("../CommonFile/TestData"); - -test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { - - // Selecting DAO for proposal creation - await PreProposal(page); - - try { - //To extend the time of test execution - test.setTimeout(120000); - - await page.click(pageLocators.OffChainPoll.NewProposal); //Click on new Proposal - - await page.click(pageLocators.OffChainPoll.OffChainPoll); //Click on Off Chain Poll - - await page.type(pageLocators.OffChainPoll.ProposalTitle, TezosTestData.OffChainPoll.ProposalTitle); //Pass the Proposal Title - - await page.type(pageLocators.OffChainPoll.ShortDescription, TezosTestData.OffChainPoll.ShortDescription); //Pass the Short Description - - await page.type(pageLocators.OffChainPoll.ExternalLink, TezosTestData.OffChainPoll.ExternalLink); //Pass the External Link - - await page.click(pageLocators.OffChainPoll.multipleChoice); // Click on Multiple Choice - - await page.type(pageLocators.OffChainPoll.Choice1, TezosTestData.OffChainPoll.Choice1); //Pass the Choice 1 Data - - await page.click(pageLocators.OffChainPoll.AddChoice); //Click on Add Choice - - await page.type(pageLocators.OffChainPoll.Choice2, TezosTestData.OffChainPoll.Choice2); //Pass The Choice 2 Data - - await page.type(pageLocators.OffChainPoll.DD, TezosTestData.OffChainPoll.DD); //Pass The Date - - await page.type(pageLocators.OffChainPoll.HH, TezosTestData.OffChainPoll.HH); //Pass The Hours - - await page.type(pageLocators.OffChainPoll.MM, TezosTestData.OffChainPoll.MM); //Pass The Minute - - await page.click(pageLocators.OffChainPoll.CreateProposalButton); //Click on the Create Proposal Button - - await page.waitForSelector(pageLocators.OffChainPoll.CreateText, { visible: true}); //Wait for Text Visible on Webpage - - console.log("The poll is successfully created and the user is redirected to a confirmation page with the details of the newly created poll.") - - } catch (error) { - console.error('Error:', error); - } - - -}) \ No newline at end of file diff --git a/tests/TC05/TC04-01_VoteOnProposal.spec.js b/tests/TC05/TC04-01_VoteOnProposal.spec.js deleted file mode 100644 index 8943393..0000000 --- a/tests/TC05/TC04-01_VoteOnProposal.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const path = require('path'); - -test('Test case 06: Vote On Proposal ', async ({ page }) => { - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - try { - - test.setTimeout(600000); //To Extend the time of test Execution - - await page.click(pageLocators.VoteOnProposal.VotingCycle); // Click on Running Cycle Status - - await page.click(pageLocators.VoteOnProposal.Active); //Click on the Active Button - - await page.click(pageLocators.VoteOnProposal.VoteFor); //Click on the Vote For Support - - await page.click(pageLocators.VoteOnProposal.UseMax); //Click on Use Max - - await page.click(pageLocators.VoteOnProposal.Submit); //Click on the Submit - - await page.waitForTimeout(2000); //Wait for Submit the Proposal - - await page.click(pageLocators.VoteOnProposal.View); //Click on the View Button - - await page.waitForTimeout(1000); - - const elementHandle0 = await page.$(pageLocators.VoteOnProposal.Support); // Find the element - - const textContent0 = await elementHandle0.textContent(); //get the text from element - - console.log(textContent0); //Print the test - - const elementHandle1 = await page.$(pageLocators.VoteOnProposal.Oppose); // Find the element - - const textContent1 = await elementHandle1.textContent(); //get the text from element - - console.log(textContent1); //Print the test - - } - catch (error) { - console.log("Now Creating Cycle is running"); - } - - - -}) \ No newline at end of file diff --git a/tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js deleted file mode 100644 index 6ca602c..0000000 --- a/tests/TC05/TC04-02_ProposalExecutionandDrop.spec.js +++ /dev/null @@ -1,30 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); - -test('Test case 07: Proposal Execution & Drop', async ({ page }) => { - - test.setTimeout(600000); //To Extend the time of test Execution - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - try { - - await page.click(pageLocators.OffChainPoll.cycle); // Click on Running Cycle Status - - if (await page.waitForLoadState(pageLocators.ProposalExecutionandDrop.PassedExecutable)) { //Click on the Passed - Executeable - - if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { //Validate That Button is clickable or not - - await page.click(pageLocators.ProposalExecutionandDrop.Execute); //Click on Execute Button - } - } else { - await page.click(pageLocators.ProposalExecutionandDrop.DropExpired); //Click on drop Expired Proposal - } - - } - catch (error) { - console.log("Error"); - } - -}) \ No newline at end of file diff --git a/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js b/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js deleted file mode 100644 index 7709a68..0000000 --- a/tests/TC06/TC06-01_SuccessfulTokenStaking.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const path = require('path'); - -test('Test case 11: Successful Token Staking', async ({ page }) => { - - test.setTimeout(600000); //To Extend the time of test Execution - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - await page.click(pageLocators.TokenStaking.User); //Click on the User ON the Tab - - await page.click(pageLocators.TokenStaking.Deposit); //Click on the Deposit Button - - //await page.type(pageLocators.TokenStaking.PassAmount, TezosTestData.TokenStaking.Amount); //Pass The Amount - - await page.click(pageLocators.TokenStaking.UseMax); //Click onn the User Max - - await page.click(pageLocators.TokenStaking.Submit); //Click on the Submit Button - - await page.waitForTimeout(30000); //Wait for Transaction Confirmed - - console.log(" The tokens are successfully staked and and show up as available balance field"); - -}) \ No newline at end of file diff --git a/tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js b/tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js deleted file mode 100644 index 3e14988..0000000 --- a/tests/TC06/TC06-02_SuccessfulTokenUnStaking.spec.js +++ /dev/null @@ -1,25 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); - -test('Test case 12: Successful Token UnStaking', async ({ page }) => { - - test.setTimeout(600000); //To Extend the time of test Execution - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - await page.click(pageLocators.OffChainPoll.Proposal); //Click on the proposal on the Tab - - await page.click(pageLocators.ProposalExecutionAndDrop.DropProposal); // Click on Drop All Proposals - - await page.waitForTimeout(2000); //Wait For Drop All The Proposal - - await page.click(pageLocators.UnStakingToken.UnStakeVotes); //Click on UnStake Votes - - await page.waitForTimeout(2000); //Wait For Complete The Transaction - - const isTextVisible = content.includes(pageLocators.UnStakingToken.TransactionText, { visible: true }); //Verify that text visible on the webpage - - console.log("The tokens are successfully UnStaked and show up in the Available Balance field.") - -}) \ No newline at end of file diff --git a/tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js b/tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js deleted file mode 100644 index 9ec87cb..0000000 --- a/tests/TC06/TC06-03_SuccessfulTokenWithdrawal.spec.js +++ /dev/null @@ -1,24 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); -const { TezosTestData } = require("./CommonFile/TestData"); - -test('Test case 13: Successful Token Withdrawal', async ({ page }) => { - - test.setTimeout(600000); //To Extend the time of test Execution - - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal - - await page.click(pageLocators.TokenWithdrawal.Withdraw); //Click On withdrawal Button - - await page.type(pageLocators.TokenWithdrawal.Amount, TezosTestData.TokenWithdrawal.Amount); //Click On the WithDraw Amount - - await page.click(pageLocators.TokenWithdrawal.UseMax); //Click on the Use Max - - await page.click(pageLocators.TokenWithdrawal.Submit); //Click On the Submit Button - - const isTextVisible = content.includes(pageLocators.TokenWithdrawal.TransactionText, { visible: true }); //Verify that text visible on the webpage - - console.log(isTextVisible); // console The Pass And Fail Result - -}) \ No newline at end of file From 2bb3b2a6dfe19159f3a5eeef2cdfe24e513f301e Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Fri, 25 Aug 2023 21:39:19 +0530 Subject: [PATCH 05/13] WIP TC03 --- tests/CommonFile/Locator.js | 36 ++++++++++--------- tests/CommonFile/TestData.js | 6 ++-- tests/TC03/TC03-04_DAOConfiguration.spec.js | 27 ++++++++------ tests/TC03/TC03-05_ChangeGuardian.spec.js | 18 +++++----- tests/TC03/TC03-06_ChangeDelegate.spec.js | 27 +++++++------- tests/TC04/TC04-01_OffChainPoll.spec.js | 6 ++-- tests/TC04/TC04-02_VoteonOffChainPoll.spec.js | 24 ++++++++----- ...-03_CorrectVoteCountOnOffChainPoll.spec.js | 28 +++++++++------ 8 files changed, 94 insertions(+), 78 deletions(-) diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index a08fe9a..7a4f335 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -69,23 +69,24 @@ const pageLocators = { }, DAOConfiguration: { - DAOConfiguration: "//p[text()='DAO Configuration']", - ProposalFee: "input[placeholder='Proposal fee']", - ReturnedTokenPercentage: "input[placeholder='Returned tokens percentage']", - SubmitButton: "//span[text()='Submit']", + DAOConfiguration: "DAO Configuration", + ProposalFee: "input[name='frozen_extra_value']", + ReturnedTokenPercentage: "input[name='returnedPercentage']", + SubmitButton: "Submit", }, ChangeGuardian: { - ChangeGuardian: "//p[text()='Change Guardian']", + ChangeGuardian: "Change Guardian", WalletAddress: "input[placeholder=' tz1...']", - SubmitButton: '//span[text()="Submit"]', + SubmitButton: 'Submit', + validateText: 'Guardian change proposal transaction confirmed' }, ChangeDelegate: { - ChangeDelegate: "//p[text()='Change Delegate']", + ChangeDelegate: "Change Delegate", NewDelegateAddress: "input[placeholder=' tz1...']", - SubmitButton: "//span[text()='Submit']", + SubmitButton: "Submit", PopUp: "", }, @@ -113,9 +114,6 @@ const pageLocators = { }, OffChainPoll: { - // ExampleDAO: "//p[text()='Example DAO']", - // Proposal: "//p[text()='Proposals']", - // cycle: "//p[text()='Creating']", NewProposal: "New Proposal", OffChainPoll: "Off Chain Poll", ProposalTitle: "input[placeholder='Proposal Title*']", @@ -134,12 +132,16 @@ const pageLocators = { }, VoteOnOffChainPoll: { - ProposalName: "//h4[text()='Community Governance Upgrades Poll']", - Option1: "//p[text()='Introduce Liquid Democracy']", - Option2: "//p[text()='Increase Proposal Exploration Period']", - CastYourVote: "//span[text()='Cast your vote']", - VoteDone: "Your vote has been submitted", - } + ProposalName: "Testing Proposal", + Option1: "option1", + Option2: "option2", + CastYourVote: "Cast your vote", + VoteVerify: "Your vote has been submitted", + }, + + CorrectVoteCount: { + VoteCount: "div[class='MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-6 MuiGrid-grid-md-6 MuiGrid-grid-lg-6'] p[class='MuiTypography-root MuiTypography-body1 MuiTypography-colorSecondary']" + }, }; diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 274e6a4..ac6fe6f 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -41,7 +41,7 @@ const TezosTestData = { }, OffChainPoll: { - ProposalTitle: "Testing Proposal", + ProposalTitle: "Testing proposal", Description: "This proposal aims to conduct an off-chain poll.", ExternalLink: "https://example.com", Choice1: "option1", @@ -54,7 +54,7 @@ const TezosTestData = { DAOConfiguration: { ProposalFee: "1", - ReturnedTokenPercentage: "1", + ReturnedTokenPercentage: "2", }, @@ -84,7 +84,5 @@ const TezosTestData = { }, - - } export { TezosTestData }; \ No newline at end of file diff --git a/tests/TC03/TC03-04_DAOConfiguration.spec.js b/tests/TC03/TC03-04_DAOConfiguration.spec.js index e4a5cf9..b50a226 100644 --- a/tests/TC03/TC03-04_DAOConfiguration.spec.js +++ b/tests/TC03/TC03-04_DAOConfiguration.spec.js @@ -21,23 +21,28 @@ test('Test case 05-04: DAO Configuration', async ({ page }) => { //Click On New Proposal await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - await page.click(pageLocators.DAOConfiguration.DAOConfiguration); //Click on DAO Configuration + //Click on DAO Configuration + await page.getByText(pageLocators.DAOConfiguration.DAOConfiguration).click(); - await page.locator(pageLocators.DAOConfiguration.ProposalFee); // Pass The Proposal Fee - await page.keyboard.type('1'); + // Pass The Proposal Fee + await page.fill(pageLocators.DAOConfiguration.ProposalFee, TezosTestData.DAOConfiguration.ProposalFee) + + //Pass The Returned Token Percentage + await page.fill(pageLocators.DAOConfiguration.ReturnedTokenPercentage, TezosTestData.DAOConfiguration.ReturnedTokenPercentage); - await page.locator(pageLocators.DAOConfiguration.ReturnedTokenPercentage); //Pass The Returned Token Percentage - await page.keyboard.type('1'); + //Wait For Type The Letters + await page.waitForTimeout(1000); - await page.waitForTimeout(1000); //Wait For Type The Letters + //Click on the Submit button + await page.getByText(pageLocators.DAOConfiguration.SubmitButton).click(); - await page.click(pageLocators.DAOConfiguration.SubmitButton); //Click on the Submit button + //Wait for DAO Configuration + await page.waitForTimeout(5000); - await page.waitForTimeout(5000); //Wait for DAO Configuration + const validateText = await page.getByText('proposal transaction'); + await expect(validateText).toBeVisible(); - console.log("Uploading Report"); - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") + console.log(" The proposal is successfully created.") } catch (error) { diff --git a/tests/TC03/TC03-05_ChangeGuardian.spec.js b/tests/TC03/TC03-05_ChangeGuardian.spec.js index 9af0211..8f430c1 100644 --- a/tests/TC03/TC03-05_ChangeGuardian.spec.js +++ b/tests/TC03/TC03-05_ChangeGuardian.spec.js @@ -21,19 +21,19 @@ test('Test case 05-02: Change Guardian', async ({ page }) => { //Click On New Proposal await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - await page.click(pageLocators.ChangeGuardian.ChangeGuardian); //Click on Change Guardian + //Click on Change Guardian + await page.getByText(pageLocators.ChangeGuardian.ChangeGuardian).click(); - await page.type(pageLocators.ChangeGuardian.WalletAddress, TezosTestData.ChangeGuardian.WalletAddress); //Pass The Wallet Address + //Pass The Wallet Address + await page.type(pageLocators.ChangeGuardian.WalletAddress, TezosTestData.ChangeGuardian.WalletAddress); - await page.click(pageLocators.ChangeGuardian.SubmitButton); //Click on Submit button + //Click on Submit button + await page.getByText(pageLocators.ChangeGuardian.SubmitButton).click(); - await page.waitForTimeout(30000); //Wait for TimeOut Submit the proposal + //Wait for TimeOut Submit the proposal + await page.waitForTimeout(5000); - const isTextVisible = content.includes(pageLocators.TokenCreator.DeployText, { visible: true }); //Verify that text visible on the webpage - - console.log("Uploading Report"); - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") + console.log(" The proposal is successfully created.") } catch (error) { diff --git a/tests/TC03/TC03-06_ChangeDelegate.spec.js b/tests/TC03/TC03-06_ChangeDelegate.spec.js index ec71706..bbde884 100644 --- a/tests/TC03/TC03-06_ChangeDelegate.spec.js +++ b/tests/TC03/TC03-06_ChangeDelegate.spec.js @@ -21,25 +21,22 @@ test('Test case 05-01: Change Delegate', async ({ page }) => { //Click On New Proposal await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - await page.click(pageLocators.ChangeDelegate.ChangeDelegate); //Click on Change Delegate + //Click on Change Delegate + await page.getByText(pageLocators.ChangeDelegate.ChangeDelegate).click(); - await page.type(pageLocators.ChangeDelegate.NewDelegateAddress, TezosTestData.ChangeDelegate.NewDelegateAddress); //New Delegate Address + //New Delegate Address + await page.type(pageLocators.ChangeDelegate.NewDelegateAddress, TezosTestData.ChangeDelegate.NewDelegateAddress); - await page.click(pageLocators.ChangeDelegate.SubmitButton); //Click on Submit button + //Click on Submit button + await page.getByText(pageLocators.ChangeDelegate.SubmitButton).click(); - await page.waitForTimeout(30000); //Wait For Timeout + //Wait For Timeout + await page.waitForTimeout(30000); + + await expect(await page.getByText('creating...')).toBeVisible(); + - const isTextVisible = content.includes(pageLocators.ChangeDelegate.PopUp, { visible: true }); //Verify that text visible on the webpage - - if (!isTextVisible) { - console.error("Expected text is not visible. Test case failed."); - } - - await page.click(pageLocators.OffChainPoll.Proposal) //Click on the Proposal - - console.log("Uploading Report"); - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") + console.log(" The proposal is successfully created.") } catch (error) { diff --git a/tests/TC04/TC04-01_OffChainPoll.spec.js b/tests/TC04/TC04-01_OffChainPoll.spec.js index 54b4ae3..056eace 100644 --- a/tests/TC04/TC04-01_OffChainPoll.spec.js +++ b/tests/TC04/TC04-01_OffChainPoll.spec.js @@ -1,4 +1,4 @@ -const { test, expect } = require("@playwright/test"); +const { test, expect } = require('@playwright/test'); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); @@ -9,7 +9,7 @@ test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { await PreProposal(page); try { - //To extend the time of test execution + //To extend the time of test execution test.setTimeout(120000); //Click on new Proposal @@ -55,7 +55,7 @@ test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { const validateText = await page.getByText(pageLocators.OffChainPoll.CreateText) await expect (validateText).toBeVisible - console.log("The poll is successfully created and the user is redirected to a confirmation page with the details of the newly created poll.") + console.log("The poll is successfully created.") } catch (error) { console.error('Error:', error); diff --git a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js index 6e49a10..1306853 100644 --- a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js +++ b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js @@ -1,19 +1,27 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); test('Test case 09: Vote On Off Chain Proposal ', async ({ page }) => { - test.setTimeout(600000); //To Extend the time of test Execution + //To extend the time of test execution + test.setTimeout(120000); - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); - await page.click(pageLocators.VoteOnOffChainPoll.ProposalName); //Click on the Proposal Name + //Click on the Proposal Name + await page.getByText(pageLocators.VoteOnOffChainPoll.ProposalName).click(); - await page.click(pageLocators.VoteOnOffChainPoll.Option1); //Click On Option 1 + //Click On Option 1 + await page.getByText(pageLocators.VoteOnOffChainPoll.Option1).first().click(); - await page.click(pageLocators.VoteOnOffChainPoll.CastYourVote); //Submit Your Votes + //Submit Your Votes + await page.getByText(pageLocators.VoteOnOffChainPoll.CastYourVote).click(); - console.log("The vote is successfully recorded and the user is redirected to a confirmation page with the details of the vote."); + const validateText = await page.getByText(pageLocators.VoteOnOffChainPoll.VoteVerify); + await expect(validateText).toBeVisible; + + console.log("The vote is successfully casted."); }) \ No newline at end of file diff --git a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js index 0069fdb..957a6dc 100644 --- a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js +++ b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js @@ -1,25 +1,31 @@ const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("./CommonFile/PreAction"); -const { pageLocators } = require("./CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); test('Test case 10: Correct vote Count on Off Chain Poll ', async ({ page }) => { - test.setTimeout(600000); //To Extend the time of test Execution + //To extend the time of test execution + test.setTimeout(120000); - await PreProposal(page); //PreConditions Open URL and Open Mask DAO For Proposal + // Selecting DAO for proposal creation + await PreProposal(page); - await page.click(pageLocators.VoteOnOffChainPoll.ProposalName); + await page.getByText(pageLocators.VoteOnOffChainPoll.ProposalName).click(); - await page.waitForSelector(pageLocators.CorrectVoteCount.VoteCount); //Wait for find the Element + await page.waitForTimeout(2000); - const element = await page.$(pageLocators.CorrectVoteCount.VoteCount); // get The element + // get The element + const content = await page.$(pageLocators.CorrectVoteCount.VoteCount); - await page.waitForTimeout(2000); //wait for get the votes + //wait for get the votes + await page.waitForTimeout(2000); - const textContent = await element.innerText(); //get the text From this element + //get the text From this element + const textContent = await content.innerText(); - console.log('Votes:', textContent); // Console The test Present on the Webpage + // Console The test Present on the Webpage + console.log('Votes:', textContent); - console.log("The vote count matches the number of votes submitted for the poll, and if multiple choice is enabled, the voting weight is evenly split between all the options that a voter picked.") + console.log("The vote count matches the number of votes submitted for the poll.") }) \ No newline at end of file From 26e624e862c976c828429db01cb49deaab14cf3c Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Sat, 26 Aug 2023 21:19:11 +0530 Subject: [PATCH 06/13] TC05 commit --- tests/CommonFile/Locator.js | 10 ++++ tests/CommonFile/TestData.js | 4 ++ tests/TC03/TC03-04_DAOConfiguration.spec.js | 5 +- tests/TC03/TC03-05_ChangeGuardian.spec.js | 2 +- tests/TC05/TC05-01_VoteOnProposal.spec.js | 54 +++++++++++++++++++ .../TC05-02_ProposalExecutionandDrop.spec.js | 33 ++++++++++++ 6 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 tests/TC05/TC05-01_VoteOnProposal.spec.js create mode 100644 tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 7a4f335..bc0aac7 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -143,6 +143,16 @@ const pageLocators = { VoteCount: "div[class='MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-grid-xs-12 MuiGrid-grid-sm-6 MuiGrid-grid-md-6 MuiGrid-grid-lg-6'] p[class='MuiTypography-root MuiTypography-body1 MuiTypography-colorSecondary']" }, + VotingOnChain: { + cycle: "Voting", + active: 'Active', + VoteFor: 'Vote For', + VoteAgainst: 'Vote Against', + Amount: 'input[placeholder="Type an Amount"]', + Submit: 'Submit', + validateText: 'Vote transaction confirmed!', + View: 'View', + } }; export { pageLocators }; diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index ac6fe6f..4b652e6 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -83,6 +83,10 @@ const TezosTestData = { }, + VotingOnChain: { + Amount: '10', + } + } export { TezosTestData }; \ No newline at end of file diff --git a/tests/TC03/TC03-04_DAOConfiguration.spec.js b/tests/TC03/TC03-04_DAOConfiguration.spec.js index b50a226..dfb5839 100644 --- a/tests/TC03/TC03-04_DAOConfiguration.spec.js +++ b/tests/TC03/TC03-04_DAOConfiguration.spec.js @@ -37,7 +37,7 @@ test('Test case 05-04: DAO Configuration', async ({ page }) => { await page.getByText(pageLocators.DAOConfiguration.SubmitButton).click(); //Wait for DAO Configuration - await page.waitForTimeout(5000); + await page.waitForTimeout(10000); const validateText = await page.getByText('proposal transaction'); await expect(validateText).toBeVisible(); @@ -46,7 +46,8 @@ test('Test case 05-04: DAO Configuration', async ({ page }) => { } catch (error) { - console.log("Now Voting Cycle is Running"); + // console.log("Now Voting Cycle is Running"); + console.log(error); } }) \ No newline at end of file diff --git a/tests/TC03/TC03-05_ChangeGuardian.spec.js b/tests/TC03/TC03-05_ChangeGuardian.spec.js index 8f430c1..28b74e7 100644 --- a/tests/TC03/TC03-05_ChangeGuardian.spec.js +++ b/tests/TC03/TC03-05_ChangeGuardian.spec.js @@ -11,7 +11,7 @@ test('Test case 05-02: Change Guardian', async ({ page }) => { try { //To Extend the time of test Execution - test.setTimeout(120000); + test.setTimeout(120000); //Check if cycle status is CREATING const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) diff --git a/tests/TC05/TC05-01_VoteOnProposal.spec.js b/tests/TC05/TC05-01_VoteOnProposal.spec.js new file mode 100644 index 0000000..cd29e04 --- /dev/null +++ b/tests/TC05/TC05-01_VoteOnProposal.spec.js @@ -0,0 +1,54 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const path = require('path'); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 06: Vote On Proposal ', async ({ page }) => { + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //To Extend the time of test Execution + test.setTimeout(120000); + + //Check if cycle status is VOTING. + const cyclestatus = await page.getByText(pageLocators.VotingOnChain.cycle, {exact: true}) + + await expect(cyclestatus).toBeVisible(); + + + //Click on the Active Button + await page.getByText(pageLocators.VotingOnChain.active).click(); + + await page.waitForTimeout(3000); + + //Click on the Vote For Support + await page.getByText(pageLocators.VotingOnChain.VoteFor).click(); + + //Enter an amount + await page.type(pageLocators.VotingOnChain.Amount, TezosTestData.VotingOnChain.Amount); + + //Click on the Submit + await page.getByText(pageLocators.VotingOnChain.Submit).click(); + + //Wait for Submit the Proposal + await page.waitForTimeout(2000); + + //Validate that Confirmation message is shown + const validateText = await page.getByText(pageLocators.VotingOnChain.validateText); + await expect(validateText).toBeVisible(); + + console.log("Vote was casted successfully."); + + } + catch (error) { + // console.log("Now Creating Cycle is running"); + console.log(error); + } + + + +}) \ No newline at end of file diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js new file mode 100644 index 0000000..df52471 --- /dev/null +++ b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js @@ -0,0 +1,33 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); + +test('Test case 07: Proposal Execution & Drop', async ({ page }) => { + + //To Extend the time of test Execution + test.setTimeout(120000); + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //Check if cycle status is Creating. + await page.click(pageLocators.ProposalCreation.Cycle); + + if (await page.waitForLoadState(pageLocators.ProposalExecutionandDrop.PassedExecutable)) { //Click on the Passed - Executeable + + if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { //Validate That Button is clickable or not + + await page.click(pageLocators.ProposalExecutionandDrop.Execute); //Click on Execute Button + } + } else { + await page.click(pageLocators.ProposalExecutionandDrop.DropExpired); //Click on drop Expired Proposal + } + + } + catch (error) { + console.log("Error"); + } + +}) \ No newline at end of file From 36b4cb49faf6ded489979e697f4cce2071132660 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Mon, 28 Aug 2023 20:48:49 +0530 Subject: [PATCH 07/13] WIP TC05 --- tests/CommonFile/Locator.js | 1 - tests/CommonFile/TestData.js | 2 +- tests/TC01/TC01-01_CreateToken.spec.js | 2 +- tests/TC01/TC01-02_TokenValues.spec.js | 2 +- tests/TC01/TC01-03_TokenWithValues.spec.js | 2 +- tests/TC02/TC02-01_CreateDAO.spec.js | 2 +- tests/TC02/TC02-02_DAOValues.spec.js | 2 +- tests/TC03/TC03-01_AddLambda.spec.js | 44 ----------------- tests/TC03/TC03-02_RemoveLambda.spec.js | 45 ----------------- tests/TC03/TC03-03_ExecuteLambda.spec.js | 48 ------------------- tests/TC03/TC03-05_ChangeGuardian.spec.js | 2 +- tests/TC03/TC03-06_ChangeDelegate.spec.js | 2 +- tests/TC04/TC04-01_OffChainPoll.spec.js | 4 +- tests/TC04/TC04-02_VoteonOffChainPoll.spec.js | 4 +- ...-03_CorrectVoteCountOnOffChainPoll.spec.js | 3 +- tests/TC05/TC05-01_VoteOnProposal.spec.js | 19 ++++---- .../TC05-02_ProposalExecutionandDrop.spec.js | 10 ++-- 17 files changed, 31 insertions(+), 163 deletions(-) delete mode 100644 tests/TC03/TC03-01_AddLambda.spec.js delete mode 100644 tests/TC03/TC03-02_RemoveLambda.spec.js delete mode 100644 tests/TC03/TC03-03_ExecuteLambda.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index bc0aac7..4a60c18 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -144,7 +144,6 @@ const pageLocators = { }, VotingOnChain: { - cycle: "Voting", active: 'Active', VoteFor: 'Vote For', VoteAgainst: 'Vote Against', diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 4b652e6..5b2f4d2 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -84,7 +84,7 @@ const TezosTestData = { }, VotingOnChain: { - Amount: '10', + Amount: '5', } diff --git a/tests/TC01/TC01-01_CreateToken.spec.js b/tests/TC01/TC01-01_CreateToken.spec.js index 99f853e..e59e95d 100644 --- a/tests/TC01/TC01-01_CreateToken.spec.js +++ b/tests/TC01/TC01-01_CreateToken.spec.js @@ -3,7 +3,7 @@ const { changeNetwork } = require("../CommonFile/Action"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData");+ -test("Test Case 1: Successful Token Creation", async ({ page }) => { +test("Test Case 01-01: Successful Token Creation", async ({ page }) => { //To extend the time of test execution test.setTimeout(120000); diff --git a/tests/TC01/TC01-02_TokenValues.spec.js b/tests/TC01/TC01-02_TokenValues.spec.js index 19f7b5a..1b36abe 100644 --- a/tests/TC01/TC01-02_TokenValues.spec.js +++ b/tests/TC01/TC01-02_TokenValues.spec.js @@ -3,7 +3,7 @@ const { changeNetwork } = require("../CommonFile/Action"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test("Test Case 2: Token Creation with Various Input Values", async ({ page, }) => { +test("Test Case 01-02: Token Creation with Various Input Values", async ({ page, }) => { //To extend the time of test execution test.setTimeout(120000); diff --git a/tests/TC01/TC01-03_TokenWithValues.spec.js b/tests/TC01/TC01-03_TokenWithValues.spec.js index 214cf4c..4058175 100644 --- a/tests/TC01/TC01-03_TokenWithValues.spec.js +++ b/tests/TC01/TC01-03_TokenWithValues.spec.js @@ -4,7 +4,7 @@ const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test3: Amount Less than Supply Token',async ({page})=>{ +test('Test Case 01-03: Amount Less than Supply Token',async ({page})=>{ //To extend the time of test execution test.setTimeout(120000); diff --git a/tests/TC02/TC02-01_CreateDAO.spec.js b/tests/TC02/TC02-01_CreateDAO.spec.js index a15df71..a1927c6 100644 --- a/tests/TC02/TC02-01_CreateDAO.spec.js +++ b/tests/TC02/TC02-01_CreateDAO.spec.js @@ -3,7 +3,7 @@ const { changeNetwork } = require("../CommonFile/Action"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test Case 3 : Create DAO Successfully', async ({ page }) => { +test('Test Case 02-01 : Create DAO Successfully', async ({ page }) => { //To extend the time of test execution test.setTimeout(120000); diff --git a/tests/TC02/TC02-02_DAOValues.spec.js b/tests/TC02/TC02-02_DAOValues.spec.js index 56ce55f..0c56cee 100644 --- a/tests/TC02/TC02-02_DAOValues.spec.js +++ b/tests/TC02/TC02-02_DAOValues.spec.js @@ -3,7 +3,7 @@ const { changeNetwork } = require("../CommonFile/Action"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test Case 4 : Create DAO with various input values', async ({ page }) => { +test('Test Case 02-02: Create DAO with various input values', async ({ page }) => { //To extend the time of test execution test.setTimeout(120000); diff --git a/tests/TC03/TC03-01_AddLambda.spec.js b/tests/TC03/TC03-01_AddLambda.spec.js deleted file mode 100644 index b67d1c5..0000000 --- a/tests/TC03/TC03-01_AddLambda.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const { TezosTestData } = require("../CommonFile/TestData"); - -test('Test case 05-07: Add Lambda ', async ({ page }) => { - - // Selecting DAO for proposal creation - await PreProposal(page); - - try { - - //To Extend the time of test Execution - test.setTimeout(120000); - - //Check if cycle status is CREATING - const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - - await expect(cyclestatus).toBeVisible() - - //Click On New Proposal - await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - - await page.click(pageLocators.AddLambda.AddLambda); // Click on Add Lambda - - await page.type(pageLocators.AddLambda.TestBox, TezosTestData.AddLambda.MichelsonCode); //Pass The Michelson Code - - await page.click(pageLocators.AddLambda.SubmitButton); //Click on Submit Button - - await page.waitForTimeout(30000); //Wait for Lambda Implementation - - console.log("Uploading Report"); - - Console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") - - - } - catch (error) { - console.log("Now Voting cycle is running"); - } - - - -}) \ No newline at end of file diff --git a/tests/TC03/TC03-02_RemoveLambda.spec.js b/tests/TC03/TC03-02_RemoveLambda.spec.js deleted file mode 100644 index 0dd4588..0000000 --- a/tests/TC03/TC03-02_RemoveLambda.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const { TezosTestData } = require("../CommonFile/TestData"); - -test('Test case 05-08: Remove Lambda ', async ({ page }) => { - - // Selecting DAO for proposal creation - await PreProposal(page); - - try { - - //To Extend the time of test Execution - test.setTimeout(120000); - - //Check if cycle status is CREATING - const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - - await expect(cyclestatus).toBeVisible() - - //Click On New Proposal - await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - - await page.click(pageLocators.RemoveLambda.RemoveLambda); //Click on Remove Lambda - - await page.type(pageLocators.RemoveLambda.SearchBox, TezosTestData.RemoveLambda.SearchText); //Pass The Search Text - - await page.keyboard.press('ArrowDown'); //Click on DownArrow Button - - await page.keyboard.press('Enter'); //Click on Enter Button - - await page.click(pageLocators.RemoveLambda.SubmitButton); //Click on Submit Button - - await page.waitForTimeout(30000); //Wait For Remove the Lambda - - console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal."); - - } - catch (error) { - console.log("Now Voting cycle is running"); - } - - - -}) \ No newline at end of file diff --git a/tests/TC03/TC03-03_ExecuteLambda.spec.js b/tests/TC03/TC03-03_ExecuteLambda.spec.js deleted file mode 100644 index 6d2948a..0000000 --- a/tests/TC03/TC03-03_ExecuteLambda.spec.js +++ /dev/null @@ -1,48 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const { TezosTestData } = require("../CommonFile/TestData"); - -test('Test case 05-09: Execute Lambda ', async ({ page }) => { - - // Selecting DAO for proposal creation - await PreProposal(page); - - try { - - //To Extend the time of test Execution - test.setTimeout(120000); - - //Check if cycle status is CREATING - const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - - await expect(cyclestatus).toBeVisible() - - //Click On New Proposal - await page.getByText(pageLocators.ProposalCreation.NewProposal).click() - await page.click(pageLocators.ExecuteLambda.ExecuteLambda); //Click on Execute Lambda - - await page.type(pageLocators.ExecuteLambda.SearchBox, TezosTestData.ExecuteLambda.SearchText); //Pass the Search Text - - await page.waitForTimeout(1000); //Wait For Pass The Data - - await page.keyboard.press('ArrowDown'); //Click on DownArrow Button - - await page.keyboard.press('Enter'); //Click on Enter Button - - await page.getByPlaceholder(pageLocators.ExecuteLambda.ExecuteLambda).type(TezosTestData.ExecuteLambda.LambdaArgumentsCode); //Pass The Lambda Arguments Code - - await page.getByPlaceholder(pageLocators.ExecuteLambda.LambdaParams).type(TezosTestData.ExecuteLambda.LambdaParams); //Pass The Lambda Params Code - - await page.waitForTimeout(2000); //Wait For Validate - - await page.click(pageLocators.ExecuteLambda.SubmitButton); //Click On the Submit Button - - await page.waitForTimeout(5000); //Wait For Pass The test Data - - } - catch (error) { - console.log("Now Voting cycle is running"); - } - -}) \ No newline at end of file diff --git a/tests/TC03/TC03-05_ChangeGuardian.spec.js b/tests/TC03/TC03-05_ChangeGuardian.spec.js index 28b74e7..4d2c972 100644 --- a/tests/TC03/TC03-05_ChangeGuardian.spec.js +++ b/tests/TC03/TC03-05_ChangeGuardian.spec.js @@ -3,7 +3,7 @@ const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test case 05-02: Change Guardian', async ({ page }) => { +test('Test case 05-05: Change Guardian', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); diff --git a/tests/TC03/TC03-06_ChangeDelegate.spec.js b/tests/TC03/TC03-06_ChangeDelegate.spec.js index bbde884..59c8e23 100644 --- a/tests/TC03/TC03-06_ChangeDelegate.spec.js +++ b/tests/TC03/TC03-06_ChangeDelegate.spec.js @@ -3,7 +3,7 @@ const { pageLocators } = require ("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); const { PreProposal } = require("../CommonFile/PreProposal"); -test('Test case 05-01: Change Delegate', async ({ page }) => { +test('Test case 05-06: Change Delegate', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); diff --git a/tests/TC04/TC04-01_OffChainPoll.spec.js b/tests/TC04/TC04-01_OffChainPoll.spec.js index 056eace..8783e06 100644 --- a/tests/TC04/TC04-01_OffChainPoll.spec.js +++ b/tests/TC04/TC04-01_OffChainPoll.spec.js @@ -3,7 +3,7 @@ const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { +test('Test case 04-01: Off Chain Poll Proposal Creation', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); @@ -53,7 +53,7 @@ test('Test case 08: Off Chain Poll Proposal Creation', async ({ page }) => { //Wait for Text Visible on Webpage const validateText = await page.getByText(pageLocators.OffChainPoll.CreateText) - await expect (validateText).toBeVisible + await expect (validateText).toBeVisible(); console.log("The poll is successfully created.") diff --git a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js index 1306853..d2d60ff 100644 --- a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js +++ b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js @@ -2,7 +2,7 @@ const { test, expect } = require("@playwright/test"); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); -test('Test case 09: Vote On Off Chain Proposal ', async ({ page }) => { +test('Test case 04-02: Vote On Off Chain Proposal ', async ({ page }) => { //To extend the time of test execution test.setTimeout(120000); @@ -19,6 +19,8 @@ test('Test case 09: Vote On Off Chain Proposal ', async ({ page }) => { //Submit Your Votes await page.getByText(pageLocators.VoteOnOffChainPoll.CastYourVote).click(); + await page.waitForTimeout(3000); + const validateText = await page.getByText(pageLocators.VoteOnOffChainPoll.VoteVerify); await expect(validateText).toBeVisible; diff --git a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js index 957a6dc..d6560a6 100644 --- a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js +++ b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js @@ -2,7 +2,7 @@ const { test, expect } = require("@playwright/test"); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); -test('Test case 10: Correct vote Count on Off Chain Poll ', async ({ page }) => { +test('Test case 04-03: Correct vote Count on Off Chain Poll ', async ({ page }) => { //To extend the time of test execution test.setTimeout(120000); @@ -22,6 +22,7 @@ test('Test case 10: Correct vote Count on Off Chain Poll ', async ({ page }) => //get the text From this element const textContent = await content.innerText(); + await expect(parseInt(textContent)).toBeGreaterThanOrEqual(1) // Console The test Present on the Webpage console.log('Votes:', textContent); diff --git a/tests/TC05/TC05-01_VoteOnProposal.spec.js b/tests/TC05/TC05-01_VoteOnProposal.spec.js index cd29e04..0f68758 100644 --- a/tests/TC05/TC05-01_VoteOnProposal.spec.js +++ b/tests/TC05/TC05-01_VoteOnProposal.spec.js @@ -4,7 +4,7 @@ const { pageLocators } = require("../CommonFile/Locator"); const path = require('path'); const { TezosTestData } = require("../CommonFile/TestData"); -test('Test case 06: Vote On Proposal ', async ({ page }) => { +test('Test case 05-01: Vote On Proposal ', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); @@ -12,16 +12,15 @@ test('Test case 06: Vote On Proposal ', async ({ page }) => { try { //To Extend the time of test Execution - test.setTimeout(120000); + test.setTimeout(160000); - //Check if cycle status is VOTING. - const cyclestatus = await page.getByText(pageLocators.VotingOnChain.cycle, {exact: true}) + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await expect(cyclestatus).toBeVisible(); + await expect(cyclestatus).not.toBeVisible(); - //Click on the Active Button - await page.getByText(pageLocators.VotingOnChain.active).click(); + await page.getByText(pageLocators.VotingOnChain.active, {exact: true}).click(); await page.waitForTimeout(3000); @@ -31,12 +30,14 @@ test('Test case 06: Vote On Proposal ', async ({ page }) => { //Enter an amount await page.type(pageLocators.VotingOnChain.Amount, TezosTestData.VotingOnChain.Amount); + await page.waitForTimeout(5000) + //Click on the Submit await page.getByText(pageLocators.VotingOnChain.Submit).click(); //Wait for Submit the Proposal - await page.waitForTimeout(2000); - + await page.waitForTimeout(10000); + //Validate that Confirmation message is shown const validateText = await page.getByText(pageLocators.VotingOnChain.validateText); await expect(validateText).toBeVisible(); diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js index df52471..24b1264 100644 --- a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js +++ b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js @@ -2,20 +2,22 @@ const { test, expect } = require("@playwright/test"); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); -test('Test case 07: Proposal Execution & Drop', async ({ page }) => { +test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { //To Extend the time of test Execution test.setTimeout(120000); // Selecting DAO for proposal creation - await PreProposal(page); + await PreProposal(page); try { //Check if cycle status is Creating. - await page.click(pageLocators.ProposalCreation.Cycle); + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle); + await expect(cyclestatus).toBeVisible(); - if (await page.waitForLoadState(pageLocators.ProposalExecutionandDrop.PassedExecutable)) { //Click on the Passed - Executeable + // Click on the Passed - Executeable + if (await page.waitForLoadState(pageLocators.ProposalExecutionandDrop.PassedExecutable)) { if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { //Validate That Button is clickable or not From b94a7435ff1e87ac82b59a37ccdfe8f1c5a036e1 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Tue, 29 Aug 2023 21:29:56 +0530 Subject: [PATCH 08/13] WIP TC06 --- tests/CommonFile/Locator.js | 26 ++++++++++++- tests/CommonFile/TestData.js | 10 ++++- tests/TC05/TC05-01_VoteOnProposal.spec.js | 1 - .../TC05-02_ProposalExecutionandDrop.spec.js | 35 ----------------- tests/TC06/TC06-01_TokenWithdraw.spec.js | 34 ++++++++++++++++ tests/TC06/TC06-02_TokenStaking.spec.js | 34 ++++++++++++++++ tests/TC06/TC06-03_TokenUnstaking.spec.js | 39 +++++++++++++++++++ 7 files changed, 141 insertions(+), 38 deletions(-) delete mode 100644 tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js create mode 100644 tests/TC06/TC06-01_TokenWithdraw.spec.js create mode 100644 tests/TC06/TC06-02_TokenStaking.spec.js create mode 100644 tests/TC06/TC06-03_TokenUnstaking.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 4a60c18..b2c7562 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -151,7 +151,31 @@ const pageLocators = { Submit: 'Submit', validateText: 'Vote transaction confirmed!', View: 'View', - } + }, + + TokenDeposit: { + User: "User", + Deposit: "Deposit", + Amount: "input[placeholder='0']", + Submit: "Submit", + verifyText: "Deposit transaction confirmed!", + Balance: ".MuiTypography-root jss2800 MuiTypography-body1 MuiTypography-colorTextPrimary" + + }, + TokenWithdrawal: { + User: "User", + Withdraw: "Withdraw", + Amount:"input[placeholder='0']", + Submit: "Submit", + verifyText: "Withdrawal transaction confirmed!" + }, + + TokenUnstaking: { + Drop: "Drop Expired", + User: "User", + Unstake: "Unstake Votes", + verifyText: "Execute transaction confirmed!" + }, }; export { pageLocators }; diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 5b2f4d2..601df20 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -85,8 +85,16 @@ const TezosTestData = { VotingOnChain: { Amount: '5', - } + }, + TokenDeposit: { + Amount: "2", + Balance: "2" + }, + + TokenWithdrawal: { + Amount: "5", + } } export { TezosTestData }; \ No newline at end of file diff --git a/tests/TC05/TC05-01_VoteOnProposal.spec.js b/tests/TC05/TC05-01_VoteOnProposal.spec.js index 0f68758..0dd2d2c 100644 --- a/tests/TC05/TC05-01_VoteOnProposal.spec.js +++ b/tests/TC05/TC05-01_VoteOnProposal.spec.js @@ -1,7 +1,6 @@ const { test, expect } = require("@playwright/test"); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); -const path = require('path'); const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-01: Vote On Proposal ', async ({ page }) => { diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js deleted file mode 100644 index 24b1264..0000000 --- a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -const { test, expect } = require("@playwright/test"); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); - -test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { - - //To Extend the time of test Execution - test.setTimeout(120000); - - // Selecting DAO for proposal creation - await PreProposal(page); - - try { - - //Check if cycle status is Creating. - const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle); - await expect(cyclestatus).toBeVisible(); - - // Click on the Passed - Executeable - if (await page.waitForLoadState(pageLocators.ProposalExecutionandDrop.PassedExecutable)) { - - if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { //Validate That Button is clickable or not - - await page.click(pageLocators.ProposalExecutionandDrop.Execute); //Click on Execute Button - } - } else { - await page.click(pageLocators.ProposalExecutionandDrop.DropExpired); //Click on drop Expired Proposal - } - - } - catch (error) { - console.log("Error"); - } - -}) \ No newline at end of file diff --git a/tests/TC06/TC06-01_TokenWithdraw.spec.js b/tests/TC06/TC06-01_TokenWithdraw.spec.js new file mode 100644 index 0000000..12856aa --- /dev/null +++ b/tests/TC06/TC06-01_TokenWithdraw.spec.js @@ -0,0 +1,34 @@ +const { test, expect } = require("@playwright/test"); +const { pageLocators } = require("../CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 06-01: Successful Token Withdrawal', async ({ page }) => { + + //To Extend the time of test Execution + test.setTimeout(160000); + + // Selecting DAO for proposal creation + await PreProposal(page); + + //Click on the User Tab + await page.getByText(pageLocators.TokenWithdrawal.User).click(); + + //Click on Withdraw Button + await page.getByText(pageLocators.TokenWithdrawal.Withdraw).click(); + + //Enter amount to withdraw + await page.type(pageLocators.TokenWithdrawal.Amount, TezosTestData.TokenWithdrawal.Amount); + + //Click on Submit Button + await page.getByText(pageLocators.TokenWithdrawal.Submit).click(); + + await page.waitForTimeout(30000); + + //Verify the PopUp text. + const validateText = await page.getByText(pageLocators.TokenWithdrawal.verifyText); + await expect(validateText).toBeVisible(); + + console.log("The tokens were successfully withdrawed and the remaining tokens are visible in Available Balance. ") + +}) \ No newline at end of file diff --git a/tests/TC06/TC06-02_TokenStaking.spec.js b/tests/TC06/TC06-02_TokenStaking.spec.js new file mode 100644 index 0000000..d92e7e1 --- /dev/null +++ b/tests/TC06/TC06-02_TokenStaking.spec.js @@ -0,0 +1,34 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 06-02: Successful Token Staking', async ({ page }) => { + + //To Extend the time of test Execution + test.setTimeout(160000); + + // Selecting DAO for proposal creation + await PreProposal(page); + + //Click on the User Tab + await page.getByText(pageLocators.TokenDeposit.User).click(); + + //Click on the Deposit Button + await page.getByText(pageLocators.TokenDeposit.Deposit).click(); + + //Pass The Amount + await page.type(pageLocators.TokenDeposit.Amount, TezosTestData.TokenDeposit.Amount); + + //Click on the Submit Button + await page.getByText(pageLocators.TokenDeposit.Submit).click(); + + await page.waitForTimeout(30000); + + // Verify the PopUp text + const validateText = await page.getByText(pageLocators.TokenDeposit.verifyText); + await expect(validateText).toBeVisible; + + console.log(" The tokens are successfully staked and are visible in Pending Balance field."); + +}) \ No newline at end of file diff --git a/tests/TC06/TC06-03_TokenUnstaking.spec.js b/tests/TC06/TC06-03_TokenUnstaking.spec.js new file mode 100644 index 0000000..c76298f --- /dev/null +++ b/tests/TC06/TC06-03_TokenUnstaking.spec.js @@ -0,0 +1,39 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); + +test('Test case 06-03: Successful Token UnStaking', async ({ page }) => { + + //To Extend the time of test Execution + test.setTimeout(160000); + + // Selecting DAO for proposal creation + await PreProposal(page); + + // await page.waitForTimeout(10000); + + //Click on Drop Expire + // await page.getByText(pageLocators.TokenUnstaking.Drop).click(); + + // await page.waitForTimeout(12000); + + // const validateText = page.getByText(pageLocators.TokenUnstaking.verifyText); + // await expect(validateText).toBeVisible(); + + // go to Users tab + await page.getByText(pageLocators.TokenUnstaking.User).click(); + + await page.waitForTimeout(5000); + + //Click on UnStake Votes + page.getByText(pageLocators.TokenUnstaking.Unstake).click(); + + await page.waitForTimeout(10000); + + // Verify PopUp text + const validateText2 = await page.getByText(pageLocators.TokenUnstaking.verifyText); + await expect(validateText2).toBeVisible(); + + console.log("The tokens are successfully Unstaked."); + +}) \ No newline at end of file From 3f5faaa0fa062e0352c8193c572e632d5e669f10 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Wed, 30 Aug 2023 22:49:14 +0530 Subject: [PATCH 09/13] WIP TC03 --- tests/CommonFile/Locator.js | 52 +++++++++--------- tests/CommonFile/TestData.js | 23 ++++---- tests/TC03/TC03-07_TransferTokens.spec.js | 65 +++++++++++++++++++++++ tests/TC03/TC03-08_TransferNFT.spec.js | 38 +++++++++++++ tests/TC03/TC03-09_EditRegistry.spec.js | 45 ++++++++++++++++ tests/TC06/TC06-03_TokenUnstaking.spec.js | 12 ++--- 6 files changed, 193 insertions(+), 42 deletions(-) create mode 100644 tests/TC03/TC03-07_TransferTokens.spec.js create mode 100644 tests/TC03/TC03-08_TransferNFT.spec.js create mode 100644 tests/TC03/TC03-09_EditRegistry.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index b2c7562..c41bac8 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -1,8 +1,8 @@ const pageLocators = { TokenCreation: { - MainNet:'Mainnet', - GhostNet:"Ghostnet", + MainNet: 'Mainnet', + GhostNet: "Ghostnet", EnterApp: ".MuiButtonBase-root.MuiButton-root.MuiButton-contained.jss11.jss12.MuiButton-containedSecondary", frame: "div.MuiGrid-root.MuiGrid-container.MuiGrid-align-items-xs-center.MuiGrid-justify-content-xs-center", // ConnectWallet: "//span[text()='Connect Wallet']", @@ -44,14 +44,14 @@ const pageLocators = { ThresholdExpiryHours: "input[name='proposalExpiryBlocksHours']", ThresholdExpiryMinutes: "input[name='proposalExpiryBlocksMinutes']", RequireStake: "input[name='proposeStakeRequired']", - Slider:"span[role='slider']", + Slider: "span[role='slider']", MinAmount: "input[name='minXtzAmount']", MaxAmount: "input[name='maxXtzAmount']", - QuorumThreshold:"input[name='quorumThreshold']", - QuorumChange:"input[name='quorumChange']", - MinQuorumAmount:"input[name='minQuorumAmount']", - QuorumMaxChange:"input[name='quorumMaxChange']", - MaxQuorumAmount:"input[name='maxQuorumAmount']", + QuorumThreshold: "input[name='quorumThreshold']", + QuorumChange: "input[name='quorumChange']", + MinQuorumAmount: "input[name='minQuorumAmount']", + QuorumMaxChange: "input[name='quorumMaxChange']", + MaxQuorumAmount: "input[name='maxQuorumAmount']", SelfDeployed: " Self-Deployed", DeployDAO: "Deploy DAO", // Managed: "//p[text()='Managed']", @@ -91,27 +91,31 @@ const pageLocators = { }, - AddLambda: { - AddLambda: "//p[text()='Add Lambda']", - TestBox: ".npm__react-simple-code-editor__textarea", - SubmitButton: "//span[text()='Submit']", + TransferToken: { + Treasury: "Treasury", + NewTransfer: "New Transfer", + Recipient: "input[placeholder='Type an Address Here']", + Asset: "//input[@class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']", + Amount: "input[placeholder='0']", + AgoraPostID: "input[placeholder='Type an Agora Post ID']", + SubmitButton: "//span[normalize-space()='Submit']", + TransactionText: "Registry proposal transaction confirmed", + }, + TransferNFT: { + NFTs: "NFTs", }, - RemoveLambda: { - RemoveLambda: "//p[text()='Remove Lambda']", - SearchBox: "#combo-box-demo", - SubmitButton: "//span[text()='Submit']", + EditRegistry: { + Registry: "Registry", + NewItem: "New Item", + BatchTransfer: "//input[type='checkbox']", + Key: "//input[@placeholder='Type a Key']", + Value: "//textarea[@placeholder='Type a value']", + Submit: "//span[text()='Submit']", }, - ExecuteLambda: { - ExecuteLambda: "//p[text()='Execute Lambda']", - SearchBox: "#combo-box-demo", - LambdaArgumentsCode: 'Write Michelson Code for the input Paramerers of your Lambda\n\nEg:-\n\n{\n "prim": "pair",\n "annots": [\n "%xtz_transfer_type"\n ],\n "args": [\n {\n "prim": "mutez",\n "annots": [\n "%amount"\n ]\n },\n {\n "prim": "address",\n "annots": [\n "%recipient"\n ]\n }\n ]\n},\n', - LambdaParams: 'Enter the values for the given params in a JSON/JavaScript Object format.\n\nEg:-\n\n{\n xtz_transfer_type: {\n amount: 10000000000000000000,\n recipient: "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb"\n }\n}\n ', - SubmitButton: "//span[text()='Submit']", - }, OffChainPoll: { NewProposal: "New Proposal", @@ -165,7 +169,7 @@ const pageLocators = { TokenWithdrawal: { User: "User", Withdraw: "Withdraw", - Amount:"input[placeholder='0']", + Amount: "input[placeholder='0']", Submit: "Submit", verifyText: "Withdrawal transaction confirmed!" }, diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 601df20..d32d02a 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -10,8 +10,8 @@ const TezosTestData = { Icon: "Picture.PNG", WalletAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Amount: "100", - TC01_03Amount:"10", - + TC01_03Amount: "10", + }, DAOCreation: { @@ -67,19 +67,18 @@ const TezosTestData = { NewDelegateAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", }, - AddLambda: { - MichelsonCode: ".npm__react-simple-code-editor__textarea", - + TransferToken: { + RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", + Asset: "SRD", + Amount: "10", + AgoraPostID: "10", }, - RemoveLambda: { - SearchText: "transfer_proposal", - }, + TransferNFT: {}, - ExecuteLambda: { - SearchText: "transfer_proposal", - LambdaArgumentsCode: "Write Michelson Code For the Input", - LambdaParams: "Enter the values for the given params in a JSON/JavaScript Object format." + EditRegistry: { + Key: "This is Registry", + Value: "Hello!", }, diff --git a/tests/TC03/TC03-07_TransferTokens.spec.js b/tests/TC03/TC03-07_TransferTokens.spec.js new file mode 100644 index 0000000..2ac2abe --- /dev/null +++ b/tests/TC03/TC03-07_TransferTokens.spec.js @@ -0,0 +1,65 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 05-07: Transfer Tokens', async ({ page }) => { + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //To Extend the time of test Execution + test.setTimeout(120000); + + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + + await expect(cyclestatus).toBeVisible(); + + //Click on Treasury + await page.getByText(pageLocators.TransferToken.Treasury).click(); + + //Click on New Transfer + await page.getByText(pageLocators.TransferToken.NewTransfer).click(); + + //Pass Recipient Address + await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); + + //Click on Asset Button + await page.type(pageLocators.TransferToken.Asset, TezosTestData.TransferToken.Asset); + + await page.waitForTimeout(2000) //Wait For Locate The Token + + await page.keyboard.press('ArrowDown'); //Click on DownArrow Button + + await page.keyboard.press('Enter'); //Click on Enter Button + + await page.type(pageLocators.TransferToken.Amount, TezosTestData.TransferToken.Amount); //Pass The Amount Wants to Transfer + + await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); //Pass The Agora Post ID + + await page.click(pageLocators.TransferToken.SubmitButton); //Click On Submit Button + + await page.waitForTimeout(30000); //Wait for Transfer Tokens + + const isTextVisible = content.includes(pageLocators.TransferToken.TransactionText, { visible: true }); //Verify that text visible on the webpage + + console.log(isTextVisible); // console The Pass And Fail Result + + console.log("Uploading Report"); + + console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") + + } + catch (error) { + console.log("Now Voting Cycle is running"); + } + + + + + + +}) \ No newline at end of file diff --git a/tests/TC03/TC03-08_TransferNFT.spec.js b/tests/TC03/TC03-08_TransferNFT.spec.js new file mode 100644 index 0000000..cf7ad02 --- /dev/null +++ b/tests/TC03/TC03-08_TransferNFT.spec.js @@ -0,0 +1,38 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); + +test('Test case 05-08: Transfer NFT ', async ({ page }) => { + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //To Extend the time of test Execution + test.setTimeout(120000); + + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + + await expect(cyclestatus).toBeVisible() + + //Click on Treasury + await page.getByText(pageLocators.TransferToken.Treasury).click(); + + //Click on NFTs + await page.getByText(pageLocators.TransferNFT.NFTs).click(); + + //Click on New Transfer + await page.getByText(pageLocators.TransferToken.NewTransfer).click(); + + console.log("Uploading Report"); + + console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") + + } + catch (error) { + console.log("Now Voting Cycle is Running"); + } + +}) \ No newline at end of file diff --git a/tests/TC03/TC03-09_EditRegistry.spec.js b/tests/TC03/TC03-09_EditRegistry.spec.js new file mode 100644 index 0000000..1b0a968 --- /dev/null +++ b/tests/TC03/TC03-09_EditRegistry.spec.js @@ -0,0 +1,45 @@ +const { test, expect } = require("@playwright/test"); +const { pageLocators } = require("../CommonFile/Locator"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { TezosTestData } = require("../CommonFile/TestData"); + +test('Test case 05-09: Edit Registry', async ({ page }) => { + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //To Extend the time of test Execution + test.setTimeout(120000); + + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + + await expect(cyclestatus).toBeVisible() + + //Click on Registry + await page.getByText(pageLocators.EditRegistry.Registry).click(); + + // Click On the New Registry item + await page.getByText(pageLocators.EditRegistry.NewItem).click(); + + await page.type(pageLocators.EditRegistry.Key,TezosTestData.EditRegistry.Key); // Pass The Key For Registry + + await page.type(pageLocators.EditRegistry.Value, TezosTestData.EditRegistry.Value); //Pass The Value + + await page.click(pageLocators.EditRegistry.Submit); //Click on the submit button + + await page.waitForTimeout(30000); //Wait for Timeout the Script + + console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal."); + + } + catch (error) { + console.log("Now Voting Cycle is Running"); + } + + + +}) + diff --git a/tests/TC06/TC06-03_TokenUnstaking.spec.js b/tests/TC06/TC06-03_TokenUnstaking.spec.js index c76298f..2258292 100644 --- a/tests/TC06/TC06-03_TokenUnstaking.spec.js +++ b/tests/TC06/TC06-03_TokenUnstaking.spec.js @@ -10,15 +10,15 @@ test('Test case 06-03: Successful Token UnStaking', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); - // await page.waitForTimeout(10000); + await page.waitForTimeout(10000); - //Click on Drop Expire - // await page.getByText(pageLocators.TokenUnstaking.Drop).click(); + Click on Drop Expire + await page.getByText(pageLocators.TokenUnstaking.Drop).click(); - // await page.waitForTimeout(12000); + await page.waitForTimeout(12000); - // const validateText = page.getByText(pageLocators.TokenUnstaking.verifyText); - // await expect(validateText).toBeVisible(); + const validateText = page.getByText(pageLocators.TokenUnstaking.verifyText); + await expect(validateText).toBeVisible(); // go to Users tab await page.getByText(pageLocators.TokenUnstaking.User).click(); From b7b1da3222bf74304637836dea3c78f9d0486cc4 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Thu, 31 Aug 2023 21:36:12 +0530 Subject: [PATCH 10/13] WIP TC03 --- tests/CommonFile/Locator.js | 14 +++++------ tests/CommonFile/TestData.js | 6 +++-- tests/TC03/TC03-07_TransferTokens.spec.js | 30 ++++++++++++----------- tests/TC03/TC03-08_TransferNFT.spec.js | 21 ++++++++++++++-- tests/TC03/TC03-09_EditRegistry.spec.js | 14 ++++++++--- 5 files changed, 56 insertions(+), 29 deletions(-) diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index c41bac8..659c7e4 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -95,24 +95,24 @@ const pageLocators = { Treasury: "Treasury", NewTransfer: "New Transfer", Recipient: "input[placeholder='Type an Address Here']", - Asset: "//input[@class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']", + Asset: "input[class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']", + TST:"TST", Amount: "input[placeholder='0']", AgoraPostID: "input[placeholder='Type an Agora Post ID']", - SubmitButton: "//span[normalize-space()='Submit']", - TransactionText: "Registry proposal transaction confirmed", + SubmitButton: "Submit", + verifyText: "Registry proposal transaction confirmed", }, TransferNFT: { NFTs: "NFTs", + NFTid: "input[class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']" }, EditRegistry: { Registry: "Registry", NewItem: "New Item", - BatchTransfer: "//input[type='checkbox']", - Key: "//input[@placeholder='Type a Key']", - Value: "//textarea[@placeholder='Type a value']", - Submit: "//span[text()='Submit']", + Key: "input[placeholder='Type a Key']", + Value: "textarea[placeholder='Type a value']", }, diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index d32d02a..719b5b1 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -69,12 +69,14 @@ const TezosTestData = { TransferToken: { RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", - Asset: "SRD", + Asset: "TST", Amount: "10", AgoraPostID: "10", }, - TransferNFT: {}, + TransferNFT: { + NFTid: "10" + }, EditRegistry: { Key: "This is Registry", diff --git a/tests/TC03/TC03-07_TransferTokens.spec.js b/tests/TC03/TC03-07_TransferTokens.spec.js index 2ac2abe..9338911 100644 --- a/tests/TC03/TC03-07_TransferTokens.spec.js +++ b/tests/TC03/TC03-07_TransferTokens.spec.js @@ -24,31 +24,33 @@ test('Test case 05-07: Transfer Tokens', async ({ page }) => { //Click on New Transfer await page.getByText(pageLocators.TransferToken.NewTransfer).click(); - //Pass Recipient Address + //Enter Recipient Address await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); //Click on Asset Button await page.type(pageLocators.TransferToken.Asset, TezosTestData.TransferToken.Asset); - await page.waitForTimeout(2000) //Wait For Locate The Token + //Wait For Locate The Token + await page.waitForTimeout(2000) - await page.keyboard.press('ArrowDown'); //Click on DownArrow Button + //Click on DownArrow Button + await page.keyboard.press('ArrowDown'); + await page.keyboard.press('Enter'); - await page.keyboard.press('Enter'); //Click on Enter Button + //Pass The Amount Wants to Transfer + await page.type(pageLocators.TransferToken.Amount, TezosTestData.TransferToken.Amount); - await page.type(pageLocators.TransferToken.Amount, TezosTestData.TransferToken.Amount); //Pass The Amount Wants to Transfer + //Pass The Agora Post ID + await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); - await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); //Pass The Agora Post ID + //Click On Submit Button + await page.getByText(pageLocators.TransferToken.SubmitButton).click(); - await page.click(pageLocators.TransferToken.SubmitButton); //Click On Submit Button + await page.waitForTimeout(30000); - await page.waitForTimeout(30000); //Wait for Transfer Tokens - - const isTextVisible = content.includes(pageLocators.TransferToken.TransactionText, { visible: true }); //Verify that text visible on the webpage - - console.log(isTextVisible); // console The Pass And Fail Result - - console.log("Uploading Report"); + //Verify POPUP text is visible + const validateText = await page.getByText(pageLocators.TransferToken.verifyText); + await expect(validateText).toBeVisible(); console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") diff --git a/tests/TC03/TC03-08_TransferNFT.spec.js b/tests/TC03/TC03-08_TransferNFT.spec.js index cf7ad02..bda2a52 100644 --- a/tests/TC03/TC03-08_TransferNFT.spec.js +++ b/tests/TC03/TC03-08_TransferNFT.spec.js @@ -1,6 +1,7 @@ const { test, expect } = require("@playwright/test"); const { PreProposal } = require("../CommonFile/PreProposal"); const { pageLocators } = require("../CommonFile/Locator"); +const { TezosTestData } = require("../CommonFile/TestData"); test('Test case 05-08: Transfer NFT ', async ({ page }) => { @@ -26,13 +27,29 @@ test('Test case 05-08: Transfer NFT ', async ({ page }) => { //Click on New Transfer await page.getByText(pageLocators.TransferToken.NewTransfer).click(); - console.log("Uploading Report"); + //Enter Recipient Address + await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); + + //Click on Asset Button + await page.type(pageLocators.TransferNFT.NFTid, TezosTestData.TransferNFT.NFTid); + + //Enter The Agora Post ID + await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); + + //Click On Submit Button + await page.getByText(pageLocators.TransferToken.SubmitButton).click(); + + await page.waitForTimeout(30000); + + //Verify POPUP text is visible + const validateText = await page.getByText(pageLocators.TransferToken.verifyText); + await expect(validateText).toBeVisible(); console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal.") } catch (error) { - console.log("Now Voting Cycle is Running"); + console.log("Error: ", error); } }) \ No newline at end of file diff --git a/tests/TC03/TC03-09_EditRegistry.spec.js b/tests/TC03/TC03-09_EditRegistry.spec.js index 1b0a968..07044b2 100644 --- a/tests/TC03/TC03-09_EditRegistry.spec.js +++ b/tests/TC03/TC03-09_EditRegistry.spec.js @@ -24,13 +24,19 @@ test('Test case 05-09: Edit Registry', async ({ page }) => { // Click On the New Registry item await page.getByText(pageLocators.EditRegistry.NewItem).click(); - await page.type(pageLocators.EditRegistry.Key,TezosTestData.EditRegistry.Key); // Pass The Key For Registry + // Enter The Key For Registry + await page.type(pageLocators.EditRegistry.Key,TezosTestData.EditRegistry.Key); - await page.type(pageLocators.EditRegistry.Value, TezosTestData.EditRegistry.Value); //Pass The Value + //Enter The Value + await page.type(pageLocators.EditRegistry.Value, TezosTestData.EditRegistry.Value); - await page.click(pageLocators.EditRegistry.Submit); //Click on the submit button + //Pass The Agora Post ID + await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); - await page.waitForTimeout(30000); //Wait for Timeout the Script + //Click On Submit Button + await page.getByText(pageLocators.TransferToken.SubmitButton).click(); + + await page.waitForTimeout(30000); console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal."); From 51ada408834fe26ded73ef3fd5a34ffd4f7c8dc2 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Sat, 2 Sep 2023 21:48:19 +0530 Subject: [PATCH 11/13] WIP TC05 --- tests/CommonFile/Locator.js | 13 +++++- tests/CommonFile/TestData.js | 9 ++-- tests/TC03/TC03-07_TransferTokens.spec.js | 27 ++++++------ tests/TC03/TC03-08_TransferNFT.spec.js | 8 ++-- tests/TC03/TC03-09_EditRegistry.spec.js | 14 +++++-- tests/TC04/TC04-01_OffChainPoll.spec.js | 6 +-- tests/TC04/TC04-02_VoteonOffChainPoll.spec.js | 4 +- ...-03_CorrectVoteCountOnOffChainPoll.spec.js | 3 +- .../TC05-02_ProposalExecutionandDrop.spec.js | 42 +++++++++++++++++++ tests/TC06/TC06-03_TokenUnstaking.spec.js | 11 ++--- 10 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index 659c7e4..cdbd452 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -96,7 +96,7 @@ const pageLocators = { NewTransfer: "New Transfer", Recipient: "input[placeholder='Type an Address Here']", Asset: "input[class='MuiInputBase-input MuiInput-input MuiAutocomplete-input MuiAutocomplete-inputFocused MuiInputBase-inputAdornedEnd']", - TST:"TST", + TST: "TST", Amount: "input[placeholder='0']", AgoraPostID: "input[placeholder='Type an Agora Post ID']", SubmitButton: "Submit", @@ -113,7 +113,7 @@ const pageLocators = { NewItem: "New Item", Key: "input[placeholder='Type a Key']", Value: "textarea[placeholder='Type a value']", - + verifyText: "Registry proposal transaction confirmed!" }, @@ -157,6 +157,15 @@ const pageLocators = { View: 'View', }, + ProposalExecutionandDrop: { + PassedExecutable: "Passed - Executable", + Passed: "Passed", + DropProposal: "Drop Proposal", + PercentageText: "p[class='MuiTypography-root jss1339 jss1340 MuiTypography-body1']", + DropExpired: "//span[text()='Drop Expired']", + Execute: "//span[text()='Execute']", + }, + TokenDeposit: { User: "User", Deposit: "Deposit", diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 719b5b1..f7eecb9 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -70,17 +70,14 @@ const TezosTestData = { TransferToken: { RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Asset: "TST", - Amount: "10", - AgoraPostID: "10", + Amount: "05", + AgoraPostID: "05", }, - TransferNFT: { - NFTid: "10" - }, EditRegistry: { Key: "This is Registry", - Value: "Hello!", + Value: "Helloo", }, diff --git a/tests/TC03/TC03-07_TransferTokens.spec.js b/tests/TC03/TC03-07_TransferTokens.spec.js index 9338911..708c5f3 100644 --- a/tests/TC03/TC03-07_TransferTokens.spec.js +++ b/tests/TC03/TC03-07_TransferTokens.spec.js @@ -28,20 +28,28 @@ test('Test case 05-07: Transfer Tokens', async ({ page }) => { await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); //Click on Asset Button - await page.type(pageLocators.TransferToken.Asset, TezosTestData.TransferToken.Asset); + await page.locator(pageLocators.TransferToken.Asset).click(); //Wait For Locate The Token - await page.waitForTimeout(2000) + await page.waitForTimeout(2000); + + await page.getByRole('option', { name: pageLocators.TransferToken.TST }).click(); //Click on DownArrow Button - await page.keyboard.press('ArrowDown'); - await page.keyboard.press('Enter'); + // await page.keyboard.press('ArrowDown'); + // await page.keyboard.press('Enter'); //Pass The Amount Wants to Transfer - await page.type(pageLocators.TransferToken.Amount, TezosTestData.TransferToken.Amount); + await page.locator(pageLocators.TransferToken.Amount).click(); + await page.keyboard.press('Backspace'); + await page.keyboard.type(TezosTestData.TransferToken.Amount); //Pass The Agora Post ID - await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); + await page.locator(pageLocators.TransferToken.AgoraPostID).click(); + await page.keyboard.press('Backspace'); + await page.keyboard.type(TezosTestData.TransferToken.AgoraPostID); + + await page.waitForTimeout(5000); //Click On Submit Button await page.getByText(pageLocators.TransferToken.SubmitButton).click(); @@ -56,12 +64,7 @@ test('Test case 05-07: Transfer Tokens', async ({ page }) => { } catch (error) { - console.log("Now Voting Cycle is running"); + console.log("Error: ", error); } - - - - - }) \ No newline at end of file diff --git a/tests/TC03/TC03-08_TransferNFT.spec.js b/tests/TC03/TC03-08_TransferNFT.spec.js index bda2a52..01a9fe1 100644 --- a/tests/TC03/TC03-08_TransferNFT.spec.js +++ b/tests/TC03/TC03-08_TransferNFT.spec.js @@ -30,11 +30,13 @@ test('Test case 05-08: Transfer NFT ', async ({ page }) => { //Enter Recipient Address await page.type(pageLocators.TransferToken.Recipient, TezosTestData.TransferToken.RecipientAddress); - //Click on Asset Button - await page.type(pageLocators.TransferNFT.NFTid, TezosTestData.TransferNFT.NFTid); //Enter The Agora Post ID - await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); + await page.locator(pageLocators.TransferToken.AgoraPostID).click(); + await page.keyboard.press('Backspace'); + await page.keyboard.type(TezosTestData.TransferToken.AgoraPostID); + + await page.waitForTimeout(3000); //Click On Submit Button await page.getByText(pageLocators.TransferToken.SubmitButton).click(); diff --git a/tests/TC03/TC03-09_EditRegistry.spec.js b/tests/TC03/TC03-09_EditRegistry.spec.js index 07044b2..b2c2800 100644 --- a/tests/TC03/TC03-09_EditRegistry.spec.js +++ b/tests/TC03/TC03-09_EditRegistry.spec.js @@ -16,7 +16,7 @@ test('Test case 05-09: Edit Registry', async ({ page }) => { //Check if cycle status is CREATING const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await expect(cyclestatus).toBeVisible() + await expect(cyclestatus).toBeVisible(); //Click on Registry await page.getByText(pageLocators.EditRegistry.Registry).click(); @@ -31,18 +31,26 @@ test('Test case 05-09: Edit Registry', async ({ page }) => { await page.type(pageLocators.EditRegistry.Value, TezosTestData.EditRegistry.Value); //Pass The Agora Post ID - await page.type(pageLocators.TransferToken.AgoraPostID, TezosTestData.TransferToken.AgoraPostID); + await page.locator(pageLocators.TransferToken.AgoraPostID).click(); + await page.keyboard.press('Backspace'); + await page.keyboard.type(TezosTestData.TransferToken.AgoraPostID); + + await page.waitForTimeout(5000); //Click On Submit Button await page.getByText(pageLocators.TransferToken.SubmitButton).click(); await page.waitForTimeout(30000); + + //Verify POPUP text is visible + const validateText = await page.getByText(pageLocators.EditRegistry.verifyText); + await expect(validateText).toBeVisible(); console.log(" The proposal is successfully created and the user is redirected to a confirmation page with the details of the newly created proposal."); } catch (error) { - console.log("Now Voting Cycle is Running"); + console.log("Error: ", error); } diff --git a/tests/TC04/TC04-01_OffChainPoll.spec.js b/tests/TC04/TC04-01_OffChainPoll.spec.js index 8783e06..c464205 100644 --- a/tests/TC04/TC04-01_OffChainPoll.spec.js +++ b/tests/TC04/TC04-01_OffChainPoll.spec.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); -const { PreProposal } = require("../CommonFile/PreProposal"); -const { pageLocators } = require("../CommonFile/Locator"); -const { TezosTestData } = require("../CommonFile/TestData"); +const { PreProposal } = require('../CommonFile/PreProposal'); +const { pageLocators } = require('../CommonFile/Locator'); +const { TezosTestData } = require('../CommonFile/TestData'); test('Test case 04-01: Off Chain Poll Proposal Creation', async ({ page }) => { diff --git a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js index d2d60ff..23aebef 100644 --- a/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js +++ b/tests/TC04/TC04-02_VoteonOffChainPoll.spec.js @@ -10,8 +10,8 @@ test('Test case 04-02: Vote On Off Chain Proposal ', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); - //Click on the Proposal Name - await page.getByText(pageLocators.VoteOnOffChainPoll.ProposalName).click(); + //Click on the Proposal Name + await page.getByRole('heading', { name: pageLocators.VoteOnOffChainPoll.ProposalName }).first().click(); //Click On Option 1 await page.getByText(pageLocators.VoteOnOffChainPoll.Option1).first().click(); diff --git a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js index d6560a6..d0e45a9 100644 --- a/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js +++ b/tests/TC04/TC04-03_CorrectVoteCountOnOffChainPoll.spec.js @@ -10,7 +10,8 @@ test('Test case 04-03: Correct vote Count on Off Chain Poll ', async ({ page }) // Selecting DAO for proposal creation await PreProposal(page); - await page.getByText(pageLocators.VoteOnOffChainPoll.ProposalName).click(); + //Click on the Proposal Name + await page.getByRole('heading', { name: pageLocators.VoteOnOffChainPoll.ProposalName }).first().click(); await page.waitForTimeout(2000); diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js new file mode 100644 index 0000000..8223634 --- /dev/null +++ b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js @@ -0,0 +1,42 @@ +const { test, expect } = require("@playwright/test"); +const { PreProposal } = require("../CommonFile/PreProposal"); +const { pageLocators } = require("../CommonFile/Locator"); + +test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { + + //To Extend the time of test Execution + test.setTimeout(120000); + + // Selecting DAO for proposal creation + await PreProposal(page); + + try { + + //Check if cycle status is CREATING + const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) + + await expect(cyclestatus).toBeVisible(); + + const passed = await page.getByText(pageLocators.ProposalExecutionandDrop.PassedExecutable); + + await passed.click(); + + // Click on the Passed - Executeable + if (await expect(passed).toBeVisible()) { + + //Validate That Button is clickable or not + if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { + //Click on Execute Button + await page.click(pageLocators.ProposalExecutionandDrop.Execute); + } + } else { + //Click on drop Expired Proposal + await page.getByText(pageLocators.ProposalExecutionandDrop.DropExpired).click(); + } + + } + catch (error) { + console.log("Error"); + } + +}) \ No newline at end of file diff --git a/tests/TC06/TC06-03_TokenUnstaking.spec.js b/tests/TC06/TC06-03_TokenUnstaking.spec.js index 2258292..5da5466 100644 --- a/tests/TC06/TC06-03_TokenUnstaking.spec.js +++ b/tests/TC06/TC06-03_TokenUnstaking.spec.js @@ -10,15 +10,12 @@ test('Test case 06-03: Successful Token UnStaking', async ({ page }) => { // Selecting DAO for proposal creation await PreProposal(page); - await page.waitForTimeout(10000); + await page.waitForTimeout(25000); - Click on Drop Expire + // Click on Drop Expire await page.getByText(pageLocators.TokenUnstaking.Drop).click(); - await page.waitForTimeout(12000); - - const validateText = page.getByText(pageLocators.TokenUnstaking.verifyText); - await expect(validateText).toBeVisible(); + await page.waitForTimeout(30000); // go to Users tab await page.getByText(pageLocators.TokenUnstaking.User).click(); @@ -28,7 +25,7 @@ test('Test case 06-03: Successful Token UnStaking', async ({ page }) => { //Click on UnStake Votes page.getByText(pageLocators.TokenUnstaking.Unstake).click(); - await page.waitForTimeout(10000); + await page.waitForTimeout(12000); // Verify PopUp text const validateText2 = await page.getByText(pageLocators.TokenUnstaking.verifyText); From 508ce9ffe9d83b8c57c58306005eb954dbb50a31 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Mon, 4 Sep 2023 21:35:53 +0530 Subject: [PATCH 12/13] WIP TC05 --- .github/workflows/Test.yml | 66 ++++++++++++++++++- package.json | 4 ++ tests/CommonFile/Locator.js | 4 +- tests/CommonFile/TestData.js | 3 +- ...pec.js => TC01-02_TokenWithValues.spec.js} | 0 .../TC05-02_ProposalExecutionandDrop.spec.js | 20 +++--- tests/TC06/TC06-03_TokenUnstaking.spec.js | 44 +++++++------ 7 files changed, 108 insertions(+), 33 deletions(-) rename tests/TC01/{TC01-02_TokenValues.spec.js => TC01-02_TokenWithValues.spec.js} (100%) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index f56a916..af2b3b2 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -52,14 +52,74 @@ jobs: - name: Install Playwright Browsers run: npx playwright install --with-deps - - name: Run Playwright tests + - name: TC01- Run Playwright tests run: npm run test:tc01 env: WEBAPP_URL: ${{ vars.WEBAPP_URL }} - - name: Deploy Report 🚀 + - name: Deploy Report for tc01🚀 uses: JamesIves/github-pages-deploy-action@v4 with: branch: gh-pages folder: playwright-report # The folder the action should deploy. - target-folder: tests/tc-01/ \ No newline at end of file + target-folder: tests/tc-01/ + + - name: TC02- Run Playwright tests + run: npm run test:tc02 + env: + WEBAPP_URL: ${{ vars.WEBAPP_URL }} + + - name: Deploy Report for tc02🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: playwright-report # The folder the action should deploy. + target-folder: tests/tc-02/ + + - name: TC03- Run Playwright tests + run: npm run test:tc03 + env: + WEBAPP_URL: ${{ vars.WEBAPP_URL }} + + - name: Deploy Report for tc03🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: playwright-report # The folder the action should deploy. + target-folder: tests/tc-03/ + + - name: TC04- Run Playwright tests + run: npm run test:tc04 + env: + WEBAPP_URL: ${{ vars.WEBAPP_URL }} + + - name: Deploy Report for tc04🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: playwright-report # The folder the action should deploy. + target-folder: tests/tc-04/ + + - name: TC05- Run Playwright tests + run: npm run test:tc05 + env: + WEBAPP_URL: ${{ vars.WEBAPP_URL }} + + - name: Deploy Report for tc05🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: playwright-report # The folder the action should deploy. + target-folder: tests/tc-05/ + + - name: TC06- Run Playwright tests + run: npm run test:tc06 + env: + WEBAPP_URL: ${{ vars.WEBAPP_URL }} + + - name: Deploy Report for tc06🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: playwright-report # The folder the action should deploy. + target-folder: tests/tc-06/ \ No newline at end of file diff --git a/package.json b/package.json index 6688cff..05d1c5f 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,10 @@ "test": "playwright test", "test:tc01": "playwright test tests/TC01", "test:tc02": "playwright test tests/TC02", + "test:tc03": "playwright test tests/TC03", + "test:tc04": "playwright test tests/TC04", + "test:tc05": "playwright test tests/TC05", + "test:tc06": "playwright test tests/TC06", "dev": "node --inspect-brk ./node_modules/@playwright/test/cli.js test TC04DAOValues.spec.js --project=chromium --headed" }, "keywords": [], diff --git a/tests/CommonFile/Locator.js b/tests/CommonFile/Locator.js index cdbd452..6ac1ab0 100644 --- a/tests/CommonFile/Locator.js +++ b/tests/CommonFile/Locator.js @@ -162,8 +162,8 @@ const pageLocators = { Passed: "Passed", DropProposal: "Drop Proposal", PercentageText: "p[class='MuiTypography-root jss1339 jss1340 MuiTypography-body1']", - DropExpired: "//span[text()='Drop Expired']", - Execute: "//span[text()='Execute']", + DropExpired: "Drop Expired", + Execute: "Execute", }, TokenDeposit: { diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index f7eecb9..31c32d4 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -17,6 +17,7 @@ const TezosTestData = { DAOCreation: { DAOName: "My Test DAO", TokenAddress: "KT1ND3pDj67PqfjvzqPUAvSRqmcqcHnqpiEQ", + TokenAddress2:"KT1BERTLG7JzpzWcT5UMVZFe4gC2cv9BhKMM", TokenID: "0", GuardianAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Description: "A DAO focused on funding and promoting open-source projects related to sustainability and renewable energy.", @@ -71,7 +72,7 @@ const TezosTestData = { RecipientAddress: "tz1LCFwczMiEuNHcMvpqgNzzEs8f4FNBgyNK", Asset: "TST", Amount: "05", - AgoraPostID: "05", + AgoraPostID: "5", }, diff --git a/tests/TC01/TC01-02_TokenValues.spec.js b/tests/TC01/TC01-02_TokenWithValues.spec.js similarity index 100% rename from tests/TC01/TC01-02_TokenValues.spec.js rename to tests/TC01/TC01-02_TokenWithValues.spec.js diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js index 8223634..81dae3d 100644 --- a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js +++ b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js @@ -15,19 +15,23 @@ test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { //Check if cycle status is CREATING const cyclestatus = await page.getByText(pageLocators.ProposalCreation.Cycle) - await expect(cyclestatus).toBeVisible(); + await expect(cyclestatus).not.toBeVisible(); - const passed = await page.getByText(pageLocators.ProposalExecutionandDrop.PassedExecutable); - - await passed.click(); + // To check if proposal is in Passed-Executable state + const passed = await page.getByText(pageLocators.ProposalExecutionandDrop.PassedExecutable).textContent(); + const isexecuteable = await expect(passed).toBe("Passed - Executable"); + console.log(isexecuteable); + await page.waitForTimeout(5000) // Click on the Passed - Executeable - if (await expect(passed).toBeVisible()) { + if (isexecuteable) { + + const execute = await page.getByText(pageLocators.ProposalExecutionandDrop.Execute); //Validate That Button is clickable or not - if (await page.waitForSelector(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { + if (await page.getByText(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { //Click on Execute Button - await page.click(pageLocators.ProposalExecutionandDrop.Execute); + await page.getByText(pageLocators.ProposalExecutionandDrop.Execute).click(); } } else { //Click on drop Expired Proposal @@ -36,7 +40,7 @@ test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { } catch (error) { - console.log("Error"); + console.log("Error:", error); } }) \ No newline at end of file diff --git a/tests/TC06/TC06-03_TokenUnstaking.spec.js b/tests/TC06/TC06-03_TokenUnstaking.spec.js index 5da5466..1a1d08f 100644 --- a/tests/TC06/TC06-03_TokenUnstaking.spec.js +++ b/tests/TC06/TC06-03_TokenUnstaking.spec.js @@ -4,33 +4,39 @@ const { pageLocators } = require("../CommonFile/Locator"); test('Test case 06-03: Successful Token UnStaking', async ({ page }) => { - //To Extend the time of test Execution - test.setTimeout(160000); + try { - // Selecting DAO for proposal creation - await PreProposal(page); + //To Extend the time of test Execution + test.setTimeout(160000); - await page.waitForTimeout(25000); + // Selecting DAO for proposal creation + await PreProposal(page); - // Click on Drop Expire - await page.getByText(pageLocators.TokenUnstaking.Drop).click(); + await page.waitForTimeout(10000); - await page.waitForTimeout(30000); + // Click on Drop Expire + await page.getByText(pageLocators.TokenUnstaking.Drop).click(); - // go to Users tab - await page.getByText(pageLocators.TokenUnstaking.User).click(); + await page.waitForTimeout(30000); - await page.waitForTimeout(5000); + // go to Users tab + await page.getByText(pageLocators.TokenUnstaking.User).click(); - //Click on UnStake Votes - page.getByText(pageLocators.TokenUnstaking.Unstake).click(); + await page.waitForTimeout(5000); - await page.waitForTimeout(12000); + //Click on UnStake Votes + page.getByText(pageLocators.TokenUnstaking.Unstake).click(); - // Verify PopUp text - const validateText2 = await page.getByText(pageLocators.TokenUnstaking.verifyText); - await expect(validateText2).toBeVisible(); + await page.waitForTimeout(12000); - console.log("The tokens are successfully Unstaked."); - + // Verify PopUp text + const validateText2 = await page.getByText(pageLocators.TokenUnstaking.verifyText); + await expect(validateText2).toBeVisible(); + + console.log("The tokens are successfully Unstaked."); + + } + catch (error) { + console.log("Error: ", error); + } }) \ No newline at end of file From 1a77492994a11b89397286d8a5233037e5f11046 Mon Sep 17 00:00:00 2001 From: w3aayushi Date: Tue, 5 Sep 2023 15:25:08 +0530 Subject: [PATCH 13/13] WIP TC05 --- tests/CommonFile/TestData.js | 2 +- .../TC05-02_ProposalExecutionandDrop.spec.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/CommonFile/TestData.js b/tests/CommonFile/TestData.js index 31c32d4..55873ae 100644 --- a/tests/CommonFile/TestData.js +++ b/tests/CommonFile/TestData.js @@ -83,7 +83,7 @@ const TezosTestData = { }, VotingOnChain: { - Amount: '5', + Amount: '25584', }, TokenDeposit: { diff --git a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js index 81dae3d..b8198ba 100644 --- a/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js +++ b/tests/TC05/TC05-02_ProposalExecutionandDrop.spec.js @@ -17,23 +17,29 @@ test('Test case 05-02: Proposal Execution & Drop', async ({ page }) => { await expect(cyclestatus).not.toBeVisible(); + await page.waitForTimeout(5000); + // To check if proposal is in Passed-Executable state - const passed = await page.getByText(pageLocators.ProposalExecutionandDrop.PassedExecutable).textContent(); - const isexecuteable = await expect(passed).toBe("Passed - Executable"); + const passed = await page.getByText(pageLocators.ProposalExecutionandDrop.PassedExecutable); + const isexecuteable = await expect(passed).toBeEnabled(); console.log(isexecuteable); await page.waitForTimeout(5000) // Click on the Passed - Executeable if (isexecuteable) { + console.log("pass1") - const execute = await page.getByText(pageLocators.ProposalExecutionandDrop.Execute); + const executeBtn = await page.getByText(pageLocators.ProposalExecutionandDrop.Execute); + const isclickable = await expect(executeBtn).toBeEnabled(); //Validate That Button is clickable or not - if (await page.getByText(pageLocators.ProposalExecutionandDrop.Execute, { click: true })) { + if (isclickable) { + console.log("pass2") //Click on Execute Button - await page.getByText(pageLocators.ProposalExecutionandDrop.Execute).click(); + await page.executeBtn.click(); } } else { + console.log("failll") //Click on drop Expired Proposal await page.getByText(pageLocators.ProposalExecutionandDrop.DropExpired).click(); }