Untitled

mail@pastecode.io avatar
unknown
java
a year ago
5.0 kB
2
Indexable
Never
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.driver.SmartWaitWebDriver
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import org.openqa.selenium.Cookie
import org.openqa.selenium.JavascriptExecutor
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.html5.LocalStorage
import org.openqa.selenium.html5.WebStorage


public class CustomFunction {

	@Keyword
	public void loginWithLocalStorage()
	//	def loginWithLocalStorage()
	{
		//		ChromeDriver driver = new ChromeDriver();
		//		driver.get("https://marketplace.dev.rndengineer.org");
		WebDriver driver = DriverFactory.getWebDriver();
		//		LocalStorage local = ((WebStorage) driver).getLocalStorage();
		//		local.setItem("walletconnect","{\"connected\":true,\"accounts\":[\"0x0c6af68b517a53898397a2ca3830bae27b41b4be\"],\"chainId\":41234,\"bridge\":\"https://api.dev.rndengineer.org/bridge\",\"key\":\"e5c65024e00dc987b02aa94b9bf751279e55ded457233b08c7f77bc12ffeab02\",\"clientId\":\"1fad31b2-0c74-4f88-9768-06f7740d9453\",\"clientMeta\":{\"description\":\"YoVerse Market\",\"url\":\"https://marketplace.dev.rndengineer.org\",\"icons\":[],\"name\":\"YoVerse Market\"},\"peerId\":\"e3f066c6-0c28-45c1-90ef-0b74a11c8acf\",\"peerMeta\":{\"description\":\"YoVerse.dev\",\"url\":\"https://wallet.dev.rndengineer.org/\",\"icons\":[\"https://walletconnect.org/walletconnect-logo.png\"],\"name\":\"YoVerse.dev\"},\"handshakeId\":1666583616695669,\"handshakeTopic\":\"9f440333-dc5d-40cb-a86a-25c64b848714\"}");
		JavascriptExecutor js = (JavascriptExecutor) driver;
		js.executeScript("window.localStorage.setItem(arguments[0],arguments[1])","walletconnect","{\"connected\":true,\"accounts\":[\"0x0c6af68b517a53898397a2ca3830bae27b41b4be\"],\"chainId\":41234,\"bridge\":\"https://api.dev.rndengineer.org/bridge\",\"key\":\"e5c65024e00dc987b02aa94b9bf751279e55ded457233b08c7f77bc12ffeab02\",\"clientId\":\"1fad31b2-0c74-4f88-9768-06f7740d9453\",\"clientMeta\":{\"description\":\"YoVerse Market\",\"url\":\"https://marketplace.dev.rndengineer.org\",\"icons\":[],\"name\":\"YoVerse Market\"},\"peerId\":\"e3f066c6-0c28-45c1-90ef-0b74a11c8acf\",\"peerMeta\":{\"description\":\"YoVerse.dev\",\"url\":\"https://wallet.dev.rndengineer.org/\",\"icons\":[\"https://walletconnect.org/walletconnect-logo.png\"],\"name\":\"YoVerse.dev\"},\"handshakeId\":1666583616695669,\"handshakeTopic\":\"9f440333-dc5d-40cb-a86a-25c64b848714\"}");
		//		local.setItem("walletconnect","{\"connected\":true,\"accounts\":[\"0x0c6af68b517a53898397a2ca3830bae27b41b4be\"],\"chainId\":41234,\"bridge\":\"https://api.dev.rndengineer.org/bridge\",\"key\":\"e5c65024e00dc987b02aa94b9bf751279e55ded457233b08c7f77bc12ffeab02\",\"clientId\":\"1fad31b2-0c74-4f88-9768-06f7740d9453\",\"clientMeta\":{\"description\":\"YoVerse Market\",\"url\":\"https://marketplace.dev.rndengineer.org\",\"icons\":[],\"name\":\"YoVerse Market\"},\"peerId\":\"e3f066c6-0c28-45c1-90ef-0b74a11c8acf\",\"peerMeta\":{\"description\":\"YoVerse.dev\",\"url\":\"https://wallet.dev.rndengineer.org/\",\"icons\":[\"https://walletconnect.org/walletconnect-logo.png\"],\"name\":\"YoVerse.dev\"},\"handshakeId\":1666583616695669,\"handshakeTopic\":\"9f440333-dc5d-40cb-a86a-25c64b848714\"}");
		Cookie cookie1 = new Cookie( "yoversemarket","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3YWxsZXRBZGRyZXNzIjoiMHgwQzZBRjY4YjUxN2E1Mzg5ODM5N0EyY0EzODMwQmFlMjdiNDFCNGJlIiwiZXhwIjoxNjY2ODQyODI0fQ.t0NmkReOsdsBcZXv-NFVAlxAuTmaY5o69QDpEaOIb0g" );
		Cookie cookie2 = new Cookie( "rf_yoversemarket","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3YWxsZXRBZGRyZXNzIjoiMHgwQzZBRjY4YjUxN2E1Mzg5ODM5N0EyY0EzODMwQmFlMjdiNDFCNGJlIiwiZXhwIjoxNjY3ODc5NjI0fQ.89Nq8Q8yV6_Nfn03DHK4UU6hJD2AOJfBB8KF-EE6gps" );
		driver.manage().addCookie( cookie1 );
		driver.manage().addCookie( cookie2 );
		driver.navigate().refresh();
		//		driver.get("https://marketplace.dev.rndengineer.org");
	}
}