mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
test(tabs): add e2e tests for basic scenario with pages, and vanilla scenario with divs
This commit is contained in:
@ -15,5 +15,40 @@ platforms.forEach(platform => {
|
|||||||
const page = new E2ETestPage(driver, platform);
|
const page = new E2ETestPage(driver, platform);
|
||||||
return page.navigate();
|
return page.navigate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
register('should check each tab', async (driver, testContext) => {
|
||||||
|
testContext.timeout(60000);
|
||||||
|
const page = new E2ETestPage(driver, platform);
|
||||||
|
|
||||||
|
await waitForTransition(300);
|
||||||
|
|
||||||
|
const tabTwoButton = await waitAndGetElementById(driver, 'tab-t-0-1');
|
||||||
|
tabTwoButton.click();
|
||||||
|
await waitForTransition(600);
|
||||||
|
|
||||||
|
const tabThreeButton = await waitAndGetElementById(driver, 'tab-t-0-2');
|
||||||
|
tabThreeButton.click();
|
||||||
|
await waitForTransition(600);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function waitAndGetElement(driver, selector) {
|
||||||
|
driver.wait(until.elementLocated(By.css(selector)));
|
||||||
|
const element = driver.findElement(By.css(selector));
|
||||||
|
await driver.wait(until.elementIsVisible(driver.findElement(By.css(selector))));
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function waitAndGetElementById(driver, selector) {
|
||||||
|
driver.wait(until.elementLocated(By.id(selector)));
|
||||||
|
const element = driver.findElement(By.id(selector));
|
||||||
|
await driver.wait(until.elementIsVisible(driver.findElement(By.id(selector))));
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
function waitForTransition(duration) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, duration);
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -15,5 +15,40 @@ platforms.forEach(platform => {
|
|||||||
const page = new E2ETestPage(driver, platform);
|
const page = new E2ETestPage(driver, platform);
|
||||||
return page.navigate();
|
return page.navigate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
register('should check each tab', async (driver, testContext) => {
|
||||||
|
testContext.timeout(60000);
|
||||||
|
const page = new E2ETestPage(driver, platform);
|
||||||
|
|
||||||
|
await waitForTransition(300);
|
||||||
|
|
||||||
|
const tabTwoButton = await waitAndGetElementById(driver, 'tab-t-0-1');
|
||||||
|
tabTwoButton.click();
|
||||||
|
await waitForTransition(600);
|
||||||
|
|
||||||
|
const tabThreeButton = await waitAndGetElementById(driver, 'tab-t-0-2');
|
||||||
|
tabThreeButton.click();
|
||||||
|
await waitForTransition(600);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function waitAndGetElement(driver, selector) {
|
||||||
|
driver.wait(until.elementLocated(By.css(selector)));
|
||||||
|
const element = driver.findElement(By.css(selector));
|
||||||
|
await driver.wait(until.elementIsVisible(driver.findElement(By.css(selector))));
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function waitAndGetElementById(driver, selector) {
|
||||||
|
driver.wait(until.elementLocated(By.id(selector)));
|
||||||
|
const element = driver.findElement(By.id(selector));
|
||||||
|
await driver.wait(until.elementIsVisible(driver.findElement(By.id(selector))));
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
function waitForTransition(duration) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, duration);
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user