davidjgoss on exceptions-in-messages
chore: delete old lock.yml chore: delete old stale.yml Merge branch 'main' into except… (compare)
davidjgoss on exceptions-in-messages
use new exception object for fa… refactor junit formatter a bit (compare)
davidjgoss on exceptions-in-messages
upgrade cck prefactoring, omit undefined me… handle well-structured errors and 3 more (compare)
davidjgoss on main
chore: delete old stale.yml (compare)
davidjgoss on main
chore: delete old lock.yml (compare)
renovate[bot] on cucumber-packages
chore(deps): update dependency … (compare)
davidjgoss on main
chore(deps): update cucumber pa… (compare)
davidjgoss on cucumber-packages
const { Given, When, Then } = require('cucumber');
const app = require('../../lib/app');
const request = require('supertest');
Given('server is running', function() {
console.log('assume server is running');
});
When(
'user posts to upload endpoint',
{ timeout: 1 * 60 * 1000 },
async function() {
await request(app)
.post('/uploads')
.set('Accept', 'application/json')
.attach('photo', 'test/testimage.jpg')
.expect(200);
}
);
Then('image is downloadable', async function() {
await request(app)
.get('/uploads/testimage.jpg')
.set('Accept', 'application/json')
.expect(200);
});
app
is an expressjs instance
const condition = until.elementLocated(by.css('html'))
await driver.wait(async driver => condition.fn(driver), 10000, 'Loading failed.')
// await driver.wait(until.elementIsVisible(outwardTravelDate), 10000);
// let actualResult = await outwardTravelDate.getText();
// assert.equal(actualResult, expectedText);
When I use a skipped return function
The next function also gets skipped status as I add a skipped just on the desired function without affecting the next function?
Then ('', () => 'skipped')
Then ('', () => 'expect')
this function does not perform 'expect' instead returns 'skipped' too
Then('it should click on more-vertical button', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
hi,
I’m getting an error 'Unexpected identifier’ with "import printWord from '../support/action/printWord’;” …
Given.js
const { Given } = require('cucumber’);
import printWord from '../support/action/printWord’;
Given(/^I print the (\S+) word$/, printWord);
printWord.js
export default word => {
console.log('============' + word);
};
Can any one help me ???
Hello guys, Im new to Cucumber (and automation in general). I have the following online calculator https://www.online-calculator.com/full-screen-calculator/ which uses html5-canvas... I wrote the below code
`package stepDefinitions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import org.junit.Assert;
public class subtractionStepDefinition {
WebDriver driver;
@Given("^user is already on the full screen calculator Page$")
public void user_is_already_on_the_full_screen_calculator_Page() {
System.setProperty("webdriver.gecko.driver", "//Users//gmoussayan//Documents//Selenium//geckodriver");
driver = new FirefoxDriver();
driver.get("https://www.online-calculator.com/full-screen-calculator/");
}
@When("^title of page is Full Screen Calculator - Online Calculator$")
public void title_of_page_is_Full_Screen_Calculator_Online_Calculator() {
String title = driver.getTitle();
System.out.println(title);
Assert.assertEquals("Full Screen Calculator - Online Calculator", title);
}
@Then("^user maximize the browser$")
public void user_maximize_the_browser() {
driver.manage().window().maximize();
}
@Then("^user clicks on number six$")
public void user_clicks_on_number_six() {
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
new Actions(driver).moveToElement(canvas, 20, 50).click().perform(); //6
}
@Then("^user clicks on number three$")
public void user_clicks_on_number_three() {
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
new Actions(driver).moveToElement(canvas, 20, 100).click().perform(); //3
}
@Then("^user clicks on the subtraction sign$")
public void user_clicks_on_the_subtraction_sign() {
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
new Actions(driver).moveToElement(canvas, 100, 100).click().perform(); // This is the Subtraction operation
}
@Then("^user clicks on the equal sign$")
public void user_clicks_on_the_equal_sign() {
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
new Actions(driver).moveToElement(canvas, 150, 200).click().perform(); //This is the equal (=) operation
}
}`
but im receiving the error Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: #fullframe
This is happening because im using the below code under (as you see) all Gherkin keywords...
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
So im wondering how can i set new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("fullframe")));
WebElement canvas = new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("canvas")));
to be readable by all Gherkin keywords without having to repeat it under each Gherkin keyword (which resulting on having it failing) - Im using Cucumber, Java and Selenium
this
in the After hook. I verified that I'm not using arrow function. I don't have any error until my program actually gets to the specific line and print "this.attach is not a function" can someone help me ?