Best Galen code snippet using com.galenframework.suite.actions.GalenPageActionMutate.MutationOptions
Source:GalenPageActionReader.java
...21import java.util.Map;22import com.galenframework.specs.Place;23import com.galenframework.specs.page.Locator;24import com.galenframework.suite.actions.*;25import com.galenframework.suite.actions.mutation.MutationOptions;26import com.galenframework.utils.GalenUtils;27import com.galenframework.suite.GalenPageAction;28import com.galenframework.suite.actions.GalenPageActionWait.UntilType;29import org.apache.commons.cli.CommandLine;30import org.apache.commons.cli.Options;31import org.apache.commons.cli.PosixParser;32import org.apache.commons.lang3.tuple.Pair;33public class GalenPageActionReader {34 public static GalenPageAction readFrom(String actionText, Place place) {35 String[] args = CommandLineParser.parseCommandLine(actionText);36 37 if (args.length < 2) {38 throw new SyntaxException(place, "Cannot parse: " + actionText);39 }40 41 if (args[0].equals("inject")) {42 return injectActionFrom(args);43 }44 else if (args[0].equals("run")) {45 return runActionFrom(args);46 }47 else if (args[0].equals("check")) {48 return checkActionFrom(args, actionText);49 }50 else if (args[0].equals("cookie")) {51 return cookieActionFrom(args);52 }53 else if (args[0].equals("open")) {54 return openActionFrom(args);55 }56 else if (args[0].equals("resize")) {57 return resizeActionFrom(args);58 }59 else if (args[0].equals("wait")) {60 return waitActionFrom(args);61 }62 else if (args[0].equals("properties")) {63 return propertiesActionFrom(args);64 }65 else if (args[0].equals("dump")) {66 return dumpPageActionFrom(args, actionText);67 }68 else if (args[0].equals("mutate")) {69 return mutatePageActionFrom(args, actionText);70 }71 else throw new SyntaxException(place, "Unknown action: " + args[0]);72 }73 private static GalenPageAction resizeActionFrom(String[] args) {74 Dimension size = GalenUtils.readSize(args[1]);75 return new GalenPageActionResize(size.width, size.height);76 }77 78 79 private static GalenPageAction propertiesActionFrom(String[] args) {80 List<String> files = new LinkedList<>();81 for (int i = 1; i < args.length; i++) {82 files.add(args[i]);83 }84 return new GalenPageActionProperties().withFiles(files);85 }86 private static GalenPageAction openActionFrom(String[] args) {87 return new GalenPageActionOpen(args[1]);88 }89 private static GalenPageAction cookieActionFrom(String[] args) {90 GalenPageActionCookie action = new GalenPageActionCookie();91 List<String> cookies = new LinkedList<>();92 for(int i = 1; i<args.length; i++) {93 cookies.add(args[i]);94 }95 action.setCookies(cookies);96 return action;97 }98 private static GalenPageAction checkActionFrom(String[] args, String originalText) {99 CommandLineReader reader = new CommandLineReader(args);100 String specPath = null;101 List<String> includedTags = new LinkedList<>();102 List<String> excludedTags = new LinkedList<>();103 String sectionNameFilter = null;104 Map<String, Object> jsVariables = new HashMap<>();105 //Skipping the check action name106 reader.skipArgument();107 while (reader.hasNext()) {108 if (!reader.isNextArgument()) {109 specPath = reader.readNext();110 } else {111 Pair<String, String> argument = reader.readArgument();112 if (argument.getKey().equals("include")) {113 includedTags.addAll(readTags(argument.getValue()));114 } else if (argument.getKey().equals("exclude")) {115 excludedTags.addAll(readTags(argument.getValue()));116 } else if (argument.getKey().startsWith("V")) {117 String varName = argument.getKey().substring(1);118 String varValue = argument.getValue();119 jsVariables.put(varName, varValue);120 } else if (argument.getKey().equals("section")) {121 sectionNameFilter = argument.getValue();122 } else {123 throw new SyntaxException("Unknown argument: " + argument.getKey());124 }125 }126 }127 if (specPath == null || specPath.isEmpty()) {128 throw new SyntaxException("Missing spec path");129 }130 return new GalenPageActionCheck()131 .withSpec(specPath)132 .withIncludedTags(includedTags)133 .withExcludedTags(excludedTags)134 .withSectionNameFilter(sectionNameFilter)135 .withJsVariables(jsVariables);136 }137 private static GalenPageAction mutatePageActionFrom(String[] args, String originalText) {138 CommandLineReader reader = new CommandLineReader(args);139 String specPath = null;140 List<String> includedTags = new LinkedList<>();141 List<String> excludedTags = new LinkedList<>();142 String sectionNameFilter = null;143 int offset = 5;144 //Skipping the check action name145 reader.skipArgument();146 while (reader.hasNext()) {147 if (!reader.isNextArgument()) {148 specPath = reader.readNext();149 } else {150 Pair<String, String> argument = reader.readArgument();151 if (argument.getKey().equals("include")) {152 includedTags.addAll(readTags(argument.getValue()));153 } else if (argument.getKey().equals("exclude")) {154 excludedTags.addAll(readTags(argument.getValue()));155 } else if (argument.getKey().equals("offset")) {156 offset = Integer.parseInt(argument.getValue());157 } else {158 throw new SyntaxException("Unknown argument: " + argument.getKey());159 }160 }161 }162 if (specPath == null || specPath.isEmpty()) {163 throw new SyntaxException("Missing spec path");164 }165 return new GalenPageActionMutate()166 .withSpec(specPath)167 .withIncludedTags(includedTags)168 .withExcludedTags(excludedTags)169 .withMutationOptions(new MutationOptions().setPositionOffset(offset))170 .withOriginalCommand(originalText);171 }172 private static GalenPageAction dumpPageActionFrom(String[] args, String originalText) {173 Options options = new Options();174 options.addOption("n", "name", true, "Page name");175 options.addOption("e", "export", true, "Export dir");176 options.addOption("w", "max-width", true, "Maximal width of elements in croppped screenshots");177 options.addOption("h", "max-height", true, "Maximal height of elements in cropped screenshots");178 options.addOption("i", "only-images", false, "Flag for exporting only images without html and json files");179 org.apache.commons.cli.CommandLineParser parser = new PosixParser();180 try {181 CommandLine cmd = parser.parse(options, args);182 String[] leftoverArgs = cmd.getArgs();183 if (leftoverArgs == null || leftoverArgs.length < 2) {...
Source:GalenPageActionReaderTest.java
...25import com.galenframework.parser.GalenPageActionReader;26import com.galenframework.specs.page.Locator;27import com.galenframework.suite.GalenPageAction;28import com.galenframework.suite.actions.GalenPageActionWait.UntilType;29import com.galenframework.suite.actions.mutation.MutationOptions;30import org.testng.annotations.DataProvider;31import org.testng.annotations.Test;32import java.util.Collections;33import java.util.HashMap;34import java.util.List;35import java.util.Map;36public class GalenPageActionReaderTest {37 private static final List<String> EMPTY_TAGS = emptyList();38 private static final Map<String, Object> EMPTY_VARIABLES = Collections.emptyMap();39 @Test(dataProvider="provideGoodSamples") public void shouldParse_action_successfully(String actionText, GalenPageAction expectedAction) {40 GalenPageAction realAction = GalenPageActionReader.readFrom(actionText, null);41 assertThat(realAction, is(expectedAction));42 }43 @DataProvider public Object[][] provideGoodSamples() {44 return new Object[][]{45 {"inject javascript.js", new GalenPageActionInjectJavascript("javascript.js")},46 {"inject /usr/bin/john/scripts/javascript.js", new GalenPageActionInjectJavascript("/usr/bin/john/scripts/javascript.js")},47 {"inject \"/usr/bin/john/scripts/javascript.js\"", new GalenPageActionInjectJavascript("/usr/bin/john/scripts/javascript.js")},48 {"run script.js \"{name: 'john'}\"", new GalenPageActionRunJavascript("script.js").withJsonArguments("{name: 'john'}")},49 {"run script.js \"\"", new GalenPageActionRunJavascript("script.js").withJsonArguments("")},50 {"run script.js \"\\\"john\\\"", new GalenPageActionRunJavascript("script.js").withJsonArguments("\"john\"")},51 {"run script.js", new GalenPageActionRunJavascript("script.js").withJsonArguments(null)},52 {"check page1.spec", new GalenPageActionCheck()53 .withSpec("page1.spec")54 .withIncludedTags(EMPTY_TAGS)55 .withExcludedTags(EMPTY_TAGS)56 .withJsVariables(EMPTY_VARIABLES)},57 {"check page1.spec --include mobile --exclude debug", new GalenPageActionCheck()58 .withSpec("page1.spec")59 .withIncludedTags(asList("mobile"))60 .withExcludedTags(asList("debug"))61 .withJsVariables(EMPTY_VARIABLES)},62 {"check page1.spec --include mobile,tablet --exclude nomobile,debug", new GalenPageActionCheck()63 .withSpec("page1.spec")64 .withIncludedTags(asList("mobile", "tablet"))65 .withExcludedTags(asList("nomobile", "debug"))66 .withJsVariables(EMPTY_VARIABLES)},67 {"check page1.spec --section \"Some section * filter\"", new GalenPageActionCheck()68 .withSpec("page1.spec")69 .withIncludedTags(EMPTY_TAGS)70 .withExcludedTags(EMPTY_TAGS)71 .withSectionNameFilter("Some section * filter")72 .withJsVariables(EMPTY_VARIABLES)},73 {"check page1.spec --VuserName John", new GalenPageActionCheck()74 .withSpec("page1.spec")75 .withIncludedTags(EMPTY_TAGS)76 .withExcludedTags(EMPTY_TAGS)77 .withJsVariables(new HashMap<String, Object>(){{78 put("userName", "John");79 }})80 },81 {"cookie \"somecookie1\" \"somecookie2\" \"somecookie3\"", new GalenPageActionCookie().withCookies("somecookie1", "somecookie2", "somecookie3")},82 {"cookie \"somecookie1\"", new GalenPageActionCookie().withCookies("somecookie1")},83 {"wait 10s", new GalenPageActionWait().withTimeout(10000)},84 {"wait 2m", new GalenPageActionWait().withTimeout(120000)},85 {"wait 10s until visible \"css: div.list\" \"xpath: //div[@id='qwe']\"", new GalenPageActionWait()86 .withTimeout(10000)87 .withUntilElements(asList(visible(css("div.list")), visible(xpath("//div[@id='qwe']"))))},88 {"wait 10s until hidden \"css: div.list\" \"xpath: //div[@id='qwe']\"", new GalenPageActionWait()89 .withTimeout(10000)90 .withUntilElements(asList(hidden(css("div.list")), hidden(xpath("//div[@id='qwe']"))))},91 {"wait 10s until gone \"id: login\" \"xpath: //div[@id='qwe']\"", new GalenPageActionWait()92 .withTimeout(10000)93 .withUntilElements(asList(gone(id("login")), gone(xpath("//div[@id='qwe']"))))},94 {"wait 10s until exist \"id: login\" gone \"xpath: //div[@id='qwe']\"", new GalenPageActionWait()95 .withTimeout(10000)96 .withUntilElements(asList(exist(id("login")), gone(xpath("//div[@id='qwe']"))))},97 {"properties \"some-path-1/file.properties\" file2.properties", new GalenPageActionProperties()98 .withFiles(asList("some-path-1/file.properties", "file2.properties"))99 },100 {"dump page1.spec --name \"Home page dump\" --export /export/dir/path", new GalenPageActionDumpPage()101 .withSpecPath("page1.spec").withPageName("Home page dump").withPageDumpPath("/export/dir/path")102 },103 {"dump page1.spec --name \"Home page dump\" --export /export/dir/path --max-width 120 --max-height 240", new GalenPageActionDumpPage()104 .withSpecPath("page1.spec").withPageName("Home page dump").withPageDumpPath("/export/dir/path").withMaxWidth(120).withMaxHeight(240).withOnlyImages(false)105 },106 {"dump page1.spec --name \"Home page dump\" --export /export/dir/path --only-images --max-width 120 --max-height 240", new GalenPageActionDumpPage()107 .withSpecPath("page1.spec").withPageName("Home page dump").withPageDumpPath("/export/dir/path").withMaxWidth(120).withMaxHeight(240).withOnlyImages(true)108 },109 {"mutate page1.gspec", new GalenPageActionMutate().withSpec("page1.gspec").withIncludedTags(emptyList()).withExcludedTags(emptyList()).withMutationOptions(new MutationOptions().setPositionOffset(5))110 },111 {"mutate page1.gspec --include mobile --exclude desktop --offset 13", new GalenPageActionMutate()112 .withSpec("page1.gspec")113 .withIncludedTags(asList("mobile"))114 .withExcludedTags(asList("desktop"))115 .withMutationOptions(new MutationOptions().setPositionOffset(13))116 }117 };118 }119 120 private static GalenPageActionWait.Until visible(Locator locator) {121 return new GalenPageActionWait.Until(UntilType.VISIBLE, locator);122 }123 124 private static GalenPageActionWait.Until hidden(Locator locator) {125 return new GalenPageActionWait.Until(UntilType.HIDDEN, locator);126 }127 128 private static GalenPageActionWait.Until exist(Locator locator) {129 return new GalenPageActionWait.Until(UntilType.EXIST, locator);...
Source:GalenPageActionMutate.java
...18import com.galenframework.browser.Browser;19import com.galenframework.reports.TestReport;20import com.galenframework.suite.GalenPageAction;21import com.galenframework.suite.GalenPageTest;22import com.galenframework.suite.actions.mutation.MutationOptions;23import com.galenframework.suite.actions.mutation.MutationReport;24import com.galenframework.utils.GalenUtils;25import com.galenframework.validation.ValidationListener;26import java.util.*;27public class GalenPageActionMutate extends GalenPageAction {28 private String specPath;29 private List<String> includedTags;30 private List<String> excludedTags;31 private MutationOptions mutationOptions = new MutationOptions();32 @Override33 public void execute(TestReport report, Browser browser, GalenPageTest pageTest, ValidationListener validationListener) throws Exception {34 MutationReport mutationReport = GalenMutate.checkAllMutations(browser, specPath, includedTags, excludedTags, mutationOptions, getCurrentProperties(), validationListener);35 if (mutationReport.getInitialLayoutReport() != null) {36 GalenUtils.attachLayoutReport(mutationReport.getInitialLayoutReport(), report, specPath, includedTags);37 }38 GalenUtils.attachMutationReport(mutationReport, report, specPath, includedTags);39 }40 public GalenPageActionMutate withSpec(String specPath) {41 this.specPath = specPath;42 return this;43 }44 public GalenPageActionMutate withIncludedTags(List<String> includedTags) {45 this.includedTags = includedTags;46 return this;47 }48 public GalenPageActionMutate withExcludedTags(List<String> excludedTags) {49 this.excludedTags = excludedTags;50 return this;51 }52 public GalenPageActionMutate withOriginalCommand(String originalCommand) {53 setOriginalCommand(originalCommand);54 return this;55 }56 public GalenPageActionMutate withMutationOptions(MutationOptions mutationOptions) {57 this.mutationOptions = mutationOptions;58 return this;59 }60 public List<String> getIncludedTags() {61 return includedTags;62 }63 public List<String> getExcludedTags() {64 return excludedTags;65 }66 @Override67 public boolean equals(Object o) {68 if (this == o) return true;69 if (o == null || getClass() != o.getClass()) return false;70 GalenPageActionMutate that = (GalenPageActionMutate) o;...
MutationOptions
Using AI Code Generation
1import com.galenframework.api.Galen;2import com.galenframework.reports.GalenTestInfo;3import com.galenframework.reports.model.LayoutReport;4import com.galenframework.reports.model.LayoutReportError;5import com.galenframework.reports.model.LayoutReportErrorList;6import com.galenframework.reports.model.LayoutReportErrorText;7import com.galenframework.suite.actions.GalenPageActionMutate;8import com.galenframework.browser.Browser;9import com.galenframework.browser.SeleniumBrowser;10import com.galenframework.browser.SeleniumBrowserFactory;11import com.galenframework.browser.SeleniumBrowserFactory.SeleniumBrowserType;12import com.galenframework.browser.SeleniumBrowserFactory.SeleniumDriverType;13import com.galenframework.browser.SeleniumBrowserFactory.SeleniumGridType;14import com.galenframework.browser.SeleniumBrowserFactory.SeleniumRemoteType;15import com.galenframework.browser.SeleniumBrowserFactory.SeleniumVersion;16import com.galenframework.browser.SeleniumBrowserFactory.SeleniumWebdriverType;17import com.galenframework.browser.SeleniumBrowserFactory.SeleniumWebdriverVersion;18import com.galenframework.browser.SeleniumBrowserFactory.SeleniumWebdriverVersionType;19import com.galenframework.browser.SeleniumBrowserFactory.SeleniumWebdriverVersionType.SeleniumWebdriverVersionTypeType;20import com.galenframework.browser.SeleniumBrowserFactory.SeleniumWebdriverVersionType.SeleniumWebdriverVersionTypeType.SeleniumWebdriverVersionTypeTypeType;21import com.galenframework.reports.GalenTestInfo;22import com.galenframework.reports.HtmlReportBuilder;23import com.galenframework.reports.TestReport;24import com.galenframework.reports.TestReportPage;25import com.galenframework.reports.nodes.TestReportNode;26import com.galenframework.reports.nodes.TestReportPageNode;27import com.galenframework.reports.nodes.TestReportSectionNode;28import com.galenframework.suite.actions.GalenPageAction;29import com.galenframework.suite.actions.GalenPageActionCheck;30import com.galenframework.suite.actions.GalenPageActionMutate;31import com.galenframework.suite.actions.GalenPageActionMutate.MutationOptions;32import com.galenframework.suite.actions.GalenPageActionMutate.MutationType;33import com.galenframework.suite.actions.GalenPageActionMutate.MutationValue;34import com.galenframework.suite.actions.GalenPageActionMutate.MutationValue.MutationValueType;35import com.galenframework.suite.actions.GalenPageActionMutate.MutationValue.MutationValueType.MutationValueTypeType;36import com.galenframework
MutationOptions
Using AI Code Generation
1import com.galenframework.reports.TestReport;2import com.galenframework.reports.model.LayoutReport;3import com.galenframework.suite.actions.GalenPageActionMutate;4import com.galenframework.suite.actions.GalenPageActionTest;5import com.galenframework.suite.actions.GalenPageActionTest;6import com.galenframework.tests.GalenBasicTest;7import com.galenframework.tests.GalenTest;8import com.galenframework.validation.ValidationError;9import com.galenframework.validation.ValidationObject;10import com.galenframework.validation.ValidationResult;11import com.galenframework.validation.Validator;12import com.galenframework.validation.ValidatorCheck;13import com.galenframework.validation.ValidatorFactory;14import com.galenframework.validation.ValidationError;15import com.galenframework.validation.ValidationObject;16import com.galenframework.validation.ValidationResult;17import com.galenframework.validation.Validator;18import com.galenframework.validation.ValidatorCheck;19import com.galenframework.validation.ValidatorFactory;20import com.galenframework.validation.ValidationError;21import com.galenframework.validation.ValidationObject;22import com.galenframework.validation.ValidationResult;23import com.galenframework.validation.Validator;24import com.galenframework.validation.ValidatorCheck;25import com.galenframework.validation.ValidatorFactory;26import com.galenframework.validation.ValidationError;27import com.galenframework.validation.ValidationObject;28import com.galenframework.validation.ValidationResult;29import com.galenframework.validation.Validator;30import com.galenframework.validation.ValidatorCheck;31import com.galenframework.validation.ValidatorFactory;32import com.galenframework.validation.ValidationError;33import com.galenframework.validation.ValidationObject;34import com.galenframework.validation.ValidationResult;35import com.galenframework.validation.Validator;36import com.galenframework.validation.ValidatorCheck;37import com.galenframework.validation.ValidatorFactory;38import com.galenframework.validation.ValidationError;39import com.galenframework.validation.ValidationObject;40import com.galenframework.validation.ValidationResult;41import com.galenframework.validation.Validator;42import com.galenframework.validation.ValidatorCheck;43import com.galenframework.validation.ValidatorFactory;44import com.galenframework.validation.ValidationError;45import com.galenframework.validation.ValidationObject;46import com.galenframework.validation.ValidationResult;47import com.galenframework.validation.Validator;48import com.galenframework.validation.ValidatorCheck;49import com.galenframework.validation.ValidatorFactory;50import com.galenframework.validation.ValidationError;51import com.galenframework.validation.ValidationObject;52import com.galenframework.validation.ValidationResult;53import com
MutationOptions
Using AI Code Generation
1package com.galenframework.suite.actions;2import com.galenframework.actions.GalenPageAction;3import com.galenframework.page.PageElement;4import com.galenframework.page.Rect;5import com.galenframework.page.RectSize;6import com.galenframework.page.selenium.SeleniumPage;7import com.galenframework.reports.model.LayoutReport;8import com.galenframework.reports.model.LayoutReportBuilder;9import com.galenframework.reports.model.LayoutSection;10import com.galenframework.reports.model.LayoutSectionObject;11import com.galenframework.specs.Spec;12import com.galenframework.specs.page.PageSection;13import com.galenframework.specs.page.PageSectionFilter;14import com.galenframework.specs.page.PageSectionFilterType;15import com.galenframework.specs.page.PageSectionSize;16import com.galenframework.specs.page.PageSectionType;17import com.galenframework.specs.page.Rectangular;18import com.galenframework.suite.GalenPageTest;19import com.galenframework.suite.actions.GalenPageActionMutate;20import com.galenframework.validation.ValidationObject;21import com.galenframework.validation.ValidationResult;22import com.galenframework.validation.ValidationResultListener;23import com.galenframework.validation.ValidationResultListenerFactory;24import com.galenframework.validation.ValidationResultListenerFactory.ValidationResultListenerType;
MutationOptions
Using AI Code Generation
1package com.galenframework.suite.actions;2import com.galenframework.api.Galen;3import com.galenframework.browser.Browser;4import com.galenframework.browser.BrowserFactory;5import com.galenframework.browser.SeleniumBrowser;6import com.galenframework.reports.model.LayoutReport;7import com.galenframework.reports.model.LayoutReportError;8import com.galenframework.reports.model.LayoutReportErrorList;9import com.galenframework.reports.model.LayoutReportErrorText;10import com.galenframework.reports.model.LayoutReportErrorTextList;11import com.galenframework.reports.model.LayoutReportErrorTextListText;12import com.galenframework.reports.model.LayoutReportErrorTextListTextList;13import com.galenframework.reports.model.LayoutReportErrorTextListTextListText;14import com.galenframework.reports.model.LayoutReportErrorTextListTextText;15import com.galenframework.reports.model.LayoutReportErrorTextText;16import com.galenframework.reports.model.LayoutReportErrorTextTextList;17import com.galenframework.reports.model.LayoutReportErrorTextTextListList;18import com.galenframework.reports.model.LayoutReportErrorTextTextListListList;19import com.galenframework.reports.model.LayoutReportErrorTextTextListListListText;20import com.galenframework.reports.model.LayoutReportErrorTextTextText;21import com.galenframework.reports.model.LayoutReportErrorTextTextTextList;22import com.galenframework.reports.model.LayoutReportErrorTextTextTextListList;23import com.galenframework.reports.model.LayoutReportErrorTextTextTextListListList;24import com.galenframework.reports.model.LayoutReportErrorTextTextTextListListListText;25import com.galenframework.reports.model.LayoutReportErrorTextTextTextText;26import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextList;27import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListList;28import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListListList;29import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListListListList;30import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListListListListList;31import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListListListListListList;32import com.galenframework.reports.model.LayoutReportErrorTextTextTextTextListListListListListList
MutationOptions
Using AI Code Generation
1package com.galenframework.java.sample.tests;2import com.galenframework.java.sample.components.GalenTestBase;3import com.galenframework.reports.GalenTestInfo;4import com.galenframework.suite.actions.GalenPageActionMutate;5import com.galenframework.suite.actions.GalenPageActionMutate.MutationOptions;6import org.openqa.selenium.By;7import org.openqa.selenium.WebDriver;8import org.testng.annotations.Test;9import java.util.LinkedList;10import java.util.List;11import static java.util.Arrays.asList;12import static org.openqa.selenium.By.cssSelector;13public class MutateTest extends GalenTestBase {14 @Test(dataProvider = "devices")15 public void mutateTest(MutationOptions mutationOptions, WebDriver driver) throws Exception {16 List<GalenTestInfo> tests = new LinkedList<>();17 tests.add(new GalenTestInfo("mutateTest", getDriver().findElement(cssSelector("body")).getSize()));18 checkLayout(driver, "specs/mutateTest.spec", tests, asList("desktop"));19 }20 private void load(WebDriver driver, String url, MutationOptions mutationOptions) {21 driver.get(url);22 GalenPageActionMutate.mutate(driver, cssSelector("input"), mutationOptions);23 }24}25package com.galenframework.java.sample.tests;26import com.galenframework.java.sample.components.GalenTestBase;27import com.galenframework.reports.GalenTestInfo;28import com.galenframework.suite.actions.GalenPageActionMutate;29import com.galenframework.suite.actions.GalenPageActionMutate.MutationOptions;30import org.openqa.selenium.By;31import org.openqa.selenium.WebDriver;32import org.testng.annotations.Test;33import java.util.LinkedList;34import java.util.List;35import static java.util.Arrays.asList;36import static org.openqa.selenium.By.cssSelector;37public class MutateTest extends GalenTestBase {38 @Test(dataProvider = "devices")39 public void mutateTest(MutationOptions mutationOptions, WebDriver driver) throws Exception {40 List<GalenTestInfo> tests = new LinkedList<>();41 tests.add(new GalenTestInfo("
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!